1
0

startup.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * File : startup.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2012-09-03 prife first implementation
  23. */
  24. #include <rthw.h>
  25. #include <rtthread.h>
  26. #include "board.h"
  27. /**
  28. * @addtogroup win32
  29. */
  30. /*@{*/
  31. extern int rt_application_init(void);
  32. extern rt_uint8_t *heap;
  33. /**
  34. * This function will startup RT-Thread RTOS.
  35. */
  36. void rtthread_startup(void)
  37. {
  38. /* init board */
  39. rt_hw_board_init();
  40. /* show version */
  41. rt_show_version();
  42. /* init tick */
  43. rt_system_tick_init();
  44. /* init kernel object */
  45. rt_system_object_init();
  46. /* init timer system */
  47. rt_system_timer_init();
  48. #ifdef RT_USING_HEAP
  49. /* init memory system */
  50. rt_system_heap_init((void *)heap, (void *)&heap[RT_HEAP_SIZE - 1]);
  51. #endif
  52. /* init scheduler system */
  53. rt_system_scheduler_init();
  54. /* init application */
  55. rt_application_init();
  56. /* init timer thread */
  57. rt_system_timer_thread_init();
  58. /* init idle thread */
  59. rt_thread_idle_init();
  60. /* start scheduler */
  61. rt_system_scheduler_start();
  62. /* never reach here */
  63. return ;
  64. }
  65. int main(void)
  66. {
  67. /* disable interrupt first */
  68. rt_hw_interrupt_disable();
  69. /* startup RT-Thread RTOS */
  70. rtthread_startup();
  71. return 0;
  72. }
  73. /*@}*/