Skip to content

Commit ffdc630

Browse files
committed
Add NXP devcontainer
1 parent dbc1311 commit ffdc630

File tree

6 files changed

+197
-5
lines changed

6 files changed

+197
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.01
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
FROM ubuntu:latest AS downloader
2+
RUN apt-get update \
3+
&& apt-get -y install --no-install-recommends apt-utils \
4+
&& apt-get install -y \
5+
curl \
6+
xz-utils \
7+
unzip \
8+
wget
9+
10+
RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted
11+
12+
ARG GCC_VERSION=13.2.rel1
13+
ARG GCC_URI=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/$GCC_VERSION/binrel/arm-gnu-toolchain-$GCC_VERSION-x86_64-arm-none-eabi.tar.xz
14+
RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \
15+
&& curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \
16+
&& xz -d /tmp/dc-downloads/gcc-arm.tar.xz \
17+
&& tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \
18+
&& rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/
19+
20+
ARG CMAKE_VERSION=3.27.6
21+
ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh
22+
RUN wget $CMAKE_SCRIPT \
23+
-q -O /tmp/dc-downloads/cmake-install.sh \
24+
&& chmod u+x /tmp/dc-downloads/cmake-install.sh \
25+
&& mkdir -p /tmp/dc-extracted/cmake \
26+
&& /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \
27+
&& rm /tmp/dc-downloads/cmake-install.sh
28+
29+
FROM python:3.10 AS devcontainer
30+
31+
# Avoid warnings by switching to noninteractive
32+
ENV DEBIAN_FRONTEND=noninteractive
33+
34+
# You can set up non-root user
35+
# ARG USERNAME=vscode
36+
# ARG USER_UID=1000
37+
# ARG USER_GID=$USER_UID
38+
39+
# Configure apt and install packages
40+
RUN apt-get update \
41+
&& apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \
42+
&& apt-get install -y \
43+
git \
44+
git-lfs \
45+
git-svn \
46+
subversion \
47+
clang-format \
48+
curl \
49+
ninja-build \
50+
srecord \
51+
nodejs \
52+
libffi-dev
53+
54+
# Create needed directories
55+
RUN mkdir -p /usr/local/bin/gcc
56+
57+
# Clone libs mbedtls and fatfs etc.
58+
RUN git clone --branch mbedtls-2.28.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \
59+
&& git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \
60+
&& git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip
61+
62+
# Clone FreeRTOS
63+
RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \
64+
&& git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git --depth 1 ./sources/CMSIS_5
65+
66+
# set gcc location
67+
ARG TMP_GCC_PATH=/usr/local/bin/gcc
68+
ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin
69+
70+
# Copy from our other container
71+
COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH
72+
COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake
73+
74+
ENV PATH=/usr/bin/cmake/bin:${PATH}
75+
76+
# Creating static link python for pyhton3
77+
RUN ln -fs /usr/bin/python3 /usr/bin/python \
78+
&& pip3 install pyserial
79+
80+
# Clean up downloaded files
81+
RUN apt-get autoremove -y \
82+
&& apt-get clean -y \
83+
&& rm -rf /var/lib/apt/lists/*
84+
85+
# Switch back to dialog for any ad-hoc use of apt-get
86+
ENV DEBIAN_FRONTEND=dialog
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "nanoFramework-FreeRTOS-NXP",
3+
// If you prefer, you can use the source files and adjust them where they are located,
4+
// To do this, change the "dockerFile" to use 'Dockerfile.NXP.SRC'.
5+
// This will allow you to customize and build the container source and add anything you may need on top.
6+
"dockerFile": "Dockerfile.FreeRTOS-NXP",
7+
"context": ".",
8+
"mounts": [
9+
// Bind the Unix socket the Docker daemon listens on by default
10+
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
11+
// Keep command history
12+
"source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume",
13+
// OPTIONAL: Mount .azure folder for seamless az cli auth
14+
// "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind"
15+
],
16+
// Set the *default* container specific settings.json values on container create.
17+
"customizations": {
18+
"vscode": {
19+
"settings": {
20+
"cmake.preferredGenerators": [
21+
"Ninja"
22+
],
23+
"cmake.generator": "Ninja",
24+
"cmake.autoRestartBuild" : true,
25+
"cmake.configureSettings": {
26+
"CMAKE_MAKE_PROGRAM":"/usr/bin/ninja"
27+
},
28+
"cmake.configureOnOpen": false
29+
},
30+
// Add the IDs of extensions you want installed when the container is created.
31+
"extensions": [
32+
"ms-vsliveshare.vsliveshare-pack",
33+
"streetsidesoftware.code-spell-checker",
34+
"twxs.cmake",
35+
"ms-vscode.cmake-tools",
36+
"xaver.clang-format"
37+
]
38+
}
39+
}
40+
// You can pull all the repos with the latest changes, this is only valid if you are using the ./sources/Dockerfile.All containers
41+
// "postAttachCommand": "/usr/local/git-pull-repos.sh"
42+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
43+
// "forwardPorts": [],
44+
// Use 'postCreateCommand' to run commands after the container is created.
45+
// "postCreateCommand": "terraform --version",
46+
// Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root.
47+
// ,"remoteUser": "vscode"
48+
}

.devcontainer/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The available pre build images are:
99
* ghcr.io/nanoframework/dev-container-ti: contains all elements to build a firmware image for any of the TI SimpleLink targets
1010
* ghcr.io/nanoframework/dev-container-esp32: contains all elements to build a firmware image for any of the ESP32 targets
1111
* ghcr.io/nanoframework/dev-container-azure-rtos: contains all elements to build a firmware image for any of the Azure RTOS targets
12+
* ghcr.io/nanoframework/dev-container-freertos-nxp: contains all elements to build a firmware image for any of the NXP targets
1213

1314
You can choose the dev container needed when opening a remote container in VSCode. The options are:
1415

@@ -17,6 +18,7 @@ You can choose the dev container needed when opening a remote container in VSCod
1718
* `nanoFramework-ChibiOS` to use the pre build container with all the elements to build ChibiOS targets
1819
* `nanoFramework-ESP32` to use the pre build container with all the elements to build ESP32 targets
1920
* `nanoFramework-TI` to use the pre build container with all the elements to build TI SimpleLink targets
21+
* `nanoFramework-FreeRTOS-NXP` to use the pre build container with all the elements to build TI SimpleLink targets
2022

2123
To use the source dockerfile for the respective platform adjust its `devcontainer.json` file and change the `"dockerFile": "Dockerfile.<platform>"` element for the image you would like to use:
2224

@@ -25,6 +27,7 @@ To use the source dockerfile for the respective platform adjust its `devcontaine
2527
* `Dockerfile.ChibiOS.SRC` to build the container image from the source with all the elements to build ChibiOS based devices
2628
* `Dockerfile.ESP32.SRC` to build the container image from the source with all the elements to build ESP32 based devices
2729
* `Dockerfile.TI.SRC` to build the container image from the source with all the elements to build TI SimpleLink based devices
30+
* `Dockerfile.FreeRTOS.NXP.SRC` to build the container image from the source with all the elements to build NXP based devices
2831

2932

3033
## Building and releasing Docker images in a fork
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright (c) .NET Foundation and Contributors
2+
# See LICENSE file in the project root for full license information.
3+
4+
name: Push devcontainer Docker image [FreeRTOS-NXP]
5+
6+
env:
7+
CONTAINER_REPO: ghcr.io
8+
CONTAINER_NAME: dev-container-freertos-nxp
9+
CONTAINER_SRC_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC
10+
11+
on:
12+
push:
13+
# branches:
14+
# - main
15+
paths:
16+
- '**Dockerfile.FreeRTOS.NXP-SRC'
17+
18+
workflow_dispatch:
19+
20+
jobs:
21+
build:
22+
if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }}
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
28+
steps:
29+
30+
- name: Checkout Repository
31+
uses: actions/checkout@v4
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}
38+
39+
- name: Login to GitHub Container Registry
40+
if: ${{ github.event_name != 'pull_request' }}
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.repository_owner }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Build and Push Docker Image
48+
uses: docker/build-push-action@v5
49+
with:
50+
file: ${{ env.CONTAINER_SRC_FILE }}
51+
push: ${{ github.event_name != 'pull_request' }}
52+
tags: |
53+
${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/devcontainer-smoketest.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ on:
55
paths:
66
- '.devcontainer/**/*'
77
- '.github/workflows/*'
8-
# push:
9-
# paths:
10-
# - '.devcontainer/**/*'
11-
# - '.github/workflows/*'
8+
push:
9+
paths:
10+
- '.devcontainer/**/*'
11+
- '.github/workflows/*'
1212

1313
jobs:
1414
build-target:
@@ -23,7 +23,7 @@ jobs:
2323
{ target: ST_STM32F769I_DISCOVERY, build-type: Debug, container: All },
2424
{ target: M5Core2, build-type: Debug, container: ESP32 },
2525
{ target: M5Core2, build-type: Debug, container: All },
26-
# { target: NXP_MIMXRT1060_EVK, build-type: Debug, container: FreeRTOS }, # No FreeRTOS container yet.
26+
{ target: NXP_MIMXRT1060_EVK, build-type: Debug, container: FreeRTOS-NXP },
2727
{ target: NXP_MIMXRT1060_EVK, build-type: Debug, container: All },
2828
{ target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: TI, radio-freq: 915 },
2929
{ target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: All, radio-freq: 915 },

0 commit comments

Comments
 (0)