rt-thread-official/bsp/bf533/startup.c

92 lines
1.8 KiB
C
Raw Normal View History

2013-01-08 22:40:58 +08:00
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
2013-01-08 22:40:58 +08:00
*
* SPDX-License-Identifier: Apache-2.0
2013-01-08 22:40:58 +08:00
*
* Change Logs:
* Date Author Notes
* 2012-02-13 mojingxian first version
*/
#include <rthw.h>
#include <rtthread.h>
#include "application.h"
#include "board.h"
#include "serial.h"
#include "finsh.h"
extern "asm" int rtt_heap_start;
extern "asm" int rtt_heap_end;
extern struct serial_device uart0;
extern struct rt_device uart0_device;
void rtthread_startup(void)
{
/* init hardware interrupt */
rt_hw_interrupt_init();
/* init board */
rt_hw_board_init();
/* show version */
rt_show_version();
/* init timer system */
rt_system_timer_init();
#ifdef RT_USING_HEAP
rt_system_heap_init((void*)&rtt_heap_start, (void*)&rtt_heap_end);
#endif
#ifdef RT_USING_MODULE
/* init module system*/
rt_system_module_init();
#endif
/* init scheduler system */
rt_system_scheduler_init();
#ifdef RT_USING_DEVICE
/* register uart0 */
rt_hw_serial_register(&uart0_device, "uart0",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&uart0);
rt_console_set_device("uart0");
#endif
/* init application */
rt_application_init();
#ifdef RT_USING_FINSH
/* init finsh */
extern int finsh_system_init(void);
2013-01-08 22:40:58 +08:00
finsh_system_init();
2022-01-03 06:51:44 +08:00
#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
2013-01-08 22:40:58 +08:00
finsh_set_device("uart0");
#endif
2013-01-08 22:40:58 +08:00
#endif
rt_system_timer_thread_init();
/* init idle thread */
rt_thread_idle_init();
/* start scheduler */
rt_system_scheduler_start();
/* never reach here */
return ;
}
int main(void)
{
/* disable interrupt first */
rt_hw_interrupt_disable();
/* startup RT-Thread RTOS */
rtthread_startup();
return 0;
}