2009-09-02 21:25:58 +08:00
|
|
|
#include <rtthread.h>
|
|
|
|
#include <rthw.h>
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
|
|
|
|
extern int rt_application_init(void);
|
|
|
|
extern void board_init(void);
|
|
|
|
|
|
|
|
#ifdef __CC_ARM
|
|
|
|
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
|
|
|
#elif __ICCARM__
|
|
|
|
#pragma section="HEAP"
|
|
|
|
#else
|
|
|
|
extern int __bss_end;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void rtthread_startup(void)
|
|
|
|
{
|
|
|
|
/* show version */
|
2009-09-03 12:24:39 +08:00
|
|
|
rt_show_version();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init tick */
|
|
|
|
rt_system_tick_init();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init kernel object */
|
|
|
|
rt_system_object_init();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init timer system */
|
|
|
|
rt_system_timer_init();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
|
|
|
#ifdef RT_USING_HEAP
|
|
|
|
#ifdef __CC_ARM
|
2009-09-03 12:24:39 +08:00
|
|
|
rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x20005000);
|
|
|
|
//#warning Image$$RW_IRAM1$$ZI$$Limit
|
2009-09-02 21:25:58 +08:00
|
|
|
#elif __ICCARM__
|
|
|
|
rt_system_heap_init(__segment_end("HEAP"), (void*)0x20005000);
|
|
|
|
#else
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init memory system */
|
|
|
|
rt_system_heap_init((void*)&__bss_end, (void*)0x20005000);
|
2009-09-02 21:25:58 +08:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init scheduler system */
|
|
|
|
rt_system_scheduler_init();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init all device */
|
|
|
|
rt_device_init_all();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init application */
|
|
|
|
rt_application_init();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* init idle thread */
|
|
|
|
rt_thread_idle_init();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* start scheduler */
|
|
|
|
rt_system_scheduler_start();
|
2009-09-02 21:25:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2009-09-03 12:24:39 +08:00
|
|
|
rt_uint32_t UNUSED level;
|
2009-09-02 21:25:58 +08:00
|
|
|
|
2009-09-03 12:24:39 +08:00
|
|
|
/* disable interrupt first */
|
|
|
|
level = rt_hw_interrupt_disable();
|
|
|
|
|
|
|
|
SystemInit();
|
|
|
|
board_init();
|
2009-09-02 21:25:58 +08:00
|
|
|
|
|
|
|
rtthread_startup();
|
|
|
|
while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|