2014-12-16 19:54:29 +08:00
|
|
|
/*
|
2021-03-17 02:26:35 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2014-12-16 19:54:29 +08:00
|
|
|
*
|
2018-10-22 11:02:14 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2014-12-16 19:54:29 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2006-08-31 Bernard first implementation
|
|
|
|
* 2011-06-05 Bernard modify for STM32F107 version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rthw.h>
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
#include "board.h"
|
|
|
|
|
|
|
|
extern int rt_application_init(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function will startup RT-Thread RTOS.
|
|
|
|
*/
|
|
|
|
void rtthread_startup(void)
|
|
|
|
{
|
2017-07-29 15:16:09 +08:00
|
|
|
/* initialize board */
|
|
|
|
rt_hw_board_init();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* show version */
|
|
|
|
rt_show_version();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* initialize timer system */
|
|
|
|
rt_system_timer_init();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
|
|
|
/* initialize system heap */
|
|
|
|
rt_system_heap_init(HEAP_BEGIN, HEAP_END);
|
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* initialize scheduler system */
|
|
|
|
rt_system_scheduler_init();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* initialize application */
|
|
|
|
rt_application_init();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
|
|
|
/* initialize timer thread */
|
|
|
|
rt_system_timer_thread_init();
|
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* initialize idle thread */
|
|
|
|
rt_thread_idle_init();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* start scheduler */
|
|
|
|
rt_system_scheduler_start();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* never reach here */
|
|
|
|
return ;
|
2014-12-16 19:54:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2017-07-29 15:16:09 +08:00
|
|
|
/* disable interrupt first */
|
|
|
|
rt_hw_interrupt_disable();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
/* startup RT-Thread RTOS */
|
|
|
|
rtthread_startup();
|
2014-12-16 19:54:29 +08:00
|
|
|
|
2017-07-29 15:16:09 +08:00
|
|
|
return 0;
|
2014-12-16 19:54:29 +08:00
|
|
|
}
|