startup.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * File : startup.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2013, 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. * 2013-7-14 Peng Fan Modified from mini4020
  23. */
  24. #include <rthw.h>
  25. #include <rtthread.h>
  26. #include <board.h>
  27. #include <serial.h>
  28. #ifdef RT_USING_FINSH
  29. #include <finsh.h>
  30. #endif
  31. #ifdef RT_USING_LWIP
  32. #include <lwip/sys.h>
  33. #include <netif/ethernetif.h>
  34. #endif
  35. #include <sep6200.h>
  36. rt_uint8_t _irq_stack_start[1024];
  37. rt_uint8_t _fiq_stack_start[1024];
  38. rt_uint8_t _undefined_stack_start[512];
  39. rt_uint8_t _abort_stack_start[512];
  40. rt_uint8_t _priv_stack_start[4096]; SECTION(".nobss");
  41. extern unsigned char __bss_start;
  42. extern unsigned char __bss_end;
  43. extern void rt_hw_board_init(void);
  44. extern void rt_application_init(void);
  45. extern int finsh_system_init(void);
  46. extern void sd_init(void);
  47. void rtthread_startup()
  48. {
  49. /* init hardware interrupt */
  50. rt_hw_interrupt_init();
  51. /* init board */
  52. rt_hw_board_init();
  53. /* show version */
  54. rt_show_version();
  55. /* init tick */
  56. rt_system_tick_init();
  57. /* init kernel object */
  58. rt_system_object_init();
  59. /* init timer system */
  60. rt_system_timer_init();
  61. /* init heap memory system */
  62. rt_system_heap_init(&__bss_end, (void*)0x45000000);
  63. /* init scheduler system */
  64. rt_system_scheduler_init();
  65. /* init application */
  66. rt_application_init();
  67. #ifdef RT_USING_FINSH
  68. /* init finsh */
  69. finsh_system_init();
  70. #ifdef RT_USING_DEVICE
  71. finsh_set_device("uart0");
  72. #endif
  73. #endif
  74. rt_system_timer_thread_init();
  75. /* init idle thread */
  76. rt_thread_idle_init();
  77. /* start scheduler */
  78. rt_system_scheduler_start();
  79. /* never reach here */
  80. return ;
  81. }