AN4989 Rev 3
67/118
AN4989
Exception handling
117
Independently from the IDE, for projects including the CMSIS library, the content of the
registers in the code can also be printed:
void HardFault_Handler(void)
{
volatile uint32_t csfr= SCB-> CSFR ; // load into variable
printf ( "SCB-> CSFR 0x%08x \n", SCB-> CSFR) // print
while (1)
{
}
}
The same content can as well be obtained directly from the memory with any memory
browser.
Other faults like UNALIGNED, UNDEFINSTR can be managed in a similar way.
For more details, refer to the relevant programming manual:
•
STM32F4 and STM32L4 Series Cortex®-M4 programming manual
•
(PM0214)
•
STM32F7 Series Cortex®-M7 processor programming manual (PM0253)
Relevant information is also available on partners websites:
•
https://www.iar.com
•
http://www.keil.com