startup.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. * 2011-04-16 nsj first version
  13. */
  14. #include <rthw.h>
  15. #include <rtthread.h>
  16. #ifdef RT_USING_FINSH
  17. #include <finsh.h>
  18. extern int finsh_system_init(void);
  19. #endif
  20. extern int rt_application_init(void);
  21. #ifdef RT_USING_DEVICE
  22. extern rt_err_t rt_hw_serial_init(void);
  23. #endif
  24. extern int __heap_start;
  25. extern int __heap_end;
  26. /**
  27. * This function will startup RT-Thread RTOS.
  28. */
  29. void rtthread_startup(void)
  30. {
  31. /* init hardware interrupt */
  32. rt_hw_interrupt_init();
  33. /* init board */
  34. rt_hw_board_init();
  35. rt_show_version();
  36. /* init tick */
  37. rt_system_tick_init();
  38. /* init timer system */
  39. rt_system_timer_init();
  40. /* init memory system */
  41. #ifdef RT_USING_HEAP
  42. rt_system_heap_init((void*)&__heap_start, (void*)&__heap_end);
  43. #endif
  44. /* init scheduler system */
  45. rt_system_scheduler_init();
  46. /* init application */
  47. rt_application_init();
  48. #ifdef RT_USING_FINSH
  49. /* init finsh */
  50. finsh_system_init();
  51. finsh_set_device("uart1");
  52. #endif
  53. /* init soft timer thread */
  54. rt_system_timer_thread_init();
  55. /* init idle thread */
  56. rt_thread_idle_init();
  57. /* start scheduler */
  58. rt_system_scheduler_start();
  59. /* never reach here */
  60. return ;
  61. }