rt-thread/bsp/lpc54608-LPCXpresso/applications/application.c

76 lines
1.5 KiB
C
Raw Normal View History

2017-08-08 11:56:50 +08:00
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
2017-08-08 11:56:50 +08:00
*
* SPDX-License-Identifier: Apache-2.0
2017-08-08 11:56:50 +08:00
*
* Change Logs:
* Date Author Notes
* 2017-08-08 Yang the first version
*/
#include <rtthread.h>
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
/* thread phase init */
void rt_init_thread_entry(void *parameter)
{
/* Initialization RT-Thread Components */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_init();
#elif defined(RT_USING_FINSH)
finsh_system_init();
#endif
}
2017-11-14 11:09:46 +08:00
void build_dump(void)
{
#if defined(__CC_ARM)
rt_kprintf("using MDK\n");
#elif defined(__IAR_SYSTEMS_ICC__)
rt_kprintf("using IAR\n");
#elif defined(__GNUC__)
rt_kprintf("using GCC\n");
#else
rt_kprintf("unkown Compiler\n");
#endif
}
void link_dump(void)
{
2017-11-15 19:55:16 +08:00
#ifdef __GNUC__
2017-11-14 11:09:46 +08:00
extern unsigned int _sdata;
extern unsigned int _edata;
extern unsigned int _sidata;
extern unsigned int _sbss;
extern unsigned int _ebss;
#define DUMP_VAR(__VAR) \
rt_kprintf("%-20s %p\n", #__VAR, &__VAR)
DUMP_VAR(_sdata);
DUMP_VAR(_edata);
DUMP_VAR(_sidata);
DUMP_VAR(_sbss);
DUMP_VAR(_ebss);
2017-11-15 19:55:16 +08:00
#endif
2017-11-14 11:09:46 +08:00
}
2017-08-08 11:56:50 +08:00
int rt_application_init(void)
{
rt_thread_t tid;
2017-11-14 11:09:46 +08:00
build_dump();
link_dump();
2017-08-08 11:56:50 +08:00
tid = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
2048, RT_THREAD_PRIORITY_MAX / 3, 20);
if (tid != RT_NULL) rt_thread_startup(tid);
return 0;
}