Just wondering if anyone has a similar experience with setting breakpoints these days.
It seems that wherever I set a breakpoint, the debugger stop the program about 3 or 4 lines after the desired line of code.
Just a bit off 
I suppose I could update my PIO installation, but I hate to risk breaking things further
The first thing that comes to mind of optimization enabled (still somehow in debug mode), or a quirk of the underlying platform / openocd configuration. On what exact platformio.ini
is this happening?
Here is the .ini
[env:nucleo_f303k8]
platform = ststm32@7.2.0
board = nucleo_f303k8
framework = mbed
platform_packages =
framework-mbed @ ~5.51401.191023
I am unfamiliar with the whole debugging toolchain. Do you know of any packages I should investigate?
Maybe the specified MBED framework could be it, but I doubt it. Regardless, I am clueless on the process of debugging the debugger! 
You can try and add
debug_build_flags = -O0 -ggdb3 -g3
to the platformio.ini
, the default is -Og
but maybe that still applies something we don’t want.
Otherwise you can also set whether compiling in debug-mode in general makes a difference (build_type = debug
in platformio.ini
to change it from release-mode).
With fixed verioning like you’ve done there there’s little risk of breaking something, just using a platform that doesn’t work, and then reverting back to the old platform. You may try and replace platform = ststm32@7.2.0
with platform = ststm32@11.0.0
and see what happens, if it builds at all etc. and if the debugging behavior has changed.
what exactly is the ststm32
platform anyways? I was under the impression that the MBED framework contains all the stm32 driver code.
The platform
value maps to the PlatformIO “platform”, in this case GitHub - platformio/platform-ststm32: ST STM32: development platform for PlatformIO. It has the board definition, platform meta-information (for e.g. which packages are use) and the Python builder scripts for the frameworks (in general, build logic and debug logic).
When you build your PlatformIO project, first the PlatformIO core does a bit of thinking (e.g. regarding installing packages or libraries), and then gives over control to the platform’s scripts. Finally, those builder scripts call into the actual builder script of the framework
and that script is then calling into the mbed-os buildsystem to actually build the project.
You should also keep your PlatformIO core up date, since it also has a play in how debugging works.
1 Like
very interesting - I really want to spend some time learning how all this stuff “builds”.
Going to update the PIO core now and test the debugger
it seems that upgrading platform = ststm32@7.2.0
to platform = ststm32@11.0.0
fixed the debugger issue for now. Thanks for your help!