Page 1 of 1

gdb on an STM32U073: Misses breakpoints

Posted: Mon Sep 30, 2024 1:01 am
by doctek
While using gdb to debug my RTC program on an STM32U073KB micro, I am seeing the following behavior:
- Breakpoints are set at loop and at Configure_RTC. When cont is entered after load, the program breaks at loop, not at Configure_RTC. Entering monitor reset halt, then cont, causes a break at Configure_RTC. This behavior is completely repeatable. Further monitor reset halt and cont sequences result in halts at Configure_RTC. If the program is reloaded and started again, the break will be at loop, until a monitor reset halt and cont.
- A breakpoint set at RTC_TAMP_IRQHandler will never break, although I can prove (by putting in a while(1) {}) that the interrupt happens.

I have used similar gdb techniques with an STM32L071KB part and it works as expected.

Can someone please tell me what might be wrong? I'm at a loss.

I am using Ubuntu 24.04.The (Arduino) code I am running may be seen here: viewtopic.php?t=2497

Thanks!!

Re: gdb on an STM32U073: Misses breakpoints

Posted: Mon Sep 30, 2024 9:14 am
by fpiSTM
With Arduino IDE you have to enable the "optimize for debugging".
Anyway the openocd version included with the stm32 core does not support the U0. So you can't debug it.

Re: gdb on an STM32U073: Misses breakpoints

Posted: Mon Sep 30, 2024 4:40 pm
by doctek
Thanks for the reply!
FWIW, optimize for debug was selected.

But the bigger question is who should I be asking about debug support for the U073 series? Surely, if ST wants a new family to be used, they will support debugging, right?

-jim

Re: gdb on an STM32U073: Misses breakpoints

Posted: Mon Sep 30, 2024 6:20 pm
by doctek
One more detail: I'm actually using the ST-LINK_gdbserver, not openOCD. Not sure if that matters or not.

Re: gdb on an STM32U073: Misses breakpoints

Posted: Tue Oct 01, 2024 9:21 am
by fpiSTM
doctek wrote: Mon Sep 30, 2024 6:20 pm One more detail: I'm actually using the ST-LINK_gdbserver, not openOCD. Not sure if that matters or not.
OK so we do not talk about debugging STM32U0 thanks the Arduino IDE or you made a customization.

About openOCD STM32U0xx support, a review is ongoing to add it:
https://review.openocd.org/c/openocd/+/8087

Re: gdb on an STM32U073: Misses breakpoints

Posted: Thu Oct 03, 2024 11:02 pm
by doctek
The way I debug is to compile code with Arduino, then find the .elf file in /tmp/arduino (check time stamps to find correct file), and use the arm-none-eabi-gdb to debug it. I first start ST-LINK_gdbserver in an Ubuntu command window.

Getting the latest version of the gdbserver seems to get things going properly. Thanks for the tip about doing this.