This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1312R: Assert_isTrue() with RTOS7 - something wrong or not clear.

Part Number: CC1312R
Other Parts Discussed in Thread: SYSCONFIG, SYSBIOS

Project with RTOS7, simplelink_cc13xx_cc26xx_sdk_6_30_01_03, buid with Ti Clang v.2.1.3LTS, and SysConfig_v1.15.

I use Assert_isTrue() to check for an errors in a several functions, for instance, like this:

    // Check if input data mailbox is defined with correct message size
    Assert_isTrue(sizeof(TskFwDnld_InputMbxMsg_t) == Mailbox_getMsgSize(mbxFwDnldTskInput), NULL);

The problem is that the compiler doesn't generate code for this assert. Assert_isTrue() macro is defined in 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

The reason code for assert to not be generated is that for the module (.c file) with my assert the BIOS_assertsEnabled_D is not defined.

Assert are managed from SysConfig sections TI_RTOS->BIOS and TI_RTOS->RUNTIME->Assertion_Handling.

The strange is that BIOS_assertsEnabled_D is enabled by sections TI_RTOS->BIOS, but Asserts should works and only by TI_RTOS->RUNTIME->Assertion_Handling, which will not happened.

Cloud you give me an example how should custom assert be used according to you SysConfig designers. I mean what header should be included and where, taking in to account that it is posible to have assertion enabled by adding assertion module by TI_RTOS->RUNTIME->Assertion_Handling without they to be enabled in RTOS by TI_RTOS->BIOS.   

Regards,

Dimitar

  • The only thing you should do in sysconfig, is to enable Asserts:

    In your application, you need to include the following:

    #include "ti_sysbios_config.h"
    #include <ti/sysbios/runtime/Assert.h>
    

    I tested this in the empty example, as verified that it works:

    If you do not include ti_sysbios_config.h before the assert.h, no code will be generated.

    BR

    Siri

  • Hi Siri,

    I undertstand that in current situation (the way that SysConfig currently works) I have to include include ti_sysbios_config.h before the assert.h in order my assers to work. Also I need to enable ASSERTs within RTOS (from sections TI_RTOS->BIOS).

    Let say that asserts from sections TI_RTOS->BIOS is not enabled (the resullt is  BIOS_assertsEnabled_D is defined as false) but there is added Assert module by section TI_RTOS->RUNTIME->Assertion_Handling. The question is where the asserts going to work in this case and what is the idea of this section TI_RTOS->RUNTIME->Assertion_Handling beside additional assert behavior control (adding line and SW BKPT)? 

    Regards,

    Dimitar

  • I talked with R&D, and they agree that the documentation is not very clear.

    What they said was that there is a limitation in sysConfig. If you add the Assert module but asserts are disabled, they will remain disabled. Only if they are both added and enabled will it be functional.

    Are you having issues getting things to work as you want to, or just feeling that it is unclear how to make it work.

    If you are not able to achieve what you want/need, please let us know and we will try to help you.

    Siri

  • Hi Siri,

    I am able to achieve what I want.

    I just tried to clear for me and you (Ti) if there is something unfinished or unclear regarding the management of assets with Sysconfig.
    Now it is clear that as I thought it is a matter of unfinished work (bad defined or forgotton), and I could be sure that the Ti is aware about it so it is going to be fixed in a rigth way in the future.

    Regards,

    Dimitar

  • Hi Dimitar

    A jira ticket has been created to have this fixed :-)

    Siri