Skip to content

Instantly share code, notes, and snippets.

@BDeliers
Last active October 8, 2024 19:04
Show Gist options
  • Save BDeliers/881b89d6e842d1ab5cea82884b927af0 to your computer and use it in GitHub Desktop.
Save BDeliers/881b89d6e842d1ab5cea82884b927af0 to your computer and use it in GitHub Desktop.
nRF Connect SDK devcontainer for Visual Studio Code

nRF Connect SDK devcontainer for Visual Studio Code

Devcontainer for Visual Studio Code to develop microcontroller applications easily with the nRF Connect SDK.

Full explaination on my blog post

{
"name": "nRFConnect-SDK",
"build": {
"_comment" : "Links to the dockerfile",
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"settings": {
"_comment": "The command called when opening the terminal",
"terminal.integrated.shell.linux": "nrfutil toolchain-manager launch /bin/bash -- /root/entry.sh",
"_comment": "Path to the working directory for nRF Connect extension",
"nrf-connect.topdir": "/workdir",
"_comment": "Path to the nRF Connect SDK",
"nrf-connect.toolchainManager.installDirectory": "/root/ncs",
"_comment": "Program used to detect conneted devices",
"nrf-connect.deviceProvider": "nrfjprog"
},
"_comment": "Extensions to be installed",
"extensions": [
"nordic-semiconductor.nrf-connect-extension-pack",
"ms-vscode.cpptools",
"twxs.cmake",
"mhutchie.git-graph",
"geeebe.duplicate",
"mcu-debug.debug-tracker-vscode",
"marus25.cortex-debug"
]
}
},
"userEnvProbe": "loginInteractiveShell",
"_comment": "Mount the working folder...",
"workspaceMount": "source=${localWorkspaceFolder},target=/workdir/workspace,type=bind",
"_comment": "... to this path",
"workspaceFolder": "/workdir/workspace",
"_comment": "The privileged container will have access to the USB devices",
"runArgs": [ "--privileged" ]
}
# Derive from Nordic's image, SDK version 2.5
FROM nordicplayground/nrfconnect-sdk:v2.5-branch
# Update the distro
RUN apt-get -y update
# Install git and GDB
RUN apt-get -y install git gdb-multiarch
# Create the workspace folder
RUN mkdir /workdir/workspace
{
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceFolder}",
"_comment": "The elf file to debug",
"executable": "${workspaceFolder}/Main/build/zephyr/zephyr.elf",
"name": "Cortex debug Main",
"request": "launch",
"type": "cortex-debug",
"_comment": "Run to main",
"runToEntryPoint": "main",
"showDevDebugOutput": "none",
"_comment": "Which type of debugger to use",
"servertype": "jlink",
"_comment": "Location of the debug server",
"serverpath": "/opt/SEGGER/JLink/JLinkGDBServerCLExe",
"_comment": "GDB path, we installed it in the Dockerfile",
"gdbPath": "gdb-multiarch",
"_comment": "The device to debug",
"device": "nRF52833_xxAA",
"_comment": "Path to the SVD file fo the device",
"svdFile": "/workdir/modules/hal/nordic/nrfx/mdk/nrf52833.svd"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment