aboutsummaryrefslogtreecommitdiffstats
path: root/.devcontainer
diff options
context:
space:
mode:
authorBloodStainedCrow <tim.aschhoff@t-online.de>2024-03-23 10:45:45 +0100
committerGitHub <noreply@github.com>2024-03-23 10:45:45 +0100
commit57e625d4dcb94c4d26a3a65e6738322f172b705b (patch)
tree5a0f39f39fc8dc3f617fe8dec16b7e478de6e1ca /.devcontainer
parent9a5f516c427f329bbc161f794bae18908fcd33c5 (diff)
Unify docker devcontainer with dockerfile used for CI (#1587)
* Only use one Dockerfile and build.sh script for both docker and devcontainer * Remove all now unneccessary tasks and scripts * Update to clang-format-14 * Move devcontainer.json into root folder * Fix conditional statements in Dockerfile * Move .devcontainer/README into doc/usingDevcontainers * Remove obsolete VSCode Task * Change standard compiler path to the correct compiler * Set GDB Path for debugging * Hide broken buttons from CMake Extension * Refactor .devcontainer * Remove unneccessary postBuildCommand * Add devcontainer dependencies to all docker images * Add Devcontainer Debug launch config * Add an additional c_cpp_properties config as a fallback for devcontainer * Remove obsolete Docker Argument * Fix wrong C/Cpp versions * Fix silent fail of gdb, add libncurses5
Diffstat (limited to '.devcontainer')
-rw-r--r--.devcontainer/Dockerfile66
-rw-r--r--.devcontainer/README.md55
-rw-r--r--.devcontainer/build.sh87
-rw-r--r--.devcontainer/build_app.sh2
-rw-r--r--.devcontainer/create_build_openocd.sh3
-rw-r--r--.devcontainer/devcontainer.json38
-rw-r--r--.devcontainer/make_build_dir.sh2
7 files changed, 0 insertions, 253 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
deleted file mode 100644
index e4ad5c4f..00000000
--- a/.devcontainer/Dockerfile
+++ /dev/null
@@ -1,66 +0,0 @@
-FROM ubuntu:latest
-
-ARG DEBIAN_FRONTEND=noninteractive
-RUN apt-get update -qq \
- && apt-get install -y \
-# x86_64 / generic packages
- bash \
- build-essential \
- cmake \
- git \
- make \
- python3 \
- python3-pip \
- python3-pil \
- tar \
- unzip \
- wget \
- curl \
- dos2unix \
- clang-format-12 \
- clang-tidy \
- locales \
- libncurses5 \
-# aarch64 packages
- libffi-dev \
- libssl-dev \
- python3-dev \
- rustc \
- && rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
-
-#SET LOCALE
-RUN locale-gen en_US.UTF-8
-ENV LANG en_US.UTF-8
-ENV LANGUAGE en_US:en
-ENV LC_ALL en_US.UTF-8
-
-RUN pip3 install adafruit-nrfutil
-# required for McuBoot
-RUN pip3 install setuptools_rust
-
-WORKDIR /opt/
-# build.sh knows how to compile but it problimatic on Win10
-COPY build.sh .
-RUN chmod +x build.sh
-# create_build_openocd.sh uses cmake to crate to build directory
-COPY create_build_openocd.sh .
-RUN chmod +x create_build_openocd.sh
-# Lets get each in a separate docker layer for better downloads
-# GCC
-# RUN bash -c "source /opt/build.sh; GetGcc;"
-RUN wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -O - | tar -xj -C /opt
-# NrfSdk
-# RUN bash -c "source /opt/build.sh; GetNrfSdk;"
-RUN wget -q "https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip" -O /tmp/nRF5_SDK_15.3.0_59ac345
-RUN unzip -q /tmp/nRF5_SDK_15.3.0_59ac345 -d /opt
-RUN rm /tmp/nRF5_SDK_15.3.0_59ac345
-# McuBoot
-# RUN bash -c "source /opt/build.sh; GetMcuBoot;"
-RUN git clone https://github.com/mcu-tools/mcuboot.git
-RUN pip3 install -r ./mcuboot/scripts/requirements.txt
-
-RUN adduser infinitime
-
-ENV NRF5_SDK_PATH /opt/nRF5_SDK_15.3.0_59ac345
-ENV ARM_NONE_EABI_TOOLCHAIN_PATH /opt/gcc-arm-none-eabi-9-2020-q2-update
-ENV SOURCES_DIR /workspaces/InfiniTime
diff --git a/.devcontainer/README.md b/.devcontainer/README.md
deleted file mode 100644
index fc755ba1..00000000
--- a/.devcontainer/README.md
+++ /dev/null
@@ -1,55 +0,0 @@
-# VS Code Dev Container
-
-This is a docker-based interactive development environment using VS Code and Docker Dev Containers removing the need to install any tools locally\*
-
-## Requirements
-
-- VS Code
- - [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension
-- Docker
-- OpenOCD - For debugging
-
-## Using
-
-### Code editing, and building.
-
-1. Clone InfiniTime and update submodules
-2. Launch VS Code
-3. Open InfiniTime directory,
-4. Allow VS Code to open folder with devcontainer.
-
-After this the environment will be built if you do not currently have a container setup, it will install all the necessary tools and extra VSCode extensions.
-
-In order to build InfiniTime we need to run the initial submodule init and CMake commands.
-
-#### Manually
-
-You can use the VS Code terminal to run the CMake commands as outlined in the [build instructions](https://github.com/InfiniTimeOrg/InfiniTime/blob/main/doc/buildAndProgram.md)
-
-#### Script
-
-The dev environment comes with some scripts to make this easier, They are located in /opt/.
-
-There are also VS Code tasks provided should you desire to use those.
-
-The task "update submodules" will update the git submodules
-
-### Build
-
-You can use the build.sh script located in /opt/
-
-CMake is also configured and controls for the CMake plugin are available in VS Code
-
-### Debugging
-
-Docker on windows does not support passing USB devices to the underlying WSL2 subsystem, To get around this we use OpenOCD in server mode running on the host.
-
-`openocd -f <yourinterface> -f <nrf52.cfg target file>`
-
-This will launch OpenOCD in server mode and attach it to the MCU.
-
-The default launch.json file expects OpenOCD to be listening on port 3333, edit if needed
-
-## Current Issues
-
-Currently WSL2 Has some real performance issues with IO on a windows host. Accessing files on the virtualized filesystem is much faster. Using VS Codes "clone in container" feature of the Remote - Containers will get around this. After the container is built you will need to update the submodules and follow the build instructions like normal
diff --git a/.devcontainer/build.sh b/.devcontainer/build.sh
deleted file mode 100644
index b4f080dd..00000000
--- a/.devcontainer/build.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-(return 0 2>/dev/null) && SOURCED="true" || SOURCED="false"
-export LC_ALL=C.UTF-8
-export LANG=C.UTF-8
-set -x
-set -e
-
-# Default locations if the var isn't already set
-export TOOLS_DIR="${TOOLS_DIR:=/opt}"
-export SOURCES_DIR="${SOURCES_DIR:=/sources}"
-export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}"
-export OUTPUT_DIR="${OUTPUT_DIR:=$BUILD_DIR/output}"
-
-export BUILD_TYPE=${BUILD_TYPE:=Release}
-export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-9-2020-q2-update"}
-export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
-
-MACHINE="$(uname -m)"
-[[ "$MACHINE" == "arm64" ]] && MACHINE="aarch64"
-
-main() {
- local target="$1"
-
- mkdir -p "$TOOLS_DIR"
-
- [[ ! -d "$TOOLS_DIR/$GCC_ARM_VER" ]] && GetGcc
- [[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk
- [[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot
-
- mkdir -p "$BUILD_DIR"
-
- CmakeGenerate
- CmakeBuild $target
- BUILD_RESULT=$?
- if [ "$DISABLE_POSTBUILD" != "true" -a "$BUILD_RESULT" == 0 ]; then
- source "$BUILD_DIR/post_build.sh"
- fi
- # assuming post_build.sh will never fail on a successful build
- return $BUILD_RESULT
-}
-
-GetGcc() {
- GCC_SRC="$GCC_ARM_VER-$MACHINE-linux.tar.bz"
- wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/$GCC_SRC -O - | tar -xj -C $TOOLS_DIR/
-}
-
-GetMcuBoot() {
- git clone https://github.com/mcu-tools/mcuboot.git "$TOOLS_DIR/mcuboot"
- pip3 install -r "$TOOLS_DIR/mcuboot/scripts/requirements.txt"
-}
-
-GetNrfSdk() {
- wget -q "https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/$NRF_SDK_VER.zip" -O /tmp/$NRF_SDK_VER
- unzip -q /tmp/$NRF_SDK_VER -d "$TOOLS_DIR/"
- rm /tmp/$NRF_SDK_VER
-}
-
-CmakeGenerate() {
- # We can swap the CD and trailing SOURCES_DIR for -B and -S respectively
- # once we go to newer CMake (Ubuntu 18.10 gives us CMake 3.10)
- cd "$BUILD_DIR"
-
- cmake -G "Unix Makefiles" \
- -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
- -DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
- -DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
- "$SOURCES_DIR"
- cmake -L -N .
-}
-
-CmakeBuild() {
- local target="$1"
- [[ -n "$target" ]] && target="--target $target"
- if cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
- then return 0; else return 1;
- fi
-}
-
-if [[ $SOURCED == "false" ]]; then
- # It is important to return exit code of main
- # To be future-proof, this is handled explicitely
- main "$@"
- BUILD_RESULT=$?
- exit $BUILD_RESULT
-else
- echo "Sourced!"
-fi
diff --git a/.devcontainer/build_app.sh b/.devcontainer/build_app.sh
deleted file mode 100644
index 0f578cc6..00000000
--- a/.devcontainer/build_app.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-cmake --build /workspaces/Pinetime/build --config Release -- -j6 pinetime-app \ No newline at end of file
diff --git a/.devcontainer/create_build_openocd.sh b/.devcontainer/create_build_openocd.sh
deleted file mode 100644
index c5bff5c8..00000000
--- a/.devcontainer/create_build_openocd.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-rm -rf build/
-cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 -S . -Bbuild \ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
deleted file mode 100644
index 1bb315f7..00000000
--- a/.devcontainer/devcontainer.json
+++ /dev/null
@@ -1,38 +0,0 @@
-// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
-// https://github.com/microsoft/vscode-dev-containers/tree/v0.154.2/containers/cpp
-{
- // "name": "Pinetime",
- // "image": "feabhas/pinetime-dev"
- "build": {
- "dockerfile": "Dockerfile",
- // Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04
- // "args": { "VARIANT": "ubuntu-20.04" }
- },
- "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
-
- // Set *default* container specific settings.json values on container create.
- "settings": {
- "terminal.integrated.shell.linux": "/bin/bash",
- "editor.formatOnSave": true,
- "clang-format.executable": "clang-format-12"
- },
-
- // Add the IDs of extensions you want installed when the container is created.
- "extensions": [
- "ms-vscode.cpptools",
- "ms-vscode.cmake-tools",
- "marus25.cortex-debug",
- "notskm.clang-tidy",
- "mjohns.clang-format"
- ],
-
- // 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": "bash /opt/create_build_openocd.sh",
-
- // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
- // "remoteUser": "vscode"
- "remoteUser": "infinitime"
-}
diff --git a/.devcontainer/make_build_dir.sh b/.devcontainer/make_build_dir.sh
deleted file mode 100644
index 76240037..00000000
--- a/.devcontainer/make_build_dir.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 ${SOURCES_DIR}