Is there a way to patch the assert?

Asked by clonephone82 on 2017-11-22

Hi,

How does the assert macro works?

I am a STM32 dev and I would like to use the Standard assert if possible but I need to redirect the failure to serial port or lcd.
So is it possible to redefine the macro?

many thanks

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
john
Solved:
2017-11-27
Last query:
2017-11-27
Last reply:
2017-11-23
Best john (jkovach) said : #1

You can simply define your own __assert_func:
void __assert_func(const char *file, int line, const char *func, const char *failedexpr)
{
...
}
I tried it, works for me.

clonephone82 (ecam) said : #2

Thanks john, that solved my question.