2021-11-17 17:43:42 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Shenzhen Academy of Aerospace Technology
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2021-11-16 Dystopia the first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rthw.h>
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
#include "board.h"
|
|
|
|
|
|
|
|
void rt_init_thread_entry(void *parameter)
|
|
|
|
{
|
2021-11-18 09:23:29 +08:00
|
|
|
rt_kprintf("hello rt-thread\n");
|
|
|
|
return 0;
|
2021-11-17 17:43:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int rt_application_init(void)
|
|
|
|
{
|
|
|
|
rt_thread_t tid;
|
|
|
|
|
|
|
|
tid = rt_thread_create("init", rt_init_thread_entry, RT_NULL, 4096, 3, 200);
|
|
|
|
if (tid != RT_NULL)
|
|
|
|
{
|
|
|
|
rt_thread_startup(tid);
|
|
|
|
} else {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function will startup RT-Thread RTOS.
|
|
|
|
*/
|
|
|
|
void rtthread_startup(void)
|
|
|
|
{
|
2021-11-18 09:23:29 +08:00
|
|
|
/* disable interrupt first */
|
|
|
|
rt_hw_interrupt_disable();
|
|
|
|
|
|
|
|
/* init board */
|
|
|
|
rt_hw_board_init();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* show version */
|
|
|
|
rt_show_version();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* init timer system */
|
|
|
|
rt_system_timer_init();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* init scheduler system */
|
|
|
|
rt_system_scheduler_init();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* init application */
|
|
|
|
rt_application_init();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* init timer thread */
|
|
|
|
rt_system_timer_thread_init();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* init idle thread */
|
|
|
|
rt_thread_idle_init();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* start scheduler */
|
|
|
|
rt_system_scheduler_start();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:23:29 +08:00
|
|
|
/* never reach here */
|
|
|
|
return ;
|
2021-11-17 17:43:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2021-11-18 09:23:29 +08:00
|
|
|
/* startup RT-Thread RTOS */
|
|
|
|
rtthread_startup();
|
2021-11-17 17:43:42 +08:00
|
|
|
|
2021-11-18 09:37:05 +08:00
|
|
|
for(;;){}
|
2021-11-17 17:43:42 +08:00
|
|
|
}
|
|
|
|
|