1
0

startup.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. * 2012-09-03 prife first implementation
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include "board.h"
  13. /**
  14. * @addtogroup win32
  15. */
  16. /*@{*/
  17. extern int rt_application_init(void);
  18. extern rt_uint8_t *heap;
  19. /**
  20. * This function will startup RT-Thread RTOS.
  21. */
  22. void rtthread_startup(void)
  23. {
  24. /* init board */
  25. rt_hw_board_init();
  26. /* show version */
  27. rt_show_version();
  28. /* init tick */
  29. rt_system_tick_init();
  30. /* init kernel object */
  31. rt_system_object_init();
  32. /* init timer system */
  33. rt_system_timer_init();
  34. #ifdef RT_USING_HEAP
  35. /* init memory system */
  36. rt_system_heap_init((void *)heap, (void *)&heap[RT_HEAP_SIZE - 1]);
  37. #endif
  38. /* init scheduler system */
  39. rt_system_scheduler_init();
  40. /* init application */
  41. rt_application_init();
  42. /* init timer thread */
  43. rt_system_timer_thread_init();
  44. /* init idle thread */
  45. rt_thread_idle_init();
  46. /* start scheduler */
  47. rt_system_scheduler_start();
  48. /* never reach here */
  49. return ;
  50. }
  51. int main(void)
  52. {
  53. /* disable interrupt first */
  54. rt_hw_interrupt_disable();
  55. /* startup RT-Thread RTOS */
  56. rtthread_startup();
  57. return 0;
  58. }
  59. /*@}*/