startup.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 timer system */
  50. rt_system_timer_init();
  51. /* init memory system */
  52. #ifdef RT_USING_HEAP
  53. #ifdef __CC_ARM
  54. rt_system_heap_init((void*)&Image$$RW_RAM1$$ZI$$Limit, (void*)0xD000000);
  55. #else
  56. rt_system_heap_init((void*)&__bss_end, (void*)0xD000000);
  57. #endif
  58. #endif
  59. /* init scheduler system */
  60. rt_system_scheduler_init();
  61. #ifdef RT_USING_HOOK
  62. /* set idle thread hook */
  63. rt_thread_idle_sethook(rt_hw_led_flash);
  64. #endif
  65. /* init application */
  66. rt_application_init();
  67. #ifdef RT_USING_FINSH
  68. /* init the finsh input */
  69. rt_hw_finsh_init();
  70. /* init finsh */
  71. finsh_system_init();
  72. #endif
  73. /* init idle thread */
  74. rt_thread_idle_init();
  75. /* unmask interrupt */
  76. rt_hw_interrupt_umask(INT_GLOBAL);
  77. /* start scheduler */
  78. rt_system_scheduler_start();
  79. /* never reach here */
  80. return ;
  81. }
  82. int main(void)
  83. {
  84. /* invoke rtthread startup */
  85. rtthread_startup();
  86. }
  87. /*@}*/