Yeah okay the problem is that it definitely doesn’t like reset_config none seperate as an argument, and thinks those are seperate flags – -c needs that as one string arg.
Remove these two lines in the platformio.ini file and retry. If openocd cannot reset the board, edit the python script
Max - tried your throughs and no mater what I use, I get “unexpected command line argument. In the following example, I set UPLOADERFLAGS = [”-c", “exit”] and still no joy.
Building in release mode
Checking size .pio\build\LPC1769\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [====== ] 59.0% (used 19304 bytes from 32736 bytes)
Flash: [===== ] 47.7% (used 226676 bytes from 475136 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, custom, jlink, mbed
CURRENT: upload_protocol = custom
Uploading .pio\build\LPC1769\firmware.bin
xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:28)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Unexpected command line argument: reset
*** [upload] Error 1
Also tried just program, just verify, just reset, just shutdown and all gave me command line errors argument errors. It is as through the Stlink command set (what ever that is) is not available or wasn’t initialized in openocd. I’m about ready to throw in the towl with this approach and toss this ‘bricked/not upgradable’ SKR board. It appears that this approach is ‘above my pay grade’ Thanks for trying.
Actually I think this is where it wrongly read reset as a seperate argument. Somehow it must be changed so that the commandline says openocd [..] -c "program {{$SOURCE}} verify reset; shutdown" and not openocd [..] -c program {{$SOURCE}} verify reset; shutdown. Verify that this is happening with pio run -t upload -v to see the used openocd invocation.
This thread is relevant to me. I want to debug the firmware but instead of using STLINK or hardware debugger. Is it possible to use USB interface? I just want to step into the main Marlin program.
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.
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.
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).
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.
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.
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?
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.
Ok looks good with Marlin. The Marlin program is going into the debug mode.
I am not sure what is the “Segmentation Fault”. The debug does not stop at breakpoint which is set in MarlinCore.cpp. Any idea why it is not going in the MarlinCore.cpp breakpoint?