-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
I am experiencing some issues where fault information is not printed in certain cases. It doesn't matter if it is an assert or a hardfault that needs to be printed.
I am testing on an nRF52840 but as far as I can tell it is not target related.
Toolchain is IAR 8.30.1
Mbed version 5.11.5
The test code could be as simple as:
int main()
{
MBED_ASSERT( false );
return 0;
}
This issue is that the default console is a singleton and as such gets constructed on the first use:
mbed-os/platform/mbed_retarget.cpp
Line 262 in 801e555
static FileHandle *default_console() |
The singleton guards in IAR use a system mutex that eventually goes to the mbed mutex implementation. It tries to acquire a mutex by calling
osMutexAcquire()
but that fails on IsIrqMasked()
because we are in a critical section from mbed_error_puts(const char *str)
.
If I put a printf("\n")
before my assert the fault information is printed successfully because the object is already constructed. I think this is also the reason why it hasn't shown up in the testcases because they all use prints before the error handling tests.
This could be an issue only for IAR because of the way the singleton is handled but I have no means to verify that easily.
Issue request type
[ ] Question
[ ] Enhancement
[x] Bug