- Overwrite the handlers for UsageFault and _unhandled_exception via the `CH_IRQ_HANDLER` API
- Follow the 'regular interrupt handlers' instructions per this page.
- Call `chSysEnable() in my main() function before hitting a while(true) block`
Code in main() to replicate my problem would look more or less like this:
Code: Select all
volatile uint16_t divisor = 0;
volatile uint16_t dividend = 0;
volatile uint16_t result = 0;
chSysEnable();
while (true)
{
chThdSleepMilliseconds(10000);
result = dividend++ / divisor;
}
AFAIK, this should cause a UsageFault for division by zero, but I never see the exception happen. Is there some configuration I'm missing?