startup.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2012-12-05 Bernard the first version
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include <board.h>
  13. extern int rt_application_init(void);
  14. extern void rt_hw_board_init(void);
  15. /**
  16. * This function will startup RT-Thread RTOS.
  17. */
  18. void rtthread_startup(void)
  19. {
  20. // platform_init();
  21. // print_version();
  22. /* initialzie hardware interrupt */
  23. rt_hw_interrupt_init();
  24. /* initialize board */
  25. rt_hw_board_init();
  26. /* show RT-Thread version */
  27. rt_show_version();
  28. /* initialize memory system */
  29. #ifdef RT_USING_HEAP
  30. rt_system_heap_init(HEAP_BEGIN, HEAP_END);
  31. #endif
  32. /* initialize scheduler system */
  33. rt_system_scheduler_init();
  34. /* initialize timer and soft timer thread */
  35. rt_system_timer_init();
  36. rt_system_timer_thread_init();
  37. /* initialize application */
  38. rt_application_init();
  39. /* initialize idle thread */
  40. rt_thread_idle_init();
  41. /* start scheduler */
  42. rt_system_scheduler_start();
  43. /* never reach here */
  44. return ;
  45. }
  46. int main(void)
  47. {
  48. /* disable interrupt first */
  49. rt_hw_interrupt_disable();
  50. /* invoke rtthread_startup */
  51. rtthread_startup();
  52. return 0;
  53. }