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  * 2006-08-31     Bernard      first implementation
9  * 2011-06-05     Bernard      modify for STM32F107 version
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)22 void rtthread_startup(void)
23 {
24     /* initialize board */
25     rt_hw_board_init();
26 
27     /* show version */
28     rt_show_version();
29 
30     /* initialize timer system */
31     rt_system_timer_init();
32 
33     /* initialize system heap */
34     rt_system_heap_init(HEAP_BEGIN, HEAP_END);
35 
36     /* initialize scheduler system */
37     rt_system_scheduler_init();
38 
39     /* initialize application */
40     rt_application_init();
41 
42     /* initialize timer thread */
43     rt_system_timer_thread_init();
44 
45     /* initialize idle thread */
46     rt_thread_idle_init();
47 
48     /* start scheduler */
49     rt_system_scheduler_start();
50 
51     /* never reach here */
52     return ;
53 }
54 
main(void)55 int main(void)
56 {
57     /* disable interrupt first */
58     rt_hw_interrupt_disable();
59 
60     /* startup RT-Thread RTOS */
61     rtthread_startup();
62 
63     return 0;
64 }
65