Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding support for using [VSCode DevContainers](https://marketplace.v… #1583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
}

// 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": [],

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:22.04

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y make cmake zip curl wget git doxygen graphviz python3 python3-pip ninja-build openssh-server rsync zip cppcheck openocd && \
wget -O archive.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz?rev=dccb66bb394240a98b87f0f24e70e87d&hash=B788763BE143D9396B59AA91DBA056B6" && \
tar xf archive.tar.xz -C /opt && \
rm archive.tar.xz && \
apt-get autoclean -y && \
apt-get autoremove -y && \
apt-get clean

# setup container arm-gcc toolchain paths for cmake
ENV PATH=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin:$PATH
RUN ln -s /opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc /usr/bin/arm-none-eabi-gcc
RUN ln -s /opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-g++ /usr/bin/arm-none-eabi-g++
RUN ln -s /opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-ar /usr/bin/arm-none-eabi-ar
RUN ln -s /opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-as /usr/bin/arm-none-eabi-as
RUN ln -s /opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-size /usr/bin/arm-none-eabi-size
RUN ln -s /opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-objcopy /usr/bin/arm-none-eabi-objcopy
34 changes: 34 additions & 0 deletions doc/VSCode_DevContainer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# VSCode Dev Container development

A Dockerfile has been added, which contains a complete development environment that is consistent across all operating systems supporting Docker.

When VSCode encounters a `.devcontainer` directory, it will prompt you to open the workspace inside a [DevContainer](https://code.visualstudio.com/docs/devcontainers/containers). The entire build system is defined by the *DockerFile*,

## Initial Setup
1. Install all [prerequisites](##prerequisites)
2. Open `hellow_world.code-workspace` in VSCode. You may be prompted to open the workspace in a dev container - select **Reopen In Container**. This will build and start the docker contain, then reopen VSCode *inside* the container.

![Alt text](images/dev_container_prompt.png)

After VSCOde is running inside the container, the lower left corner of VSCode wil look something like this:

![Alt text](images/env_devContainer.png)
3. Your environment is all setup, continue with instructions from development-environment.md

## Prerequisites

### MS Windows based development

* [Docker Desktop](https://www.docker.com/products/docker-desktop/)
* WSL 2
* VSCode
* VSCode Extension : Dev Containers - Microsoft
* VSCode Extension : C++ Extension Pack - Microsoft
* VSCode Extension : CMake - twxs (optional - CMake syntax highliting)

### Linux based development
* Docker Desktop
* VSCode
* VSCode Extension : Dev Containers - Microsoft
* VSCode Extension : C++ Extension Pack - Microsoft
* VSCode Extension : CMake - twxs (optional - CMake syntax highliting)
Binary file added doc/images/dev_container_prompt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/env_devContainer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.