rtm.h 1.8 KB
Newer Older
D
dzzxzz@gmail.com 已提交
1 2 3 4 5
/*
 * File      : rtm.h
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
 *
B
Bernard Xiong 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
D
dzzxzz@gmail.com 已提交
19
 */
B
Bernard Xiong 已提交
20

D
dzzxzz@gmail.com 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33
#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;
};

34 35 36 37 38 39 40
#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__)
41
#define RTM_EXPORT(symbol)
42

43
#else
D
dzzxzz@gmail.com 已提交
44
#define RTM_EXPORT(symbol)                                            \
45
const char __rtmsym_##symbol##_name[] SECTION(".rodata.name") = #symbol;     \
D
dzzxzz@gmail.com 已提交
46 47 48 49 50
const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \
{                                                                     \
    (void *)&symbol,                                                  \
    __rtmsym_##symbol##_name                                          \
};
51 52
#endif

D
dzzxzz@gmail.com 已提交
53 54 55 56 57
#else
#define RTM_EXPORT(symbol)
#endif

#endif