startup.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. * 2012-12-05 Bernard the first version
  13. */
  14. #include <rthw.h>
  15. #include <rtthread.h>
  16. #include <board.h>
  17. extern int rt_application_init(void);
  18. extern void rt_hw_board_init(void);
  19. /**
  20. * This function will startup RT-Thread RTOS.
  21. */
  22. void rtthread_startup(void)
  23. {
  24. // platform_init();
  25. // print_version();
  26. /* initialzie hardware interrupt */
  27. rt_hw_interrupt_init();
  28. /* initialize board */
  29. rt_hw_board_init();
  30. /* show RT-Thread version */
  31. rt_show_version();
  32. /* initialize memory system */
  33. #ifdef RT_USING_HEAP
  34. rt_system_heap_init(HEAP_BEGIN, HEAP_END);
  35. #endif
  36. /* initialize scheduler system */
  37. rt_system_scheduler_init();
  38. /* initialize timer and soft timer thread */
  39. rt_system_timer_init();
  40. rt_system_timer_thread_init();
  41. /* initialize application */
  42. rt_application_init();
  43. /* initialize idle thread */
  44. rt_thread_idle_init();
  45. /* start scheduler */
  46. rt_system_scheduler_start();
  47. /* never reach here */
  48. return ;
  49. }
  50. int main(void)
  51. {
  52. /* disable interrupt first */
  53. rt_hw_interrupt_disable();
  54. /* invoke rtthread_startup */
  55. rtthread_startup();
  56. return 0;
  57. }