startup.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * File : startup.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2010, RT-Thread Development 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://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-03-30 Kyle First version
  13. */
  14. #include <rtthread.h>
  15. extern void rt_hw_board_init(void);
  16. extern void rt_application_init(void);
  17. #ifdef RT_USING_FINSH
  18. extern int finsh_system_init(void);
  19. extern void finsh_set_device(const char* device);
  20. #endif
  21. int main(void)
  22. {
  23. #ifdef RT_USING_HEAP
  24. extern void __heap_start__;
  25. extern void __heap_end__;
  26. #endif
  27. rt_hw_board_init();
  28. rt_system_tick_init();
  29. rt_system_object_init();
  30. rt_system_timer_init();
  31. #ifdef RT_USING_HEAP
  32. rt_system_heap_init(&__heap_start__, &__heap_end__);
  33. #endif
  34. rt_system_scheduler_init();
  35. rt_application_init();
  36. #ifdef RT_USING_FINSH
  37. /* init finsh */
  38. finsh_system_init();
  39. finsh_set_device(FINSH_DEVICE_NAME);
  40. #endif
  41. rt_thread_idle_init();
  42. rt_system_scheduler_start();
  43. return 0;
  44. }