1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2012-12-05     Bernard      the first version
9  */
10 
11 #include <rthw.h>
12 #include <rtthread.h>
13 
14 #include <board.h>
15 
16 extern int  rt_application_init(void);
17 extern void rt_hw_board_init(void);
18 
19 /**
20  * This function will startup RT-Thread RTOS.
21  */
rtthread_startup(void)22 void rtthread_startup(void)
23 {
24     // platform_init();
25     // print_version();
26 
27     /* initialzie hardware interrupt */
28     rt_hw_interrupt_init();
29 
30     /* initialize board */
31     rt_hw_board_init();
32 
33     /* show RT-Thread version */
34     rt_show_version();
35 
36     /* initialize memory system */
37 #ifdef RT_USING_HEAP
38     rt_system_heap_init(HEAP_BEGIN, HEAP_END);
39 #endif
40 
41     /* initialize scheduler system */
42     rt_system_scheduler_init();
43 
44     /* initialize timer and soft timer thread */
45     rt_system_timer_init();
46     rt_system_timer_thread_init();
47 
48     /* initialize application */
49     rt_application_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)61 int main(void)
62 {
63     /* disable interrupt first */
64     rt_hw_interrupt_disable();
65 
66     /* invoke rtthread_startup */
67     rtthread_startup();
68 
69     return 0;
70 }
71