startup.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * File : startup.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Develop Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-06-25 Bernard first version
  13. */
  14. #include <rthw.h>
  15. #include <rtthread.h>
  16. #include <cache.h>
  17. #include "board.h"
  18. /**
  19. * @addtogroup jz47xx
  20. */
  21. /*@{*/
  22. extern unsigned char __bss_start;
  23. extern unsigned char __bss_end;
  24. extern int rt_application_init(void);
  25. /**
  26. * This function will startup RT-Thread RTOS.
  27. */
  28. void rtthread_startup(void)
  29. {
  30. /* init cache */
  31. rt_hw_cache_init();
  32. /* init hardware interrupt */
  33. rt_hw_interrupt_init();
  34. /* init board */
  35. rt_hw_board_init();
  36. rt_show_version();
  37. /* init tick */
  38. rt_system_tick_init();
  39. /* init timer system */
  40. rt_system_timer_init();
  41. #ifdef RT_USING_HEAP
  42. rt_system_heap_init((void*)&__bss_end, (void*)RT_HW_HEAP_END);
  43. #endif
  44. /* init scheduler system */
  45. rt_system_scheduler_init();
  46. #ifdef RT_USING_DEVICE
  47. /* init all device */
  48. rt_device_init_all();
  49. #endif
  50. /* init application */
  51. rt_application_init();
  52. #ifdef RT_USING_FINSH
  53. /* init finsh */
  54. finsh_system_init();
  55. finsh_set_device(FINSH_DEVICE_NAME);
  56. #endif
  57. /* init idle thread */
  58. rt_thread_idle_init();
  59. /* start scheduler */
  60. rt_system_scheduler_start();
  61. /* never reach here */
  62. return ;
  63. }
  64. /*@}*/