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.

Compiler/MSP430FR6989: Behaviour of _assert when no debugger is connected

Part Number: MSP430FR6989


Tool/software: TI C/C++ Compiler

Hi,

i was not able to find any information about the exact implementation of the standard _assert() implementation (referenced by assert.h).

I wonder if it somehow works different when debugging the program or when the same program is running without  a connected debugger.

When no debugger is connected there can't be any breakpoint set, but does it hang in an infinite loop then?

I'm using CCS 6.1.2 without any updates and i'm using the C compiler only.

Regards,

Sebastian

  • Sebastian M said:
    i was not able to find any information about the exact implementation of the standard _assert() implementation (referenced by assert.h).

    Should an assert fail, it calls the function _abort_msg.  This function is defined in the source file assert.c in the RTS library source.  You can find it in a location similar to ...

    C:\ti\ccsv6\tools\compiler\ti-cgt-msp430_15.12.0.LTS\lib\src

    You will see that _abort_msg calls the function fputs.  This is a C I/O function. 

    Sebastian M said:
    When no debugger is connected there can't be any breakpoint set, but does it hang in an infinite loop then?

    Yes.  Because no debugger is connected, the fputs has no effect.  In theory, executing fputs could foul up memory or some other aspect of the execution state.  In practice, however, you usually see nothing.  For more background on C I/O functions and how they rely on the debugger, see the section titled The C I/O Functions in the MSP430 compiler manual.  After the no-effect call to fputs, the function abort is called.  This function ends with an endless loop.

    Thanks and regards,

    -George