From 57e625d4dcb94c4d26a3a65e6738322f172b705b Mon Sep 17 00:00:00 2001 From: BloodStainedCrow Date: Sat, 23 Mar 2024 10:45:45 +0100 Subject: 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 --- doc/buildWithVScode.md | 2 +- doc/usingDevcontainers.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 doc/usingDevcontainers.md (limited to 'doc') diff --git a/doc/buildWithVScode.md b/doc/buildWithVScode.md index 9d0a5bdf..5f872482 100644 --- a/doc/buildWithVScode.md +++ b/doc/buildWithVScode.md @@ -32,7 +32,7 @@ The .devcontainer folder contains the configuration and scripts for using a Dock Using the [Remote-Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension is recommended. It will handle configuring the Docker virtual machine and setting everything up. -More documentation is available in the [readme in .devcontainer](../.devcontainer/README.md) +More documentation is available in the [readme in .devcontainer](usingDevcontainers.md) ### DevContainer on Ubuntu diff --git a/doc/usingDevcontainers.md b/doc/usingDevcontainers.md new file mode 100644 index 00000000..fc755ba1 --- /dev/null +++ b/doc/usingDevcontainers.md @@ -0,0 +1,55 @@ +# 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 -f ` + +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 -- cgit v1.2.3-70-g09d2