This is an example configuration for setting up Visual Studio Code for Zephyr application development. It was originally created for the talk entitled, "Zephyr & Visual Studio Code: How to Develop Zephyr Apps with a Modern, Visual IDE" at EOSS 2023.
There are many, many different ways to develop a Zephyr application. This example currently assumes:
- All paths follow the Getting Started Guide
- Uses the Zephyr SDK where possible (ex. Host tools are not available on macOS or Windows)
- In-tree development
- Use of Python Virtual Environments
- Building
samples/basic/thread
so we can demonstrate thread-aware debugging - Targetting an nRF52840 DK
- Follow the Zephyr Getting Started Guide for your OS and make sure to use virtual environments
- Turn on Compilation Database with
west config build.cmake-args -- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- Copy the
.code-workspace
for your OS tosamples/basic/thread
as well the.vscode
folder - Retrieve
ZEPHYR_SDK_INSTALL_DIR
withcmake -P zephyr/cmake/verify-toolchain.cmake
. It'll be the prefix of theC_Cpp.default.compilerPath
- Set the
Python: Interpreter Path
- CD to
samples/basic/thread
- Try the different build tasks and the flash task
- Try to connect over the serial terminal
- TODO try step debugging