Bug in mbed. Due to the call of printf inside mbed-os during interrupt (when program crashes)

It is clear that when an interrupt happen due to a segmentation fault or any other problem inside your code, this function inside mbed-os fails

mbed_error_printf("\n++ MbedOS Fault Handler ++\n\nFaultType: "); (inside mbed_fault_handler.cpp)

Why?
Because printf is not allowed by mbedos…
It is silly that printf is not allowed but mbedos try to use it …

It has been like that for a long time … no one report it or try to fix it I think (not sure).
mbed_error_printf must be able to write to serial port even if it is inside an interrupt. As it is a fatal message … mbed shouldn’t care about anything else.

Due to this problem, I never can get a crash report.

I hope I explained well.

Note: NUCLEO_L476RG. Mbed-OS from the online IDE(latest)

You can’t use any operation that requires a mutex lock within an ISR context. It’s not allowed by Mbed for a variety of reasons.

I suggest that, instead, you use the interrupt to set a flag that is then serviced from a different thread.

Hope that helps,
Adam

@amitchone we already discus about that but he probably means another problem. See Serial interrupt not cleared after the interrupt?

BR, Jan

Again you didn’t understand the question either.
It is not about using serial in my code. It is mbed itself fails to give you a fatal report (hard fault)

Maybe you need to read it twice before reply, because I not wrote it to you but to Adam to show him that you were thinking something else and that we were already discussing it.
So sorry I want to help you. Nevermind.

BR, Jan

That kind of attitude goes nowhere towards getting people to help you, so count me out.