Page 1 of 1

STM32G0 SV#8

Posted: Wed Nov 11, 2020 7:16 am
by mck1117
I'm getting an unexpected SV#8 doing the bringup on an STM32G031. Here's the stack trace:

Screen Shot 2020-11-10 at 10.01.57 PM.png


As suggested by the file name, Vector64 is DMA1.

I've reduced the code down to the minimum project that does it (tested on a nucleo g031): https://github.com/mck1117/chibi_sv8

One thread continuously samples the adc, only one sample at a time (setting/clearing a pin while adcConvert is running). One thread toggles a GPIO every 3ms. I hooked up a logic analyzer to see some history of what's going on, and the exception occurs something like 10ms after startup. I also added a context switch hook to toggle a third pin to see what the scheduler is doing.

Screen Shot 2020-11-10 at 10.04.21 PM.png


Any idea what's going on? Looking in the debugger, the priority of that interrupt is 10, so it shouldn't be able to preempt the kernel unless something has gone wrong (besides, on v6m there is no partial disable, you can only disable interrupts fully).

Re: STM32G0 SV#8

Posted: Wed Nov 11, 2020 7:39 am
by mck1117
The plot thickens: everything works properly at -Og but does not work at -O1 or -O2.

Re: STM32G0 SV#8

Posted: Wed Nov 11, 2020 7:58 am
by Giovanni
Hi,

What compiler are you using? there is a known problem in GCC above 6.x, only the very latest 9.3.1 is not affected.

Giovanni

Re: STM32G0 SV#8

Posted: Wed Nov 11, 2020 8:12 am
by mck1117
Yep - updating from 9.2.1 to 9.3.1 fixed it. Evidently I misread the discussion about when that bug had been fixed (the warning was printing itself out every compile...), and thought I was safe from the bug.

Thanks for the help!