startup.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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]; RT_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 timer system */
  56. rt_system_timer_init();
  57. /* init heap memory system */
  58. rt_system_heap_init(&__bss_end, (void*)0x45000000);
  59. /* init scheduler system */
  60. rt_system_scheduler_init();
  61. /* init application */
  62. rt_application_init();
  63. #ifdef RT_USING_FINSH
  64. /* init finsh */
  65. finsh_system_init();
  66. #ifdef RT_USING_DEVICE
  67. finsh_set_device("uart0");
  68. #endif
  69. #endif
  70. rt_system_timer_thread_init();
  71. /* init idle thread */
  72. rt_thread_idle_init();
  73. /* start scheduler */
  74. rt_system_scheduler_start();
  75. /* never reach here */
  76. return ;
  77. }