LPC1768 Debugging Error

I’m attempting to start debugging with the mbed NXT LPC1768 board which supposedly supports an on-board debugger. Upon launch the project builds, waits a few seconds, and then displays this error message:

>Failed to launch GDB: .pioinit:10 Error in sourced command file:
:3333: No connection could be made because the target machine actively refused it. (from interpreter-exec console .pioinit")

Since the board is connected through USB I manually set the debug_port to “COM73”, which then says “COM73: No such file or directory.” with the same error. COM73 is for sure the right port as I can access the mbed through other terminal apps. (I should add that just uploading to the board works fine without any configuration)

Edit: Specifying a COM port seems to get passed the original issue now, but the process still times out with this error:

Failed to launch GDB: .pioinit:10
Remote replied unexpectedly to ‘vMustReplyEmpty’:timeout(from interpreter-exec console “source .pioinit”)

I’m running platform IO through VSCode. Here is my platformio.inf configuration file:

[env:lpc1768]
platform = nxplpc
board = lpc1768
framework = mbed
debug_port = COM3
debug_load_cmd = preload

Any help or ideas would be appreciated. Thanks!

Can you upload the output of pio debug -v so that we can see what commands its trying to execute?

Perhaps this is normal, but when running that command through the terminal doesn’t show the debugging breakpoint toolbar at the top like starting debugging from the debug menu does. Also seems like it doesn’t cause the same timeout error, it just doesn’t do anything after the command finishes.

Output from terminal: (I had to add spaces in links to allow me to post this)

PS C:\Users\bw\Documents\PlatformIO\Projects\testing> pio debug -v
Processing lpc1768 (platform: nxplpc; debug_port: COM2; board: lpc1768; debug_load_cmd: preload; framework: mbed)


CONFIGURATION: https ://docs.platformio.org/page/boards/nxplpc/lpc1768.html
PLATFORM: NXP LPC > NXP mbed LPC1768
HARDWARE: LPC1768 96MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(cmsis-dap) ON-BOARD(cmsis-dap) EXTERNAL(blackmagic, jlink)
Library Dependency Finder → http ://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 25 compatible libraries
Scanning dependencies…
Dependency Graph
|-- (C:\Users\bw.platformio\packages\framework-mbed\features\mbedtls)
MethodWrapper([“checkprogsize”], [“.pioenvs\lpc1768\firmware.elf”])
Memory Usage → http ://bit.ly/pio-memory-usage
DATA: [ ] 4.7% (used 3105 bytes from 65536 bytes)
PROGRAM: [ ] 2.5% (used 13324 bytes from 524288 bytes)
.pioenvs\lpc1768\firmware.elf :
section size addr
.text 10920 0
.ARM.exidx 8 10920
.data 2396 268435656
.bss 709 268438056
.heap 2048 268438768
.stack_dummy 3072 268438768
.ARM.attributes 41 0
.comment 126 0
.debug_info 152763 0
.debug_abbrev 20096 0
.debug_loc 27596 0
.debug_aranges 3192 0
.debug_ranges 3856 0
.debug_macro 25990 0
.debug_line 52354 0
.debug_str 125503 0
.debug_frame 10040 0
Total 440710
============================== [SUCCESS] Took 4.18 seconds ==============================

And here’s the output from the Debug Console, from a debug starting from the Debug Menu, and shows the error:

Processing lpc1768 (platform: nxplpc; board: lpc1768; framework: mbed)
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https ://docs.platformio.org/page/boards/nxplpc/lpc1768.html
PLATFORM: NXP LPC > NXP mbed LPC1768
HARDWARE: LPC1768 96MHz 64KB RAM (512KB Flash)
DEBUG: CURRENT(cmsis-dap) ON-BOARD(cmsis-dap) EXTERNAL(blackmagic, jlink)
Library Dependency Finder → http ://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 25 compatible libraries
Scanning dependencies…
Dependency Graph
|--
Checking size .pioenvslpc1768 irmware.elf
Memory Usage → http ://bit.ly/pio-memory-usage
DATA: [ ] 4.7% (used 3105 bytes from 65536 bytes)
PROGRAM: [ ] 2.5% (used 13324 bytes from 524288 bytes)
Configuring upload protocol…
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed
CURRENT: upload_protocol = mbed
Looking for upload disk…
Auto-detected: D:\n
Uploading .pioenvslpc1768 irmware.bin
Firmware has been successfully uploaded.
(Some boards may require manual hard reset)
[SUCCESS] Took 4.27 seconds
Reading symbols from c:/Users/bw/Documents/PlatformIO/Projects/testing/.pioenvs/lpc1768/firmware.elf…
done.
PlatformIO Unified Debugger > http ://bit.ly/pio-debug
PlatformIO: Initializing remote target…
Ignoring packet error, continuing…
warning: unrecognized item “timeout” in “qSupported” response
Ignoring packet error, continuing…
.pioinit:10: Error in sourced command file:
Remote replied unexpectedly to ‘vMustReplyEmpty’: timeout
pio_reset_target

And this is my launch.json configuration:

{
“type”: “platformio-debug”,
“request”: “launch”,
“name”: “PIO Debug”,
“executable”: “c:/Users/boydw/Documents/PlatformIO/Projects/testing/.pioenvs/lpc1768/firmware.elf”,
“toolchainBinDir”: “C:/Users/boydw/.platformio/packages/toolchain-gccarmnoneeabi/bin”,
“svdPath”: “C:/Users/boydw/.platformio/platforms/nxplpc/misc/svd/LPC176x5x_v0.2.svd”,
“preLaunchTask”: {
“type”: “PlatformIO”,
“task”: “Pre-Debug”
},
“internalConsoleOptions”: “openOnSessionStart”
}

formatting didn’t go too well on that one.

Since I don’t have the hardware and can’t see a wrong configuration, maybe @ivankravets knows a person responsible for the mbed LXP platform that can help? :confused:

1 Like

Thanks for your help anyways. There’s nothing else I’m supposed to install first right? Like GDB is built in and should be working? I’ve got the mbed windows drivers installed, although that’s mostly for serial communication, and I’m able to upload programs just fine through pio.

The board also requires a restart to load new firmware, could that be affecting how the debugger works? I’ve tried manually restarting the board at different stages of upload but that doesn’t seem to make a difference.

Do you use this board? If yes, please check that you use the latest mbed Interface Firmware. You need a firmware with CMSIS-DAP support.

When you flash the latest firmware (bootloader), please use simple platformio.ini without any extra options:

[env:lpc1768]
platform = nxplpc
board = lpc1768
framework = mbed

@sstaub do you have this board? Does debugging work for you?

Debugging on the board works fine. I’m on macOS Mojave with VSCode.

1 Like

Ah of course! Updated the firmware and now debugging does start without much trouble.

It does seem to only want to break on certain actions, like an int declaration or increment won’t trigger but a break on a “wait_us(1);” or if statement will. Not sure if this is expected behavior or just an issue with the board itself but I can make do.

Thanks!

1 Like