startup.c 827 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <rtthread.h>
  2. extern void *__bss_end__;
  3. extern void *_heap_end;
  4. #define HEAP_BEGIN &__bss_end__
  5. #define HEAP_END &_heap_end
  6. static void rtthread_startup(void)
  7. {
  8. /* initialize board */
  9. rt_hw_board_init();
  10. /* show version */
  11. rt_show_version();
  12. #ifdef RT_USING_HEAP
  13. rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
  14. #endif
  15. /* initialize scheduler system */
  16. rt_system_scheduler_init();
  17. /* initialize system timer*/
  18. rt_system_timer_init();
  19. /* initialize application */
  20. rt_application_init();
  21. /* initialize timer thread */
  22. rt_system_timer_thread_init();
  23. /* initialize idle thread */
  24. rt_thread_idle_init();
  25. /* start scheduler */
  26. rt_system_scheduler_start();
  27. /* never reach here */
  28. return;
  29. }
  30. #include "encoding.h"
  31. #include <platform.h>
  32. int main(void)
  33. {
  34. rtthread_startup();
  35. return 0;
  36. }