2009-07-03 07:19:19 +08:00
|
|
|
/*
|
|
|
|
* File : startup.c
|
|
|
|
* This file is part of RT-Thread RTOS
|
|
|
|
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
|
|
|
*
|
|
|
|
* The license and distribution terms for this file may be
|
|
|
|
* found in the file LICENSE in this distribution or at
|
2009-07-31 12:10:48 +08:00
|
|
|
* http://www.rt-thread.org/license/LICENSE
|
2009-07-03 07:19:19 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2008-12-11 xuxinming first version
|
2017-12-08 11:57:22 +08:00
|
|
|
* 2010-4-3 LiJin add init soft timer thread
|
2009-07-03 07:19:19 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rthw.h>
|
2010-04-03 16:31:06 +08:00
|
|
|
#include <rtthread.h>
|
2009-07-31 12:10:48 +08:00
|
|
|
|
2009-07-03 07:19:19 +08:00
|
|
|
#include <LPC24xx.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup LPC2478
|
|
|
|
*/
|
|
|
|
/*@{*/
|
|
|
|
|
2009-07-31 12:10:48 +08:00
|
|
|
extern int rt_application_init(void);
|
2009-07-03 07:19:19 +08:00
|
|
|
|
2009-07-31 12:10:48 +08:00
|
|
|
#ifdef __CC_ARM
|
2010-04-03 16:31:06 +08:00
|
|
|
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
|
|
|
#else
|
|
|
|
extern int __bss_end;
|
|
|
|
#endif
|
2009-07-03 07:19:19 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function will startup RT-Thread RTOS.
|
|
|
|
*/
|
|
|
|
void rtthread_startup(void)
|
|
|
|
{
|
2017-12-08 11:57:22 +08:00
|
|
|
/* init hardware interrupt */
|
|
|
|
rt_hw_interrupt_init();
|
|
|
|
|
|
|
|
/* init board */
|
|
|
|
rt_hw_board_init();
|
|
|
|
|
|
|
|
/* init tick */
|
|
|
|
rt_system_tick_init();
|
|
|
|
|
|
|
|
/* init kernel object */
|
|
|
|
rt_system_object_init();
|
|
|
|
|
|
|
|
rt_show_version();
|
|
|
|
|
|
|
|
/* init timer system */
|
|
|
|
rt_system_timer_init();
|
|
|
|
|
|
|
|
/* init memory system */
|
2009-07-03 07:19:19 +08:00
|
|
|
#ifdef RT_USING_HEAP
|
|
|
|
#ifdef __CC_ARM
|
2017-12-08 11:57:22 +08:00
|
|
|
rt_system_heap_init((void *)&Image$$RW_IRAM1$$ZI$$Limit, (void *)0x40010000);
|
2009-07-03 07:19:19 +08:00
|
|
|
#else
|
2017-12-08 11:57:22 +08:00
|
|
|
rt_system_heap_init((void *)&__bss_end, (void *)0x40010000);
|
2009-07-03 07:19:19 +08:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2017-12-08 11:57:22 +08:00
|
|
|
/* init scheduler system */
|
|
|
|
rt_system_scheduler_init();
|
2010-04-03 16:31:06 +08:00
|
|
|
|
2017-12-08 11:57:22 +08:00
|
|
|
/* init application */
|
|
|
|
rt_application_init();
|
|
|
|
|
|
|
|
/* init soft timer thread */
|
|
|
|
rt_system_timer_thread_init();
|
|
|
|
|
|
|
|
/* init idle thread */
|
|
|
|
rt_thread_idle_init();
|
|
|
|
|
|
|
|
/* start scheduler */
|
|
|
|
rt_system_scheduler_start();
|
|
|
|
|
|
|
|
/* never reach here */
|
|
|
|
return ;
|
2013-01-08 22:40:58 +08:00
|
|
|
}
|
|
|
|
|
2009-07-03 07:19:19 +08:00
|
|
|
#ifdef __CC_ARM
|
2010-04-03 16:31:06 +08:00
|
|
|
int main(void)
|
2013-01-08 22:40:58 +08:00
|
|
|
{
|
2017-12-08 11:57:22 +08:00
|
|
|
/* disable interrupt first */
|
|
|
|
rt_hw_interrupt_disable();
|
|
|
|
|
|
|
|
/* invoke rtthread_startup */
|
|
|
|
rtthread_startup();
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2017-12-08 11:57:22 +08:00
|
|
|
return 0;
|
2010-04-03 16:31:06 +08:00
|
|
|
}
|
|
|
|
#endif
|
2009-07-03 07:19:19 +08:00
|
|
|
|
|
|
|
/*@}*/
|