1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2009-01-05 Bernard first implementation 9 * 2014-07-13 xiaonong for LPC43xx 10 */ 11 12 #include <rthw.h> 13 #include <rtthread.h> 14 15 #include "board.h" 16 17 extern int rt_application_init(void); 18 19 /** 20 * This function will startup RT-Thread RTOS. 21 */ rtthread_startup(void)22void rtthread_startup(void) 23 { 24 /* initialize board */ 25 rt_hw_board_init(); 26 27 /* show version */ 28 rt_show_version(); 29 30 #ifdef RT_USING_HEAP 31 #if LPC_EXT_SDRAM 32 rt_system_heap_init((void *)LPC_EXT_SDRAM_BEGIN, (void *)LPC_EXT_SDRAM_END); 33 sram_init(); 34 #else 35 rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); 36 #endif 37 #endif 38 39 /* initialize scheduler system */ 40 rt_system_scheduler_init(); 41 42 /* initialize system timer*/ 43 rt_system_timer_init(); 44 45 /* initialize application */ 46 rt_application_init(); 47 48 /* initialize timer thread */ 49 rt_system_timer_thread_init(); 50 51 /* initialize idle thread */ 52 rt_thread_idle_init(); 53 54 /* start scheduler */ 55 rt_system_scheduler_start(); 56 57 /* never reach here */ 58 return ; 59 } 60 main(void)61int main(void) 62 { 63 /* disable interrupt first */ 64 rt_hw_interrupt_disable(); 65 66 /* startup RT-Thread RTOS */ 67 rtthread_startup(); 68 69 return 0; 70 } 71