PIO Debug doesn't work anymore

I’ve been successfully building and debugging my projects for at least two years, but all of a sudden today I load a project that compiled and debugged fine a few days ago and it will not allow debugging!
It gives the following error in the Debug Console and stops:
“undefinedError: Could not load a build configuration”

My platform.ini has a debug configuration that I have used many times. The source code builds just fine and creates .elf and .bin files in the .pio\build\debug folder. This same project was able to be debugged fine the day before.

To check my sanity, I loaded an older project (different project from a month ago) and now it won’t debug either.

I tried uninstalling PlatformIO IDE from VSCode, then I uninstalled VSCode.
Next I reinstalled VSCode and then PlatformIO extension. But this didn’t fix the
problem.

What can I try to fix this?

Can you post the full log? I’ve never seen this message before.

The compile process completes fine:

Executing task: C:\Users\tony.platformio\penv\Scripts\platformio.exe debug --environment LPC1769Debug <

Processing LPC1769Debug (platform: https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip; board: nxp_lpc1769; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc-arduino-lpc176x/nxp_lpc1769.html
PLATFORM: NXP Arduino LPC176x (0.1.3) > NXP LPC1769
HARDWARE: LPC1769 120MHz, 31.97KB RAM, 464KB Flash
DEBUG: Current (custom) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES:
 - framework-arduino-lpc176x 0.2.9
 - toolchain-gccarmnoneeabi 1.90301.200702 (9.3.1)
Converting Marlin.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ off, Compatibility ~ strict
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <U8glib-HAL> 0.4.5
Building in debug mode
Checking size .pio\build\LPC1769Debug\debug\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [====      ]  39.8% (used 13044 bytes from 32736 bytes)
Flash: [======    ]  64.5% (used 306536 bytes from 475136 bytes)
================================================================ [SUCCESS] Took 7.54 seconds ================================================================

Environment    Status    Duration
-------------  --------  ------------
LPC1769Debug   SUCCESS   00:00:07.538
================================================================ 1 succeeded in 00:00:07.538 ================================================================ 

Terminal will be reused by tasks, press any key to close it.

The Debug Console has only one line of output and it is:

undefinedError: Could not load a build configuration

Here is my platform.ini file
[platformio]
src_dir = Marlin
boards_dir = buildroot/share/PlatformIO/boards
default_envs = LPC1769Debug
include_dir = Marlin

[common]
…tons of things here not pertinent to the problem …
[features]
…tons of things here not pertinent to the problem …
[env]
framework = arduino
extra_scripts = ${common.extra_scripts}
build_flags = ${common.build_flags}
lib_deps = ${common.lib_deps}
monitor_speed = 250000
monitor_flags =
–quiet
–echo
–eol
LF
–filter
colorize
–filter
time

[common_LPC]
platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip
platform_packages = framework-arduino-lpc176x@^0.2.6
lib_ldf_mode = off
lib_compat_mode = strict
extra_scripts = ${common.extra_scripts}
src_filter = ${common.default_src_filter} +<src/HAL/LPC1768> +<src/HAL/shared/backtrace>
lib_deps = ${common.lib_deps}
Servo
custom_marlin.uses_liquidcrystal = arduino-libraries/LiquidCrystal@~1.0.7
custom_marlin.neopixel_led = Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/1.5.0.zip
build_flags = ${common.build_flags} -DU8G_HAL_LINKS -IMarlin/src/HAL/LPC1768/include -IMarlin/src/HAL/LPC1768/u8g
-Wno-int-in-bool-context -Wno-unused-variable -Wno-unknown-pragmas

[env:LPC1768]
platform = ${common_LPC.platform}
extends = common_LPC
board = nxp_lpc1768
lib_deps = marlinfirmware/U8glib-HAL@^0.4.4

[env:LPC1769Debug]
extends = env:LPC1769
build_type = debug
build_flags = ${common_LPC.build_flags} -g3 -O0 -ggdb -DDEBUG -DVECT_TAB_FLASH=0x00000000
debug_tool = custom
debug_server = $PLATFORMIO_CORE_DIR/packages/tool-openocd/bin/openocd
-c
gdb_port 3334
-c
tcl_port disabled
-c
telnet_port disabled
-c
set CALLER DEBUG # so that all cfg files know who called them
-c
set LOADADDRESS 0x00000000 # MAKE SURE TO SET THIS CORRECTLY!!!
-c
set FIRMWARENAME {$PROG_PATH} # for debug, use $PROG_PATH ($SOURCE is not available) for output filename
-c
set PROGRAMMER STLINK # tell MY_LPC1769.cfg whether to use STLink or MCULink interface
-c
set PROG_DEVICE STLINK_COPPER # tell MY_LPC1769.cfg which device (STLINK_DISCO, STLINK_BLACK, STLINK_COPPER)
-f # it outputs .elf, but the MY_LPC1769.cfg will rename it to .bin
$PLATFORMIO_CORE_DIR/packages\tool-openocd\scripts\board\MY_LPC1769.cfg
#Add debug related commands
debug_build_flags = -g3 -O0 -ggdb3 -DDEBUG
debug_load_mode = modified
debug_port = localhost:3334 # where GDB connects to OpenOCD
debug_load_cmds = load
debug_init_break = #tbreak loop #main # leave empty to not stop on main(), or set a function name or line to break at
debug_init_cmds =
#mon gdb_memory_map enable
define pio_reset_halt_target
monitor reset
monitor halt
end
define pio_reset_run_target
monitor reset
end
define pio_restart_target
pio_reset_halt_target
end
target remote $DEBUG_PORT

#mon set non-stop on
#define hook-stop
#echo "hook-stop"
#mon cortex_m maskisr on
#end
#define hook-continue
#echo "hook-continue" 
#mon cortex_m maskisr off 
#end 
monitor init                            # GDB monitor commands to send to OpenOCD
monitor reset init                      # sets MEMMAP (0x400FC040) to 0x1 for User Flash mapped to address 0x00000000
set mem inaccessible-by-default off     # GDB commands
monitor mdw 0x400FC040                  # look to see if User Reset (1) and not Bootloader (0)
$INIT_BREAK                             # GDB commands this sends whatever is in (debug_init_break = )
$LOAD_CMDS                              # GDB commands this sends whatever is in (debug_load_cmds = )

debug_extra_cmds =
set remotetimeout 5000 # GDB command to extend timeout from target 5000 seconds
show remotetimeout
lib_deps = marlinfirmware/U8glib-HAL@^0.4.4 # needed by Marlin 2.0.8 release

[env:LPC1769]
build_type = release
platform = ${common_LPC.platform}
extends = common_LPC
board = nxp_lpc1769
build_flags = ${common_LPC.build_flags} -g -ggdb -O1 # any optimize levels -O1,-O2,-O3,-Os cause Marlin Mode failure on TFT35
extra_scripts = ${common_LPC.extra_scripts}
TGExtra\MY_LPC17xx_helper.py # calcs LPC checksum and writes it to 0x0000001c in binary file
#TGExtra\dump_env.py

#Add upload related commands
upload_protocol= custom # for LPC17xx use custom, cmsis-dap inserts an extra “-t, lpc1768” to upload_flags, causing errors

#strange, the arguments to command below must all be on the same line, unlike the debug_server =, (or put args in upload_flags)
upload_command = $PROJECT_PACKAGES_DIR\tool-openocd\bin\openocd
upload_flags =
-c
set FIRMWARENAME {$PROJECT_DIR$SOURCE} # for upload, $SOURCE seems to be available as output filename
-c
set CALLER UPLOAD # so that all cfg files know who called them
-c
set LOADADDRESS 0x00000000 # MAKE SURE TO SET THIS CORRECTLY!!! For now LPC parts must start at zero!
-c
set PROGRAMMER STLINK # tell MY_LPC1769.cfg whether to use STLink or MCULink interface
-c
set PROG_DEVICE STLINK_COPPER # tell MY_LPC1769.cfg which device (STLINK_DISCO, STLINK_BLACK, STLINK_COPPER)
-f
$PROJECT_PACKAGES_DIR\tool-openocd\scripts\board\MY_LPC1769.cfg
lib_deps = marlinfirmware/U8glib-HAL@^0.4.4 # needed by Marlin 2.0.8 release

Here is the Console output from Toggle Developer Tools:
console.ts:137 [Extension Host] (node:11700) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.(Use Code --trace-deprecation ... to show where the warning was created)
v @ console.ts:137
console.ts:137 [Extension Host] activating extension
console.ts:137 [Extension Host] starting language server
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\python3\python.exe Array(2) Object
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\python3\python.exe Array(8) Object
console.ts:137 [Extension Host] Found compatible PlatformIO Core 5.2.0 → C:\Users\tony.platformio\penv\Scripts\platformio.exe
console.ts:137 [Extension Host] PIO Core State Object
console.ts:137 [Extension Host] Switching project to c:\Users\tony\Documents\CNC\MAINBOARD\Marlin-2.0.8-0525210-SGEN
console.ts:137 [Extension Host] Activating project c:\Users\tony\Documents\CNC\MAINBOARD\Marlin-2.0.8-0525210-SGEN
console.ts:137 [Extension Host] Put command in queue C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object
log.ts:301 ERR Bad progress location: platformio-ide.projectTasks: Error: Bad progress location: platformio-ide.projectTasks
at i.withProgress (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1992:121025)
at w.$startProgress (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1495:29184)
at d._doInvokeHandler (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:12737)
at d._invokeHandler (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:12421)
at d._receiveRequest (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:11083)
at d._receiveOneMessage (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:9761)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:7857
at l.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:69:1712)
at r.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:16477)
at f._receiveMessage (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:21747)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:18625
at l.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:69:1712)
at b.acceptChunk (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:13838)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:13186
at Socket.k (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2872:163769)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
console.ts:137 [Extension Host] Put command in queue C:\Users\tony.platformio\penv\Scripts\python.exe Array(7) Object
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\penv\Scripts\python.exe Array(7) Object
console.ts:137 [Extension Host] Put command in queue C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object
log.ts:301 ERR Bad progress location: platformio-ide.projectTasks: Error: Bad progress location: platformio-ide.projectTasks
at i.withProgress (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1992:121025)
at w.$startProgress (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1495:29184)
at d._doInvokeHandler (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:12737)
at d._invokeHandler (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:12421)
at d._receiveRequest (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:11083)
at d._receiveOneMessage (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:9761)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:7857
at l.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:69:1712)
at r.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:16477)
at f._receiveMessage (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:21747)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:18625
at l.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:69:1712)
at b.acceptChunk (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:13838)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:13186
at Socket.k (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2872:163769)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
console.ts:137 [Extension Host] Could not fetch project targets for ‘LPC1769Debug’ environment => Error: Traceback (most recent call last):
File “”, line 1, in
TypeError: ‘NoneType’ object is not subscriptable
v @ console.ts:137
console.ts:137 [Extension Host] Put command in queue C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object
log.ts:301 ERR Bad progress location: platformio-ide.projectTasks: Error: Bad progress location: platformio-ide.projectTasks
at i.withProgress (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1992:121025)
at w.$startProgress (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1495:29184)
at d._doInvokeHandler (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:12737)
at d._invokeHandler (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:12421)
at d.receiveRequest (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:11083)
at d.receiveOneMessage (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:9761)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1502:7857
at l.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:69:1712)
at r.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:16477)
at f.receiveMessage (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:21747)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:18625
at l.fire (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:69:1712)
at b.acceptChunk (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:13838)
at vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:85:13186
at Socket.k (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2872:163769)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object
console.ts:137 [Extension Host] Error: C:\Users\tony.platformio\penv\lib\site-packages\platformio_main
.py:70: DeprecationWarning: ‘resultcallback’ has been renamed to ‘result_callback’. The old name will be removed in Click 8.1.
@cli.resultcallback()
Error: Traceback (most recent call last):
File "C:\Users\tony.platformio\penv\lib\site-packages\platformio_main
.py", line 115, in main
cli() # pylint: disable=no-value-for-parameter
File “C:\Users\tony.platformio\penv\lib\site-packages\click\core.py”, line 1137, in call
return self.main(*args, **kwargs)
File “C:\Users\tony.platformio\penv\lib\site-packages\click\core.py”, line 1062, in main
rv = self.invoke(ctx)
File "C:\Users\tony.platformio\penv\lib\site-packages\platformio\commands_init
.py", line 44, in invoke
return super(PlatformioCLI, self).invoke(ctx)
File “C:\Users\tony.platformio\penv\lib\site-packages\click\core.py”, line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “C:\Users\tony.platformio\penv\lib\site-packages\click\core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “C:\Users\tony.platformio\penv\lib\site-packages\click\core.py”, line 763, in invoke
return __callback(*args, **kwargs)
File “C:\Users\tony.platformio\penv\lib\site-packages\click\decorators.py”, line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File “C:\Users\tony.platformio\penv\lib\site-packages\platformio\commands\project.py”, line 197, in project_init
pg.generate()
File “C:\Users\tony.platformio\penv\lib\site-packages\platformio\ide\projectgenerator.py”, line 132, in generate
contents = self._render_tpl(tpl_path, tpl_vars)
File “C:\Users\tony.platformio\penv\lib\site-packages\platformio\ide\projectgenerator.py”, line 138, in _render_tpl
return bottle.template(fp.read(), **tpl_vars)
File “C:\Users\tony.platformio\penv\lib\site-packages\bottle.py”, line 3630, in template
return TEMPLATES[tplid].render(kwargs)
File “C:\Users\tony.platformio\penv\lib\site-packages\bottle.py”, line 3419, in render
self.execute(stdout, env)
File “C:\Users\tony.platformio\penv\lib\site-packages\bottle.py”, line 3406, in execute
eval(self.co, env)
File “”, line 77, in
NameError: name ‘includes’ is not defined

============================================================

An unexpected error occurred. Further steps:

============================================================

at spawnOptions.cwd (c:\Users\tony\.vscode\extensions\platformio.platformio-ide-2.3.3\node_modules\platformio-node-helpers\dist\index.js:1:776014)	at ChildProcess.a (c:\Users\tony\.vscode\extensions\platformio.platformio-ide-2.3.3\node_modules\platformio-node-helpers\dist\index.js:1:771284)	at ChildProcess.emit (events.js:315:20)	at ChildProcess.EventEmitter.emit (domain.js:467:12)	at ChildProcess.cp.emit (c:\Users\tony\.vscode\extensions\platformio.platformio-ide-2.3.3\node_modules\cross-spawn\lib\enoent.js:34:29)	at maybeClose (internal/child_process.js:1048:16)	at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)

v @ console.ts:137
console.ts:137 [Extension Host] runCommand C:\Users\tony.platformio\penv\Scripts\python.exe Array(2) Object

One curious thing I discovered… this is the output which shows up under the folder “Marlin-2.0.8-0525210-SGEN.pio\build\LPC1769Debug\debug”

image

I found that if I move all those files up one level to Marlin-2.0.8-0525210-SGEN.pio\build\LPC1769Debug (no /debug subfolder), and I adjust the launch.json eliminating the extra /debug folder from “Marlin-2.0.8-0525210-SGEN.pio\build\LPC1769Debug”

“executable”: “C://Users//tony//Documents//CNC/MAINBOARD//Marlin-2.0.8-0525210-SGEN//.pio//build//LPC1769Debug//debug//firmware.elf”, to

“executable”: “C://Users//tony//Documents//CNC/MAINBOARD//Marlin-2.0.8-0525210-SGEN//.pio//build//LPC1769Debug//firmware.elf”,

then PIO Debug will run … but I don’t know why, and this is a lot of work to mess with the folders like that. I never had to do this before, everything used to work fine. It seems like there is a problem finding the output files when that extra “/debug” folder is there. Could there be a limit to the string length of the path?

I’ll try moving the entire project up a few folders to shorten the paths, and see what happens.

Have you recently installed other extension in VSCode? Multiple extensions are known to block PIO debugging from working, including Google Cloud code.

A quick way to test this is to start a CLI and the command

pio debug --interface=gdb -x .pioinit

If that doesn’t yield something obvious, a more minimal example needs to be setup. This is Marlin with a billion config flags, custom platform, custom debug_server, etc. etc. The most possible complicated project setup with a billion variables.

On another note, one may also try one primitive first: Test whether OpenOCD can connect to the chip. You’d need to write this command in one line and replace the dynamic environment variables with the actual core paths and firmware path etc. I suggest preparing the command in a text editor first.

Max,
The only other extension installed is C/C++ Intellisense from Microsoft.

I tried moving the entire project to the “C:” folder to make all the filepaths shorter, but still get the error.

When I run the command “pio debug --interface=gdb -x .pioinit”, here is the result:

PS C:\Users\tony\Documents\CNC\MAINBOARD\Marlin-2.0.8-0525210-SGEN> pio debug --interface=gdb -x .pioinit
Error: Could not load a build configuration
PS C:\Users\tony\Documents\CNC\MAINBOARD\Marlin-2.0.8-0525210-SGEN> 

OpenOCD can connect to the chip fine. As I mentioned in the earlier post, PIO Debug command will build first and the open the debugger and flash the chip as it always did before BUT only if I manually move the output files up one folder from “.pio\build\LPC1769Debug\debug” to “.pio\build\LPC1769Debug” and try the PIO Debug command a second time.

For some weird reason, PIO Debug command cannot locate the .elf file or the idedata.json file if they are one level lower than “.pio\build\LPC1769Debug”

Does the [env:] with a build_type = debug always put the output files in a subdir of the build_dir called “debug”?

Is there a way to force the output files to be in the build_dir (".pio\build\LPC1769Debug" in my case) and not in a subdir called “debug”?

What platformIO code is responsible for finding and loading the .elf file for debugging? (a .py file I assume). Maybe I can check there to see why it can’t locate the file when it’s in this “debug” subfolder of the build_dir?

Max,

Okay, I did some fiddling around with the file “base.py” in C:\Users\tony.platformio\penv\Lib\site-packages\platformio\debug\config\base.py.

I located the error msg “Could not load a build configuration” around line 149 and I added “//debug//” to the self.env_name as shown below:

and everything worked fine after that!

So why is this necessary now, when I haven’t had this problem in the past?
I don’t think my workaround is a good one because I see in some of my other projects that they do not create that extra “debug” subfolder in the Project output. So my workaround would break those projects.