Catching hard faults #26
johankraft
started this conversation in
General
Replies: 1 comment
-
The implementation of hard faults in the deprecated qemu-system-gnuarmeclipse was not complete. I suggest you use the new qemu-system-arm. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to test some fault exceptions on STM32F4 but with moderate success.
I manage to generate a UsageFault (ended up in UsageFault_Handler_C) when doing this:
void (*bad_fun_ptr_usagefault)(int) = &"THIS IS NOT CODE, CRASH GOD DAMN IT!";
bad_fun_ptr_usagefault(3);
I also managed to crash it by overwriting the return address from a function, but no exception handler was called.
More subtle errors are ignored. It just keeps running despite doing things like unaligned memory accesses and division by zero.
I have added the following to enable the fault exceptions. This runs in the end of _initialize_hardware.
SCB->CCR |= SCB_CCR_DIV_0_TRP_Msk
| SCB_CCR_UNALIGN_TRP_Msk;
SCB->SHCSR |= SCB_SHCSR_USGFAULTENA_Msk
| SCB_SHCSR_BUSFAULTENA_Msk
| SCB_SHCSR_MEMFAULTENA_Msk;
Does anyone have any idea what is missing?
Beta Was this translation helpful? Give feedback.
All reactions