Skip to content

Commit 22fa63f

Browse files
Add FreeRTOS NXP container (#2855)
1 parent 641cd9e commit 22fa63f

File tree

6 files changed

+200
-1
lines changed

6 files changed

+200
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.01
2+
LABEL org.website="https://nanoframework.net/"
3+
LABEL description="This is dockerfile image for NXP targets"
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: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright (c) .NET Foundation and Contributors
2+
# See LICENSE file in the project root for full license information.
3+
4+
name: Push Docker image [FreeRTOS-NXP]
5+
6+
env:
7+
CONTAINER_REPO: ghcr.io
8+
CONTAINER_NAME: dev-container-freertos-nxp
9+
CONTAINER_SOURCE_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC
10+
CONTAINER_VERSION_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP
11+
12+
on:
13+
push:
14+
branches:
15+
- main
16+
paths:
17+
- '**Dockerfile.FreeRTOS-NXP' # We only care if the version has changed!
18+
19+
workflow_dispatch:
20+
21+
jobs:
22+
build:
23+
if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }}
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
packages: write
28+
29+
steps:
30+
- name: Checkout Repository
31+
uses: actions/checkout@v4
32+
33+
- name: Get container version
34+
shell: pwsh
35+
run: |
36+
$dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}")
37+
$dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)'
38+
$containerVersion = $Matches[0].ToString()
39+
echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
40+
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
44+
- name: Login to GitHub Container Registry
45+
if: ${{ github.event_name != 'pull_request' }}
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ${{ env.CONTAINER_REPO }}
49+
username: ${{ github.repository_owner }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Build and Push Docker Image
53+
uses: docker/build-push-action@v5
54+
with:
55+
file: ${{ env.CONTAINER_SOURCE_FILE }}
56+
push: ${{ github.event_name != 'pull_request' }}
57+
tags: |
58+
${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }}
59+
${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest

.github/workflows/devcontainer-smoketest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)