Vs code zephyr sdk container unable to open gdb session, missing board directory


I have built and flashed the Swan host using my stlink v3mini, using one of the example projects.

I do get, this pop up when I initiate run and debug using the launch configuration provided in the repo.


Any idea on what might be missing on my side?

I did some digging and tried to run in the container terminal

$ openocd -s ${config:zephyr_sdk_path}/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -s ${config:zephyr_base}/boards/arm/${config:board}/support -f openocd.cfg

Open On-Chip Debugger 0.11.0+dev-00726-ge2b6f5655 (2023-09-22-14:29)
Licensed under GNU GPL v2
For bug reports, read
embedded:startup.tcl:26: Error: Can't find openocd.cfg
in procedure 'script' 
at file "embedded:startup.tcl", line 26

looks like missing openocd.cfg to me

then checked into zehpyr_base

$ ls $zephyr_base
CMakeLists.txt  Dockerfile  README.md  app.overlay  build  prj.conf  src

Turns out that there is no board directory.

the path variables in .vscode/settings.json are wrong, please push a fix to the zephyr example repos

I spelled everything out in this launch configuration member like so

"debugServerArgs": "-s /usr/local/zephyr-sdk-0.16.3/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -s /home/blues/zephyrproject/zephyr/boards/blues/swan_r5/support -f openocd.cfg",

That got the gdb session going :smiley:

I believe this is the fix you are requesting:

Can you try pulling the latest, and see if this fixes your issue with no workarounds necessary?

I pulled the latest, and it was not enough to resolve the issue.

I find that it is enough to change in debugServerArgs the directory ‘arm’ to ‘blues’.

"debugServerArgs": "-s ${config:zephyr_sdk_path}/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -s ${config:zephyr_base}/boards/blues/${config:board}/support -f openocd.cfg",

Oddly it does not seem to use zephyr_sdk_path since I can use both 0.15.2 and 0.16.3

As a sidenote to this. is the MS serial monitor extension (came installed with the docker image) working for you in VScode ?

It just comes up blank for me. But I installed another serial monitor and that worked.

Thanks for helping me line this out!

Can you pull the latest and test again?

Done. worked like a charm. :+1: