diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP new file mode 100644 index 0000000000..7d6b9c33ef --- /dev/null +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP @@ -0,0 +1,3 @@ +FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.01 +LABEL org.website="https://nanoframework.net/" +LABEL description="This is dockerfile image for NXP targets" diff --git a/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC new file mode 100644 index 0000000000..a9ea4281fe --- /dev/null +++ b/.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC @@ -0,0 +1,86 @@ +FROM ubuntu:latest AS downloader +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils \ + && apt-get install -y \ + curl \ + xz-utils \ + unzip \ + wget + +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted + +ARG GCC_VERSION=13.2.rel1 +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 +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \ + && curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \ + && xz -d /tmp/dc-downloads/gcc-arm.tar.xz \ + && tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \ + && rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/ + +ARG CMAKE_VERSION=3.27.6 +ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh +RUN wget $CMAKE_SCRIPT \ + -q -O /tmp/dc-downloads/cmake-install.sh \ + && chmod u+x /tmp/dc-downloads/cmake-install.sh \ + && mkdir -p /tmp/dc-extracted/cmake \ + && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ + && rm /tmp/dc-downloads/cmake-install.sh + +FROM python:3.10 AS devcontainer + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# You can set up non-root user +# ARG USERNAME=vscode +# ARG USER_UID=1000 +# ARG USER_GID=$USER_UID + +# Configure apt and install packages +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ + && apt-get install -y \ + git \ + git-lfs \ + git-svn \ + subversion \ + clang-format \ + curl \ + ninja-build \ + srecord \ + nodejs \ + libffi-dev + +# Create needed directories +RUN mkdir -p /usr/local/bin/gcc + +# Clone libs mbedtls and fatfs etc. +RUN git clone --branch mbedtls-2.28.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ + && git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ + && git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip + +# Clone FreeRTOS +RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \ + && git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git --depth 1 ./sources/CMSIS_5 + +# set gcc location +ARG TMP_GCC_PATH=/usr/local/bin/gcc +ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin + +# Copy from our other container +COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH +COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake + +ENV PATH=/usr/bin/cmake/bin:${PATH} + +# Creating static link python for pyhton3 +RUN ln -fs /usr/bin/python3 /usr/bin/python \ + && pip3 install pyserial + +# Clean up downloaded files +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog diff --git a/.devcontainer/FreeRTOS-NXP/devcontainer.json b/.devcontainer/FreeRTOS-NXP/devcontainer.json new file mode 100644 index 0000000000..7be0828ab6 --- /dev/null +++ b/.devcontainer/FreeRTOS-NXP/devcontainer.json @@ -0,0 +1,48 @@ +{ + "name": "nanoFramework-FreeRTOS-NXP", + // If you prefer, you can use the source files and adjust them where they are located, + // To do this, change the "dockerFile" to use 'Dockerfile.NXP.SRC'. + // This will allow you to customize and build the container source and add anything you may need on top. + "dockerFile": "Dockerfile.FreeRTOS-NXP", + "context": ".", + "mounts": [ + // Bind the Unix socket the Docker daemon listens on by default + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", + // Keep command history + "source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume", + // OPTIONAL: Mount .azure folder for seamless az cli auth + // "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind" + ], + // Set the *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "cmake.preferredGenerators": [ + "Ninja" + ], + "cmake.generator": "Ninja", + "cmake.autoRestartBuild" : true, + "cmake.configureSettings": { + "CMAKE_MAKE_PROGRAM":"/usr/bin/ninja" + }, + "cmake.configureOnOpen": false + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vsliveshare.vsliveshare-pack", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "ms-vscode.cmake-tools", + "xaver.clang-format" + ] + } + } + // You can pull all the repos with the latest changes, this is only valid if you are using the ./sources/Dockerfile.All containers + // "postAttachCommand": "/usr/local/git-pull-repos.sh" + // 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": "terraform --version", + // Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root. + // ,"remoteUser": "vscode" +} diff --git a/.devcontainer/README.md b/.devcontainer/README.md index d380bc9bec..ed849679ac 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -9,6 +9,7 @@ The available pre build images are: * ghcr.io/nanoframework/dev-container-ti: contains all elements to build a firmware image for any of the TI SimpleLink targets * ghcr.io/nanoframework/dev-container-esp32: contains all elements to build a firmware image for any of the ESP32 targets * ghcr.io/nanoframework/dev-container-azure-rtos: contains all elements to build a firmware image for any of the Azure RTOS targets +* ghcr.io/nanoframework/dev-container-freertos-nxp: contains all elements to build a firmware image for any of the NXP targets You can choose the dev container needed when opening a remote container in VSCode. The options are: @@ -17,6 +18,7 @@ You can choose the dev container needed when opening a remote container in VSCod * `nanoFramework-ChibiOS` to use the pre build container with all the elements to build ChibiOS targets * `nanoFramework-ESP32` to use the pre build container with all the elements to build ESP32 targets * `nanoFramework-TI` to use the pre build container with all the elements to build TI SimpleLink targets +* `nanoFramework-FreeRTOS-NXP` to use the pre build container with all the elements to build TI SimpleLink targets To use the source dockerfile for the respective platform adjust its `devcontainer.json` file and change the `"dockerFile": "Dockerfile."` element for the image you would like to use: @@ -25,6 +27,7 @@ To use the source dockerfile for the respective platform adjust its `devcontaine * `Dockerfile.ChibiOS.SRC` to build the container image from the source with all the elements to build ChibiOS based devices * `Dockerfile.ESP32.SRC` to build the container image from the source with all the elements to build ESP32 based devices * `Dockerfile.TI.SRC` to build the container image from the source with all the elements to build TI SimpleLink based devices +* `Dockerfile.FreeRTOS.NXP.SRC` to build the container image from the source with all the elements to build NXP based devices ## Building and releasing Docker images in a fork diff --git a/.github/workflows/devcontainer-freertos-nxp.yaml b/.github/workflows/devcontainer-freertos-nxp.yaml new file mode 100644 index 0000000000..20baaf3216 --- /dev/null +++ b/.github/workflows/devcontainer-freertos-nxp.yaml @@ -0,0 +1,59 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +name: Push Docker image [FreeRTOS-NXP] + +env: + CONTAINER_REPO: ghcr.io + CONTAINER_NAME: dev-container-freertos-nxp + CONTAINER_SOURCE_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC + CONTAINER_VERSION_FILE: .devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP + +on: + push: + branches: + - main + paths: + - '**Dockerfile.FreeRTOS-NXP' # We only care if the version has changed! + + workflow_dispatch: + +jobs: + build: + if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Get container version + shell: pwsh + run: | + $dockerfileContent = Get-Content("${{ env.CONTAINER_VERSION_FILE }}") + $dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)' + $containerVersion = $Matches[0].ToString() + echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + registry: ${{ env.CONTAINER_REPO }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + file: ${{ env.CONTAINER_SOURCE_FILE }} + push: ${{ github.event_name != 'pull_request' }} + tags: | + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }} + ${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest diff --git a/.github/workflows/devcontainer-smoketest.yaml b/.github/workflows/devcontainer-smoketest.yaml index 1c7863d17f..aaa8a03eb8 100644 --- a/.github/workflows/devcontainer-smoketest.yaml +++ b/.github/workflows/devcontainer-smoketest.yaml @@ -23,7 +23,7 @@ jobs: { target: ST_STM32F769I_DISCOVERY, build-type: Debug, container: All }, { target: M5Core2, build-type: Debug, container: ESP32 }, { target: M5Core2, build-type: Debug, container: All }, - # { target: NXP_MIMXRT1060_EVK, build-type: Debug, container: FreeRTOS }, # No FreeRTOS container yet. + { target: NXP_MIMXRT1060_EVK, build-type: Debug, container: FreeRTOS-NXP }, { target: NXP_MIMXRT1060_EVK, build-type: Debug, container: All }, { target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: TI, radio-freq: 915 }, { target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: All, radio-freq: 915 },