"Thread:SysConfig"、"SysBIOS"中讨论的其他器件
使用 RTOS7、 simplelink_cc13xx_cc26xx_sdk_6_30_01_03进行工程设计、使用 TI Clang v.2.1.3LTS 和 SysConfig_v1.15进行工程设计。
我使用 assert_isTrue ()来检查几个函数中的错误,例如如下所示:
// Check if input data mailbox is defined with correct message size
Assert_isTrue(sizeof(TskFwDnld_InputMbxMsg_t) == Mailbox_getMsgSize(mbxFwDnldTskInput), NULL);
问题是编译器不会为此断言生成代码。 assert_isTrue ()宏在 Assert.h 中定义
#if BIOS_assertsEnabled_D
#if Assert_useBkpt_D
#define Assert_isTrue(c, id) do { \
if (!(c)) __asm("bkpt #13"); } while (0);
#else
extern void Assert_failX(const char * id);
#if Assert_addFileLine_D
#define Assert_isTrue(c, id) do { \
Error_PLACE_STR_IN_SECTION(loc, # id " (" __FILE__ ":" Error_STR(__LINE__) ")"); \
if (!(c)) Assert_failX(loc); } while (0);
#else
#define Assert_isTrue(c, id) do { \
Error_PLACE_STR_IN_SECTION(loc, # id); \
if (!(c)) Assert_failX(loc); } while (0);
#endif
#endif
#else
#define Assert_isTrue(c, id)
#endif
未生成断言的原因代码是对于具有断言的模块(.c 文件) BIOS_assertsEnabled_D 电压。
从 SysConfig 部分 TI_RTOS->BIOS 和 TI_RTOS->Runtime->Assertion_Handling 管理断言。
奇怪的是 BIOS_assertsEnabled_D 由 TI_RTOS->BIOS 段启用、但生效应该有效、并且只能通过 TI_RTOS->Runtime->Assertion_Handling 启用、这种情况不会发生。
云您给了我一个示例、告诉我根据您的 SysConfig 设计人员应如何使用自定义断言。 我是说应该包含什么标头以及在哪里、考虑到可以通过 TI_RTOS->Runtime->Assertion_Handling 添加断言模块来启用断言、而不是通过 TI_RTOS -> BIOS 在 RTOS 中启用断言。
此致、
Dimitar