No, you will need a SWD debugger of some kind for this, e.g. a JLink or STLink or BMP. Without that, one would need a GDB stub running as part of the firmware to communicate with the GDB client on the PC, but no such implementation exists to my knowledge.
Thank you Max for your response.
I have ordered STLink. Is there any tutorial where I can setup STLink with PIO and SKR 1.4Turbo using Marlin? Please note that SKR 1.4 Turbo is LPC1769 based.
Sadly a few have tried as can be in read this thread, but none succeded finally.
In theory all it needs is that a SWD probe, like an ST-Link, is connected to the target microcontroller via the SWD connections (SWDIO, SWDCLK, GND), then OpenOCD should be able to establish a connection to it for flashing + debugging, at which point it is âjustâ a matter of teaching PlatformIO to do the correct OpenOCD invocations.
Iâll read up on the thread again and prepare an example with which some things can be tried.
Thank you Max.
Yes, this thread is there but i think âteaching PlatformIO to do the correct OpenOCD invocationsâ is little bit murky to me.
I will be looking forward for your example. Meanwhile I am waiting for my STLINK.
I think folks from Bigtreetech or Marlin should also share how they use to debug when developing SKR 1.4Turbo
Iâve read up on the thread and decided to do some updates to the example and my forked version of the nxp platform code. For me it now looks like building works, and upload and debug is attempted with the right commandds (it uses pyocd at the moment).
Please try and clone the example GitHub - maxgerhardt/pio-nxp-lpc1769-arduino-test: Simple project for testing Arduino support on the NXP LPC1769 chip using a custom platform., then build and upload it. The project is preconfigured for the cmsis-dap
(that an ST-Link is compatible with) type upload and debugging. Letâs get a normal upload + LED blinky working first.
Sidenote: If PyOCD says that it canât find a connected debug probe and youâre using Windows, you will need to install libusb for Python (copying of a libusb-1.0.dll
file in the Python installation directory).
Sidenote 2: The SWD pins on the board can be found per this.
Will try the example. It will take few days for the STLINK to ship. Will update once I try.
I was wondering, since the SKR 1.4T board is already talking to the PC(Windows) thru USB, there should be some way to use the USB interface directly (instead of going thru the STLINK) to activate the debugging.
Hi Max,
For SWD connection with SKR 1.4Turbo, please confirm if I only need to connect SWDIO, GND and SWCLK pins of STLINK-V2(pin 7,8,9) with SKR 1.4Turbo only?
Thanks.
Never mind, i was able to figure it out.
pin 1 of STLINK to 3.3V of SKR 1.4 Turbo
pin 7 to SWDIO
pin 8 to GND
pin 9 to CLK
pin 15 to RST.
Max, I was able to get your âpio-nxp-lpc1769-arduino-testâ working in debug mode.
Let me know what all modifications to make to get the debug working for Marlin FW.
Thanks.
Actually, creating a forked platform versions and adding cmsis-dap support via the Python code may have been overkill. The board already declares cmsis-dap debugging support via pyOCD, so the should do the same as my modified platform.
Just try and change to the Marlin envirnoment for your LPC1769 board with the switcher and press the debug button. It should start to invoke PyOCD. Does that just work?
In fresh Marlin repo from git, I added below lines in platformio.ini in [common_LPC].
debug_tool = cmsis-dap
;debug_tool = custom
debug_server =
openocd
-f
../scripts/interface/stlink.cfg
-f
../scripts/target/lpc17xx.cfg
The debug is launching but it fails to put a break point.
PlatformIO Unified Debugger â Redirecting...
PlatformIO: debug_tool = cmsis-dap
PlatformIO: Initializing remote targetâŚ
GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00462-gdd1d90111 (2019-01-18-11:42)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport âhla_swdâ. To override use âtransport select â.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 10 kHz
adapter_nsrst_delay: 200
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 10 kHz
Error: read version failed
2
.pioinit:13: Error in sourced command file:
Remote communication error. Target disconnected.: Success.
What happens if you do not modify it in any way and just press the debug button? It should use pyocd
.
Hi Max,
I first tried with how you asked. So, I opened my Marlin project in the same Visual Studio Code(thru PIO) where âpio-nxp-lpc1769-arduino-testâ was launched in debug mode. Then I switched to Marlin project and clicked debug. The breakpoint happened in âpio-nxp-lpc1769-arduino-testâ instead of happening in Marlin.
I am not fully aware of how âswitcherâ works and could be making some mistake while I switch between projects.