rt-thread/bsp/mini4020/applications/startup.c

109 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
*/
#include <rthw.h>
#include <rtthread.h>
#include <sep4020.h>
#include <board.h>
#include <serial.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <netif/ethernetif.h>
#endif
#define SDRAM_BASE 0x30000000
2013-01-08 22:40:58 +08:00
#ifdef __CC_ARM
extern int Image$$RW_RAM1$$ZI$$Limit;
#elif (defined (__GNUC__))
extern unsigned char __bss_end;
2013-01-08 22:40:58 +08:00
#endif
extern void rt_application_init(void);
extern int finsh_system_init(void);
2013-01-08 22:40:58 +08:00
extern void sd_init(void);
void rtthread_startup()
{
/* init hardware interrupt */
rt_hw_interrupt_init();
2013-01-08 22:40:58 +08:00
/* init board */
rt_hw_board_init();
2013-01-08 22:40:58 +08:00
/* show version */
rt_show_version();
2013-01-08 22:40:58 +08:00
/* init timer system */
rt_system_timer_init();
/* init heap memory system */
2013-01-08 22:40:58 +08:00
#ifdef __CC_ARM
rt_system_heap_init((void*)&Image$$RW_RAM1$$ZI$$Limit, (void*)(SDRAM_BASE + 0x200000));
2013-01-08 22:40:58 +08:00
#else
rt_system_heap_init(&__bss_end, (void*)0x34000000);
2013-01-08 22:40:58 +08:00
#endif
/* init scheduler system */
rt_system_scheduler_init();
2013-01-08 22:40:58 +08:00
#ifdef RT_USING_DEVICE
#ifdef RT_USING_DFS
rt_hw_sdcard_init();
2013-01-08 22:40:58 +08:00
#endif
#ifdef RT_USING_LWIP
eth_system_device_init();
rt_hw_dm9161_init();
2013-01-08 22:40:58 +08:00
#endif
#endif
/* init application */
rt_application_init();
2013-01-08 22:40:58 +08:00
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
2013-01-08 22:40:58 +08:00
#ifdef RT_USING_DEVICE
finsh_set_device("uart0");
2013-01-08 22:40:58 +08:00
#endif
#endif
/* init idle thread */
rt_thread_idle_init();
/* start scheduler */
rt_system_scheduler_start();
2013-01-08 22:40:58 +08:00
/* never reach here */
return ;
2013-01-08 22:40:58 +08:00
}
int main()
{
/* disable interrupt first */
rt_hw_interrupt_disable();
2013-01-08 22:40:58 +08:00
/* startup RT-Thread RTOS */
rtthread_startup();
2013-01-08 22:40:58 +08:00
return 0;
2013-01-08 22:40:58 +08:00
}