From af7f3004113c5fbdc88bf352b10a63ae8d8dcfcf Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 07:50:24 +0100 Subject: [PATCH 1/8] boards/sim/: Change SIM boards to use Clang. This commit will change toolchain in SIM boards that uses Libcxx to use clang because GCC < 15 have lack of features needed for latest LLVM libcxx and libcxxabi. Signed-off-by: Bartosz --- boards/sim/sim/sim/configs/citest/defconfig | 1 + boards/sim/sim/sim/configs/libcxxtest/defconfig | 1 + boards/sim/sim/sim/configs/matter/defconfig | 1 + boards/sim/sim/sim/configs/tflm/defconfig | 1 + boards/sim/sim/sim/scripts/Make.defs | 10 ++++++++-- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/boards/sim/sim/sim/configs/citest/defconfig b/boards/sim/sim/sim/configs/citest/defconfig index f6a89d075308d..2c4ecfdf347d0 100644 --- a/boards/sim/sim/sim/configs/citest/defconfig +++ b/boards/sim/sim/sim/configs/citest/defconfig @@ -15,6 +15,7 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y +CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARDCTL_ROMDISK=y diff --git a/boards/sim/sim/sim/configs/libcxxtest/defconfig b/boards/sim/sim/sim/configs/libcxxtest/defconfig index 86df52f1db1f1..1c07c49eb797b 100644 --- a/boards/sim/sim/sim/configs/libcxxtest/defconfig +++ b/boards/sim/sim/sim/configs/libcxxtest/defconfig @@ -11,6 +11,7 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y +CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=0 diff --git a/boards/sim/sim/sim/configs/matter/defconfig b/boards/sim/sim/sim/configs/matter/defconfig index 34eeb8afec0ec..f5b5d6a1b5909 100644 --- a/boards/sim/sim/sim/configs/matter/defconfig +++ b/boards/sim/sim/sim/configs/matter/defconfig @@ -12,6 +12,7 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y +CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=0 diff --git a/boards/sim/sim/sim/configs/tflm/defconfig b/boards/sim/sim/sim/configs/tflm/defconfig index e688f5d9a2866..e74edb8003b9d 100644 --- a/boards/sim/sim/sim/configs/tflm/defconfig +++ b/boards/sim/sim/sim/configs/tflm/defconfig @@ -11,6 +11,7 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y +CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=0 diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index 4106e7412479f..55df92cdb5d76 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -152,8 +152,8 @@ else ARCHCFLAGS += -fno-pic ARCHCXXFLAGS += -fno-pic ifneq ($(CONFIG_HOST_MACOS),y) - ARCHCFLAGS += -mcmodel=medium - ARCHCXXFLAGS += -mcmodel=medium + ARCHCFLAGS += -mcmodel=large + ARCHCXXFLAGS += -mcmodel=large endif endif @@ -186,9 +186,15 @@ endif ARCHPICFLAGS = -fpic +ifeq ($(CONFIG_SIM_TOOLCHAIN_CLANG),y) +CC = $(CROSSDEV)clang +CXX = $(CROSSDEV)clang++ +CPP = $(CROSSDEV)clang -E -P -x c +else CC = $(CROSSDEV)cc CXX = $(CROSSDEV)c++ CPP = $(CROSSDEV)cc -E -P -x c +endif LD = $(CROSSDEV)ld ifeq ($(CONFIG_HOST_MACOS),y) STRIP = $(CROSSDEV)strip From b6cf48a8e0b0cca368b0feb86d7976b2728a4102 Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 10:38:02 +0100 Subject: [PATCH 2/8] /boards/sim/: Added clang toolchain only for CI build This commit will add clang toolchain only for CI builds. Signed-off-by: Bartosz --- boards/sim/sim/sim/configs/citest/defconfig | 1 - .../sim/sim/sim/configs/libcxxtest/defconfig | 1 - boards/sim/sim/sim/configs/matter/defconfig | 1 - boards/sim/sim/sim/configs/tflm/defconfig | 1 - boards/sim/sim/sim/scripts/Make.defs | 6 - tools/ci/platforms/darwin.sh | 22 +- tools/ci/platforms/linux.sh | 20 +- tools/ci/platforms/msys2.sh | 18 +- tools/ci/platforms/ubuntu.sh | 20 +- tools/ci/platforms/windows.ps1 | 704 +++++++++--------- tools/ci/testlist/sim-01.dat | 2 +- tools/ci/testlist/sim-02.dat | 4 +- tools/ci/testlist/sim-03.dat | 2 +- 13 files changed, 396 insertions(+), 406 deletions(-) diff --git a/boards/sim/sim/sim/configs/citest/defconfig b/boards/sim/sim/sim/configs/citest/defconfig index 2c4ecfdf347d0..f6a89d075308d 100644 --- a/boards/sim/sim/sim/configs/citest/defconfig +++ b/boards/sim/sim/sim/configs/citest/defconfig @@ -15,7 +15,6 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y -CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARDCTL_ROMDISK=y diff --git a/boards/sim/sim/sim/configs/libcxxtest/defconfig b/boards/sim/sim/sim/configs/libcxxtest/defconfig index 1c07c49eb797b..86df52f1db1f1 100644 --- a/boards/sim/sim/sim/configs/libcxxtest/defconfig +++ b/boards/sim/sim/sim/configs/libcxxtest/defconfig @@ -11,7 +11,6 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y -CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=0 diff --git a/boards/sim/sim/sim/configs/matter/defconfig b/boards/sim/sim/sim/configs/matter/defconfig index f5b5d6a1b5909..34eeb8afec0ec 100644 --- a/boards/sim/sim/sim/configs/matter/defconfig +++ b/boards/sim/sim/sim/configs/matter/defconfig @@ -12,7 +12,6 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y -CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=0 diff --git a/boards/sim/sim/sim/configs/tflm/defconfig b/boards/sim/sim/sim/configs/tflm/defconfig index e74edb8003b9d..e688f5d9a2866 100644 --- a/boards/sim/sim/sim/configs/tflm/defconfig +++ b/boards/sim/sim/sim/configs/tflm/defconfig @@ -11,7 +11,6 @@ CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" CONFIG_ARCH_SIM=y -CONFIG_SIM_TOOLCHAIN_CLANG=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=0 diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index 55df92cdb5d76..24d39370248b1 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -186,15 +186,9 @@ endif ARCHPICFLAGS = -fpic -ifeq ($(CONFIG_SIM_TOOLCHAIN_CLANG),y) -CC = $(CROSSDEV)clang -CXX = $(CROSSDEV)clang++ -CPP = $(CROSSDEV)clang -E -P -x c -else CC = $(CROSSDEV)cc CXX = $(CROSSDEV)c++ CPP = $(CROSSDEV)cc -E -P -x c -endif LD = $(CROSSDEV)ld ifeq ($(CONFIG_HOST_MACOS),y) STRIP = $(CROSSDEV)strip diff --git a/tools/ci/platforms/darwin.sh b/tools/ci/platforms/darwin.sh index 250eb2fb12627..602e6efa032ee 100755 --- a/tools/ci/platforms/darwin.sh +++ b/tools/ci/platforms/darwin.sh @@ -42,10 +42,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVMEmbeddedToolchainForArm-17.0.1-Darwin + basefile=LLVM-ET-Arm-19.1.5-Darwin-universal cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.dmg + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.dmg sudo hdiutil attach ${basefile}.dmg sudo cp -R /Volumes/${basefile}/${basefile} "${NUTTXTOOLS}"/${basefile} sudo mv ${basefile} clang-arm-none-eabi @@ -60,9 +60,9 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi + basefile=arm-gnu-toolchain-15.2.rel1-darwin-x86_64-arm-none-eabi cd "${NUTTXTOOLS}" - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-arm-none-eabi @@ -77,10 +77,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-aarch64-none-elf + basefile=arm-gnu-toolchain-15.2.Rel1-darwin-x86_64-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-aarch64-none-elf @@ -256,11 +256,11 @@ python_tools() { echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin fi - + if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi - + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" @@ -295,12 +295,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-14.2.0-3-darwin-x64 + basefile=xpack-riscv-none-elf-gcc-15.2.0-1-darwin-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.tar.gz + curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.tar.gz tar zxf ${basefile}.tar.gz - mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc rm ${basefile}.tar.gz fi diff --git a/tools/ci/platforms/linux.sh b/tools/ci/platforms/linux.sh index a56ae81542e4e..5e1f64984ba46 100755 --- a/tools/ci/platforms/linux.sh +++ b/tools/ci/platforms/linux.sh @@ -35,10 +35,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64 + basefile=LLVM-ET-Arm-19.1.5-Linux-x86_64 cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.tar.xz + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} clang-arm-none-eabi @@ -53,10 +53,10 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi + basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-arm-none-eabi cd "${NUTTXTOOLS}" # Download the latest ARM GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-arm-none-eabi @@ -71,10 +71,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf + basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-aarch64-none-elf @@ -88,7 +88,7 @@ bloaty() { add_path "${NUTTXTOOLS}"/bloaty/bin if [ ! -f "${NUTTXTOOLS}/bloaty/bin/bloaty" ]; then - git clone --depth 1 --branch v1.1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src + git clone --depth 1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src mkdir -p "${NUTTXTOOLS}"/bloaty cd "${NUTTXTOOLS}"/bloaty-src cmake -B build -DCMAKE_INSTALL_PREFIX="${NUTTXTOOLS}"/bloaty @@ -163,12 +163,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-14.2.0-3-linux-x64 + basefile=xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - wget --quiet https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.tar.gz + wget --quiet https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.tar.gz tar zxf ${basefile}.tar.gz - mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc rm ${basefile}.tar.gz fi command riscv-none-elf-gcc --version diff --git a/tools/ci/platforms/msys2.sh b/tools/ci/platforms/msys2.sh index ce8463e84fe35..e4888d773ac17 100755 --- a/tools/ci/platforms/msys2.sh +++ b/tools/ci/platforms/msys2.sh @@ -35,10 +35,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVMEmbeddedToolchainForArm-17.0.1-Windows-x86_64 + basefile=LLVM-ET-Arm-19.1.5-Windows-x86_64 cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.zip + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.zip unzip -qo ${basefile}.zip mv ${basefile} clang-arm-none-eabi rm ${basefile}.zip @@ -52,9 +52,9 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi + basefile=arm-gnu-toolchain-15.2.Rel1-mingw-w64-i686-arm-none-eabi cd "${NUTTXTOOLS}" - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.zip + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.zip unzip -qo ${basefile}.zip mv ${basefile} gcc-arm-none-eabi rm ${basefile}.zip @@ -68,10 +68,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-aarch64-none-elf + basefile=arm-gnu-toolchain-15.2.Rel1-mingw-w64-i686-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.zip + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.zip unzip -qo ${basefile}.zip mv ${basefile} gcc-aarch64-none-elf rm ${basefile}.zip @@ -158,12 +158,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-14.2.0-3-win32-x64 + basefile=xpack-riscv-none-elf-gcc-15.2.0-1-win32-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.zip + curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.zip unzip -qo ${basefile}.zip - mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc rm ${basefile}.zip fi command riscv-none-elf-gcc --version diff --git a/tools/ci/platforms/ubuntu.sh b/tools/ci/platforms/ubuntu.sh index 25f60825fb6fa..941b741d90846 100755 --- a/tools/ci/platforms/ubuntu.sh +++ b/tools/ci/platforms/ubuntu.sh @@ -35,10 +35,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64 + basefile=LLVM-ET-Arm-19.1.5-Linux-x86_64 cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.tar.xz + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} clang-arm-none-eabi @@ -53,10 +53,10 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi + basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-arm-none-eabi cd "${NUTTXTOOLS}" # Download the latest ARM GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-arm-none-eabi @@ -71,10 +71,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf + basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-aarch64-none-elf @@ -104,7 +104,7 @@ bloaty() { add_path "${NUTTXTOOLS}"/bloaty/bin if [ ! -f "${NUTTXTOOLS}/bloaty/bin/bloaty" ]; then - git clone --depth 1 --branch v1.1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src + git clone --depth 1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src mkdir -p "${NUTTXTOOLS}"/bloaty cd "${NUTTXTOOLS}"/bloaty-src cmake -B build -DCMAKE_INSTALL_PREFIX="${NUTTXTOOLS}"/bloaty @@ -216,12 +216,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-14.2.0-3-linux-x64 + basefile=xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.tar.gz + curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.tar.gz tar zxf ${basefile}.tar.gz - mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc rm ${basefile}.tar.gz fi diff --git a/tools/ci/platforms/windows.ps1 b/tools/ci/platforms/windows.ps1 index 4b2a2620d3fe9..abc6997ceaa98 100644 --- a/tools/ci/platforms/windows.ps1 +++ b/tools/ci/platforms/windows.ps1 @@ -1,352 +1,352 @@ -#!/usr/bin/env pswd -############################################################################ -# tools/ci/platforms/windows.ps1 -# PowerShell script for CI on Windows Native -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -############################################################################ - -# Windows native - -# Set-PSDebug -Trace 0 - -function add_path() { - param ( - [string]$Path - ) - if (!$Path) { - Write-Host "Error: add_path path file not found" -ForegroundColor Red - return - } - $envPaths = $env:Path -split ';' - if ($envPaths -notcontains $Path) { - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "add_path $Path" - $env:PATH = "$Path;" + $env:PATH - } -} - -function add_envpath { - param( - [string] $envfile - ) - $head = @" -#!/usr/bin/env pswd -############################################################################ -# env.ps1 -# PowerShell script for CI on Windows Native -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -############################################################################ - -function add_path() { - param ( - [string]`$Path - ) - if (!`$Path) { - Write-Host "Error: add_path path file not found" -ForegroundColor Red - return - } - `$envPaths = `$env:Path -split ';' - if (`$envPaths -notcontains `$Path) { - `$env:PATH = "`$Path;" + `$env:PATH - } -} -"@ - - Add-Content -Path "$envfile" -Value "$head" -} - -function arm_clang_toolchain { - Write-Host "Check ARM clang toolchain ..." -ForegroundColor Green - try { - if (run_command("clang") -ne 0) { - add_path "$NUTTXTOOLS\clang-arm-none-eabi\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\clang-arm-none-eabi\bin\clang.exe")) { - # Download the file - Write-Host "Download: ARM clang toolchain" -ForegroundColor Green - $basefile = "LLVMEmbeddedToolchainForArm-17.0.1-Windows-x86_64" - Set-Location "$NUTTXTOOLS" - # Download the latest ARM clang toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "clang-arm-none-eabi" - Remove-Item "$basefile*" -Force - } - } - clang --version - Write-Host "" - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function arm_gcc_toolchain() { - Write-Host "Check ARM GCC toolchain toolchain ..." -ForegroundColor Green - try { - if (run_command("arm-none-eabi-gcc") -ne 0) { - add_path "$NUTTXTOOLS\gcc-arm-none-eabi\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-arm-none-eabi\bin\arm-none-eabi-gcc.exe")) { - # Download the file - Write-Host "Download: ARM GCC toolchain" -ForegroundColor Green - $basefile = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi" - Set-Location "$NUTTXTOOLS" - # Download the latest ARM GCC toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "gcc-arm-none-eabi" - Remove-Item "$basefile*" -Force - } - } - arm-none-eabi-gcc --version - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function arm64_gcc_toolchain() { - Write-Host "Check ARM64 GCC toolchain toolchain ..." -ForegroundColor Green - - try { - if (run_command("aarch64-none-elf-gcc") -ne 0) { - add_path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin\aarch64-none-elf-gcc.exe")) { - # Download the file - Write-Host "Download: ARM64 GCC toolchain" -ForegroundColor Green - $basefile = "arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-aarch64-none-elf" - Set-Location "$NUTTXTOOLS" - # Download the latest ARM64 GCC toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "gcc-aarch64-none-elf" - Remove-Item "$basefile*" -Force - } - } - aarch64-none-elf-gcc --version - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function cmake_tool { - Write-Host "Check Cmake ..." -ForegroundColor Green - if (run_command("cmake") -ne 0) { - add_path "$NUTTXTOOLS\cmake\bin" - if ($null -eq (Get-Command cmake -ErrorAction SilentlyContinue)) { - Write-Host "Download: Ninja package" -ForegroundColor Green - # Download the file - $basefile = "cmake-3.31.6-windows-x86_64" - Set-Location "$NUTTXTOOLS" - # Download tool cmake - Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v3.31.6/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile" -Destination "cmake" - Remove-Item "$basefile*" -Force - } - } - cmake --version -} - -function kconfig_frontends() { - Write-Host "Check kconfig-frontends ..." -ForegroundColor Green - add_path "$NUTTXTOOLS\kconfig-frontends\bin" - try { - if (-not (Test-Path -Path "$NUTTXTOOLS\kconfig-frontends\bin\kconfig-conf.exe")) { - # Download the file - Write-Host "Download: kconfig-frontends package" -ForegroundColor Green - $basefile = "kconfig-frontends-windows-mingw64" - Set-Location "$NUTTXTOOLS" - # Download the kconfig-frontends prebuilt - Invoke-WebRequest -Uri "https://github.com/simbit18/kconfig-frontends-windows-mingw64/releases/download/kconfig-frontends-4.11.0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "kconfig-frontends" - Remove-Item "$basefile*" -Force - Write-Host "File downloaded successfully to kconfig-frontends" - } - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function ninja_tool { - Write-Host "Check Ninja ..." -ForegroundColor Green - if (run_command("ninja") -ne 0) { - add_path "$NUTTXTOOLS\ninja" - if ($null -eq (Get-Command ninja -ErrorAction SilentlyContinue)) { - Write-Host "Download: Ninja package" -ForegroundColor Green - # Download the file - $basefile = "ninja-win" - Set-Location "$NUTTXTOOLS" - # Download tool ninja - Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v1.12.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" # -DestinationPath "$basefile" - Move-Item -Path "$basefile" -Destination "ninja" - Remove-Item "$basefile*" -Force - } - } - ninja --version - Write-Host "" -} - -function pico_sdk { - Write-Host "Check pico-sdk ..." -ForegroundColor Green - add_path "$NUTTXTOOLS\pico-sdk" - try { - if (-not (Test-Path -Path "$NUTTXTOOLS\pico-sdk\pico_sdk_init.cmake")) { - Write-Host "Download: pico-sdk package" -ForegroundColor Green - # Download the file - $basefile = "2.2.0" - Set-Location "$NUTTXTOOLS" - # Download pico-sdk - Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk/archive/refs/tags/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\pico-sdk-2.2.0" -Destination "pico-sdk" - Remove-Item "$basefile*" -Force - # Configuring the PATH environment variable - $env:PICO_SDK_PATH = "$NUTTXTOOLS\pico-sdk" - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "PICO_SDK_PATH=$NUTTXTOOLS\pico-sdk" - Write-Host "File downloaded successfully to pico-sdk" - } - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function pico_tool { - Write-Host "Check picotool ..." -ForegroundColor Green - if (run_command("picotool") -ne 0) { - add_path "$NUTTXTOOLS\picotool" - if ($null -eq (Get-Command picotool -ErrorAction SilentlyContinue)) { - Write-Host "Download: picotool package" -ForegroundColor Green - # Download the file - $basefile = "picotool-2.2.0-x64-win" - Set-Location "$NUTTXTOOLS" - # Download tool picotool - Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.2.0-0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\picotool" -Destination "picotool" - Remove-Item "$basefile*" -Force -Recurse - } - } - picotool version - Write-Host "" -} - -function riscv_gcc_toolchain() { - Write-Host "Check RISCV GCC toolchain ..." -ForegroundColor Green - add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" - try { - if (run_command("riscv-none-elf-gcc") -ne 0) { - add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\riscv-none-elf-gcc\bin\riscv-none-elf-gcc.exe")) { - Write-Host "Download: RISCV GCC toolchain" -ForegroundColor Green - $basefile = "xpack-riscv-none-elf-gcc-14.2.0-3-win32-x64" - Set-Location "$NUTTXTOOLS" - # Download the latest RISCV GCC toolchain prebuilt by xPack - Invoke-WebRequest -Uri "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\xpack-riscv-none-elf-gcc-14.2.0-3" -Destination "riscv-none-elf-gcc" - Remove-Item "$basefile*" -Force - } - } - riscv-none-elf-gcc --version - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -# GitHub Actions runners already have rustup installed -function rust() { - Write-Host "Check Rust ..." - if (run_command("rustc") -ne 0) { - add_path "$NUTTXTOOLS\rust\cargo\bin" - # Configuring the PATH environment variable - $env:CARGO_HOME = "$NUTTXTOOLS\rust\cargo" - $env:RUSTUP_HOME = "$NUTTXTOOLS\rust\rustup" - - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "CARGO_HOME=$NUTTXTOOLS\rust\cargo" - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "RUSTUP_HOME=$NUTTXTOOLS\rust\rustup" - - if ($null -eq (Get-Command rustc -ErrorAction SilentlyContinue)) { - Write-Host "Download: Rust package" -ForegroundColor Green - # Download the file - $basefile = "x86_64-pc-windows-gnu" - New-Item -ItemType Directory -Path "$NUTTXTOOLS\rust" -Force - Set-Location "$NUTTXTOOLS" - # Download tool rustup-init.exe - Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile "rustup-init.exe" -ErrorAction Stop - # Install Rust target x86_64-pc-windows-gnu - cmd /c start /wait rustup-init.exe -y --default-host $basefile --no-modify-path - # Install targets supported from NuttX - cmd /c start /wait rustup.exe target add thumbv6m-none-eabi - cmd /c start /wait rustup.exe target add thumbv7m-none-eabi - cmd /c start /wait rustup.exe target add riscv64gc-unknown-none-elf - Remove-Item rustup-init.exe -Force - } - } - rustc --version -} - -function run_command ($command) { - if ($null -eq (Get-Command "$command" -ErrorAction SilentlyContinue)) { - return 1 - } - else { - return 0 - } -} - -function install_build_tools { - if (-not (Test-Path -Path "$NUTTXTOOLS\env.ps1")) { - add_envpath "$NUTTXTOOLS\env.ps1" - } - $install = "arm_clang_toolchain arm_gcc_toolchain arm64_gcc_toolchain riscv_gcc_toolchain pico_sdk pico_tool cmake_tool kconfig_frontends ninja_tool" - - $splitArray = $install.Split(" ") - $oldpath = Get-Location - - foreach ( $node in $splitArray ) { - & $node - } - - Set-Location "$oldpath" -} - -install_build_tools +#!/usr/bin/env pswd +############################################################################ +# tools/ci/platforms/windows.ps1 +# PowerShell script for CI on Windows Native +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +# Windows native + +# Set-PSDebug -Trace 0 + +function add_path() { + param ( + [string]$Path + ) + if (!$Path) { + Write-Host "Error: add_path path file not found" -ForegroundColor Red + return + } + $envPaths = $env:Path -split ';' + if ($envPaths -notcontains $Path) { + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "add_path $Path" + $env:PATH = "$Path;" + $env:PATH + } +} + +function add_envpath { + param( + [string] $envfile + ) + $head = @" +#!/usr/bin/env pswd +############################################################################ +# env.ps1 +# PowerShell script for CI on Windows Native +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +function add_path() { + param ( + [string]`$Path + ) + if (!`$Path) { + Write-Host "Error: add_path path file not found" -ForegroundColor Red + return + } + `$envPaths = `$env:Path -split ';' + if (`$envPaths -notcontains `$Path) { + `$env:PATH = "`$Path;" + `$env:PATH + } +} +"@ + + Add-Content -Path "$envfile" -Value "$head" +} + +function arm_clang_toolchain { + Write-Host "Check ARM clang toolchain ..." -ForegroundColor Green + try { + if (run_command("clang") -ne 0) { + add_path "$NUTTXTOOLS\clang-arm-none-eabi\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\clang-arm-none-eabi\bin\clang.exe")) { + # Download the file + Write-Host "Download: ARM clang toolchain" -ForegroundColor Green + $basefile = "LLVM-ET-Arm-19.1.5-Windows-x86_64" + Set-Location "$NUTTXTOOLS" + # Download the latest ARM clang toolchain prebuilt by ARM + Invoke-WebRequest -Uri "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "clang-arm-none-eabi" + Remove-Item "$basefile*" -Force + } + } + clang --version + Write-Host "" + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function arm_gcc_toolchain() { + Write-Host "Check ARM GCC toolchain toolchain ..." -ForegroundColor Green + try { + if (run_command("arm-none-eabi-gcc") -ne 0) { + add_path "$NUTTXTOOLS\gcc-arm-none-eabi\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-arm-none-eabi\bin\arm-none-eabi-gcc.exe")) { + # Download the file + Write-Host "Download: ARM GCC toolchain" -ForegroundColor Green + $basefile = "arm-gnu-toolchain-15.2.Rel1-mingw-w64-i686-arm-none-eabi" + Set-Location "$NUTTXTOOLS" + # Download the latest ARM GCC toolchain prebuilt by ARM + Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "gcc-arm-none-eabi" + Remove-Item "$basefile*" -Force + } + } + arm-none-eabi-gcc --version + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function arm64_gcc_toolchain() { + Write-Host "Check ARM64 GCC toolchain toolchain ..." -ForegroundColor Green + + try { + if (run_command("aarch64-none-elf-gcc") -ne 0) { + add_path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin\aarch64-none-elf-gcc.exe")) { + # Download the file + Write-Host "Download: ARM64 GCC toolchain" -ForegroundColor Green + $basefile = "arm-gnu-toolchain-15.2.rel1-mingw-w64-i686-aarch64-none-elf" + Set-Location "$NUTTXTOOLS" + # Download the latest ARM64 GCC toolchain prebuilt by ARM + Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "gcc-aarch64-none-elf" + Remove-Item "$basefile*" -Force + } + } + aarch64-none-elf-gcc --version + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function cmake_tool { + Write-Host "Check Cmake ..." -ForegroundColor Green + if (run_command("cmake") -ne 0) { + add_path "$NUTTXTOOLS\cmake\bin" + if ($null -eq (Get-Command cmake -ErrorAction SilentlyContinue)) { + Write-Host "Download: Ninja package" -ForegroundColor Green + # Download the file + $basefile = "cmake-3.31.6-windows-x86_64" + Set-Location "$NUTTXTOOLS" + # Download tool cmake + Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v3.31.6/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile" -Destination "cmake" + Remove-Item "$basefile*" -Force + } + } + cmake --version +} + +function kconfig_frontends() { + Write-Host "Check kconfig-frontends ..." -ForegroundColor Green + add_path "$NUTTXTOOLS\kconfig-frontends\bin" + try { + if (-not (Test-Path -Path "$NUTTXTOOLS\kconfig-frontends\bin\kconfig-conf.exe")) { + # Download the file + Write-Host "Download: kconfig-frontends package" -ForegroundColor Green + $basefile = "kconfig-frontends-windows-mingw64" + Set-Location "$NUTTXTOOLS" + # Download the kconfig-frontends prebuilt + Invoke-WebRequest -Uri "https://github.com/simbit18/kconfig-frontends-windows-mingw64/releases/download/kconfig-frontends-4.11.0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "kconfig-frontends" + Remove-Item "$basefile*" -Force + Write-Host "File downloaded successfully to kconfig-frontends" + } + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function ninja_tool { + Write-Host "Check Ninja ..." -ForegroundColor Green + if (run_command("ninja") -ne 0) { + add_path "$NUTTXTOOLS\ninja" + if ($null -eq (Get-Command ninja -ErrorAction SilentlyContinue)) { + Write-Host "Download: Ninja package" -ForegroundColor Green + # Download the file + $basefile = "ninja-win" + Set-Location "$NUTTXTOOLS" + # Download tool ninja + Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v1.12.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" # -DestinationPath "$basefile" + Move-Item -Path "$basefile" -Destination "ninja" + Remove-Item "$basefile*" -Force + } + } + ninja --version + Write-Host "" +} + +function pico_sdk { + Write-Host "Check pico-sdk ..." -ForegroundColor Green + add_path "$NUTTXTOOLS\pico-sdk" + try { + if (-not (Test-Path -Path "$NUTTXTOOLS\pico-sdk\pico_sdk_init.cmake")) { + Write-Host "Download: pico-sdk package" -ForegroundColor Green + # Download the file + $basefile = "2.2.0" + Set-Location "$NUTTXTOOLS" + # Download pico-sdk + Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk/archive/refs/tags/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\pico-sdk-2.2.0" -Destination "pico-sdk" + Remove-Item "$basefile*" -Force + # Configuring the PATH environment variable + $env:PICO_SDK_PATH = "$NUTTXTOOLS\pico-sdk" + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "PICO_SDK_PATH=$NUTTXTOOLS\pico-sdk" + Write-Host "File downloaded successfully to pico-sdk" + } + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function pico_tool { + Write-Host "Check picotool ..." -ForegroundColor Green + if (run_command("picotool") -ne 0) { + add_path "$NUTTXTOOLS\picotool" + if ($null -eq (Get-Command picotool -ErrorAction SilentlyContinue)) { + Write-Host "Download: picotool package" -ForegroundColor Green + # Download the file + $basefile = "picotool-2.2.0-x64-win" + Set-Location "$NUTTXTOOLS" + # Download tool picotool + Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.2.0-0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\picotool" -Destination "picotool" + Remove-Item "$basefile*" -Force -Recurse + } + } + picotool version + Write-Host "" +} + +function riscv_gcc_toolchain() { + Write-Host "Check RISCV GCC toolchain ..." -ForegroundColor Green + add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" + try { + if (run_command("riscv-none-elf-gcc") -ne 0) { + add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\riscv-none-elf-gcc\bin\riscv-none-elf-gcc.exe")) { + Write-Host "Download: RISCV GCC toolchain" -ForegroundColor Green + $basefile = "xpack-riscv-none-elf-gcc-14.2.0-3-win32-x64" + Set-Location "$NUTTXTOOLS" + # Download the latest RISCV GCC toolchain prebuilt by xPack + Invoke-WebRequest -Uri "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\xpack-riscv-none-elf-gcc-14.2.0-3" -Destination "riscv-none-elf-gcc" + Remove-Item "$basefile*" -Force + } + } + riscv-none-elf-gcc --version + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +# GitHub Actions runners already have rustup installed +function rust() { + Write-Host "Check Rust ..." + if (run_command("rustc") -ne 0) { + add_path "$NUTTXTOOLS\rust\cargo\bin" + # Configuring the PATH environment variable + $env:CARGO_HOME = "$NUTTXTOOLS\rust\cargo" + $env:RUSTUP_HOME = "$NUTTXTOOLS\rust\rustup" + + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "CARGO_HOME=$NUTTXTOOLS\rust\cargo" + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "RUSTUP_HOME=$NUTTXTOOLS\rust\rustup" + + if ($null -eq (Get-Command rustc -ErrorAction SilentlyContinue)) { + Write-Host "Download: Rust package" -ForegroundColor Green + # Download the file + $basefile = "x86_64-pc-windows-gnu" + New-Item -ItemType Directory -Path "$NUTTXTOOLS\rust" -Force + Set-Location "$NUTTXTOOLS" + # Download tool rustup-init.exe + Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile "rustup-init.exe" -ErrorAction Stop + # Install Rust target x86_64-pc-windows-gnu + cmd /c start /wait rustup-init.exe -y --default-host $basefile --no-modify-path + # Install targets supported from NuttX + cmd /c start /wait rustup.exe target add thumbv6m-none-eabi + cmd /c start /wait rustup.exe target add thumbv7m-none-eabi + cmd /c start /wait rustup.exe target add riscv64gc-unknown-none-elf + Remove-Item rustup-init.exe -Force + } + } + rustc --version +} + +function run_command ($command) { + if ($null -eq (Get-Command "$command" -ErrorAction SilentlyContinue)) { + return 1 + } + else { + return 0 + } +} + +function install_build_tools { + if (-not (Test-Path -Path "$NUTTXTOOLS\env.ps1")) { + add_envpath "$NUTTXTOOLS\env.ps1" + } + $install = "arm_clang_toolchain arm_gcc_toolchain arm64_gcc_toolchain riscv_gcc_toolchain pico_sdk pico_tool cmake_tool kconfig_frontends ninja_tool" + + $splitArray = $install.Split(" ") + $oldpath = Get-Location + + foreach ( $node in $splitArray ) { + & $node + } + + Set-Location "$oldpath" +} + +install_build_tools diff --git a/tools/ci/testlist/sim-01.dat b/tools/ci/testlist/sim-01.dat index d756836641ae6..d23d950fe5fa3 100644 --- a/tools/ci/testlist/sim-01.dat +++ b/tools/ci/testlist/sim-01.dat @@ -5,7 +5,7 @@ -Darwin,sim:alsa # clang doesn't -fsanitize=kernel-address --Darwin,sim:citest +-Darwin,sim:citest,CONFIG_SIM_TOOLCHAIN_CLANG # macOS can compilation is not currently supported -Darwin,sim:can diff --git a/tools/ci/testlist/sim-02.dat b/tools/ci/testlist/sim-02.dat index 56e85274ea1be..c385fd8c55757 100644 --- a/tools/ci/testlist/sim-02.dat +++ b/tools/ci/testlist/sim-02.dat @@ -34,7 +34,7 @@ -Darwin,sim:wamr # macOS matter compilation is not currently supported --Darwin,sim:matter +-Darwin,sim:matter,CONFIG_SIM_TOOLCHAIN_CLANG # Boards build by CMake CMake,sim:dynconns @@ -51,4 +51,4 @@ CMake,sim:nettest CMake,sim:note CMake,sim:nsh CMake,sim:nxffs -CMake,sim:matter +CMake,sim:matter,CONFIG_SIM_TOOLCHAIN_CLANG diff --git a/tools/ci/testlist/sim-03.dat b/tools/ci/testlist/sim-03.dat index 88456bd1973af..8b2c729779961 100644 --- a/tools/ci/testlist/sim-03.dat +++ b/tools/ci/testlist/sim-03.dat @@ -42,7 +42,7 @@ CMake,sim:smp CMake,sim:spiffs CMake,sim:tcpblaster CMake,sim:tcploop -CMake,sim:tflm +CMake,sim:tflm,CONFIG_SIM_TOOLCHAIN_CLANG CMake,sim:udgram CMake,sim:unionfs CMake,sim:usbdev From 9476f6976cdd3ba6a2928db35805dd8647962db4 Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 11:00:53 +0100 Subject: [PATCH 3/8] /tools/ci/: Revert changes in scripts. Revert changes in scripts. Signed-off-by: Bartosz --- tools/ci/platforms/darwin.sh | 24 ++++++++++++------------ tools/ci/platforms/darwin_arm64.sh | 2 +- tools/ci/platforms/linux.sh | 22 +++++++++++----------- tools/ci/platforms/msys2.sh | 20 ++++++++++---------- tools/ci/platforms/ubuntu.sh | 22 +++++++++++----------- tools/ci/platforms/windows.ps1 | 18 +++++++++--------- 6 files changed, 54 insertions(+), 54 deletions(-) diff --git a/tools/ci/platforms/darwin.sh b/tools/ci/platforms/darwin.sh index 602e6efa032ee..ec5df36c36539 100755 --- a/tools/ci/platforms/darwin.sh +++ b/tools/ci/platforms/darwin.sh @@ -42,10 +42,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVM-ET-Arm-19.1.5-Darwin-universal + basefile=LLVMEmbeddedToolchainForArm-17.0.1-Darwin cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.dmg + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.dmg sudo hdiutil attach ${basefile}.dmg sudo cp -R /Volumes/${basefile}/${basefile} "${NUTTXTOOLS}"/${basefile} sudo mv ${basefile} clang-arm-none-eabi @@ -60,9 +60,9 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.rel1-darwin-x86_64-arm-none-eabi + basefile=arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi cd "${NUTTXTOOLS}" - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-arm-none-eabi @@ -77,10 +77,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.Rel1-darwin-x86_64-aarch64-none-elf + basefile=arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-aarch64-none-elf @@ -256,11 +256,11 @@ python_tools() { echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin fi - + if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi - + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" @@ -295,12 +295,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-15.2.0-1-darwin-x64 + basefile=xpack-riscv-none-elf-gcc-14.2.0-3-darwin-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.tar.gz + curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.tar.gz tar zxf ${basefile}.tar.gz - mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc rm ${basefile}.tar.gz fi @@ -446,4 +446,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools +install_build_tools \ No newline at end of file diff --git a/tools/ci/platforms/darwin_arm64.sh b/tools/ci/platforms/darwin_arm64.sh index 69b03ccfbaed5..c72dd02cdca65 100755 --- a/tools/ci/platforms/darwin_arm64.sh +++ b/tools/ci/platforms/darwin_arm64.sh @@ -422,4 +422,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools +install_build_tools \ No newline at end of file diff --git a/tools/ci/platforms/linux.sh b/tools/ci/platforms/linux.sh index 5e1f64984ba46..34d87a5ebcd8f 100755 --- a/tools/ci/platforms/linux.sh +++ b/tools/ci/platforms/linux.sh @@ -35,10 +35,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVM-ET-Arm-19.1.5-Linux-x86_64 + basefile=LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64 cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.tar.xz + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} clang-arm-none-eabi @@ -53,10 +53,10 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-arm-none-eabi + basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi cd "${NUTTXTOOLS}" # Download the latest ARM GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-arm-none-eabi @@ -71,10 +71,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-aarch64-none-elf + basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-aarch64-none-elf @@ -88,7 +88,7 @@ bloaty() { add_path "${NUTTXTOOLS}"/bloaty/bin if [ ! -f "${NUTTXTOOLS}/bloaty/bin/bloaty" ]; then - git clone --depth 1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src + git clone --depth 1 --branch v1.1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src mkdir -p "${NUTTXTOOLS}"/bloaty cd "${NUTTXTOOLS}"/bloaty-src cmake -B build -DCMAKE_INSTALL_PREFIX="${NUTTXTOOLS}"/bloaty @@ -163,12 +163,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64 + basefile=xpack-riscv-none-elf-gcc-14.2.0-3-linux-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - wget --quiet https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.tar.gz + wget --quiet https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.tar.gz tar zxf ${basefile}.tar.gz - mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc rm ${basefile}.tar.gz fi command riscv-none-elf-gcc --version @@ -367,4 +367,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools +install_build_tools \ No newline at end of file diff --git a/tools/ci/platforms/msys2.sh b/tools/ci/platforms/msys2.sh index e4888d773ac17..ba0e61a92c70a 100755 --- a/tools/ci/platforms/msys2.sh +++ b/tools/ci/platforms/msys2.sh @@ -35,10 +35,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVM-ET-Arm-19.1.5-Windows-x86_64 + basefile=LLVMEmbeddedToolchainForArm-17.0.1-Windows-x86_64 cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.zip + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.zip unzip -qo ${basefile}.zip mv ${basefile} clang-arm-none-eabi rm ${basefile}.zip @@ -52,9 +52,9 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.Rel1-mingw-w64-i686-arm-none-eabi + basefile=arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi cd "${NUTTXTOOLS}" - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.zip + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.zip unzip -qo ${basefile}.zip mv ${basefile} gcc-arm-none-eabi rm ${basefile}.zip @@ -68,10 +68,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.Rel1-mingw-w64-i686-aarch64-none-elf + basefile=arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.zip + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.zip unzip -qo ${basefile}.zip mv ${basefile} gcc-aarch64-none-elf rm ${basefile}.zip @@ -158,12 +158,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-15.2.0-1-win32-x64 + basefile=xpack-riscv-none-elf-gcc-14.2.0-3-win32-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.zip + curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.zip unzip -qo ${basefile}.zip - mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc rm ${basefile}.zip fi command riscv-none-elf-gcc --version @@ -269,4 +269,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools +install_build_tools \ No newline at end of file diff --git a/tools/ci/platforms/ubuntu.sh b/tools/ci/platforms/ubuntu.sh index 941b741d90846..1475f8097ab76 100755 --- a/tools/ci/platforms/ubuntu.sh +++ b/tools/ci/platforms/ubuntu.sh @@ -35,10 +35,10 @@ arm_clang_toolchain() { if [ ! -f "${NUTTXTOOLS}/clang-arm-none-eabi/bin/clang" ]; then local basefile - basefile=LLVM-ET-Arm-19.1.5-Linux-x86_64 + basefile=LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64 cd "${NUTTXTOOLS}" # Download the latest ARM clang toolchain prebuilt by ARM - curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/${basefile}.tar.xz + curl -O -L -s https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} clang-arm-none-eabi @@ -53,10 +53,10 @@ arm_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-arm-none-eabi + basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi cd "${NUTTXTOOLS}" # Download the latest ARM GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-arm-none-eabi @@ -71,10 +71,10 @@ arm64_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/gcc-aarch64-none-elf/bin/aarch64-none-elf-gcc" ]; then local basefile - basefile=arm-gnu-toolchain-15.2.Rel1-x86_64-aarch64-none-elf + basefile=arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf cd "${NUTTXTOOLS}" # Download the latest ARM64 GCC toolchain prebuilt by ARM - curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/${basefile}.tar.xz + curl -O -L -s https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/${basefile}.tar.xz xz -d ${basefile}.tar.xz tar xf ${basefile}.tar mv ${basefile} gcc-aarch64-none-elf @@ -104,7 +104,7 @@ bloaty() { add_path "${NUTTXTOOLS}"/bloaty/bin if [ ! -f "${NUTTXTOOLS}/bloaty/bin/bloaty" ]; then - git clone --depth 1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src + git clone --depth 1 --branch v1.1 https://github.com/google/bloaty "${NUTTXTOOLS}"/bloaty-src mkdir -p "${NUTTXTOOLS}"/bloaty cd "${NUTTXTOOLS}"/bloaty-src cmake -B build -DCMAKE_INSTALL_PREFIX="${NUTTXTOOLS}"/bloaty @@ -216,12 +216,12 @@ riscv_gcc_toolchain() { if [ ! -f "${NUTTXTOOLS}/riscv-none-elf-gcc/bin/riscv-none-elf-gcc" ]; then local basefile - basefile=xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64 + basefile=xpack-riscv-none-elf-gcc-14.2.0-3-linux-x64 cd "${NUTTXTOOLS}" # Download the latest RISCV GCC toolchain prebuilt by xPack - curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/${basefile}.tar.gz + curl -O -L -s https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/${basefile}.tar.gz tar zxf ${basefile}.tar.gz - mv xpack-riscv-none-elf-gcc-15.2.0-1 riscv-none-elf-gcc + mv xpack-riscv-none-elf-gcc-14.2.0-3 riscv-none-elf-gcc rm ${basefile}.tar.gz fi @@ -447,4 +447,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools +install_build_tools \ No newline at end of file diff --git a/tools/ci/platforms/windows.ps1 b/tools/ci/platforms/windows.ps1 index abc6997ceaa98..15078ff8f7eed 100644 --- a/tools/ci/platforms/windows.ps1 +++ b/tools/ci/platforms/windows.ps1 @@ -96,10 +96,10 @@ function arm_clang_toolchain { if (-not (Test-Path -Path "$NUTTXTOOLS\clang-arm-none-eabi\bin\clang.exe")) { # Download the file Write-Host "Download: ARM clang toolchain" -ForegroundColor Green - $basefile = "LLVM-ET-Arm-19.1.5-Windows-x86_64" + $basefile = "LLVMEmbeddedToolchainForArm-17.0.1-Windows-x86_64" Set-Location "$NUTTXTOOLS" # Download the latest ARM clang toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.5/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Invoke-WebRequest -Uri "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop Expand-Archive "$NUTTXTOOLS\$basefile.zip" Move-Item -Path "$basefile\$basefile" -Destination "clang-arm-none-eabi" Remove-Item "$basefile*" -Force @@ -121,10 +121,10 @@ function arm_gcc_toolchain() { if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-arm-none-eabi\bin\arm-none-eabi-gcc.exe")) { # Download the file Write-Host "Download: ARM GCC toolchain" -ForegroundColor Green - $basefile = "arm-gnu-toolchain-15.2.Rel1-mingw-w64-i686-arm-none-eabi" + $basefile = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi" Set-Location "$NUTTXTOOLS" # Download the latest ARM GCC toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop Expand-Archive "$NUTTXTOOLS\$basefile.zip" Move-Item -Path "$basefile\$basefile" -Destination "gcc-arm-none-eabi" Remove-Item "$basefile*" -Force @@ -146,10 +146,10 @@ function arm64_gcc_toolchain() { if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin\aarch64-none-elf-gcc.exe")) { # Download the file Write-Host "Download: ARM64 GCC toolchain" -ForegroundColor Green - $basefile = "arm-gnu-toolchain-15.2.rel1-mingw-w64-i686-aarch64-none-elf" + $basefile = "arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-aarch64-none-elf" Set-Location "$NUTTXTOOLS" # Download the latest ARM64 GCC toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/15.2.Rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop Expand-Archive "$NUTTXTOOLS\$basefile.zip" Move-Item -Path "$basefile\$basefile" -Destination "gcc-aarch64-none-elf" Remove-Item "$basefile*" -Force @@ -159,7 +159,7 @@ function arm64_gcc_toolchain() { } catch { Write-Error "Failed to download the file: $_" - } + } } function cmake_tool { @@ -345,8 +345,8 @@ function install_build_tools { foreach ( $node in $splitArray ) { & $node } - + Set-Location "$oldpath" } -install_build_tools +install_build_tools \ No newline at end of file From 30d3cebf7db05f9ae3242882ce0c7775fd533914 Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 11:02:31 +0100 Subject: [PATCH 4/8] /tools/ci/: Revert formatting Revert formatting. Signed-off-by: Bartosz --- tools/ci/platforms/darwin.sh | 6 +++--- tools/ci/platforms/darwin_arm64.sh | 6 +++--- tools/ci/platforms/linux.sh | 2 +- tools/ci/platforms/msys2.sh | 2 +- tools/ci/platforms/ubuntu.sh | 2 +- tools/ci/platforms/windows.ps1 | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/ci/platforms/darwin.sh b/tools/ci/platforms/darwin.sh index ec5df36c36539..edf2840a14fa0 100755 --- a/tools/ci/platforms/darwin.sh +++ b/tools/ci/platforms/darwin.sh @@ -256,11 +256,11 @@ python_tools() { echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin fi - + if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi - + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" @@ -446,4 +446,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools \ No newline at end of file +install_build_tools diff --git a/tools/ci/platforms/darwin_arm64.sh b/tools/ci/platforms/darwin_arm64.sh index c72dd02cdca65..90f42f81009b1 100755 --- a/tools/ci/platforms/darwin_arm64.sh +++ b/tools/ci/platforms/darwin_arm64.sh @@ -232,11 +232,11 @@ python_tools() { echo "export PIP_USER=yes" >> "${NUTTXTOOLS}"/env.sh echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin - + if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi - + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" @@ -422,4 +422,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools \ No newline at end of file +install_build_tools diff --git a/tools/ci/platforms/linux.sh b/tools/ci/platforms/linux.sh index 34d87a5ebcd8f..a56ae81542e4e 100755 --- a/tools/ci/platforms/linux.sh +++ b/tools/ci/platforms/linux.sh @@ -367,4 +367,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools \ No newline at end of file +install_build_tools diff --git a/tools/ci/platforms/msys2.sh b/tools/ci/platforms/msys2.sh index ba0e61a92c70a..ce8463e84fe35 100755 --- a/tools/ci/platforms/msys2.sh +++ b/tools/ci/platforms/msys2.sh @@ -269,4 +269,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools \ No newline at end of file +install_build_tools diff --git a/tools/ci/platforms/ubuntu.sh b/tools/ci/platforms/ubuntu.sh index 1475f8097ab76..25f60825fb6fa 100755 --- a/tools/ci/platforms/ubuntu.sh +++ b/tools/ci/platforms/ubuntu.sh @@ -447,4 +447,4 @@ install_build_tools() { echo "export PATH" >> "${NUTTXTOOLS}"/env.sh } -install_build_tools \ No newline at end of file +install_build_tools diff --git a/tools/ci/platforms/windows.ps1 b/tools/ci/platforms/windows.ps1 index 15078ff8f7eed..089907652eb18 100644 --- a/tools/ci/platforms/windows.ps1 +++ b/tools/ci/platforms/windows.ps1 @@ -159,7 +159,7 @@ function arm64_gcc_toolchain() { } catch { Write-Error "Failed to download the file: $_" - } + } } function cmake_tool { @@ -345,8 +345,8 @@ function install_build_tools { foreach ( $node in $splitArray ) { & $node } - + Set-Location "$oldpath" } -install_build_tools \ No newline at end of file +install_build_tools From 2fe28e07727a91eecb035d32784a2d8550c60722 Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 11:04:41 +0100 Subject: [PATCH 5/8] /tools/ci/: Minor style fixes to revert changes. Style fixes. Signed-off-by: Bartosz --- tools/ci/platforms/darwin_arm64.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/ci/platforms/darwin_arm64.sh b/tools/ci/platforms/darwin_arm64.sh index 90f42f81009b1..dd86ac5647b7c 100755 --- a/tools/ci/platforms/darwin_arm64.sh +++ b/tools/ci/platforms/darwin_arm64.sh @@ -232,11 +232,9 @@ python_tools() { echo "export PIP_USER=yes" >> "${NUTTXTOOLS}"/env.sh echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin - if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi - # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" From 4f0894d3c6bed5ab741667b459bd4f1e7a5f93ea Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 11:04:56 +0100 Subject: [PATCH 6/8] /tools/ci/: Revert formatting Revert formatting. Signed-off-by: Bartosz --- tools/ci/platforms/darwin.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/ci/platforms/darwin.sh b/tools/ci/platforms/darwin.sh index edf2840a14fa0..110c3c7949a36 100755 --- a/tools/ci/platforms/darwin.sh +++ b/tools/ci/platforms/darwin.sh @@ -256,11 +256,9 @@ python_tools() { echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin fi - if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi - # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" From 83a3cc22e21e1cc28e7fc401f1edc9cb8e22ddbf Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 11:08:16 +0100 Subject: [PATCH 7/8] /tools/ci/: Revert darwin.sh file Signed-off-by: Bartosz --- tools/ci/platforms/darwin.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/ci/platforms/darwin.sh b/tools/ci/platforms/darwin.sh index 110c3c7949a36..edf2840a14fa0 100755 --- a/tools/ci/platforms/darwin.sh +++ b/tools/ci/platforms/darwin.sh @@ -256,9 +256,11 @@ python_tools() { echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin fi + if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" From 107d5a53fa3553e8dad34e72961c550cbfc193db Mon Sep 17 00:00:00 2001 From: Bartosz Wawrzynek Date: Tue, 13 Jan 2026 11:10:22 +0100 Subject: [PATCH 8/8] /tools/ci/: Revert formatting Revert formatting. Signed-off-by: Bartosz --- tools/ci/platforms/darwin.sh | 4 +- tools/ci/platforms/darwin_arm64.sh | 2 + tools/ci/platforms/windows.ps1 | 704 ++++++++++++++--------------- 3 files changed, 356 insertions(+), 354 deletions(-) diff --git a/tools/ci/platforms/darwin.sh b/tools/ci/platforms/darwin.sh index edf2840a14fa0..250eb2fb12627 100755 --- a/tools/ci/platforms/darwin.sh +++ b/tools/ci/platforms/darwin.sh @@ -256,11 +256,11 @@ python_tools() { echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin fi - + if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi - + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" diff --git a/tools/ci/platforms/darwin_arm64.sh b/tools/ci/platforms/darwin_arm64.sh index dd86ac5647b7c..69b03ccfbaed5 100755 --- a/tools/ci/platforms/darwin_arm64.sh +++ b/tools/ci/platforms/darwin_arm64.sh @@ -232,9 +232,11 @@ python_tools() { echo "export PIP_USER=yes" >> "${NUTTXTOOLS}"/env.sh echo "export PYTHONUSERBASE=${NUTTXTOOLS}/pylocal" >> "${NUTTXTOOLS}"/env.sh add_path "${PYTHONUSERBASE}"/bin + if [ "X$osarch" == "Xarm64" ]; then python3 -m venv --system-site-packages /opt/homebrew fi + # workaround for Cython issue # https://github.com/yaml/pyyaml/pull/702#issuecomment-1638930830 pip3 install "Cython<3.0" diff --git a/tools/ci/platforms/windows.ps1 b/tools/ci/platforms/windows.ps1 index 089907652eb18..4b2a2620d3fe9 100644 --- a/tools/ci/platforms/windows.ps1 +++ b/tools/ci/platforms/windows.ps1 @@ -1,352 +1,352 @@ -#!/usr/bin/env pswd -############################################################################ -# tools/ci/platforms/windows.ps1 -# PowerShell script for CI on Windows Native -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -############################################################################ - -# Windows native - -# Set-PSDebug -Trace 0 - -function add_path() { - param ( - [string]$Path - ) - if (!$Path) { - Write-Host "Error: add_path path file not found" -ForegroundColor Red - return - } - $envPaths = $env:Path -split ';' - if ($envPaths -notcontains $Path) { - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "add_path $Path" - $env:PATH = "$Path;" + $env:PATH - } -} - -function add_envpath { - param( - [string] $envfile - ) - $head = @" -#!/usr/bin/env pswd -############################################################################ -# env.ps1 -# PowerShell script for CI on Windows Native -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -############################################################################ - -function add_path() { - param ( - [string]`$Path - ) - if (!`$Path) { - Write-Host "Error: add_path path file not found" -ForegroundColor Red - return - } - `$envPaths = `$env:Path -split ';' - if (`$envPaths -notcontains `$Path) { - `$env:PATH = "`$Path;" + `$env:PATH - } -} -"@ - - Add-Content -Path "$envfile" -Value "$head" -} - -function arm_clang_toolchain { - Write-Host "Check ARM clang toolchain ..." -ForegroundColor Green - try { - if (run_command("clang") -ne 0) { - add_path "$NUTTXTOOLS\clang-arm-none-eabi\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\clang-arm-none-eabi\bin\clang.exe")) { - # Download the file - Write-Host "Download: ARM clang toolchain" -ForegroundColor Green - $basefile = "LLVMEmbeddedToolchainForArm-17.0.1-Windows-x86_64" - Set-Location "$NUTTXTOOLS" - # Download the latest ARM clang toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "clang-arm-none-eabi" - Remove-Item "$basefile*" -Force - } - } - clang --version - Write-Host "" - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function arm_gcc_toolchain() { - Write-Host "Check ARM GCC toolchain toolchain ..." -ForegroundColor Green - try { - if (run_command("arm-none-eabi-gcc") -ne 0) { - add_path "$NUTTXTOOLS\gcc-arm-none-eabi\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-arm-none-eabi\bin\arm-none-eabi-gcc.exe")) { - # Download the file - Write-Host "Download: ARM GCC toolchain" -ForegroundColor Green - $basefile = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi" - Set-Location "$NUTTXTOOLS" - # Download the latest ARM GCC toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "gcc-arm-none-eabi" - Remove-Item "$basefile*" -Force - } - } - arm-none-eabi-gcc --version - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function arm64_gcc_toolchain() { - Write-Host "Check ARM64 GCC toolchain toolchain ..." -ForegroundColor Green - - try { - if (run_command("aarch64-none-elf-gcc") -ne 0) { - add_path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin\aarch64-none-elf-gcc.exe")) { - # Download the file - Write-Host "Download: ARM64 GCC toolchain" -ForegroundColor Green - $basefile = "arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-aarch64-none-elf" - Set-Location "$NUTTXTOOLS" - # Download the latest ARM64 GCC toolchain prebuilt by ARM - Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "gcc-aarch64-none-elf" - Remove-Item "$basefile*" -Force - } - } - aarch64-none-elf-gcc --version - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function cmake_tool { - Write-Host "Check Cmake ..." -ForegroundColor Green - if (run_command("cmake") -ne 0) { - add_path "$NUTTXTOOLS\cmake\bin" - if ($null -eq (Get-Command cmake -ErrorAction SilentlyContinue)) { - Write-Host "Download: Ninja package" -ForegroundColor Green - # Download the file - $basefile = "cmake-3.31.6-windows-x86_64" - Set-Location "$NUTTXTOOLS" - # Download tool cmake - Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v3.31.6/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile" -Destination "cmake" - Remove-Item "$basefile*" -Force - } - } - cmake --version -} - -function kconfig_frontends() { - Write-Host "Check kconfig-frontends ..." -ForegroundColor Green - add_path "$NUTTXTOOLS\kconfig-frontends\bin" - try { - if (-not (Test-Path -Path "$NUTTXTOOLS\kconfig-frontends\bin\kconfig-conf.exe")) { - # Download the file - Write-Host "Download: kconfig-frontends package" -ForegroundColor Green - $basefile = "kconfig-frontends-windows-mingw64" - Set-Location "$NUTTXTOOLS" - # Download the kconfig-frontends prebuilt - Invoke-WebRequest -Uri "https://github.com/simbit18/kconfig-frontends-windows-mingw64/releases/download/kconfig-frontends-4.11.0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\$basefile" -Destination "kconfig-frontends" - Remove-Item "$basefile*" -Force - Write-Host "File downloaded successfully to kconfig-frontends" - } - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function ninja_tool { - Write-Host "Check Ninja ..." -ForegroundColor Green - if (run_command("ninja") -ne 0) { - add_path "$NUTTXTOOLS\ninja" - if ($null -eq (Get-Command ninja -ErrorAction SilentlyContinue)) { - Write-Host "Download: Ninja package" -ForegroundColor Green - # Download the file - $basefile = "ninja-win" - Set-Location "$NUTTXTOOLS" - # Download tool ninja - Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v1.12.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" # -DestinationPath "$basefile" - Move-Item -Path "$basefile" -Destination "ninja" - Remove-Item "$basefile*" -Force - } - } - ninja --version - Write-Host "" -} - -function pico_sdk { - Write-Host "Check pico-sdk ..." -ForegroundColor Green - add_path "$NUTTXTOOLS\pico-sdk" - try { - if (-not (Test-Path -Path "$NUTTXTOOLS\pico-sdk\pico_sdk_init.cmake")) { - Write-Host "Download: pico-sdk package" -ForegroundColor Green - # Download the file - $basefile = "2.2.0" - Set-Location "$NUTTXTOOLS" - # Download pico-sdk - Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk/archive/refs/tags/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\pico-sdk-2.2.0" -Destination "pico-sdk" - Remove-Item "$basefile*" -Force - # Configuring the PATH environment variable - $env:PICO_SDK_PATH = "$NUTTXTOOLS\pico-sdk" - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "PICO_SDK_PATH=$NUTTXTOOLS\pico-sdk" - Write-Host "File downloaded successfully to pico-sdk" - } - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -function pico_tool { - Write-Host "Check picotool ..." -ForegroundColor Green - if (run_command("picotool") -ne 0) { - add_path "$NUTTXTOOLS\picotool" - if ($null -eq (Get-Command picotool -ErrorAction SilentlyContinue)) { - Write-Host "Download: picotool package" -ForegroundColor Green - # Download the file - $basefile = "picotool-2.2.0-x64-win" - Set-Location "$NUTTXTOOLS" - # Download tool picotool - Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.2.0-0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\picotool" -Destination "picotool" - Remove-Item "$basefile*" -Force -Recurse - } - } - picotool version - Write-Host "" -} - -function riscv_gcc_toolchain() { - Write-Host "Check RISCV GCC toolchain ..." -ForegroundColor Green - add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" - try { - if (run_command("riscv-none-elf-gcc") -ne 0) { - add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" - if (-not (Test-Path -Path "$NUTTXTOOLS\riscv-none-elf-gcc\bin\riscv-none-elf-gcc.exe")) { - Write-Host "Download: RISCV GCC toolchain" -ForegroundColor Green - $basefile = "xpack-riscv-none-elf-gcc-14.2.0-3-win32-x64" - Set-Location "$NUTTXTOOLS" - # Download the latest RISCV GCC toolchain prebuilt by xPack - Invoke-WebRequest -Uri "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop - Expand-Archive "$NUTTXTOOLS\$basefile.zip" - Move-Item -Path "$basefile\xpack-riscv-none-elf-gcc-14.2.0-3" -Destination "riscv-none-elf-gcc" - Remove-Item "$basefile*" -Force - } - } - riscv-none-elf-gcc --version - } - catch { - Write-Error "Failed to download the file: $_" - } -} - -# GitHub Actions runners already have rustup installed -function rust() { - Write-Host "Check Rust ..." - if (run_command("rustc") -ne 0) { - add_path "$NUTTXTOOLS\rust\cargo\bin" - # Configuring the PATH environment variable - $env:CARGO_HOME = "$NUTTXTOOLS\rust\cargo" - $env:RUSTUP_HOME = "$NUTTXTOOLS\rust\rustup" - - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "CARGO_HOME=$NUTTXTOOLS\rust\cargo" - Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "RUSTUP_HOME=$NUTTXTOOLS\rust\rustup" - - if ($null -eq (Get-Command rustc -ErrorAction SilentlyContinue)) { - Write-Host "Download: Rust package" -ForegroundColor Green - # Download the file - $basefile = "x86_64-pc-windows-gnu" - New-Item -ItemType Directory -Path "$NUTTXTOOLS\rust" -Force - Set-Location "$NUTTXTOOLS" - # Download tool rustup-init.exe - Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile "rustup-init.exe" -ErrorAction Stop - # Install Rust target x86_64-pc-windows-gnu - cmd /c start /wait rustup-init.exe -y --default-host $basefile --no-modify-path - # Install targets supported from NuttX - cmd /c start /wait rustup.exe target add thumbv6m-none-eabi - cmd /c start /wait rustup.exe target add thumbv7m-none-eabi - cmd /c start /wait rustup.exe target add riscv64gc-unknown-none-elf - Remove-Item rustup-init.exe -Force - } - } - rustc --version -} - -function run_command ($command) { - if ($null -eq (Get-Command "$command" -ErrorAction SilentlyContinue)) { - return 1 - } - else { - return 0 - } -} - -function install_build_tools { - if (-not (Test-Path -Path "$NUTTXTOOLS\env.ps1")) { - add_envpath "$NUTTXTOOLS\env.ps1" - } - $install = "arm_clang_toolchain arm_gcc_toolchain arm64_gcc_toolchain riscv_gcc_toolchain pico_sdk pico_tool cmake_tool kconfig_frontends ninja_tool" - - $splitArray = $install.Split(" ") - $oldpath = Get-Location - - foreach ( $node in $splitArray ) { - & $node - } - - Set-Location "$oldpath" -} - -install_build_tools +#!/usr/bin/env pswd +############################################################################ +# tools/ci/platforms/windows.ps1 +# PowerShell script for CI on Windows Native +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +# Windows native + +# Set-PSDebug -Trace 0 + +function add_path() { + param ( + [string]$Path + ) + if (!$Path) { + Write-Host "Error: add_path path file not found" -ForegroundColor Red + return + } + $envPaths = $env:Path -split ';' + if ($envPaths -notcontains $Path) { + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "add_path $Path" + $env:PATH = "$Path;" + $env:PATH + } +} + +function add_envpath { + param( + [string] $envfile + ) + $head = @" +#!/usr/bin/env pswd +############################################################################ +# env.ps1 +# PowerShell script for CI on Windows Native +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +function add_path() { + param ( + [string]`$Path + ) + if (!`$Path) { + Write-Host "Error: add_path path file not found" -ForegroundColor Red + return + } + `$envPaths = `$env:Path -split ';' + if (`$envPaths -notcontains `$Path) { + `$env:PATH = "`$Path;" + `$env:PATH + } +} +"@ + + Add-Content -Path "$envfile" -Value "$head" +} + +function arm_clang_toolchain { + Write-Host "Check ARM clang toolchain ..." -ForegroundColor Green + try { + if (run_command("clang") -ne 0) { + add_path "$NUTTXTOOLS\clang-arm-none-eabi\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\clang-arm-none-eabi\bin\clang.exe")) { + # Download the file + Write-Host "Download: ARM clang toolchain" -ForegroundColor Green + $basefile = "LLVMEmbeddedToolchainForArm-17.0.1-Windows-x86_64" + Set-Location "$NUTTXTOOLS" + # Download the latest ARM clang toolchain prebuilt by ARM + Invoke-WebRequest -Uri "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "clang-arm-none-eabi" + Remove-Item "$basefile*" -Force + } + } + clang --version + Write-Host "" + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function arm_gcc_toolchain() { + Write-Host "Check ARM GCC toolchain toolchain ..." -ForegroundColor Green + try { + if (run_command("arm-none-eabi-gcc") -ne 0) { + add_path "$NUTTXTOOLS\gcc-arm-none-eabi\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-arm-none-eabi\bin\arm-none-eabi-gcc.exe")) { + # Download the file + Write-Host "Download: ARM GCC toolchain" -ForegroundColor Green + $basefile = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi" + Set-Location "$NUTTXTOOLS" + # Download the latest ARM GCC toolchain prebuilt by ARM + Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "gcc-arm-none-eabi" + Remove-Item "$basefile*" -Force + } + } + arm-none-eabi-gcc --version + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function arm64_gcc_toolchain() { + Write-Host "Check ARM64 GCC toolchain toolchain ..." -ForegroundColor Green + + try { + if (run_command("aarch64-none-elf-gcc") -ne 0) { + add_path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\gcc-aarch64-none-elf\bin\aarch64-none-elf-gcc.exe")) { + # Download the file + Write-Host "Download: ARM64 GCC toolchain" -ForegroundColor Green + $basefile = "arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-aarch64-none-elf" + Set-Location "$NUTTXTOOLS" + # Download the latest ARM64 GCC toolchain prebuilt by ARM + Invoke-WebRequest -Uri "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "gcc-aarch64-none-elf" + Remove-Item "$basefile*" -Force + } + } + aarch64-none-elf-gcc --version + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function cmake_tool { + Write-Host "Check Cmake ..." -ForegroundColor Green + if (run_command("cmake") -ne 0) { + add_path "$NUTTXTOOLS\cmake\bin" + if ($null -eq (Get-Command cmake -ErrorAction SilentlyContinue)) { + Write-Host "Download: Ninja package" -ForegroundColor Green + # Download the file + $basefile = "cmake-3.31.6-windows-x86_64" + Set-Location "$NUTTXTOOLS" + # Download tool cmake + Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v3.31.6/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile" -Destination "cmake" + Remove-Item "$basefile*" -Force + } + } + cmake --version +} + +function kconfig_frontends() { + Write-Host "Check kconfig-frontends ..." -ForegroundColor Green + add_path "$NUTTXTOOLS\kconfig-frontends\bin" + try { + if (-not (Test-Path -Path "$NUTTXTOOLS\kconfig-frontends\bin\kconfig-conf.exe")) { + # Download the file + Write-Host "Download: kconfig-frontends package" -ForegroundColor Green + $basefile = "kconfig-frontends-windows-mingw64" + Set-Location "$NUTTXTOOLS" + # Download the kconfig-frontends prebuilt + Invoke-WebRequest -Uri "https://github.com/simbit18/kconfig-frontends-windows-mingw64/releases/download/kconfig-frontends-4.11.0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\$basefile" -Destination "kconfig-frontends" + Remove-Item "$basefile*" -Force + Write-Host "File downloaded successfully to kconfig-frontends" + } + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function ninja_tool { + Write-Host "Check Ninja ..." -ForegroundColor Green + if (run_command("ninja") -ne 0) { + add_path "$NUTTXTOOLS\ninja" + if ($null -eq (Get-Command ninja -ErrorAction SilentlyContinue)) { + Write-Host "Download: Ninja package" -ForegroundColor Green + # Download the file + $basefile = "ninja-win" + Set-Location "$NUTTXTOOLS" + # Download tool ninja + Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v1.12.1/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" # -DestinationPath "$basefile" + Move-Item -Path "$basefile" -Destination "ninja" + Remove-Item "$basefile*" -Force + } + } + ninja --version + Write-Host "" +} + +function pico_sdk { + Write-Host "Check pico-sdk ..." -ForegroundColor Green + add_path "$NUTTXTOOLS\pico-sdk" + try { + if (-not (Test-Path -Path "$NUTTXTOOLS\pico-sdk\pico_sdk_init.cmake")) { + Write-Host "Download: pico-sdk package" -ForegroundColor Green + # Download the file + $basefile = "2.2.0" + Set-Location "$NUTTXTOOLS" + # Download pico-sdk + Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk/archive/refs/tags/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\pico-sdk-2.2.0" -Destination "pico-sdk" + Remove-Item "$basefile*" -Force + # Configuring the PATH environment variable + $env:PICO_SDK_PATH = "$NUTTXTOOLS\pico-sdk" + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "PICO_SDK_PATH=$NUTTXTOOLS\pico-sdk" + Write-Host "File downloaded successfully to pico-sdk" + } + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +function pico_tool { + Write-Host "Check picotool ..." -ForegroundColor Green + if (run_command("picotool") -ne 0) { + add_path "$NUTTXTOOLS\picotool" + if ($null -eq (Get-Command picotool -ErrorAction SilentlyContinue)) { + Write-Host "Download: picotool package" -ForegroundColor Green + # Download the file + $basefile = "picotool-2.2.0-x64-win" + Set-Location "$NUTTXTOOLS" + # Download tool picotool + Invoke-WebRequest -Uri "https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.2.0-0/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\picotool" -Destination "picotool" + Remove-Item "$basefile*" -Force -Recurse + } + } + picotool version + Write-Host "" +} + +function riscv_gcc_toolchain() { + Write-Host "Check RISCV GCC toolchain ..." -ForegroundColor Green + add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" + try { + if (run_command("riscv-none-elf-gcc") -ne 0) { + add_path "$NUTTXTOOLS\riscv-none-elf-gcc\bin" + if (-not (Test-Path -Path "$NUTTXTOOLS\riscv-none-elf-gcc\bin\riscv-none-elf-gcc.exe")) { + Write-Host "Download: RISCV GCC toolchain" -ForegroundColor Green + $basefile = "xpack-riscv-none-elf-gcc-14.2.0-3-win32-x64" + Set-Location "$NUTTXTOOLS" + # Download the latest RISCV GCC toolchain prebuilt by xPack + Invoke-WebRequest -Uri "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-3/$basefile.zip" -OutFile "$NUTTXTOOLS\$basefile.zip" -ErrorAction Stop + Expand-Archive "$NUTTXTOOLS\$basefile.zip" + Move-Item -Path "$basefile\xpack-riscv-none-elf-gcc-14.2.0-3" -Destination "riscv-none-elf-gcc" + Remove-Item "$basefile*" -Force + } + } + riscv-none-elf-gcc --version + } + catch { + Write-Error "Failed to download the file: $_" + } +} + +# GitHub Actions runners already have rustup installed +function rust() { + Write-Host "Check Rust ..." + if (run_command("rustc") -ne 0) { + add_path "$NUTTXTOOLS\rust\cargo\bin" + # Configuring the PATH environment variable + $env:CARGO_HOME = "$NUTTXTOOLS\rust\cargo" + $env:RUSTUP_HOME = "$NUTTXTOOLS\rust\rustup" + + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "CARGO_HOME=$NUTTXTOOLS\rust\cargo" + Add-Content -Path "$NUTTXTOOLS\env.ps1" -Value "RUSTUP_HOME=$NUTTXTOOLS\rust\rustup" + + if ($null -eq (Get-Command rustc -ErrorAction SilentlyContinue)) { + Write-Host "Download: Rust package" -ForegroundColor Green + # Download the file + $basefile = "x86_64-pc-windows-gnu" + New-Item -ItemType Directory -Path "$NUTTXTOOLS\rust" -Force + Set-Location "$NUTTXTOOLS" + # Download tool rustup-init.exe + Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe -OutFile "rustup-init.exe" -ErrorAction Stop + # Install Rust target x86_64-pc-windows-gnu + cmd /c start /wait rustup-init.exe -y --default-host $basefile --no-modify-path + # Install targets supported from NuttX + cmd /c start /wait rustup.exe target add thumbv6m-none-eabi + cmd /c start /wait rustup.exe target add thumbv7m-none-eabi + cmd /c start /wait rustup.exe target add riscv64gc-unknown-none-elf + Remove-Item rustup-init.exe -Force + } + } + rustc --version +} + +function run_command ($command) { + if ($null -eq (Get-Command "$command" -ErrorAction SilentlyContinue)) { + return 1 + } + else { + return 0 + } +} + +function install_build_tools { + if (-not (Test-Path -Path "$NUTTXTOOLS\env.ps1")) { + add_envpath "$NUTTXTOOLS\env.ps1" + } + $install = "arm_clang_toolchain arm_gcc_toolchain arm64_gcc_toolchain riscv_gcc_toolchain pico_sdk pico_tool cmake_tool kconfig_frontends ninja_tool" + + $splitArray = $install.Split(" ") + $oldpath = Get-Location + + foreach ( $node in $splitArray ) { + & $node + } + + Set-Location "$oldpath" +} + +install_build_tools