From d509688167d97e6353b71a45bf07329243152d8b Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Sat, 1 Feb 2025 09:29:56 +0100 Subject: [PATCH] vscode: Add devcontainer Signed-off-by: Thomas Klaehn --- .devcontainer/Dockerfile | 38 ++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 48 +++++++++++++++++++++++++++++++++ .vscode/launch.json | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..1f6973b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,38 @@ +FROM debian:stable-slim + +LABEL maintainer="thomas.klaehn@perinet.io" + +# Enable contrip section for "repo" +# RUN sed -i -e 's/.main$/ main contrib/' /etc/apt/sources.list + +RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get -y install --no-install-recommends \ + binutils-arm-none-eabi \ + gcc-arm-none-eabi \ + gdb-multiarch \ + git \ + libstdc++-arm-none-eabi-dev \ + libstdc++-arm-none-eabi-newlib \ + make \ + openocd + +# Set UTF8 locale settings +# RUN apt-get install -yq locales && \ +# locale-gen en_US.UTF-8 && \ +# sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ +# dpkg-reconfigure --frontend=noninteractive locales && \ +# update-locale LANG=en_US.UTF-8 + +# ENV LANG en_US.UTF-8 + +# RUN useradd -ms /bin/bash builder +# RUN echo "builder:builder" | chpasswd + +# ADD init.sh /usr/local/bin/init.sh + +# WORKDIR = /work + +# ENTRYPOINT ["/usr/local/bin/init.sh"] +RUN mkdir /workspaces +VOLUME /workspaces +WORKDIR /workspaces/ +CMD ["/bin/bash"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..4c8ae89 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,48 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "arm-none-eabi-cpp", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "build": { "dockerfile": "Dockerfile" }, + + // Privileged container in order to access /dev + "privileged": true, + + // Mount USB devices (debug probes, UART interfaces, ...) + "mounts": [ + "source=/dev/bus/usb/,target=/dev/bus/usb/,type=bind" + ], + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "sudo apt update && sudo apt install -y openocd && sudo apt install -y gdb-multiarch", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "marus25.cortex-debug", + "zoma.vscode-auto-open-workspace" + ], + // default settings, can be overwritten in .vscode/settings.conf + "settings": { + "terminal.integrated.defaultProfile.linux.shell": "/bin/bash", + "autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true, + "autoOpenWorkspace.enableAutoOpenAlwaysFirst": true, + "files.exclude": { + "**/.git": true, + "**/.repo": true + } + } + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.vscode/launch.json b/.vscode/launch.json index 9eec17e..120a9bb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,7 @@ "environment": [], "externalConsole": false, "MIMode": "gdb", - "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerPath": "gdb-multiarch", "debugServerPath": "openocd", "debugServerArgs": "-f ${workspaceRoot}/openocd.cfg", "serverLaunchTimeout": 20000,