1
0

startup.c 1.6 KB

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