Skip to content

Commit

Permalink
Add Mbed os docker image (#6352)
Browse files Browse the repository at this point in the history
* Update base docker file to include CMake 3.19.3

* Add docker image to build with Mbed OS.

* Update chip-build-vscode image to import Mbed OS requirements.

Three things are imported in the docker image:
- GCC
- Mbed OS
- OpenOCD
  • Loading branch information
pan- authored Apr 28, 2021
1 parent c0fbc33 commit 6b0a6de
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 2 deletions.
68 changes: 68 additions & 0 deletions integrations/docker/images/chip-build-mbed-os/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
ARG VERSION=latest
FROM connectedhomeip/chip-build:${VERSION}

# ------------------------------------------------------------------------------
# Install system tools via apt
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy \
python3-setuptools \
python3-usb \
software-properties-common \
build-essential \
astyle \
mercurial \
&& rm -rf /var/lib/apt/lists \
&& : # last line

# ------------------------------------------------------------------------------
# Install Mbed-OS sources
RUN set -x \
&& (mkdir -p /opt/mbed-os \
&& cd /opt/mbed-os \
&& wget --progress=dot:giga https://github.com/ARMmbed/mbed-os/archive/mbed-os-6.7.0.tar.gz \
&& tar --strip-components=1 -xzf mbed-os-6.7.0.tar.gz \
&& rm mbed-os-6.7.0.tar.gz) \
&& : # last line

# ------------------------------------------------------------------------------
# Install Python modules
RUN set -x \
&& pip3 install --no-cache-dir -U mbed-cli mbed-tools \
&& pip3 install --no-cache-dir -r /opt/mbed-os/requirements.txt \
&& : # last line

# ------------------------------------------------------------------------------
# Install ARM Toolchain (gcc-arm-none-eabi-9-2019-q4)
RUN set -x \
&& (mkdir -p /opt/mbed-os-toolchain \
&& cd /opt/mbed-os-toolchain \
&& wget --progress=dot:giga https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 \
&& tar -xjf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 \
&& rm gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 \
&& : ) # last line

# ------------------------------------------------------------------------------
# Configure mbed build system
RUN set -x \
&& mbed config -G GCC_ARM_PATH /opt/mbed-os-toolchain/gcc-arm-none-eabi-9-2019-q4-major/bin/ \
&& mbed toolchain -G -s GCC_ARM \
&& : # last line

# ------------------------------------------------------------------------------
# Install openocd
RUN set -x \
&& (mkdir -p /opt/openocd \
&& cd /opt/openocd \
&& wget --progress=dot:giga https://github.com/cypresssemiconductorco/openocd/releases/download/release-v4.2.0/openocd-4.2.0.1430-linux.tar.gz \
&& tar --strip-components=1 -xzf openocd-4.2.0.1430-linux.tar.gz \
&& rm openocd-4.2.0.1430-linux.tar.gz) \
&& : # last line

# ------------------------------------------------------------------------------
# Configure environment variables
ENV MBED_GCC_ARM_PATH=/opt/mbed-os-toolchain/gcc-arm-none-eabi-9-2019-q4-major/bin/
ENV MBED_OS_PATH=/opt/mbed-os/
ENV OPENOCD_PATH=/opt/openocd/

ENV PATH="${PATH}:${MBED_GCC_ARM_PATH}:${OPENOCD_PATH}/bin"
1 change: 1 addition & 0 deletions integrations/docker/images/chip-build-mbed-os/build.sh
1 change: 1 addition & 0 deletions integrations/docker/images/chip-build-mbed-os/run.sh
1 change: 1 addition & 0 deletions integrations/docker/images/chip-build-mbed-os/version
7 changes: 7 additions & 0 deletions integrations/docker/images/chip-build-vscode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM connectedhomeip/chip-build-nrf-platform:${VERSION} AS nrf
FROM connectedhomeip/chip-build-efr32:${VERSION} AS efr32
FROM connectedhomeip/chip-build-android:${VERSION} AS android
FROM connectedhomeip/chip-build-esp32-qemu:${VERSION} as esp32
FROM connectedhomeip/chip-build-mbed-os:${VERSION} AS mbedos
FROM connectedhomeip/chip-build:${VERSION}
COPY --from=esp32 /opt/espressif/esp-idf /opt/espressif/esp-idf
COPY --from=esp32 /opt/espressif/tools /opt/espressif/tools
Expand All @@ -12,6 +13,9 @@ COPY --from=nrf /opt/NordicSemiconductor/nrfconnect /opt/NordicSemiconductor/nrf
COPY --from=nrf /opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major /opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major
COPY --from=android /opt/android/sdk /opt/android/sdk
COPY --from=android /opt/android/android-ndk-r21b /opt/android/android-ndk-r21b
COPY --from=mbedos /opt/mbed-os /opt/mbed-os
COPY --from=mbedos /opt/mbed-os-toolchain/ /opt/mbed-os-toolchain/
COPY --from=mbedos /opt/openocd/ /opt/openocd/
ENV IDF_PATH=/opt/espressif/esp-idf/
ENV IDF_TOOLS_PATH=/opt/espressif/tools
ENV QEMU_ESP32_DIR=/opt/espressif/qemu
Expand All @@ -24,4 +28,7 @@ ENV ARM_GCC_INSTALL_ROOT=/opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major/bin
ENV EFR32_BOARD=BRD4161A
ENV ANDROID_HOME=/opt/android/sdk
ENV ANDROID_NDK_HOME=/opt/android/android-ndk-r21b
ENV MBED_GCC_ARM_PATH=/opt/mbed-os-toolchain/gcc-arm-none-eabi-9-2019-q4-major/bin/
ENV MBED_OS_PATH=/opt/mbed-os/
ENV OPENOCD_PATH=/opt/openocd/
ENV PW_ENVIRONMENT_ROOT=/home/vscode/pigweed/env
10 changes: 9 additions & 1 deletion integrations/docker/images/chip-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ RUN set -x \
clang \
clang-format \
clang-tidy \
cmake \
curl \
flex \
g++ \
Expand Down Expand Up @@ -65,6 +64,15 @@ RUN set -x \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

# Cmake (Mbed OS requires >=3.19.0-rc3 version which is not available in Ubuntu 20.04 repository)
RUN set -x \
&& (cd /tmp \
&& wget --progress=dot:giga https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh \
&& sh cmake-3.19.3-Linux-x86_64.sh --exclude-subdir --prefix=/usr/local \
&& rm -rf cmake-3.19.3-Linux-x86_64.sh) \
&& exec bash \
&& : # last line

# Python 2 and PIP
RUN set -x \
&& apt-get update \
Expand Down
2 changes: 1 addition & 1 deletion integrations/docker/images/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.23
0.4.24

0 comments on commit 6b0a6de

Please sign in to comment.