mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
[bsp][simulator] 支持自动初始化及用户 main 入口
This commit is contained in:
+26
-1
@@ -210,7 +210,32 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
typedef int (*init_fn_t)(void);
|
||||
#ifdef _MSC_VER /* we do not support MS VC++ compiler */
|
||||
#define INIT_EXPORT(fn, level)
|
||||
#pragma section("rti_fn$f",read)
|
||||
#if RT_DEBUG_INIT
|
||||
struct rt_init_desc
|
||||
{
|
||||
const char* level;
|
||||
const init_fn_t fn;
|
||||
const char* fn_name;
|
||||
};
|
||||
#define INIT_EXPORT(fn, level) \
|
||||
const char __rti_level_##fn[] = level"__rt_init_"#fn; \
|
||||
const char __rti_##fn##_name[] = #fn; \
|
||||
__declspec(allocate("rti_fn$f")) \
|
||||
RT_USED const struct rt_init_desc __rt_init_msc_##fn = \
|
||||
{__rti_level_##fn, fn, __rti_##fn##_name};
|
||||
#else
|
||||
struct rt_init_desc
|
||||
{
|
||||
const char* level;
|
||||
const init_fn_t fn;
|
||||
};
|
||||
#define INIT_EXPORT(fn, level) \
|
||||
const char __rti_level_##fn[] = level"__rt_init_"#fn; \
|
||||
__declspec(allocate("rti_fn$f")) \
|
||||
RT_USED const struct rt_init_desc __rt_init_msc_##fn = \
|
||||
{__rti_level_##fn, fn };
|
||||
#endif
|
||||
#else
|
||||
#if RT_DEBUG_INIT
|
||||
struct rt_init_desc
|
||||
|
||||
Reference in New Issue
Block a user