startup.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * COPYRIGHT (C) 2013-2014, Shanghai Real-Thread Technology Co., Ltd
  3. *
  4. * All rights reserved.
  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. #include <rthw.h>
  21. #include <rtthread.h>
  22. #include <board.h>
  23. extern int rt_application_init(void);
  24. /**
  25. * This function will startup RT-Thread RTOS.
  26. */
  27. void rtthread_startup(void)
  28. {
  29. rt_hw_mmu_init();
  30. /* initialzie hardware interrupt */
  31. rt_hw_interrupt_init();
  32. /* initialize board */
  33. rt_hw_board_init();
  34. /* show RT-Thread version */
  35. rt_show_version();
  36. /* initialize memory system */
  37. #ifdef RT_USING_HEAP
  38. rt_system_heap_init(HEAP_BEGIN, HEAP_END);
  39. #endif
  40. /* initialize scheduler system */
  41. rt_system_scheduler_init();
  42. /* initialize system timer */
  43. rt_system_timer_init();
  44. /* initialize soft timer thread */
  45. rt_system_timer_thread_init();
  46. /* initialize application */
  47. rt_application_init();
  48. /* initialize idle thread */
  49. rt_thread_idle_init();
  50. /* start scheduler */
  51. rt_system_scheduler_start();
  52. /* never reach here */
  53. return ;
  54. }
  55. int main(void)
  56. {
  57. /* disable interrupt first */
  58. rt_hw_interrupt_disable();
  59. /* invoke rtthread_startup */
  60. rtthread_startup();
  61. return 0;
  62. }