2012-12-14 16:59:22 +08:00
|
|
|
/*
|
2018-09-14 22:37:43 +08:00
|
|
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
2013-06-24 17:06:09 +08:00
|
|
|
*
|
2018-09-14 22:37:43 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2012-12-14 16:59:22 +08:00
|
|
|
#ifndef __RTM_H__
|
|
|
|
#define __RTM_H__
|
|
|
|
|
|
|
|
#include <rtdef.h>
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
#ifdef RT_USING_MODULE
|
|
|
|
struct rt_module_symtab
|
|
|
|
{
|
|
|
|
void *addr;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
2013-10-01 17:43:38 +08:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#pragma section("RTMSymTab$f",read)
|
|
|
|
#define RTM_EXPORT(symbol) \
|
|
|
|
__declspec(allocate("RTMSymTab$f"))const char __rtmsym_##symbol##_name[] = "__vs_rtm_"#symbol;
|
|
|
|
#pragma comment(linker, "/merge:RTMSymTab=mytext")
|
|
|
|
|
|
|
|
#elif defined(__MINGW32__)
|
2013-02-27 00:37:57 +08:00
|
|
|
#define RTM_EXPORT(symbol)
|
2013-10-01 17:43:38 +08:00
|
|
|
|
2013-02-27 00:37:57 +08:00
|
|
|
#else
|
2012-12-14 16:59:22 +08:00
|
|
|
#define RTM_EXPORT(symbol) \
|
2021-02-09 23:25:16 +08:00
|
|
|
const char __rtmsym_##symbol##_name[] RT_SECTION(".rodata.name") = #symbol; \
|
|
|
|
const struct rt_module_symtab __rtmsym_##symbol RT_SECTION("RTMSymTab")= \
|
2012-12-14 16:59:22 +08:00
|
|
|
{ \
|
|
|
|
(void *)&symbol, \
|
|
|
|
__rtmsym_##symbol##_name \
|
|
|
|
};
|
2013-02-27 00:37:57 +08:00
|
|
|
#endif
|
|
|
|
|
2012-12-14 16:59:22 +08:00
|
|
|
#else
|
|
|
|
#define RTM_EXPORT(symbol)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|