Unable to Debug HelloWorld with vsCode

I’m trying to debug the HelloWorld project using vsCode. The build seems to complete successfully, but whenever I click the debug icon (on the bottom bar), I get the following error:

[main] Problem getting debug configuration from cache. Error: Unable to find GDB in default search path and gdb.

Any ideas?

Here is the full output:

[build] Starting build
[driver] Start build Onethinx_HelloWorld.elf
[driver] Runnnig pre-configure checks and steps
[proc] Executing command: “C:/Program Files/CMake/bin/cmake.exe” --build “c:/Users/Paul Gyurkikiss/Documents/VSCode/Onethinx_HelloWorld/build” --config DEBUG --target Onethinx_HelloWorld.elf – -j 6
[build] [100%] Built target Onethinx_HelloWorld.elf
[driver] Run _refreshExpansions
[cms-driver] Run doRefreshExpansions
[driver] Run _refreshExpansions cb
[build] Build finished with exit code 0
[cache] Reading CMake cache file c:/Users/Paul Gyurkikiss/Documents/VSCode/Onethinx_HelloWorld/build/CMakeCache.txt
[cache] Parsing CMake cache string
[proc] Executing command: “C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gdb.exe” --version
[cache] Reading CMake cache file c:/Users/Paul Gyurkikiss/Documents/VSCode/Onethinx_HelloWorld/build/CMakeCache.txt
[cache] Parsing CMake cache string
[proc] Executing command: gdb --version
[main] Problem getting debug configuration from cache. Error: Unable to find GDB in default search path and gdb.
[extension] [2124] cmake.debugTarget finished (returned null)

Can you try to debug using the extension? It’s the ‘bug’ icon at the left bar and then ‘Launch [config]’ at the top.

Schermafbeelding 2020-02-05 om 09.09.04

Rolf,
Using the extension, I don’t see any error message, but when I start the debugging, I get a traveling blue bar at the top (see screenshot) that goes on forever. Nothing else appears to happen.

Paul

Paul,

Can you send me the ‘Adapter output’ log? It’s at the output window, select ‘Adapter output’ at the right.

Thanks,
Rolf

Rolf,
I can’t find an “Adapter Output” option. Here are my choices:


Paul

Did you install the Cortex Debug Extension?

I think so. Is this the correct one?

Yes, it’s the correct one.

For some reason GDB or OpenOCD is not starting. It should fail after about 20 seconds automatically, not sure why it hangs. Which operating system are you using?

You may want to check this topic…

Windoze 10 Pro 64-bit

Can you try to restart your machine?

If that doesn’t help, maybe the prelaunch task is failing. Can you comment (//) this line from your selected launch (CM4 Kitprog):
//"preLaunchTask": "Check build", // Set this to run a task from tasks.json before starting a debug session

Also, if you open Command Prompt and you type set, does it show the ONETHINX_ environment variables?

Restarting did not help.
Commenting out the pre-launch task didn’t help.
Here are the ONETHINX environment variables:

Does openocd start from the location set in launch.Json if you try it in the terminal window of VScode? And GDB?

launch.json has several paths. It’s not obvious to me which one you mean.

Paul

Rolf,
I tried manually navigating to the serverpath location, using a command window. From that location, I could invoke openocd, but not GDB.

Paul

Hello.

I gave up on this for a while and worked on other things. Now, I’m trying again to get this thing running.

I completely uninstalled Modus Toolbox and VSCode. I then installed VSCode and the VSCode Onethinx Pack for Windows per the instructions on this GitHub repository:

It now appears that I have to have Modus Toolbox installed, even if I am using VSCode, so I will install it. What I need to know is, with the current VSCode version of HelloWorld on GitHub, what version of Modus Toolbox should I install? Any guidance would be appreciated.

Paul

Hi Paul,

There is no need to install Modus Toolbox if you are using our OnethinxPack with VSCode.

Just follow the instructions: https://github.com/onethinx/VSCode_OnethinxPack_Windows

Tomislav

Hi Tomislav,

Thanks for the info. What made me think I needed Modus Toolbox was the following error I got when trying to clean the project:
[cmake] CMake Error at CMakeLists.txt:142 (add_executable):
[cmake] Cannot find source file:
[cmake]
[cmake] C:/ModusToolbox_1.0/libraries/psoc6sw-1.0/components/psoc6pdl/devices/psoc6/startup/system_psoc6_cm4.c

I now realize that the error comes from the following line in the file CMakeLists.txt:
set(CY_MODUS_DIR C:/ModusToolbox_1.0)

Searching through the VSCode Onethinx Pack directory tree, I can only find two files named system_psoc6_cm4.c. They are in the following directories:
C:\VSCode_OnethinxPack_Windows\PDL_1.3.1.1499\devices\bsp\COMPONENT_MBED\startup
C:\VSCode_OnethinxPack_Windows\PDL_1.3.1.1499\devices\bsp\COMPONENT_MTB\startup

There appears to be a problem setting correct paths in some of the variable assignments, as shown here:

If you can tell me which system_psoc6_cm4.c file I should use, I can probably sort out the rest.

Paul

Oops. My bad.

It appears that my installation of VSCode works fine with the HelloWorld project. The problem of wrong paths in CMakeLists variables exists in the VSCodeLightSensor project. I can use VSCode_HelloWorld as an example to correct VSCodeLightSensor.

Sorry for the false alarm.

Paul