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 * 2010-03-04 Magicoe for LPC17xx 10 */ 11 12 #include <rthw.h> 13 #include <rtthread.h> 14 15 /** 16 * @addtogroup LPC176x 17 */ 18 19 /*@{*/ 20 #include <board.h> 21 extern int rt_application_init(void); 22 23 #ifdef __CC_ARM 24 extern int Image$$RW_IRAM1$$ZI$$Limit; 25 #elif __ICCARM__ 26 #pragma section="HEAP" 27 #else 28 extern int __bss_end; 29 #endif 30 31 /** 32 * This function will startup RT-Thread RTOS. 33 */ rtthread_startup(void)34void rtthread_startup(void) 35 { 36 /* initialize board */ 37 rt_hw_board_init(); 38 39 /* show version */ 40 rt_show_version(); 41 42 #ifdef RT_USING_HEAP 43 /* initialize memory system */ 44 #ifdef __CC_ARM 45 rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x10008000); 46 #elif __ICCARM__ 47 rt_system_heap_init(__segment_end("HEAP"), (void*)0x10008000); 48 #else 49 rt_system_heap_init((void*)&__bss_end, (void*)0x10008000); 50 #endif 51 #endif 52 53 /* initialize scheduler system */ 54 rt_system_scheduler_init(); 55 56 /* initialize application */ 57 rt_application_init(); 58 59 /* initialize timer */ 60 rt_system_timer_init(); 61 62 /* initialize timer thread */ 63 rt_system_timer_thread_init(); 64 65 /* initialize idle thread */ 66 rt_thread_idle_init(); 67 68 /* start scheduler */ 69 rt_system_scheduler_start(); 70 71 /* never reach here */ 72 return ; 73 } 74 main(void)75int main(void) 76 { 77 /* disable interrupt first */ 78 rt_hw_interrupt_disable(); 79 80 /* startup RT-Thread RTOS */ 81 rtthread_startup(); 82 83 return 0; 84 } 85 86 /*@}*/ 87