From e664aec650b817cbc795cfbbc72b21fb78755cb9 Mon Sep 17 00:00:00 2001 From: Ahmad Faour <ahmad.faour@polymtl.ca> Date: Thu, 13 May 2021 03:23:26 +0000 Subject: [PATCH] container setup --- .devcontainer/Dockerfile | 26 ++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 33 +++++++++++++++++++++++++++++++++ .devcontainer/entrypoint.sh | 9 +++++++++ 3 files changed, 68 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/entrypoint.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..75ec94e --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,26 @@ +ARG VARIANT=focal +FROM mcr.microsoft.com/vscode/devcontainers/base:${VARIANT} + +ARG USER=vscode +ARG GNU_ARM_VERSION=10-2020-q4-major +ARG GNU_ARM_DIRECTORY=/opt/toolchains + +RUN apt update -y && \ + apt upgrade -y && \ + apt install -y build-essential clang-format clang-tidy git \ + openocd picocom libncurses5 \ + meson ninja-build python3 python3-pip python3-setuptools python3-wheel \ + usbutils + +RUN mkdir -p /dev/bus/usb && \ + usermod -aG plugdev $USER + +RUN mkdir -p ${GNU_ARM_DIRECTORY} && \ + wget -qO- "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-${GNU_ARM_VERSION}-x86_64-linux.tar.bz2" | tar -xj -C "${GNU_ARM_DIRECTORY}" + +ENV PATH="${GNU_ARM_DIRECTORY}/gcc-arm-none-eabi-${GNU_ARM_VERSION}/bin:$PATH" +ENV XDG_DATA_DIRS="/workspaces/unicorn-hal/" +ENV XDG_DATA_HOME="/workspaces/unicorn-hal/" + +USER $USER +RUN pip3 install --user meson --upgrade diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..8b18f0c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +{ + "name": "Machine PM - Embedded Development", + "dockerFile": "./Dockerfile", + "extensions": [ + // Meson extension + "asabil.meson", + // Cortex Debug + "marus25.cortex-debug", + // C++ extension + "ms-vscode.cpptools", + // IntelliSense extension + "visualstudioexptteam.vscodeintellicode", + "mhutchie.git-graph", + "editorconfig.editorconfig", + "zixuanwang.linkerscript", + "dan-c-underwood.arm" + ], + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind", + "source=/dev/,target=/dev/,type=bind", + "source=/etc/udev/rules.d,target=/etc/udev/rules.d,type=bind" + ], + "workspaceFolder": "/workspaces/unicorn-hal", + "remoteUser": "vscode", + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined", + "--device-cgroup-rule=a 166:* rwm", + "--device-cgroup-rule=a 189:* rwm", + ], + "postCreateCommand": "./.devcontainer/entrypoint.sh", +} \ No newline at end of file diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh new file mode 100644 index 0000000..f5b2920 --- /dev/null +++ b/.devcontainer/entrypoint.sh @@ -0,0 +1,9 @@ +#!/usr/bin/bash + +FILE=/etc/udev/rules.d/60-openocd.rules +if [ ! -f "$FILE" ]; then + mkdir -p /etc/udev/rules.d/ + sudo cp /lib/udev/rules.d/60-openocd.rules /etc/udev/rules.d/ +fi + + -- GitLab