How to provoke HardFault on STM32H7

hardfault_trigger.cpp
((volatile int*)0xFFFFFFFF)[0] = 0;

This will perform an illegal memory access and hence trigger the hard faul. Due to voltatile, it won’t be optimized out by the compiler.


Check out similar posts by category: STM32