startup.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2011-04-16 nsj first version
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #ifdef RT_USING_FINSH
  13. #include <finsh.h>
  14. extern int finsh_system_init(void);
  15. #endif
  16. extern int rt_application_init(void);
  17. #ifdef RT_USING_DEVICE
  18. extern rt_err_t rt_hw_serial_init(void);
  19. #endif
  20. extern int __heap_start;
  21. extern int __heap_end;
  22. /**
  23. * This function will startup RT-Thread RTOS.
  24. */
  25. void rtthread_startup(void)
  26. {
  27. /* init hardware interrupt */
  28. rt_hw_interrupt_init();
  29. /* init board */
  30. rt_hw_board_init();
  31. rt_show_version();
  32. /* init timer system */
  33. rt_system_timer_init();
  34. /* init memory system */
  35. #ifdef RT_USING_HEAP
  36. rt_system_heap_init((void*)&__heap_start, (void*)&__heap_end);
  37. #endif
  38. /* init scheduler system */
  39. rt_system_scheduler_init();
  40. /* init application */
  41. rt_application_init();
  42. #ifdef RT_USING_FINSH
  43. /* init finsh */
  44. finsh_system_init();
  45. finsh_set_device("uart1");
  46. #endif
  47. /* init soft timer thread */
  48. rt_system_timer_thread_init();
  49. /* init idle thread */
  50. rt_thread_idle_init();
  51. /* start scheduler */
  52. rt_system_scheduler_start();
  53. /* never reach here */
  54. return ;
  55. }