1
0

startup.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * File : startup.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009, 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. * 2009-01-05 Bernard first implementation
  13. * 2010-03-04 Magicoe for LPC17xx
  14. */
  15. #include <rthw.h>
  16. #include <rtthread.h>
  17. #include "board.h"
  18. extern int rt_application_init(void);
  19. extern void sram_init(void);
  20. /**
  21. * This function will startup RT-Thread RTOS.
  22. */
  23. void rtthread_startup(void)
  24. {
  25. /* initialize board */
  26. rt_hw_board_init();
  27. /* show version */
  28. rt_show_version();
  29. #ifdef RT_USING_HEAP
  30. #if LPC_EXT_SDRAM
  31. rt_system_heap_init((void *)LPC_EXT_SDRAM_BEGIN, (void *)LPC_EXT_SDRAM_END);
  32. sram_init();
  33. #else
  34. rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
  35. #endif
  36. #endif
  37. /* initialize scheduler system */
  38. rt_system_scheduler_init();
  39. /* initialize system timer*/
  40. rt_system_timer_init();
  41. /* initialize application */
  42. rt_application_init();
  43. /* initialize timer thread */
  44. rt_system_timer_thread_init();
  45. /* initialize idle thread */
  46. rt_thread_idle_init();
  47. /* start scheduler */
  48. rt_system_scheduler_start();
  49. /* never reach here */
  50. return ;
  51. }
  52. int main(void)
  53. {
  54. /* disable interrupt first */
  55. rt_hw_interrupt_disable();
  56. /* startup RT-Thread RTOS */
  57. rtthread_startup();
  58. return 0;
  59. }