How to use NDEBUG?

sunnydaywest
Fri, 12 Jan 2024 18:36:15 +0000
Best practice

This is more a general question.

In the source system_clock.c there is a check in SetSysClock() with an assertion:

error("SetSysClock failed\n");

But when enter in this condition (by forcing) there is nothing at the serial port about error information and the code stops.

if I go to mbed_error.c I see that something is executed when:

#ifndef NDEBUG
...
#endif

I already tried #undef NDEBUG in the c-file or “target.macros_add”: [“NDEBUG=1”] in the target_overrides but no effect. In that stage a printf is also not working.

There is nothing to find about the correct use of NDEBUG and how to make error information visible in case of debugging.

Any suggestion?

20 posts - 3 participants