startup.c 1.4 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://openlab.rt-thread.com/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2006-08-31 Bernard first implementation
  13. * 2011-06-05 Bernard modify for STM32F107 version
  14. */
  15. #include <rthw.h>
  16. #include <rtthread.h>
  17. #include "board.h"
  18. extern int rt_application_init(void);
  19. /**
  20. * This function will startup RT-Thread RTOS.
  21. */
  22. void rtthread_startup(void)
  23. {
  24. /* initialize board */
  25. rt_hw_board_init();
  26. /* show version */
  27. rt_show_version();
  28. /* initialize tick */
  29. rt_system_tick_init();
  30. /* initialize kernel object */
  31. rt_system_object_init();
  32. /* initialize timer system */
  33. rt_system_timer_init();
  34. /* initialize system heap */
  35. rt_system_heap_init(HEAP_BEGIN, HEAP_END);
  36. /* initialize scheduler system */
  37. rt_system_scheduler_init();
  38. /* initialize application */
  39. rt_application_init();
  40. /* initialize timer thread */
  41. rt_system_timer_thread_init();
  42. /* initialize idle thread */
  43. rt_thread_idle_init();
  44. /* start scheduler */
  45. rt_system_scheduler_start();
  46. /* never reach here */
  47. return ;
  48. }
  49. int main(void)
  50. {
  51. /* disable interrupt first */
  52. rt_hw_interrupt_disable();
  53. /* startup RT-Thread RTOS */
  54. rtthread_startup();
  55. return 0;
  56. }