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