From 705d5bf385526263a8887462d7f574345e93e3ef Mon Sep 17 00:00:00 2001 From: Jiu-xiao <2592509183@qq.com> Date: Mon, 5 Oct 2026 20:26:21 +0100 Subject: [PATCH] Add HPM SDK to the hpm image and MSPM0 SDK with SysConfig to a dedicated mspm0 image --- .github/workflows/docker-publish.yml | 2 +- README.md | 4 +- hpm/Dockerfile | 13 ++++- mspm0/Dockerfile | 85 ++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 mspm0/Dockerfile diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index d0106da..d528134 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -29,7 +29,7 @@ jobs: - image_name: docker-image-stm32 context: ./stm32 - image_name: docker-image-mspm0 - context: ./stm32 + context: ./mspm0 - image_name: docker-image-esp32 context: ./esp32 - image_name: docker-image-ch32-riscv diff --git a/README.md b/README.md index 3a37c1b..5f25a1c 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ Docker image for XRobot build. - `linux`: generic Ubuntu 24.04 development base for XRobot Linux-side builds - `stm32`: STM32 build image with `arm-none-eabi` GNU Arm toolchain and `starm-clang` -- `mspm0`: alias of the `stm32` image for GNU Arm `arm-none-eabi` based MSPM0 builds +- `mspm0`: MSPM0 build image with the same GNU Arm `arm-none-eabi` toolchain and `starm-clang` as `stm32`, plus the MSPM0 SDK `mspm0_sdk_2_11_00_07` (`MSPM0_SDK_INSTALL_DIR=/opt/ti/mspm0_sdk_2_11_00_07`) and SysConfig 1.28.1 (`SYSCONFIG_TOOL=/opt/ti/sysconfig_1.28.1/sysconfig_cli.sh`) - `esp32`: ESP-IDF based image for ESP32 builds - `ch32-riscv`: CH32 RISC-V image with the WCH `riscv32-wch-elf` toolchain -- `hpm`: HPM image with the published Linux x64 mainline GNU `riscv32-unknown-elf` toolchain from `https://github.com/Jiu-xiao/hpm-linux-gcc-release/releases/tag/v0.1.0` +- `hpm`: HPM image with the published Linux x64 mainline GNU `riscv32-unknown-elf` toolchain from `https://github.com/Jiu-xiao/hpm-linux-gcc-release/releases/tag/v0.1.0` and the HPM SDK `v1.13.0` (`HPM_SDK_BASE=/opt/hpm_sdk/v1.13.0`, `GNURISCV_TOOLCHAIN_PATH` points to the toolchain root) - `webots`: Webots and OpenCV based simulation image ## Publishing diff --git a/hpm/Dockerfile b/hpm/Dockerfile index 01f277a..08a53fd 100644 --- a/hpm/Dockerfile +++ b/hpm/Dockerfile @@ -5,9 +5,10 @@ ARG HPM_TOOLCHAIN_VERSION="v0.1.0" ARG HPM_TOOLCHAIN_ARCHIVE_BASENAME="hpm-riscv32-unknown-elf-linux-x64" ARG HPM_TOOLCHAIN_URL="" ARG HPM_TOOLCHAIN_SHA256="6a14d30ac29da5a23185db249d5f7b1f9e20bb2deb8d26302ba2baff0442f108" +ARG HPM_SDK_VERSION="v1.13.0" LABEL maintainer="2592509183@qq.com" \ - description="Docker Image for XRobot HPM builds with the published mainline riscv32-unknown-elf GNU toolchain." \ + description="Docker Image for XRobot HPM builds with the published mainline riscv32-unknown-elf GNU toolchain and the HPM SDK." \ org.opencontainers.image.version="${HPM_TOOLCHAIN_VERSION}" RUN apt-get update && \ @@ -48,6 +49,7 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python && \ curl -sS https://bootstrap.pypa.io/get-pip.py | python3 ENV XR_HPM_TOOLCHAIN_ROOT=/opt/hpm-riscv32-unknown-elf +ENV GNURISCV_TOOLCHAIN_PATH=${XR_HPM_TOOLCHAIN_ROOT} ENV PATH=${XR_HPM_TOOLCHAIN_ROOT}/bin:${PATH} RUN set -eux; \ @@ -67,3 +69,12 @@ RUN set -eux; \ riscv32-unknown-elf-gcc --version | head -n 1; \ riscv32-unknown-elf-g++ --version | head -n 1; \ riscv32-unknown-elf-gdb --version | head -n 1 + +# HPM SDK: the BSPs find it through find_package(hpm-sdk HINTS $ENV{HPM_SDK_BASE}). +ENV HPM_SDK_BASE=/opt/hpm_sdk/${HPM_SDK_VERSION} + +RUN set -eux; \ + mkdir -p /opt/hpm_sdk; \ + git clone --depth 1 --branch "${HPM_SDK_VERSION}" https://github.com/hpmicro/hpm_sdk "${HPM_SDK_BASE}"; \ + rm -rf "${HPM_SDK_BASE}/.git"; \ + test -f "${HPM_SDK_BASE}/cmake/hpm-sdk-config.cmake" diff --git a/mspm0/Dockerfile b/mspm0/Dockerfile new file mode 100644 index 0000000..b305fbd --- /dev/null +++ b/mspm0/Dockerfile @@ -0,0 +1,85 @@ +FROM ubuntu:24.04 + +ARG DEBIAN_FRONTEND=noninteractive +# Pin the last STM32Cube IDE core package that still ships the Linux cube +# downloader. Newer 1.2.x packages currently only contain win32/cube.exe, +# which would otherwise build a silently broken image without starm-clang. +ARG STM32CUBE_IDE_CORE_VERSION=1.1.0 +ARG STM32CUBE_IDE_CORE_VSIX_URL="https://stmicroelectronics.gallerycdn.vsassets.io/extensions/stmicroelectronics/stm32cube-ide-core/1.1.0/1765810657223/Microsoft.VisualStudio.Services.VSIXPackage" + +ARG MSPM0_SDK_TAG="mspm0_sdk_2_11_00_07" +ARG SYSCONFIG_VERSION="1.28.1" +ARG SYSCONFIG_BUILD="4785" + +LABEL maintainer="2592509183@qq.com" +LABEL description="Docker Image for XRobot MSPM0 builds: the stm32 image content (GNU Arm toolchain, starm-clang) plus the MSPM0 SDK and SysConfig." + +RUN apt update + +RUN apt upgrade -y --no-install-recommends && apt install -y --no-install-recommends xz-utils git curl sudo wget zip unzip make && apt install -y net-tools usbutils util-linux nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk && apt clean + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + xz-utils git curl sudo wget zip unzip make \ + net-tools usbutils util-linux nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk libgpiod-dev && \ + apt-get clean + +RUN curl -L -o stm32cube-ide-core.pkg \ + -H "Accept: application/octet-stream" \ + -A "Mozilla/5.0" \ + "${STM32CUBE_IDE_CORE_VSIX_URL}" && \ + if file stm32cube-ide-core.pkg | grep -qi "gzip compressed"; then \ + mv stm32cube-ide-core.pkg stm32cube-ide-core.vsix.gz && \ + gunzip stm32cube-ide-core.vsix.gz; \ + else \ + mv stm32cube-ide-core.pkg stm32cube-ide-core.vsix; \ + fi && \ + unzip -q stm32cube-ide-core.vsix && \ + test -x extension/resources/binaries/linux/x86_64/cube || \ + (echo "Linux STM32Cube downloader missing in stm32cube-ide-core ${STM32CUBE_IDE_CORE_VERSION}" >&2 && exit 1) && \ + extension/resources/binaries/linux/x86_64/cube bundle download --yes st-arm-clang && \ + BUNDLE_FILE=$(find . -maxdepth 1 -type f -name 'st-arm-clang*-linux.bundle' | head -n1) && \ + test -n "$BUNDLE_FILE" && \ + mkdir -p /opt/st-arm-clang && \ + unzip "$BUNDLE_FILE" -d /opt/st-arm-clang && \ + rm -rf extension *.bundle stm32cube-ide-core.pkg stm32cube-ide-core.vsix stm32cube-ide-core.vsix.gz + +RUN test -x /opt/st-arm-clang/bin/starm-clang && \ + test -x /opt/st-arm-clang/bin/starm-clang++ && \ + for exe in /opt/st-arm-clang/bin/*; do \ + ln -sf "$exe" /usr/bin/$(basename "$exe"); \ + done && \ + command -v starm-clang && \ + command -v starm-clang++ + + +RUN sudo mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk + +RUN wget https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz && tar -xvf arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz && rm arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz && mv arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi /opt && sudo ln -s /opt/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi/bin/* /usr/bin + +RUN ln -s /usr/bin/python3 /usr/bin/python && curl -sS https://bootstrap.pypa.io/get-pip.py | python3 + +# MSPM0 SDK: only source/ and .metadata/ are needed by the BSPs (sparse checkout, no blobs elsewhere). +ENV MSPM0_SDK_INSTALL_DIR=/opt/ti/mspm0_sdk_2_11_00_07 + +RUN set -eux; \ + mkdir -p /opt/ti; \ + git clone --depth 1 --filter=blob:none --sparse --branch "${MSPM0_SDK_TAG}" \ + https://github.com/TexasInstruments/mspm0-sdk "${MSPM0_SDK_INSTALL_DIR}"; \ + git -C "${MSPM0_SDK_INSTALL_DIR}" sparse-checkout set source .metadata; \ + rm -rf "${MSPM0_SDK_INSTALL_DIR}/.git"; \ + test -f "${MSPM0_SDK_INSTALL_DIR}/.metadata/product.json"; \ + test -d "${MSPM0_SDK_INSTALL_DIR}/source/ti/driverlib" + +# SysConfig (Node based CLI) for the .syscfg files of the MSPM0 BSPs. +ENV SYSCONFIG_TOOL=/opt/ti/sysconfig_1.28.1/sysconfig_cli.sh + +RUN set -eux; \ + installer="/tmp/sysconfig-${SYSCONFIG_VERSION}_${SYSCONFIG_BUILD}-setup.run"; \ + curl -L --fail --retry 3 -o "${installer}" \ + "https://downloads.ti.com/ccs/esd/sysconfig/sysconfig-${SYSCONFIG_VERSION}_${SYSCONFIG_BUILD}-setup.run"; \ + chmod +x "${installer}"; \ + "${installer}" --mode unattended --prefix "/opt/ti/sysconfig_${SYSCONFIG_VERSION}"; \ + rm -f "${installer}"; \ + test -x "${SYSCONFIG_TOOL}"; \ + "${SYSCONFIG_TOOL}" --version