Closed desowin closed 3 years ago
@desowin What is your Mbed OS SHA you tested it with ? I recall there was similar issue and was fixed on master.
The mbed-os version I use is 73f096399b4cda1f780b140c87afad9446047432, which is tagged as mbed-os-5.12.4
I think the fix is something along the lines of mbed_fault_handler
manipulating the error_in_progress
flag that mbed_error
does, or having its own equivalent.
That trap is suppressed if mbed_error
is called from IRQ handler, but not if it's a direct fault handler.
I'm not quite sure how to structure the change though - mbed_error
in turn suppresses some of its behaviour if it sees error_in_progress
set.
Something like this would work, but it's ugly:
mbed_fault_handler
{
bool old_flag = core_util_atomic_exchange_bool(&error_in_progress, true);
do context prints
core_util_atomic_store_bool(&error_in_progress, old_flag);
mbed_error(xxx);
}
cc @ARMmbed/mbed-os-core
@desowin thank you for raising this issue.Please take a look at the following comments:
Could you add some more detail to the description? A good description should be at least 25 words. What target(s) are you using? What toolchain(s) are you using? What version of Mbed OS are you using (tag or sha)? It would help if you could also specify the versions of any tools you are using? How can we reproduce your issue?
NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'.This indicates to us that at least all the fields have been considered. Please update the issue header with the missing information, the issue will not be mirroredto our internal defect tracking system or investigated until this has been fully resolved.
Could you add some more detail to the description? A good description should be at least 25 words.
I think the description is adequate.
What target(s) are you using?
ST 32F746GDISCOVERY
What toolchain(s) are you using?
GCC ARM
What version of Mbed OS are you using (tag or sha)?
73f0963, which is tagged as mbed-os-5.12.4
It would help if you could also specify the versions of any tools you are using?
GNU Tools ARM Embedded 7 2018-q2-update
How can we reproduce your issue?
Easiest way to reproduce is to do NULL pointer dereference in class constructor and create statically allocated object of this class.
We've updated our automation, I will fix the requirements .
@desowin could you confirm if this is still an issue for you on Mbed 6 ? Mbed 5 (other than 5,15) is no longer supported.
Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-2463
We closed this issue because it has been inactive for quite some time and we believe it to be low priority. If you think that the priority should be higher, then please reopen with your justification for increasing the priority.
Description of defect
Misleading Error Message: Not allowed in ISR context when hard fault happens before default_console() is called for first time
Easiest way to reproduce is to do NULL pointer dereference in class constructor and create statically allocated object of this class. The Hard Fault handler will collect the information and try to print it. However, as it is the first time default_console() is executing, the Hard Fault won't get printed because the Hard Fault handler will fail to acquire singleton mutex when constructing the console object in default_console().
Thus instead of Hard Fault message, you get completely misleading
and if you look into map file you'll notice that the
Mutex: 0x200284B4
refers tosingleton_mutex_obj
.The workaround is to ensure that default_console() gets called prior to the HardFault, but you need atleast good guess to do it.
Target(s) affected by this defect ?
ST 32F746GDISCOVERY
Toolchain(s) (name and version) displaying this defect ?
GNU Tools ARM Embedded 7 2018-q2-update
What version of Mbed-os are you using (tag or sha) ?
mbed-os-5.12.4
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
n/a
How is this defect reproduced ?
See description