使用RTT Sudio新建的429基于芯片创建的工程,在board.c中定义这个函数RT_WEAK void rt_hw_board_init(),编译提示出现
error: expected '=', ',', ';', 'asm' or 'attribute' before 'void'RT_WEAK void rt_hw_board_init()
错误,一查找才知道在rtdef.h定义的宏为
/* maximum value of ipc type */
#define RT_SEM_VALUE_MAX RT_UINT16_MAX /< Maximum number of semaphore .value */
#define RT_MUTEX_VALUE_MAX RT_UINT16_MAX /< Maximum number of mutex .value */
#define RT_MUTEX_HOLD_MAX RT_UINT8_MAX /< Maximum number of mutex .hold */
#define RT_MB_ENTRY_MAX RT_UINT16_MAX /< Maximum number of mailbox .entry */
#define RT_MQ_ENTRY_MAX RT_UINT16_MAX /**< Maximum number of message queue .entry /
/ Common Utilities /
#define RT_UNUSED(x) ((void)x)
/ compile time assertion /
#define RT_CTASSERT(name, expn) typedef char ct_assert##name[(expn)?1:-1]
/ Compiler Related Definitions /
#if defined(__ARMCC_VERSION) / ARM Compiler */
#define rt_section(x) attribute((section(x)))
#define rt_used attribute((used))
#define rt_align(n) attribute((aligned(n)))
#define rt_weak attribute((weak))
#define rt_inline static __inline
弱函数的宏是rt_weak.但在另一台电脑中安装的RTT Studio的宏定义却是RT_WEAK.
更多回帖