1
0

startup.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. * 2006-09-23 Bernard first version
  13. * 2006-10-05 Bernard add .nobbs attribute for _svc_stack_start
  14. */
  15. #include <rtthread.h>
  16. #include <rthw.h>
  17. #include <s3c44b0.h>
  18. #include <board.h>
  19. extern void rt_hw_interrupt_init(void);
  20. extern void rt_serial_init(void);
  21. extern void rt_hw_cpu_icache_enable(void);
  22. /**
  23. * @addtogroup wh44b0
  24. */
  25. /*@{*/
  26. #ifdef __CC_ARM
  27. extern int Image$$RW_RAM1$$ZI$$Limit;
  28. #else
  29. extern int __bss_end;
  30. #endif
  31. #ifdef RT_USING_FINSH
  32. extern int finsh_system_init(void);
  33. #endif
  34. extern int rt_application_init(void);
  35. /**
  36. * This function will startup RT-Thread RTOS.
  37. */
  38. void rtthread_startup(void)
  39. {
  40. /* enable cpu cache */
  41. rt_hw_cpu_icache_enable();
  42. /* init hardware interrupt */
  43. rt_hw_interrupt_init();
  44. /* init board */
  45. rt_hw_board_init();
  46. /* init hardware serial */
  47. rt_serial_init();
  48. rt_show_version();
  49. /* init tick */
  50. rt_system_tick_init();
  51. /* init kernel object */
  52. rt_system_object_init();
  53. /* init timer system */
  54. rt_system_timer_init();
  55. /* init memory system */
  56. #ifdef RT_USING_HEAP
  57. #ifdef __CC_ARM
  58. rt_system_heap_init((void*)&Image$$RW_RAM1$$ZI$$Limit, (void*)0xD000000);
  59. #else
  60. rt_system_heap_init((void*)&__bss_end, (void*)0xD000000);
  61. #endif
  62. #endif
  63. /* init scheduler system */
  64. rt_system_scheduler_init();
  65. #ifdef RT_USING_HOOK
  66. /* set idle thread hook */
  67. rt_thread_idle_sethook(rt_hw_led_flash);
  68. #endif
  69. /* init application */
  70. rt_application_init();
  71. #ifdef RT_USING_FINSH
  72. /* init the finsh input */
  73. rt_hw_finsh_init();
  74. /* init finsh */
  75. finsh_system_init();
  76. #endif
  77. /* init idle thread */
  78. rt_thread_idle_init();
  79. /* unmask interrupt */
  80. rt_hw_interrupt_umask(INT_GLOBAL);
  81. /* start scheduler */
  82. rt_system_scheduler_start();
  83. /* never reach here */
  84. return ;
  85. }
  86. int main(void)
  87. {
  88. /* invoke rtthread startup */
  89. rtthread_startup();
  90. }
  91. /*@}*/