PIO Unified Debugger


#41

Hi, I’d like too improve some of the auto-detection of blackmagic debugger connections and fix support of the onboard cmsis-dap on a kl25z board I’m using.
Is PIO Debugger open source to accept contributions?


#42

All the Espressif ESP32 boards seem to not be supported, but it should be a relatively easy thing since they use OpenOCD and their own customized GDB from a Crosstools-NG build.

Make for a win there, guys.

https://github.com/espressif/openocd-esp32

https://esp-idf.readthedocs.io/en/v2.0/openocd.html


#43

We have just released new PIO Core+ v0.8.11 with a support for custom debugging configuration. Please run pio update command.

See


#44
  • PlatformIO IDE for Atom, Menu: “PlatformIO > Upgrade PlatformIO Core”. Be sure that you use minimum 3.4.0b3 version
  • Open PlatformIO IDE Terminal and type
pio platform uninstall atmelsam
pio platform install atmelsam --with-package=uploader
  • Create Adafruit M0 based project, open “platformio.ini” and update its content to:
[env:adafruit_feather_m0_usb]
platform = atmelsam
board = adafruit_feather_m0_usb
framework = arduino
debug_tool = custom
debug_server =
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/bin/openocd
  -f
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/interface/cmsis-dap.cfg
  -c
  set CHIPNAME at91samd21g18; set ENDIAN little; set telnet_port 0
  -f
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/target/at91samdXX.cfg

See details about SWCLK & SWDIO pins

Now, press “Debug” button on toolbar.


PlatformIO -> J-Link -> ESP32-DevKitC debugging not working
#45

Which problems do you have? What is your board?

Could you explain problem in detail?


#46

With blackmagic probe I’ve got some python code I currently use in .gdbinit to auto-select the correct com port so I don’t have to set it manually anywhere, I would be happy to contribute it.

Before I switched to the blackmagic I could not get my frdm-kl25z mbed board working at all with the onboard cmsis debugger. There was no console outputs from the the debugging engine being used behind the scenes to see what the progress was and the error notification that eventually popped up was very obscure - sorry I don’t remember what it was now.

I definitely appreciate the end goal of zero-configuration and having debugging that just works, but in the mean time (especially for beta releases) it’d be great if there was an option to display the openocd / gdb console(s) output when starting debugging, if for no other reason than displaying progress of the debugger connecting.
Currently I hit the debug button, it runs the compiler again (wasting a few seconds as it figures out it doesn’t need to compile anything) and then it just looks like it’s doing nothing at all while the debug engine is silently starting in the background. Eventually I’m at a debug highlight in the code, or there’s a final obscure error message in a notification popup.


#47

Hi

I followed the steps above and get:

Error launching PIO Debugger
Error: Flushed due to previous errors

What errors ? Where did i set up to use my Ateml ICE as the debug interface?

Thanks


Trouble uploading to nrf51-DK with Platformio
#48

Please create in the root of a project file named openocd.cfg with the next content:

interface cmsis-dap
# example: cmsis_dap_vid_pid 0x1a2b 0x3c4d
cmsis_dap_vid_pid %INSERT_VID% %INSERT_PID%
# uncomment if you have more than 1 probe
# $cmsis_dap_serial %SERIAL_NUNBER%
set CHIPNAME at91samd21g18
set ENDIAN little
set telnet_port 0

and platformio.ini

[env:adafruit_feather_m0_usb]
platform = atmelsam
board = adafruit_feather_m0_usb
framework = arduino
debug_tool = custom
debug_server =
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/bin/openocd
  -f
  $PROJECT_PATH/openocd.cfg
  -f
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/target/at91samdXX.cfg

#49

Where is openpcd located? I cannot find where it is installed?

I have created that file but still have the same Error launching PIO Debugger.


#50

[env:adafruit_feather_m0_usb]
platform = atmelsam
board = adafruit_feather_m0_usb
framework = arduino
upload_port = com29
debug_tool = custom
debug_server =
$PLATFORMIO_HOME_DIR/packages/tool-openocd/bin/openocd
-f
$PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/interface/cmsis-dap.cfg
-c
set CHIPNAME at91samd21g18; set ENDIAN little; set telnet_port 0
-f
$PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/target/at91samdXX.cfg


#51
interface cmsis-dap
# example: cmsis_dap_vid_pid 0x1a2b 0x3c4d
cmsis_dap_vid_pid 0x03EB 0x2141 
# uncomment if you have more than 1 probe
# $cmsis_dap_serial %SERIAL_NUNBER%
set CHIPNAME at91samd21g18
set ENDIAN little
set telnet_port 0

#52

The problem is that you didn’t used new config. Please be creafully, I modified debug_server option in the comment above: -f $PROJECT_PATH/openocd.cfg

P.S: tool-openocd is located in ~/.platformio/packages folder.


#53

I have changed this see below. Still not working.

I am using windows. I cannot seem to find the platformio location?

[env:adafruit_feather_m0_usb]
platform = atmelsam
board = adafruit_feather_m0_usb
framework = arduino
debug_tool = custom
upload_port = com30
debug_server =
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/bin/openocd
  -f
  $PROJECT_PATH/openocd.cfg
  -f
  $PLATFORMIO_HOME_DIR/packages/tool-openocd/scripts/target/at91samdXX.cfg

#54

Found the platformio folder. There is no tool-opencd in there?


#55

Opss… I see that PIO will not install openOCD if you board is based BOSSAC. If we add “debugging” support directly to board, you will not have this issue.

Try to change in your config board = zero and press “Upload” button (also, don’t connect any boards). PIO will download OpenOCD for you.


#56

Cool

Different error now:

Error: .pioinit:1: Error in sourced command file: Remote communication error. Target disconnected.: No error.


#57

Please check PM here


#58

We’ve just released new PIO Core+ v0.8.12 which improves debugging support for the MCUs that have locked flash (Freescale Kinetis, NXP LPC boards ). Could you test development version of NXP LPC?

  • pio update
  • pio platform uninstall nxplpc
  • pio platform install https://github.com/platformio/platform-nxplpc.git

Now, just use generic ARM mbed project and press “Debug” button.

Does it work?


#59

I found following problem with mbed LPC1768:
When starting the debugger I get the message STARTING, after a while (~7s) i get the message EXITED and after another period (~13s) the debugger is in RUNNING mode. So I need to pause the debugger to set my breakpoints. But then it works.
So, after EXITING the debugger shouldn’t run immediately.


#60

Sorry, after updating the nxplpc package it works, but a little slow. I’m using a very simple blinky with a counter and one variable watch, it need 5s per cycle. But yeah it works :grinning: