1
0

startup.c 1.3 KB

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