Debugging feature

Short question…
In the latest update i noticed debugging features.
Will they be available in the free version of platformio an which boards will be supported at the first stage.
I could not find it in the doc’s, so i tried a couple of boards (guessing it will be M1/M3) but could not find a supported one.

Haaaardly working on a debug (PIO IDE, Core, PIO Plus), multiple components. It is finally ready! The last thing - PIO Debug Configuration for the debug-compatible boards. Currently, working on ST STM32 development platform. I hope I’ll deploy first configs tomorrow.

Which debug-enabled boards do you have? Or even, debug adapters/links?

I don’t have a debug enabled board, guess the blue pill would not work.
I asked because I’m interested in this feature and like to buy a board.
Thank you for your answer I’ll wait for the board list until tomorrow :slight_smile:

Why? It will work with any SWD adapter. However, they are not cheap. I recommend to buy on of ST STM32 Nucleo Boards. It’s very cheap, $10-12.

PIO will support for debug 99% of all boards available in ST STM32 development platform.

Thank you, I will get a Nucleo Board!

While waiting for the board I played around with the blue pill without success…

When I hit the debug button in the ide I get "Error: Please specify debug_port for environment."
When I specify the serial-port as debug_port I get the “Continue - Pause - Stop debugging” Buttons
but no debug-window.

Is there any possibility to debug the debug function.
The command line “pio debug -v” does not give any useful information.

Currently, only the one adapter is configured for that board. Its name is Home · blackmagic-debug/blackmagic Wiki · GitHub
It means, that you need to connect external debug adapter with your board via SWD interface. AS I’ve said before, universal debug adapter is not cheap.

See full list with supported adapter by OpenOCD: Debug Adapter Hardware (OpenOCD User’s Guide)

Also, you can use other adapters that are not listed in OpenOCD site, but has own GDB server (software or hardware).

Ok,got it! it’s openocd based.
But the nucleo will work without external hardware?
(Bought a wrong adapter in the past, that’s why I asked twice)

No, Black Magic Probe works without OpenOCD, it has built-in debug server on a dongle. I gave a hint with OpenOCD because it supports multiple adapters. You can use any adapters that are compatible with GDB server software or handle it internally on a chip.

Nucleo has on-board ST-Link, as result, you can use it for debug. No need to buy additional dongle/adapter.

Could you provide a link? Maybe we can add support for it?

It was for another hardware.
At my beginning with miocrocontrollers I bought a AVRISP mkII for debuging (Shame on me).

I get the same issue when I am trying with my black magic probe. Occasionally I get the debug window but no variables are shown. I ll post the screenshots when I get home from work.

Okay.
A little progress.

Here are my findings. My BMP wasnt able to upload the bluepill board no matter what I did, forget debugging.
All I got was an error “SWDP_Scan Failed!”

On going through this post

http://www.stm32duino.com/viewtopic.php?t=1614

I realised, that the arduino port for the STM32, by default, disables the SWD functionality for the sake of GPIO functionality. So no matter what debugging tool you use SWD debugging and or uploading is not possible.

The fix is given in the replies below. Either place the bluepill in Serial bootloader mode, reset and it uploads fine via BMP or fix the build flags in the platformio.ini file.

Adding this,

build_flags = -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1

to the platformio.ini file will allow you to override the stm32 arduino build and enable the SWD pin functionality.

SWD debugging using any compatible adapter works afterwards.
I was able to debug as shown, but soon ran into the problem as explained here.

https://community.platformio.org/t/platformio-debugging/1704/3

I too get the same errors sometimes when I try to debug, further while the variables are shown in the watch window, any incrementing of the variables in code does not reflect in the watch window.

I ll keep digging and see what else I can do to fix the debugging issue. I suspect it has nothing to do with the platformio but more to do with gdb. A quick google search reports that these issues are common even in eclipse (on X86 platforms, I did not check if any results contained references to any embedded platforms)

Maybe another day or so and I should have an answer for the debugging issues too.

Hope this helps someone reduce their frustration. :slight_smile:

(Please excuse any grammatical errors, Its almost 3 AM here and I spent the last 5-6 hours trying to understand and resolve this issue. Highly tired and sleep deprived)

Okay then, new day refreshed and clear mind.
Compiling the code with these flags

build_flags = -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB

and using the USB connection of the bluepill board as a USB Serial passthrough is working just fine.
I am able to debug using the platformio debug tools.

I faced the problem earlier because I was using the native Serial port and a FT232 board and debugging. For some reason it was finicky and unreliable. The Serial_USB flags works just fine and I am able to debug now.
:slight_smile:

Thanks a lot @ivankravets and the platformio team for the addition.

I suggest anyone who is working with the STM32 processors and arduino framework to replicate the build_flags steps and then check if debugging is working.

1 Like

As @ivankravets suggested i bought a nucleo stm32f103 board.
Initial setup including debugging with platformio is really plug-and-play!
It works out of the box.
Unfortunately i have a similar problem as described here:

None of the variables are shown in the variables window.
Is there any possibility to enter custom gdb commands?

Are you using mbed framework or arduino??

tried with mbed framework.

Gimme some time. I have tried and got results with arduino. I ll try with the mbed framework and report back.

Thank you!

PS:
I’m totally new to stm32 and bought the nucleo, another blue pill and a st-link.
at the moment i have only the blue pill and the nucleo (second blue-pill and st-link is on the way).

Really appreciate your feedback! Thanks a lot!!! I understand all issues what you have reported above. We have an internal discussion within our team what to do with debug front-end. Currently, we use Atom’s gdb GUI and it’s made for desktop debugging, not embedded, as result, functionality is very limited.

If debug is really important for our community, we will refactor it. Currently, that isn’t an alpha or beta, it’s just a prototype/experiment. Need to receive first feedback what do you think about this approach.

If you like generic idea and our debug workflow, please vote here and we will make it better.

GDB does not provide MI-command to fetch GLOBAL variables. Only local/in-scope variables could be fetched automatically. Current GUI doesn’t provide functionality to add manually variable to watch list. That is why we think on a new front-end for debug.

Will it be much work to provide a gdb-command-line interface?
That would be a huge advantage.