From a384668ed761212f73f1733f50bdf5533d0720ab Mon Sep 17 00:00:00 2001 From: Adrian Soundy Date: Wed, 31 Jul 2024 03:38:31 +1200 Subject: [PATCH] Upgrade ESP32 IDF to v5.2.2 (#2991) --- .devcontainer/All/Dockerfile.All | 2 +- .devcontainer/All/Dockerfile.All.SRC | 300 +- .devcontainer/ESP32/Dockerfile.ESP32 | 2 +- .devcontainer/ESP32/Dockerfile.ESP32.SRC | 172 +- CMake/Modules/FindESP32_IDF.cmake | 4 +- CMake/binutils.ESP32.cmake | 4 - azure-pipelines-nightly.yml | 10 +- .../build-espressif-esp32-targets.yml | 212 +- ...ownload-install-esp32-build-components.yml | 4 +- azure-pipelines.yml | 2978 ++++++++--------- targets/ESP32/CMakeLists.txt | 2 +- .../ESP32/_Network/NF_ESP32_OpenThread.cpp | 6 +- ...wm_native_System_Device_Pwm_PwmChannel.cpp | 4 +- .../_nanoCLR/System.Device.Spi/cpu_spi.cpp | 47 +- ..._ser_native_System_IO_Ports_SerialPort.cpp | 20 +- ...ware_esp32_native_Hardware_Esp32_Sleep.cpp | 4 +- ...ramework_Hardware_Esp32_Touch_TouchPad.cpp | 15 +- version.json | 56 +- 18 files changed, 1931 insertions(+), 1911 deletions(-) diff --git a/.devcontainer/All/Dockerfile.All b/.devcontainer/All/Dockerfile.All index 1be69669a8..8d5bb6df95 100644 --- a/.devcontainer/All/Dockerfile.All +++ b/.devcontainer/All/Dockerfile.All @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-all:v2.49 +FROM ghcr.io/nanoframework/dev-container-all:v2.50 diff --git a/.devcontainer/All/Dockerfile.All.SRC b/.devcontainer/All/Dockerfile.All.SRC index 047502e3f7..c3afb634dc 100644 --- a/.devcontainer/All/Dockerfile.All.SRC +++ b/.devcontainer/All/Dockerfile.All.SRC @@ -1,150 +1,150 @@ -FROM ubuntu:latest AS downloader -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils \ - && apt-get install -y \ - curl \ - xz-utils \ - unzip \ - wget - -RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted - -ARG GCC_VERSION=13.2.rel1 -ARG GCC_URI=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/$GCC_VERSION/binrel/arm-gnu-toolchain-$GCC_VERSION-x86_64-arm-none-eabi.tar.xz -RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \ - && curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \ - && xz -d /tmp/dc-downloads/gcc-arm.tar.xz \ - && tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \ - && rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/ - -ARG CMAKE_VERSION=3.27.6 -ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh -RUN wget $CMAKE_SCRIPT \ - -q -O /tmp/dc-downloads/cmake-install.sh \ - && chmod u+x /tmp/dc-downloads/cmake-install.sh \ - && mkdir -p /tmp/dc-extracted/cmake \ - && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ - && rm /tmp/dc-downloads/cmake-install.sh - -# This is TI XDC tools for linux. Cheack all versions here: https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/index.html -ARG TI_TOOL_URL=https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/3_62_00_08/exports/xdccore/xdctools_3_62_00_08_core_linux.zip -RUN mkdir -p /tmp/dc-extracted/titools \ - && curl -o /tmp/dc-downloads/titools.zip $TI_TOOL_URL -L \ - && unzip -d /tmp/dc-extracted/titools /tmp/dc-downloads/titools.zip - -FROM python:3.11 AS devcontainer - -# Avoid warnings by switching to noninteractive -ENV DEBIAN_FRONTEND=noninteractive - -# You can set up non-root user -# ARG USERNAME=vscode -# ARG USER_UID=1000 -# ARG USER_GID=$USER_UID - -# Configure apt and install packages -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ - && apt-get install -y \ - git \ - git-lfs \ - git-svn \ - subversion \ - clang-format \ - curl \ - ninja-build \ - srecord \ - nodejs \ - libffi-dev - -# Create needed directories -RUN mkdir -p /usr/local/bin/gcc \ - && mkdir -p /usr/local/bin/titools - -# Clone ChibiOS repo -# RUN git svn clone http://svn.code.sf.net/p/chibios/code/branches/stable_21.11.x -rHEAD ./sources/ChibiOs -# Alternative source for those having issues with git svn downloads: -RUN git clone --branch stable_21.11.x https://github.com/ArduPilot/ChibiOS.svn.git --depth 1 ./sources/ChibiOs - -# Clone support repos for STM32 including AzureRTOS -RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git --depth 1 ./sources/STM32CubeL4 \ - && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF7.git --depth 1 ./sources/STM32CubeF7 \ - && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF4.git --depth 1 ./sources/STM32CubeF4 \ - && git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git --depth 1 ./sources/STM32CubeH7 \ - && git clone --branch chibios-21.11.x https://github.com/ChibiOS/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib - -# Clone repos for AzureRTOS -RUN git clone --branch v6.4.0_rel --recursive https://github.com/eclipse-threadx/threadx.git --depth 1 ./sources/AzureRTOS \ - && git clone --branch v6.3.0_rel --recursive https://github.com/eclipse-threadx/netxduo.git --depth 1 ./sources/NetxDuo - -# Clone dependent repos (mbedtls, fatfs and littlefs) -RUN git clone --branch mbedtls-3.5.2 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ - && git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ - && git clone --branch v2.9.3 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs - -# Clone FreeRTOS and what is needed for ESP32 -RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \ - && git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git --depth 1 ./sources/CMSIS_5 - -# Clone lwIP for STM32 and NXP -RUN git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip - -# Clone ESP-IDF -RUN git clone --branch v5.1.4 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf - -# Clone what is needed for TI -RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC32xx_SDK.git --depth 1 ./sources/SimpleLinkCC32 \ - # you can't use the nanoFramework repository as it's Windows only - # && git clone --branch 3.61.00.16 https://github.com/nanoframework/TI_XDCTools.git --depth 1 ./sources/TI_XDCTools \ - && git clone --branch 5.40.00.40 https://github.com/nanoframework/SimpleLink_CC13xx_26xx_SDK.git --depth 1 ./sources/SimpleLinkCC13 \ - && git clone --branch 1.10.0 https://github.com/nanoframework/TI_SysConfig.git --depth 1 ./sources/TI_SysConfig \ - && chmod +x ./sources/TI_SysConfig/sysconfig_cli.sh - -# set gcc location -ARG TMP_GCC_PATH=/usr/local/bin/gcc -ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin - -# Copy from our other container -COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH -COPY --from=downloader /tmp/dc-extracted/titools/xdctools_3_62_00_08_core /usr/local/bin/titools -COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake - -ENV PATH=/usr/bin/cmake/bin:${PATH} - -# Putting hex2dfu in the container -ENV HEX2DFU_PATH=/usr/local/bin/hex2dfu - -ARG HEX2DFU=https://github.com/nanoframework/hex2dfu/releases/latest/download/hex2dfu -RUN mkdir -p $HEX2DFU_PATH \ - && curl -o $HEX2DFU_PATH/hex2dfu $HEX2DFU -L \ - && chmod +x $HEX2DFU_PATH/hex2dfu - -# Creating static link python for pyhton3 -RUN ln -fs /usr/bin/python3 /usr/bin/python \ - && pip3 install pyserial - -# Install ESP-IDF -ENV IDF_PATH=/sources/esp-idf -ENV ESP_PATCH_VER=esp-12.2.0_20230208 -# This is now taking care in the following line -# RUN python -m pip install -r $IDF_PATH/requirements.txt -RUN $IDF_PATH/install.sh - -ENV PATH=/root/.espressif/python_env/idf5.1_py3.11_env/bin:$PATH:\ -$IDF_PATH/components/esptool_py/esptool:\ -$IDF_PATH/components/espcoredump:\ -$IDF_PATH/components/partition_table/:\ -$IDF_PATH/tools/:\ -$IDF_PATH/components/app_update:\ -/root/.espressif/tools/xtensa-esp32-elf/$ESP_PATCH_VER/xtensa-esp32-elf/bin:\ -/root/.espressif/tools/xtensa-esp32s2-elf/$ESP_PATCH_VER/xtensa-esp32s2-elf/bin:\ -/root/.espressif/tools/xtensa-esp32s3-elf/$ESP_PATCH_VER/xtensa-esp32s3-elf/bin:\ -/root/.espressif/tools/riscv32-esp-elf/$ESP_PATCH_VER/riscv32-esp-elf/bin - -# Clean up downloaded files -RUN apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND=dialog +FROM ubuntu:latest AS downloader +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils \ + && apt-get install -y \ + curl \ + xz-utils \ + unzip \ + wget + +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted + +ARG GCC_VERSION=13.2.rel1 +ARG GCC_URI=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/$GCC_VERSION/binrel/arm-gnu-toolchain-$GCC_VERSION-x86_64-arm-none-eabi.tar.xz +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \ + && curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \ + && xz -d /tmp/dc-downloads/gcc-arm.tar.xz \ + && tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \ + && rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/ + +ARG CMAKE_VERSION=3.27.6 +ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh +RUN wget $CMAKE_SCRIPT \ + -q -O /tmp/dc-downloads/cmake-install.sh \ + && chmod u+x /tmp/dc-downloads/cmake-install.sh \ + && mkdir -p /tmp/dc-extracted/cmake \ + && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ + && rm /tmp/dc-downloads/cmake-install.sh + +# This is TI XDC tools for linux. Cheack all versions here: https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/index.html +ARG TI_TOOL_URL=https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/3_62_00_08/exports/xdccore/xdctools_3_62_00_08_core_linux.zip +RUN mkdir -p /tmp/dc-extracted/titools \ + && curl -o /tmp/dc-downloads/titools.zip $TI_TOOL_URL -L \ + && unzip -d /tmp/dc-extracted/titools /tmp/dc-downloads/titools.zip + +FROM python:3.11 AS devcontainer + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# You can set up non-root user +# ARG USERNAME=vscode +# ARG USER_UID=1000 +# ARG USER_GID=$USER_UID + +# Configure apt and install packages +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ + && apt-get install -y \ + git \ + git-lfs \ + git-svn \ + subversion \ + clang-format \ + curl \ + ninja-build \ + srecord \ + nodejs \ + libffi-dev + +# Create needed directories +RUN mkdir -p /usr/local/bin/gcc \ + && mkdir -p /usr/local/bin/titools + +# Clone ChibiOS repo +# RUN git svn clone http://svn.code.sf.net/p/chibios/code/branches/stable_21.11.x -rHEAD ./sources/ChibiOs +# Alternative source for those having issues with git svn downloads: +RUN git clone --branch stable_21.11.x https://github.com/ArduPilot/ChibiOS.svn.git --depth 1 ./sources/ChibiOs + +# Clone support repos for STM32 including AzureRTOS +RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git --depth 1 ./sources/STM32CubeL4 \ + && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF7.git --depth 1 ./sources/STM32CubeF7 \ + && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF4.git --depth 1 ./sources/STM32CubeF4 \ + && git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git --depth 1 ./sources/STM32CubeH7 \ + && git clone --branch chibios-21.11.x https://github.com/ChibiOS/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib + +# Clone repos for AzureRTOS +RUN git clone --branch v6.4.0_rel --recursive https://github.com/eclipse-threadx/threadx.git --depth 1 ./sources/AzureRTOS \ + && git clone --branch v6.3.0_rel --recursive https://github.com/eclipse-threadx/netxduo.git --depth 1 ./sources/NetxDuo + +# Clone dependent repos (mbedtls, fatfs and littlefs) +RUN git clone --branch mbedtls-3.5.2 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ + && git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ + && git clone --branch v2.9.3 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs + +# Clone FreeRTOS and what is needed for ESP32 +RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \ + && git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git --depth 1 ./sources/CMSIS_5 + +# Clone lwIP for STM32 and NXP +RUN git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip + +# Clone ESP-IDF +RUN git clone --branch v5.2.2 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf + +# Clone what is needed for TI +RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC32xx_SDK.git --depth 1 ./sources/SimpleLinkCC32 \ + # you can't use the nanoFramework repository as it's Windows only + # && git clone --branch 3.61.00.16 https://github.com/nanoframework/TI_XDCTools.git --depth 1 ./sources/TI_XDCTools \ + && git clone --branch 5.40.00.40 https://github.com/nanoframework/SimpleLink_CC13xx_26xx_SDK.git --depth 1 ./sources/SimpleLinkCC13 \ + && git clone --branch 1.10.0 https://github.com/nanoframework/TI_SysConfig.git --depth 1 ./sources/TI_SysConfig \ + && chmod +x ./sources/TI_SysConfig/sysconfig_cli.sh + +# set gcc location +ARG TMP_GCC_PATH=/usr/local/bin/gcc +ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin + +# Copy from our other container +COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH +COPY --from=downloader /tmp/dc-extracted/titools/xdctools_3_62_00_08_core /usr/local/bin/titools +COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake + +ENV PATH=/usr/bin/cmake/bin:${PATH} + +# Putting hex2dfu in the container +ENV HEX2DFU_PATH=/usr/local/bin/hex2dfu + +ARG HEX2DFU=https://github.com/nanoframework/hex2dfu/releases/latest/download/hex2dfu +RUN mkdir -p $HEX2DFU_PATH \ + && curl -o $HEX2DFU_PATH/hex2dfu $HEX2DFU -L \ + && chmod +x $HEX2DFU_PATH/hex2dfu + +# Creating static link python for pyhton3 +RUN ln -fs /usr/bin/python3 /usr/bin/python \ + && pip3 install pyserial + +# Install ESP-IDF +ENV IDF_PATH=/sources/esp-idf +ENV ESP_PATCH_VER=esp-13.2.0_20230928 +# This is now taking care in the following line +# RUN python -m pip install -r $IDF_PATH/requirements.txt +RUN $IDF_PATH/install.sh + +ENV PATH=/root/.espressif/python_env/idf5.1_py3.11_env/bin:$PATH:\ +$IDF_PATH/components/esptool_py/esptool:\ +$IDF_PATH/components/espcoredump:\ +$IDF_PATH/components/partition_table/:\ +$IDF_PATH/tools/:\ +$IDF_PATH/components/app_update:\ +/root/.espressif/tools/xtensa-esp32-elf/$ESP_PATCH_VER/xtensa-esp32-elf/bin:\ +/root/.espressif/tools/xtensa-esp32s2-elf/$ESP_PATCH_VER/xtensa-esp32s2-elf/bin:\ +/root/.espressif/tools/xtensa-esp32s3-elf/$ESP_PATCH_VER/xtensa-esp32s3-elf/bin:\ +/root/.espressif/tools/riscv32-esp-elf/$ESP_PATCH_VER/riscv32-esp-elf/bin + +# Clean up downloaded files +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog diff --git a/.devcontainer/ESP32/Dockerfile.ESP32 b/.devcontainer/ESP32/Dockerfile.ESP32 index ebd315629a..6157bc5698 100644 --- a/.devcontainer/ESP32/Dockerfile.ESP32 +++ b/.devcontainer/ESP32/Dockerfile.ESP32 @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-esp32:v2.31 +FROM ghcr.io/nanoframework/dev-container-esp32:v2.32 diff --git a/.devcontainer/ESP32/Dockerfile.ESP32.SRC b/.devcontainer/ESP32/Dockerfile.ESP32.SRC index 581b2417a2..c27d88f632 100644 --- a/.devcontainer/ESP32/Dockerfile.ESP32.SRC +++ b/.devcontainer/ESP32/Dockerfile.ESP32.SRC @@ -1,86 +1,86 @@ -FROM ubuntu:latest AS downloader -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils \ - && apt-get install -y \ - curl \ - bzip2 \ - unzip \ - wget - -RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted - -ARG CMAKE_VERSION=3.27.6 -ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh -RUN wget $CMAKE_SCRIPT \ - -q -O /tmp/dc-downloads/cmake-install.sh \ - && chmod u+x /tmp/dc-downloads/cmake-install.sh \ - && mkdir -p /tmp/dc-extracted/cmake \ - && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ - && rm /tmp/dc-downloads/cmake-install.sh - -FROM python:3.11 AS devcontainer - -# Avoid warnings by switching to noninteractive -ENV DEBIAN_FRONTEND=noninteractive - -# You can set up non-root user -# ARG USERNAME=vscode -# ARG USER_UID=1000 -# ARG USER_GID=$USER_UID - -# Configure apt and install packages -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ - && apt-get install -y \ - git \ - git-lfs \ - clang-format \ - curl \ - ninja-build \ - srecord \ - nodejs \ - libffi-dev - -# Create needed directories -RUN mkdir -p /usr/local/bin/gcc - -# Clone fatfs -RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs - -# Clone ESP-IDF -RUN git clone --branch v5.1.4 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf - -# Creating static link python for pyhton3 -RUN ln -fs /usr/bin/python3 /usr/bin/python \ - && pip3 install pyserial - -# copy from our other container -COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake - -ENV PATH=/usr/bin/cmake/bin:${PATH} - -# Install ESP-IDF -ENV IDF_PATH=/sources/esp-idf -ENV ESP_PATCH_VER=esp-12.2.0_20230208 -# This is now taking care in the following line -# RUN python -m pip install -r $IDF_PATH/requirements.txt -RUN $IDF_PATH/install.sh - -ENV PATH=/root/.espressif/python_env/idf5.1_py3.11_env/bin:$PATH:\ -$IDF_PATH/components/esptool_py/esptool:\ -$IDF_PATH/components/espcoredump:\ -$IDF_PATH/components/partition_table/:\ -$IDF_PATH/tools/:\ -$IDF_PATH/components/app_update:\ -/root/.espressif/tools/xtensa-esp32-elf/$ESP_PATCH_VER/xtensa-esp32-elf/bin:\ -/root/.espressif/tools/xtensa-esp32s2-elf/$ESP_PATCH_VER/xtensa-esp32s2-elf/bin:\ -/root/.espressif/tools/xtensa-esp32s3-elf/$ESP_PATCH_VER/xtensa-esp32s3-elf/bin:\ -/root/.espressif/tools/riscv32-esp-elf/$ESP_PATCH_VER/riscv32-esp-elf/bin - -# Clean up downloaded files -RUN apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND=dialog +FROM ubuntu:latest AS downloader +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils \ + && apt-get install -y \ + curl \ + bzip2 \ + unzip \ + wget + +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted + +ARG CMAKE_VERSION=3.27.6 +ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh +RUN wget $CMAKE_SCRIPT \ + -q -O /tmp/dc-downloads/cmake-install.sh \ + && chmod u+x /tmp/dc-downloads/cmake-install.sh \ + && mkdir -p /tmp/dc-extracted/cmake \ + && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ + && rm /tmp/dc-downloads/cmake-install.sh + +FROM python:3.11 AS devcontainer + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# You can set up non-root user +# ARG USERNAME=vscode +# ARG USER_UID=1000 +# ARG USER_GID=$USER_UID + +# Configure apt and install packages +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ + && apt-get install -y \ + git \ + git-lfs \ + clang-format \ + curl \ + ninja-build \ + srecord \ + nodejs \ + libffi-dev + +# Create needed directories +RUN mkdir -p /usr/local/bin/gcc + +# Clone fatfs +RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs + +# Clone ESP-IDF +RUN git clone --branch v5.2.2 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf + +# Creating static link python for pyhton3 +RUN ln -fs /usr/bin/python3 /usr/bin/python \ + && pip3 install pyserial + +# copy from our other container +COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake + +ENV PATH=/usr/bin/cmake/bin:${PATH} + +# Install ESP-IDF +ENV IDF_PATH=/sources/esp-idf +ENV ESP_PATCH_VER=esp-13.2.0_20230928 +# This is now taking care in the following line +# RUN python -m pip install -r $IDF_PATH/requirements.txt +RUN $IDF_PATH/install.sh + +ENV PATH=/root/.espressif/python_env/idf5.1_py3.11_env/bin:$PATH:\ +$IDF_PATH/components/esptool_py/esptool:\ +$IDF_PATH/components/espcoredump:\ +$IDF_PATH/components/partition_table/:\ +$IDF_PATH/tools/:\ +$IDF_PATH/components/app_update:\ +/root/.espressif/tools/xtensa-esp32-elf/$ESP_PATCH_VER/xtensa-esp32-elf/bin:\ +/root/.espressif/tools/xtensa-esp32s2-elf/$ESP_PATCH_VER/xtensa-esp32s2-elf/bin:\ +/root/.espressif/tools/xtensa-esp32s3-elf/$ESP_PATCH_VER/xtensa-esp32s3-elf/bin:\ +/root/.espressif/tools/riscv32-esp-elf/$ESP_PATCH_VER/riscv32-esp-elf/bin + +# Clean up downloaded files +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog diff --git a/CMake/Modules/FindESP32_IDF.cmake b/CMake/Modules/FindESP32_IDF.cmake index 6a3f7dc870..732ba96630 100644 --- a/CMake/Modules/FindESP32_IDF.cmake +++ b/CMake/Modules/FindESP32_IDF.cmake @@ -114,8 +114,10 @@ include(${TARGET_SERIES}_GCC_options) # freertos # ############ +list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/config/include) +list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/config/include/freertos) +list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/config/${ESP32_CPU_TYPE}/include) list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/FreeRTOS-Kernel/include) -list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/include/esp_additions) list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/esp_additions/include) list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/esp_additions/include/freertos) list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/freertos/esp_additions/arch/${ESP32_CPU_TYPE}/include) diff --git a/CMake/binutils.ESP32.cmake b/CMake/binutils.ESP32.cmake index 39a008c652..8cc2b6b879 100644 --- a/CMake/binutils.ESP32.cmake +++ b/CMake/binutils.ESP32.cmake @@ -707,10 +707,6 @@ macro(nf_add_idf_as_library) if(ESP32_USB_CDC) - #idf_build_set_property(IDF_COMPONENT_MANAGER 1) - #idf_build_set_property(__COMPONENT_MANAGER_INTERFACE_VERSION 2) - #message(STATUS "Support for component manager enabled") - # add IDF components specific to ESP32S2/S3 series # They have to be added in a specific order so they compile/link ok list(APPEND IDF_COMPONENTS_TO_ADD tinyusb) diff --git a/azure-pipelines-nightly.yml b/azure-pipelines-nightly.yml index c77021ae2a..f2f698509e 100644 --- a/azure-pipelines-nightly.yml +++ b/azure-pipelines-nightly.yml @@ -17,7 +17,7 @@ resources: type: github name: espressif/esp-idf endpoint: nanoframework - ref: refs/tags/v5.1.4 + ref: refs/tags/v5.2.2 # scheduled build # the schedule is defined at the AZDO web interface because of inconsistencies with time zones @@ -293,7 +293,7 @@ jobs: variables: DOTNET_NOLOGO: true # creates a counter and assigns it to the revision variable - REVISION: $[counter('STM32_1_11_0_versioncounter', 0)] + REVISION: $[counter('STM32_1_12_0_versioncounter', 0)] HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] TargetPlatform: "stm32" @@ -544,7 +544,7 @@ jobs: variables: DOTNET_NOLOGO: true # creates a counter and assigns it to the revision variable - REVISION: $[counter('ESP32_1_11_0_versioncounter', 0)] + REVISION: $[counter('ESP32_1_12_0_versioncounter', 0)] IDF_PATH: "D:/a/1/s/esp-idf" PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip TargetPlatform: "esp32" @@ -620,7 +620,7 @@ jobs: variables: DOTNET_NOLOGO: true # creates a counter and assigns it to the revision variable - REVISION: $[counter('TI_1_11_0_versioncounter', 0)] + REVISION: $[counter('TI_1_12_0_versioncounter', 0)] HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] TargetPlatform: "ti_simplelink" @@ -671,7 +671,7 @@ jobs: variables: # creates a counter and assigns it to the revision variable - REVISION: $[counter('AZURERTOS_1_11_0_versioncounter', 0)] + REVISION: $[counter('AZURERTOS_1_12_0_versioncounter', 0)] HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] TargetPlatform: "azure_rtos" diff --git a/azure-pipelines-templates/build-espressif-esp32-targets.yml b/azure-pipelines-templates/build-espressif-esp32-targets.yml index 59e30f60da..f90bac9940 100644 --- a/azure-pipelines-templates/build-espressif-esp32-targets.yml +++ b/azure-pipelines-templates/build-espressif-esp32-targets.yml @@ -1,106 +1,106 @@ -# Copyright (c) .NET Foundation and Contributors -# See LICENSE file in the project root for full license information. - -parameters: - - name: repoDirectory - type: string - default: $(Build.SourcesDirectory)\nf-interpreter - - name: partitionsDirectory - type: string - default: $(Build.SourcesDirectory)\nf-interpreter\targets\ESP32\_IDF\$(IDF_Target) - -steps: - - template: setup-cmake-user-presets.yml - parameters: - repoDirectory: ${{ parameters.repoDirectory }} - - - task: Cache@2 - displayName: Cache IDF components - inputs: - key: 'esp-idf-components-cache | 0' - path: $(Agent.BuildDirectory)/s/esp-idf/components - cacheHitVar: ESP32_COMPONENTS_RESTORED - - - task: CMake@1 - condition: succeeded() - displayName: Setup build with CMake - inputs: - cmakeArgs: "--preset $(CMakePreset) -DESP32_IDF_PATH=$(IDF_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$(TARGET_BUILD_COUNTER) -DTARGET_NAME=$(TargetPublishName) $(BuildOptions)" - workingDirectory: ${{ parameters.repoDirectory }} - - - task: CMake@1 - displayName: Build with CMake - condition: succeeded() - inputs: - cmakeArgs: "--build --preset $(CMakePreset) --target all --config MinSizeRel" - workingDirectory: ${{ parameters.repoDirectory }} - - # because of permission issues (the python script isn't allowed to write on the output folder) - # we need to perform these steps by calling directly the python scripts - - # 16MB partition table it's generated for ESP32 and ESP32_C3 only - - task: PythonScript@0 - condition: >- - and( - succeeded(), - or( - eq(variables['TargetSeries'], 'esp32'), - eq(variables['TargetSeries'], 'esp32c6'), - eq(variables['TargetSeries'], 'esp32s2'), - eq(variables['TargetSeries'], 'esp32s3') - ) - ) - displayName: Generate ESP32 Partition tables for 16MB flash - inputs: - scriptSource: "filePath" - scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' - arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_16mb.csv ${{ parameters.repoDirectory }}\build\partitions_16mb.bin' - - - task: PythonScript@0 - condition: >- - and( - succeeded(), - or( - eq(variables['TargetSeries'], 'esp32'), - eq(variables['TargetSeries'], 'esp32s2') - ) - ) - displayName: Generate ESP32 Partition tables for 8MB flash - inputs: - scriptSource: "filePath" - scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' - arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_8mb.csv ${{ parameters.repoDirectory }}\build\partitions_8mb.bin' - - - task: PythonScript@0 - condition: succeeded() - displayName: Generate ESP32 Partition tables for 4MB flash - inputs: - scriptSource: "filePath" - scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' - arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_4mb.csv ${{ parameters.repoDirectory }}\build\partitions_4mb.bin' - - - task: PythonScript@0 - condition: >- - and( - succeeded(), - or( - eq(variables['TargetSeries'], 'esp32'), - eq(variables['TargetSeries'], 'esp32c3') - ) - ) - displayName: Generate ESP32 Partition tables for 2MB flash - inputs: - scriptSource: "filePath" - scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' - arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_2mb.csv ${{ parameters.repoDirectory }}\build\partitions_2mb.bin' - - - task: CopyFiles@2 - condition: succeeded() - displayName: Copy CSV partition files - inputs: - sourceFolder: ${{ parameters.partitionsDirectory }} - Contents: | - *.csv - TargetFolder: ${{ parameters.repoDirectory }}\build - flattenFolders: false - ignoreMakeDirErrors: true +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +parameters: + - name: repoDirectory + type: string + default: $(Build.SourcesDirectory)\nf-interpreter + - name: partitionsDirectory + type: string + default: $(Build.SourcesDirectory)\nf-interpreter\targets\ESP32\_IDF\$(IDF_Target) + +steps: + - template: setup-cmake-user-presets.yml + parameters: + repoDirectory: ${{ parameters.repoDirectory }} + + - task: Cache@2 + displayName: Cache IDF components + inputs: + key: 'esp-idf-components-cache | 5_2_2' + path: $(Agent.BuildDirectory)/s/esp-idf/components + cacheHitVar: ESP32_COMPONENTS_RESTORED + + - task: CMake@1 + condition: succeeded() + displayName: Setup build with CMake + inputs: + cmakeArgs: "--preset $(CMakePreset) -DESP32_IDF_PATH=$(IDF_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$(TARGET_BUILD_COUNTER) -DTARGET_NAME=$(TargetPublishName) $(BuildOptions)" + workingDirectory: ${{ parameters.repoDirectory }} + + - task: CMake@1 + displayName: Build with CMake + condition: succeeded() + inputs: + cmakeArgs: "--build --preset $(CMakePreset) --target all --config MinSizeRel" + workingDirectory: ${{ parameters.repoDirectory }} + + # because of permission issues (the python script isn't allowed to write on the output folder) + # we need to perform these steps by calling directly the python scripts + + # 16MB partition table it's generated for ESP32 and ESP32_C3 only + - task: PythonScript@0 + condition: >- + and( + succeeded(), + or( + eq(variables['TargetSeries'], 'esp32'), + eq(variables['TargetSeries'], 'esp32c6'), + eq(variables['TargetSeries'], 'esp32s2'), + eq(variables['TargetSeries'], 'esp32s3') + ) + ) + displayName: Generate ESP32 Partition tables for 16MB flash + inputs: + scriptSource: "filePath" + scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' + arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_16mb.csv ${{ parameters.repoDirectory }}\build\partitions_16mb.bin' + + - task: PythonScript@0 + condition: >- + and( + succeeded(), + or( + eq(variables['TargetSeries'], 'esp32'), + eq(variables['TargetSeries'], 'esp32s2') + ) + ) + displayName: Generate ESP32 Partition tables for 8MB flash + inputs: + scriptSource: "filePath" + scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' + arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_8mb.csv ${{ parameters.repoDirectory }}\build\partitions_8mb.bin' + + - task: PythonScript@0 + condition: succeeded() + displayName: Generate ESP32 Partition tables for 4MB flash + inputs: + scriptSource: "filePath" + scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' + arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_4mb.csv ${{ parameters.repoDirectory }}\build\partitions_4mb.bin' + + - task: PythonScript@0 + condition: >- + and( + succeeded(), + or( + eq(variables['TargetSeries'], 'esp32'), + eq(variables['TargetSeries'], 'esp32c3') + ) + ) + displayName: Generate ESP32 Partition tables for 2MB flash + inputs: + scriptSource: "filePath" + scriptPath: '$(IDF_PATH)\components\partition_table\gen_esp32part.py' + arguments: '--verify ${{ parameters.partitionsDirectory }}\partitions_nanoclr_2mb.csv ${{ parameters.repoDirectory }}\build\partitions_2mb.bin' + + - task: CopyFiles@2 + condition: succeeded() + displayName: Copy CSV partition files + inputs: + sourceFolder: ${{ parameters.partitionsDirectory }} + Contents: | + *.csv + TargetFolder: ${{ parameters.repoDirectory }}\build + flattenFolders: false + ignoreMakeDirErrors: true diff --git a/azure-pipelines-templates/download-install-esp32-build-components.yml b/azure-pipelines-templates/download-install-esp32-build-components.yml index de549d5d44..3dcc49d697 100644 --- a/azure-pipelines-templates/download-install-esp32-build-components.yml +++ b/azure-pipelines-templates/download-install-esp32-build-components.yml @@ -6,8 +6,8 @@ steps: - task: Cache@2 displayName: Cache ESP32 tools inputs: - key: "esp32_tools | 5_1_4" - restoreKeys: 5_1_4 + key: "esp32_tools | 5_2_2" + restoreKeys: 5_2_2 path: $(UserProfile)\.espressif\tools cacheHitVar: ESP32_TOOLS_CACHE_RESTORED diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1fd6b880d3..d73bde0450 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,1489 +1,1489 @@ -# Copyright (c) .NET Foundation and Contributors -# See LICENSE file in the project root for full license information. - -trigger: - branches: - include: - - main - - develop* - - release-* - - refs/tags/* - paths: - exclude: - - .clang-format - - .github_changelog_generator - - .gitignore - - .typo-ci.yml - - build.ps1 - - CHANGELOG.md - - CMakeSettings.json - - CMakeSettings.SAMPLE.json - - LICENSE.md - - nf.props - - nfcore.vssettings - - README.md - - README.zh-cn.md - - RunCmd.bat - - startocd.bat - - .github/* - - .devcontainer/* - - .vscode/* - - .vs/* - - assets/* - - config/* - - install-scripts/* - - VisualStudioDevelopment/* - -pr: - autoCancel: true - -# add nf-tools repo to resources (for Azure Pipelines templates) -resources: - repositories: - - repository: templates - type: github - name: nanoframework/nf-tools - endpoint: nanoframework - - repository: esp32_idf - type: github - name: espressif/esp-idf - endpoint: nanoframework - ref: 'refs/tags/v5.1.4' - - repository: mscorlib - type: github - name: nanoframework/CoreLibrary - endpoint: nanoframework - - repository: littlefs - type: github - name: littlefs-project/littlefs - endpoint: nanoframework - ref: refs/tags/v2.9.3 - -jobs: - ############################## - - job: Check_Build_Options - pool: - vmImage: "windows-latest" - - variables: - DOTNET_NOLOGO: true - - steps: - - checkout: self - fetchDepth: 1 - - # get commit message - - powershell: | - - # set default values - echo "##vso[task.setvariable variable=RUN_MSCORLIB_TESTS;isOutput=true]false" - - if($env:StartReleaseCandidate -like "true") - { - # this is a release prep so NO build - echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true" - - Write-Host "##[command] Release preparation, skipping build." - } - else - { - # get commit details, if this is a PR - if($env:System_PullRequest_PullRequestId -ne $null) - { - Write-Host "##[command] **This is a PR build**" - - $commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -ContentType "application/json" -Method GET - - if( ($commit.commit.author.name -eq "nfbot") -and ($commit.commit.message -like "*[version update]*") ) - { - echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true" - } - else - { - echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false" - } - - # check if Unit Tests for mscorlib should be run - if($commit.commit.message -like "*[run mscorlib tests]*") - { - echo "##vso[task.setvariable variable=RUN_MSCORLIB_TESTS;isOutput=true]true" - } - - } - else - { - Write-Host "##[command] **build for other reasons**" - - echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false" - } - } - - name: BuildOptions - displayName: Get build options - - # check what changed - - powershell: | - git config --global user.email "nfbot" - git config --global user.name "nanoframework@outlook.com" - - $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$(GitHubToken)")))" - - if($env:StartReleaseCandidate -like "true") - { - # this is a release prep so NO build - } - elseif($env:Build_Reason -eq "Manual") - { - # this is a manual build, no need to check anything - Write-host "##[command] Manual build" - } - else - { - # check if this build was triggered by the pipeline itself - if($env:Build_Reason -eq "Manual") - { - # this is a manual build, no need to check anything - Write-host "##[command] Manual build" - } - if($env:System_PullRequest_PullRequestId -ne $null) - { - # get files changed in PR, if this is a PR - $commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/pulls/$env:System_PullRequest_PullRequestNumber/files" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET - - # filter removed files - $files = $commit.where{$_.status -ne 'removed'} - } - else - { - # get files changed in the commit, if this is NOT a PR - $commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET - - # filter removed files - $files = $commit.files.where{$_.status -ne 'removed'} - } - - # get file names only - $files = $files | % {$_.filename} - - Write-host "##[group] Files changed:" - $files | % { Write-host $_ } - Write-host "##[endgroup]" - - # set default values - echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_FREERTOS;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_AZURERTOS;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_WIN32;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_NANOCLR_CLI;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]false" - - if( - (($files.where{$_.Contains('/')}).Count -eq 0) -Or - (($files.where{$_.StartsWith('azure-pipelines-templates')}).Count -gt 0) -Or - (($files.where{$_.StartsWith('CMake')}).Count -gt 0) -Or - (($files.where{$_.StartsWith('src')}).Count -gt 0) - ) - { - # files at: - # - repo root - # - azure-pipelines-templates - # - CMake - # - src - - echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]true" - - Write-host "##[command] Building ALL targets" - } - - if( ($files.where{$_.Contains('targets/ChibiOS')}).Count -gt 0) - { - # files at ChibiOS folder - echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true" - - Write-host "##[command] Building ChibiOS targets" - } - - if( ($files.where{$_.Contains('targets/FreeRTOS')}).Count -gt 0) - { - # files at FreeRTOS folder - echo "##vso[task.setvariable variable=BUILD_FREERTOS;isOutput=true]true" - - Write-host "##[command] Building FreeRTOS targets" - } - - if( ($files.where{$_.Contains('targets/ESP32')}).Count -gt 0) - { - # files at ESP32 folder - echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]true" - - Write-host "##[command] Building ESP32 targets" - } - - if( ($files.where{$_.Contains('targets/TI_SimpleLink')}).Count -gt 0) - { - # files at TI_SimpleLink folder - echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]true" - - Write-host "##[command] Building TI SimpleLink targets" - } - - if( ($files.where{$_.Contains('targets/AzureRTOS')}).Count -gt 0) - { - # files at AzureRTOS folder - echo "##vso[task.setvariable variable=BUILD_AZURERTOS;isOutput=true]true" - - Write-host "##[command] Building Azure RTOS targets" - } - - if( - (($files.where{$_.Contains('targets/netcore/nanoFramework.nanoCLR')}).Count -gt 0) -Or - (($files.where{$_.Contains('targets/netcore/nanoCLR.sln')}).Count -gt 0) -Or - (($files.where{$_.Contains('targets/netcore/littlefs')}).Count -gt 0) -Or - (($files.where{$_.Contains('targets/win32')}).Count -gt 0) - ) - { - # files at win32 or netcore folders - echo "##vso[task.setvariable variable=BUILD_WIN32;isOutput=true]true" - - Write-host "##[command] Building nanoCLR target" - } - - if( - (($files.where{$_.Contains('targets/netcore/nanoFramework.nanoCLR.CLI')}).Count -gt 0) -Or - (($files.where{$_.Contains('targets/netcore/nanoCLR.sln')}).Count -gt 0) -Or - (($files.where{$_.Contains('targets/netcore/nanoFramework.nanoCLR.Host')}).Count -gt 0) - ) - { - # files at nanoCLR CLI or Host folders - echo "##vso[task.setvariable variable=BUILD_NANOCLR_CLI;isOutput=true]true" - - Write-host "##[command] Building nanoCLR CLI target" - } - - } - - name: TargetsToBuild - displayName: Get targets to build - - - task: DotNetCoreCLI@2 - condition: eq( variables['StartReleaseCandidate'], true ) - displayName: Install NBGV tool - inputs: - command: custom - custom: tool - arguments: install -g nbgv - - - powershell: | - - # compute authorization header in format "AUTHORIZATION: basic 'encoded token'" - # 'encoded token' is the Base64 of the string "nfbot:personal-token" - $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))" - - cd "$env:Agent_TempDirectory" > $null - - git init "$env:Agent_TempDirectory\repo" - cd repo > $null - git remote add origin "$env:Build_Repository_Uri" - git config --global gc.auto 0 - git config --global user.name nfbot - git config --global user.email nanoframework@outlook.com - git config --global core.autocrlf true - git -c http.extraheader="AUTHORIZATION: $auth" fetch --progress origin - - git checkout develop - - # prepare release and capture output - $release = nbgv prepare-release - - # push all changes to github - git -c http.extraheader="AUTHORIZATION: $auth" push --all origin - - # get release branch name - $branch = $release.Split(' ')[0] - - # start PR for release - $prRequestBody = @{title="Release $branch";body="";head="$branch";base="main"} | ConvertTo-Json - $githubApiEndpoint = "https://api.github.com/repos/$env:Build_Repository_Name/pulls" - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - - $headers = @{} - $headers.Add("Authorization","$auth") - $headers.Add("Accept","application/vnd.github.symmetra-preview+json") - - try - { - $result = Invoke-RestMethod -Method Post -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Uri $githubApiEndpoint -Header $headers -ContentType "application/json" -Body $prRequestBody - 'Started PR for new release...' | Write-Host -NoNewline - '##[error] OK' | Write-Host -ForegroundColor Green - } - catch - { - $result = $_.Exception.Response.GetResponseStream() - $reader = New-Object System.IO.StreamReader($result) - $reader.BaseStream.Position = 0 - $reader.DiscardBufferedData() - $responseBody = $reader.ReadToEnd(); - - "##[error] Error starting PR: $responseBody" | Write-Host -ForegroundColor Red - } - - condition: eq( variables['StartReleaseCandidate'], true ) - displayName: NBGV prepare release - - ############################## - - job: Check_Code_Style - condition: >- - and( - ne(dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ESP32'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_FREERTOS'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_AZURERTOS'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_WIN32'], true) - ) - ) - - dependsOn: - - Check_Build_Options - - pool: - vmImage: "windows-latest" - - steps: - - checkout: self - fetchDepth: 1 - condition: ne(variables['System.PullRequest.PullRequestId'], '') - - - template: azure-pipelines-templates/download-install-llvm.yml - - template: azure-pipelines-templates/check-code-style.yml - - ################ - # STM32 - - job: Build_STM32_targets - condition: >- - or( - and( - succeeded('Check_Code_Style'), - ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true) - ) - ), - and( - eq(variables['Build.Reason'], 'Manual'), - or( - eq(variables['BUILD_ALL__'], 'true'), - eq(variables['BUILD_CHIBIOS__'], 'true') - ) - ) - ) - - dependsOn: - - Check_Build_Options - - Check_Code_Style - - pool: - vmImage: "windows-latest" - - strategy: - matrix: - ST_STM32F429I_DISCOVERY: - TargetBoard: ST_STM32F429I_DISCOVERY - TargetSeries: "stm32f4xx" - BuildOptions: - NeedsDFU: false - NeedsSRECORD: false - CMakePreset: ST_STM32F429I_DISCOVERY - - ST_STM32F769I_DISCOVERY: - TargetBoard: ST_STM32F769I_DISCOVERY - TargetSeries: "stm32f7xx" - BuildOptions: - NeedsDFU: false - NeedsSRECORD: true - CMakePreset: ST_STM32F769I_DISCOVERY - - variables: - DOTNET_NOLOGO: true - # creates a counter and assigns it to the revision variable - REVISION: $[counter('STM32_1_11_0_versioncounter', 0)] - HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] - TargetPlatform: "stm32" - - steps: - - template: azure-pipelines-templates/build-preparations.yml - - template: azure-pipelines-templates/nb-gitversioning.yml - - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml - - template: azure-pipelines-templates/download-install-ninja.yml - - template: azure-pipelines-templates/download-srecord.yml - - template: azure-pipelines-templates/download-hexdfu.yml - - template: azure-pipelines-templates/build-chibios-stm32-targets.yml - - template: azure-pipelines-templates/pack-publish-artifacts.yml - - template: azure-pipelines-templates/publish-cloudsmith.yml - - template: azure-pipelines-templates/pack-publish-managed-helpers.yml - - ################# - # ESP32 targets - - job: Build_ESP32_targets - condition: >- - or( - and( - succeeded('Check_Code_Style'), - ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ESP32'], true) - ) - ), - and( - eq(variables['Build.Reason'], 'Manual'), - or( - eq(variables['BUILD_ALL__'], 'true'), - eq(variables['BUILD_ESP32__'], 'true') - ) - ) - ) - - dependsOn: - - Check_Build_Options - - Check_Code_Style - - pool: - vmImage: "windows-latest" - - # there is only a single ESP32 target, but this is already config as a matrix to make it easy to add new ones - strategy: - matrix: - ESP32_PSRAM_REV0: - TargetBoard: ESP32 - TargetSeries: "esp32" - BuildOptions: - IDF_Target: esp32 - TargetName: ESP32 - PackageName: ESP32_PSRAM_REV0 - CMakePreset: ESP32_PSRAM_REV0 - - ESP32_BLE_REV0: - TargetBoard: ESP32 - TargetSeries: "esp32" - BuildOptions: - IDF_Target: esp32 - TargetName: ESP32 - PackageName: ESP32_BLE_REV0 - CMakePreset: ESP32_BLE_REV0 - - ESP_WROVER_KIT: - TargetBoard: ESP32 - TargetSeries: "esp32" - BuildOptions: - IDF_Target: esp32 - TargetName: ESP_WROVER_KIT - PackageName: ESP_WROVER_KIT - CMakePreset: ESP_WROVER_KIT - - ESP32_LILYGO: - TargetBoard: ESP32 - TargetSeries: "esp32" - BuildOptions: - IDF_Target: esp32 - TargetName: ESP32_LILYGO - PackageName: ESP32_LILYGO - CMakePreset: ESP32_LILYGO - - FEATHER_S2: - TargetBoard: ESP32_S2 - TargetSeries: "esp32_s2" - BuildOptions: - IDF_Target: esp32s2 - TargetName: FEATHER_S2 - PackageName: FEATHER_S2 - CMakePreset: FEATHER_S2 - - ESP32_C3: - TargetBoard: ESP32_C3 - TargetSeries: "esp32c3" - BuildOptions: - IDF_Target: esp32c3 - TargetName: ESP32_C3 - PackageName: ESP32_C3 - CMakePreset: ESP32_C3 - - ESP32_C6_THREAD: - TargetBoard: ESP32_C6 - TargetSeries: "esp32c6" - BuildOptions: - IDF_Target: esp32c6 - TargetName: ESP32_C6_THREAD - PackageName: ESP32_C6_THREAD - CMakePreset: ESP32_C6_THREAD - - ESP32_H2_THREAD: - TargetBoard: ESP32_H2 - TargetSeries: "esp32h2" - BuildOptions: - IDF_Target: esp32h2 - TargetName: ESP32_H2_THREAD - PackageName: ESP32_H2_THREAD - CMakePreset: ESP32_H2_THREAD - - ESP32_S3: - TargetBoard: ESP32_S3 - TargetSeries: "esp32s3" - BuildOptions: - IDF_Target: esp32s3 - TargetName: ESP32_S3 - PackageName: ESP32_S3 - CMakePreset: ESP32_S3 - - ESP32_S3_ALL: - TargetBoard: ESP32_S3 - TargetSeries: "esp32s3" - BuildOptions: - IDF_Target: esp32s3 - TargetName: ESP32_S3_ALL - PackageName: ESP32_S3_ALL - CMakePreset: ESP32_S3_ALL - - ESP32_ETHERNET_KIT_1.2: - TargetBoard: ESP32 - TargetSeries: "esp32" - BuildOptions: - IDF_Target: esp32 - TargetName: ESP32_ETHERNET_KIT_1.2 - PackageName: ESP32_ETHERNET_KIT_1.2 - CMakePreset: ESP32_ETHERNET_KIT_1.2 - - variables: - DOTNET_NOLOGO: true - # creates a counter and assigns it to the revision variable - REVISION: $[counter('ESP32_1_11_0_versioncounter', 0)] - IDF_PATH: "D:/a/1/s/esp-idf" - PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip - TargetPlatform: "esp32" - - steps: - - checkout: self - - checkout: esp32_idf - fetchDepth: 1 - - - template: azure-pipelines-templates/build-preparations.yml - parameters: - repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' - - template: azure-pipelines-templates/nb-gitversioning.yml - parameters: - repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' - - template: azure-pipelines-templates/download-install-esp32-build-components.yml - - template: azure-pipelines-templates/download-install-ninja.yml - parameters: - repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' - - template: azure-pipelines-templates/build-espressif-esp32-targets.yml - - - task: CopyFiles@2 - condition: succeeded() - displayName: Copying bootloader - inputs: - sourceFolder: '$(Build.SourcesDirectory)\nf-interpreter\build\bootloader' - Contents: | - bootloader.bin - TargetFolder: '$(Build.ArtifactStagingDirectory)\$(TargetPublishName)' - flattenFolders: true - ignoreMakeDirErrors: true - - - template: azure-pipelines-templates/copy-sdkconfig.yml - - template: azure-pipelines-templates/pack-publish-artifacts.yml - parameters: - buildDirectory: '$(Build.SourcesDirectory)\nf-interpreter\build' - - template: azure-pipelines-templates/publish-cloudsmith.yml - - template: azure-pipelines-templates/publish-sdkconfig.yml - - ################# - # NXP - - job: Build_NXP_targets - condition: >- - or( - and( - succeeded('Check_Code_Style'), - ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_FREERTOS'], true) - ) - ), - and( - eq(variables['Build.Reason'], 'Manual'), - or( - eq(variables['BUILD_ALL__'], 'true'), - eq(variables['BUILD_NXP__'], 'true') - ) - ) - ) - - dependsOn: - - Check_Build_Options - - Check_Code_Style - - pool: - vmImage: "windows-latest" - - strategy: - matrix: - NXP_MIMXRT1060_EVK: - TargetBoard: NXP_MIMXRT1060_EVK - TargetSeries: "imxrt10xx" - BuildOptions: - NeedsSRECORD: true - CMakePreset: NXP_MIMXRT1060_EVK - - variables: - DOTNET_NOLOGO: true - # creates a counter and assigns it to the revision variable - REVISION: $[counter('NXP_1_11_0_versioncounter', 0)] - GIT_LFS_SKIP_SMUDGE: 1 - TargetPlatform: "freertos" - - steps: - - template: azure-pipelines-templates/build-preparations.yml - - template: azure-pipelines-templates/nb-gitversioning.yml - - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml - - template: azure-pipelines-templates/download-install-ninja.yml - - template: azure-pipelines-templates/download-srecord.yml - - template: azure-pipelines-templates/build-freertos-nxp-targets.yml - - template: azure-pipelines-templates/pack-publish-artifacts.yml - - template: azure-pipelines-templates/publish-cloudsmith.yml - - template: azure-pipelines-templates/pack-publish-managed-helpers.yml - - ################# - # TI SimpleLink - - job: Build_TI_SimpleLink_targets - condition: >- - or( - and( - succeeded('Check_Code_Style'), - ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true) - ) - ), - and( - eq(variables['Build.Reason'], 'Manual'), - or( - eq(variables['BUILD_ALL__'], 'true'), - eq(variables['BUILD_TI__'], 'true') - ) - ) - ) - - dependsOn: - - Check_Build_Options - - Check_Code_Style - - pool: - vmImage: "windows-latest" - - strategy: - matrix: - # disabled: waiting to update SDK to latest version with Sys Config - # TI_CC3220SF_LAUNCHXL: - # TargetBoard: TI_CC3220SF_LAUNCHXL - # TargetSeries: 'cc32xx' - # BuildOptions: >- - # -DTARGET_SERIES=CC32xx - # -DRTOS=TI_SimpleLink - # -DSUPPORT_ANY_BASE_CONVERSION=OFF - # -DNF_FEATURE_DEBUGGER=ON - # -DNF_FEATURE_RTC=ON - # -DNF_FEATURE_WATCHDOG=OFF - # -DNF_FEATURE_HAS_CONFIG_BLOCK=ON - # -DAPI_System.Device.Gpio=ON - # -DAPI_System.Device.Spi=ON - # -DAPI_System.Device.I2c=ON - # -DAPI_System.Device.Pwm=ON - # -DAPI_System.Device.Adc=ON - # -DAPI_System.Net=ON - # -DAPI_nanoFramework.System.Collections=ON - # -DAPI_nanoFramework.System.Text=ON - - TI_CC1352R1_LAUNCHXL_915: - TargetBoard: TI_CC1352R1_LAUNCHXL - PackageName: TI_CC1352R1_LAUNCHXL_915 - TargetSeries: "CC13X2" - BuildOptions: >- - -DRADIO_FREQUENCY=915 - CMakePreset: TI_CC1352R1_LAUNCHXL - - variables: - DOTNET_NOLOGO: true - # creates a counter and assigns it to the revision variable - REVISION: $[counter('TI_1_11_0_versioncounter', 0)] - HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] - TargetPlatform: "ti_simplelink" - - steps: - - template: azure-pipelines-templates/build-preparations.yml - - template: azure-pipelines-templates/nb-gitversioning.yml - - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml - - template: azure-pipelines-templates/download-install-ninja.yml - - template: azure-pipelines-templates/build-ti-simplelink-targets.yml - - template: azure-pipelines-templates/pack-publish-artifacts.yml - - template: azure-pipelines-templates/publish-cloudsmith.yml - - template: azure-pipelines-templates/pack-publish-ti-sl-managed-helpers.yml - - ################# - # Azure RTOS - - job: Build_Azure_RTOS_targets - condition: >- - or( - and( - succeeded('Check_Code_Style'), - ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_AZURERTOS'], true) - ) - ), - and( - eq(variables['Build.Reason'], 'Manual'), - or( - eq(variables['BUILD_ALL__'], 'true'), - eq(variables['BUILD_AZURERTOS__'], 'true') - ) - ) - ) - - dependsOn: - - Check_Build_Options - - Check_Code_Style - - pool: - vmImage: "windows-latest" - - strategy: - matrix: - # ST_B_L475E_IOT01A: - # TargetBoard: ST_B_L475E_IOT01A - # TargetSeries: 'stm32l4xx' - # BuildOptions: - # NeedsDFU: true - # NeedsSRECORD: false - # CMakePreset: ST_B_L475E_IOT01A - - # ORGPAL_PALTHREE: - # TargetBoard: ORGPAL_PALTHREE - # TargetSeries: 'stm32f7xx' - # BuildOptions: - # NeedsDFU: true - # NeedsSRECORD: false - # CMakePreset: ORGPAL_PALTHREE - - SL_STK3701A: - TargetBoard: SL_STK3701A - TargetSeries: "efm32gg11" - BuildOptions: - NeedsDFU: false - NeedsSRECORD: false - CMakePreset: SL_STK3701A - - variables: - # creates a counter and assigns it to the revision variable - REVISION: $[counter('AZURERTOS_1_11_0_versioncounter', 0)] - HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] - TargetPlatform: "azure_rtos" - - steps: - - template: azure-pipelines-templates/build-preparations.yml - - template: azure-pipelines-templates/nb-gitversioning.yml - - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml - - template: azure-pipelines-templates/download-install-ninja.yml - - template: azure-pipelines-templates/download-hexdfu.yml - - template: azure-pipelines-templates/download-srecord.yml - - template: azure-pipelines-templates/build-azurertos-targets.yml - - template: azure-pipelines-templates/pack-publish-artifacts.yml - - template: azure-pipelines-templates/publish-cloudsmith.yml - - template: azure-pipelines-templates/pack-publish-managed-helpers.yml - - ################# - # WIN32 executable - - job: Build_WIN32_nanoCLR - condition: >- - or( - and( - succeeded('Check_Code_Style'), - ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_WIN32'], true) - ) - ), - and( - eq(variables['Build.Reason'], 'Manual'), - or( - eq(variables['BUILD_ALL__'], 'true'), - eq(variables['BUILD_WINDOWS_NANOCLR__'], 'true') - ) - ) - ) - - dependsOn: - - Check_Build_Options - - Check_Code_Style - - pool: - vmImage: "windows-latest" - - variables: - - group: sign-client-credentials - - name: DOTNET_NOLOGO - value: true - # creates a counter and assigns it to the revision variable - - name: REVISION - value: $[counter('WIN32_1_11_0_versioncounter', 0)] - - name: LITTLEFS_PATH - value: "D:/a/1/s/littlefs" - - steps: - - checkout: self - - checkout: littlefs - fetchDepth: 1 - - - template: azure-pipelines-templates/nb-gitversioning.yml - parameters: - repoDirectory: '$(Build.SourcesDirectory)/nf-interpreter' - - - task: PowerShell@2 - displayName: Store CLR DLL revision - name: SetRevision - inputs: - targetType: "inline" - script: | - Write-Host "$("##vso[task.setvariable variable=CLR_REVISION;isOutput=true]")$(REVISION)" - - - task: PowerShell@2 - displayName: Store package version - inputs: - targetType: "inline" - script: | - Write-Host "$("##vso[task.setvariable variable=WINCLR_PACKAGE_VERSION]")$(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$(TARGET_BUILD_COUNTER)" - Write-Host "$("##vso[task.setvariable variable=WINCLR_AssemblyInformationalVersion]")$(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$(TARGET_BUILD_COUNTER)$(NBGV_BuildMetadataFragment)" - - - template: azure-pipelines-templates/install-nuget.yml@templates - - - task: DotNetCoreCLI@2 - displayName: Restore NuGet packages - inputs: - command: restore - restoreArguments: "--locked-mode" - verbosityRestore: minimal - projects: nf-interpreter/targets/netcore/nanoCLR.sln - feedsToUse: select - includeNuGetOrg: true - - - task: VSBuild@1 - displayName: Build WIN32 EXE target - inputs: - solution: "nf-interpreter/targets/win32/nanoCLR.sln" - platform: "x86" - maximumCpuCount: true - msbuildArgs: "/p:PublicRelease=true" - configuration: "Release" - - - task: VSBuild@1 - displayName: Build WIN DLL target - inputs: - solution: "nf-interpreter/targets/netcore/nanoCLR.sln" - platform: "Any CPU" - maximumCpuCount: true - msbuildArgs: "/p:PublicRelease=true" - configuration: "Release" - - - task: DotNetCoreCLI@2 - displayName: Install Sign Client CLI - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], '') - ) - inputs: - command: custom - custom: tool - arguments: install --tool-path . sign --version 0.9.1-beta.23530.1 - - - pwsh: | - .\sign code azure-key-vault ` - "**/nanoFramework.nanoCLR.*" ` - --base-directory "$(Build.SourcesDirectory)/nf-interpreter/build/bin/Release" ` - --publisher-name ".NET nanoFramework" ` - --description "nanoFramework.nanoCLR" ` - --description-url "https://github.com/$env:Build_Repository_Name" ` - --azure-key-vault-tenant-id "$(SignTenantId)" ` - --azure-key-vault-client-id "$(SignClientId)" ` - --azure-key-vault-client-secret "$(SignClientSecret)" ` - --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` - --azure-key-vault-url "$(SignKeyVaultUrl)" ` - --timestamp-url http://timestamp.digicert.com - displayName: Sign nanoCLR assemblies - continueOnError: true - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], '') - ) - - - task: NuGetCommand@2 - condition: succeeded() - displayName: Pack nanoCLR WIN32 - inputs: - command: "custom" - arguments: "pack nf-interpreter/targets/win32/nanoFramework.nanoCLR.Win32.nuspec -Version $(NBGV_NuGetPackageVersion)" - - - task: CopyFiles@2 - condition: succeeded() - displayName: Collecting NuGet packages - inputs: - sourceFolder: $(Build.SourcesDirectory) - Contents: | - **\nanoFramework.nanoCLR.Win32*.nupkg - TargetFolder: "$(Build.ArtifactStagingDirectory)" - flattenFolders: true - ignoreMakeDirErrors: true - - - task: CopyFiles@2 - condition: succeeded() - displayName: Adding nanoCLR WIN32 to deployable artifacts - inputs: - sourceFolder: $(Build.SourcesDirectory) - Contents: | - **\nanoFramework.nanoCLR.exe - TargetFolder: '$(Build.ArtifactStagingDirectory)\WIN32_nanoCLR' - flattenFolders: true - ignoreMakeDirErrors: true - - - task: CopyFiles@2 - condition: succeeded() - displayName: Adding nanoCLR DLL to deployable artifacts - inputs: - sourceFolder: $(Build.SourcesDirectory) - Contents: | - **\nanoFramework.nanoCLR.dll - TargetFolder: '$(Build.ArtifactStagingDirectory)\WIN_DLL_nanoCLR' - flattenFolders: true - ignoreMakeDirErrors: true - - - pwsh: | - .\sign code azure-key-vault ` - "**/*.nupkg" ` - --base-directory "$(Build.ArtifactStagingDirectory)" ` - --publisher-name ".NET nanoFramework" ` - --description "nanoFramework.nanoCLR NuGets" ` - --description-url "https://github.com/$env:Build_Repository_Name" ` - --azure-key-vault-tenant-id "$(SignTenantId)" ` - --azure-key-vault-client-id "$(SignClientId)" ` - --azure-key-vault-client-secret "$(SignClientSecret)" ` - --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` - --azure-key-vault-url "$(SignKeyVaultUrl)" ` - --timestamp-url http://timestamp.digicert.com - displayName: Sign packages - continueOnError: true - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], '') - ) - - # publish artifacts - - task: PublishPipelineArtifact@1 - condition: succeeded() - displayName: Publish deployables artifacts - inputs: - targetPath: "$(Build.ArtifactStagingDirectory)" - artifactName: nanoclr_win32 - artifactType: pipeline - - # push NuGet packages to Azure Artifacts feed (always happens when building from main, except on PR builds) - - task: NuGetCommand@2 - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], ''), - or( - eq(variables['ForceUpload'], true), - eq(variables['Build.SourceBranchName'], 'main') - ) - ) - continueOnError: true - displayName: Push NuGet packages to Azure Artifacts - inputs: - command: push - nuGetFeedType: external - packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" - publishFeedCredentials: "AzureArtifacts-nf-interpreter" - allowPackageConflicts: true - - # push NuGet packages to NuGet (always happens when building from main, except on PR builds) - - task: NuGetCommand@2 - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], ''), - or( - eq(variables['ForceUpload'], true), - eq(variables['Build.SourceBranchName'], 'main') - ) - ) - continueOnError: true - displayName: Push NuGet packages to NuGet - inputs: - command: push - nuGetFeedType: external - allowPackageConflicts: true - packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" - publishFeedCredentials: "NuGet-nf-interpreter" - - - template: azure-pipelines-templates/publish-nanoclr.yml - - ################# - # nanoCLR CLI tool - - job: Build_nanoCLR_CLI - condition: >- - or( - and( - succeeded('Check_Code_Style'), - ne(dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true), - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_NANOCLR_CLI'], true) - ) - ), - and( - eq(variables['Build.Reason'], 'Manual'), - or( - eq(variables['BUILD_ALL__'], 'true'), - eq(variables['BUILD_NANOCLR_CLI__'], 'true') - ) - ) - ) - - dependsOn: - - Check_Build_Options - - Check_Code_Style - - Build_WIN32_nanoCLR - - pool: - vmImage: "windows-latest" - - variables: - - group: sign-client-credentials - - name: DOTNET_NOLOGO - value: true - - name: LITTLEFS_PATH - value: "D:/a/1/s/littlefs" - - name: REVISION - value: $[dependencies.Build_WIN32_nanoCLR.outputs['SetRevision.CLR_REVISION']] - - steps: - - checkout: self - - checkout: littlefs - fetchDepth: 1 - - - template: azure-pipelines-templates/nb-gitversioning.yml - parameters: - repoDirectory: '$(Build.SourcesDirectory)/nf-interpreter' - - - template: azure-pipelines-templates/install-nuget.yml@templates - - - task: DotNetCoreCLI@2 - displayName: Restore NuGet packages - inputs: - command: restore - restoreArguments: "--locked-mode" - verbosityRestore: minimal - projects: "nf-interpreter/targets/netcore/nanoCLR.sln" - feedsToUse: select - includeNuGetOrg: true - - - task: VSBuild@1 - displayName: Build .NET tool - condition: succeeded() - inputs: - solution: "nf-interpreter/targets/netcore/nanoCLR.sln" - platform: "Any CPU" - maximumCpuCount: true - msbuildArgs: "/p:PublicRelease=true" - configuration: "Release" - - - task: DotNetCoreCLI@2 - displayName: Install Sign Client CLI - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], '') - ) - inputs: - command: custom - custom: tool - arguments: install --tool-path . sign --version 0.9.1-beta.23530.1 - - - pwsh: | - .\sign code azure-key-vault ` - "**/nanoFramework.nanoCLR.*" ` - --base-directory "$(Build.SourcesDirectory)/nf-interpreter/build/bin/Release" ` - --publisher-name ".NET nanoFramework" ` - --description "nanoFramework.nanoCLR.CLI" ` - --description-url "https://github.com/$env:Build_Repository_Name" ` - --azure-key-vault-tenant-id "$(SignTenantId)" ` - --azure-key-vault-client-id "$(SignClientId)" ` - --azure-key-vault-client-secret "$(SignClientSecret)" ` - --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` - --azure-key-vault-url "$(SignKeyVaultUrl)" ` - --timestamp-url http://timestamp.digicert.com - displayName: Sign nanoCLR assemblies - continueOnError: true - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], '') - ) - - - task: MSBuild@1 - condition: succeeded() - displayName: Pack nanoCLR CLI - inputs: - solution: "nf-interpreter/targets/netcore/nanoFramework.nanoCLR.CLI/nanoFramework.nanoCLR.CLI.csproj" - platform: "Any CPU" - msbuildArguments: "/p:PublicRelease=true /t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) " - configuration: "Release" - maximumCpuCount: true - - - pwsh: | - .\sign code azure-key-vault ` - "**/*.nupkg" ` - --base-directory "$(Build.ArtifactStagingDirectory)" ` - --publisher-name ".NET nanoFramework" ` - --description "nanoFramework.nanoCLR.CLI NuGet" ` - --description-url "https://github.com/$env:Build_Repository_Name" ` - --azure-key-vault-tenant-id "$(SignTenantId)" ` - --azure-key-vault-client-id "$(SignClientId)" ` - --azure-key-vault-client-secret "$(SignClientSecret)" ` - --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` - --azure-key-vault-url "$(SignKeyVaultUrl)" ` - --timestamp-url http://timestamp.digicert.com - displayName: Sign packages - continueOnError: true - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], '') - ) - - - task: CopyFiles@2 - condition: succeeded() - displayName: Copy nanoclr - inputs: - SourceFolder: "nf-interpreter/build/bin/Release" - Contents: "nanoFramework.nanoCLR.dll" - TargetFolder: "$(Build.ArtifactStagingDirectory)/nanoclr" - - - task: PublishPipelineArtifact@1 - condition: succeeded() - displayName: Publish nanoclr - inputs: - targetPath: "$(Build.ArtifactStagingDirectory)/nanoclr" - artifactName: nanoclr_cli - artifactType: pipeline - - # push NuGet packages to Azure Artifacts feed (always happens when building from main, except on PR builds) - - task: NuGetCommand@2 - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], ''), - or( - eq(variables['ForceUpload'], true), - eq(variables['Build.SourceBranchName'], 'main') - ) - ) - continueOnError: true - displayName: Push NuGet packages to Azure Artifacts - inputs: - command: push - nuGetFeedType: external - packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" - publishFeedCredentials: "AzureArtifacts-nf-interpreter" - allowPackageConflicts: true - - # push NuGet packages to NuGet (always happens when building from main, except on PR builds) - - task: NuGetCommand@2 - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], ''), - or( - eq(variables['ForceUpload'], true), - eq(variables['Build.SourceBranchName'], 'main') - ) - ) - continueOnError: true - displayName: Push NuGet packages to NuGet - inputs: - command: push - nuGetFeedType: external - allowPackageConflicts: true - packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" - publishFeedCredentials: "NuGet-nf-interpreter" - - ######################### - # Run mscorlib Unit Tests - - - job: Run_UnitTests_mscorlib - condition: >- - and( - succeeded('Build_nanoCLR_CLI'), - ne(dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true), - or( - eq(variables['BUILD_NANOCLR_CLI__'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_NANOCLR_CLI'], true), - eq(dependencies.Check_Build_Options.outputs['BuildOptions.RUN_MSCORLIB_TESTS'], true) - ) - ) - - dependsOn: - - Build_nanoCLR_CLI - - pool: - vmImage: "windows-latest" - - variables: - DOTNET_NOLOGO: true - solution: "nanoFramework.CoreLibrary.sln" - buildPlatform: "Any CPU" - buildConfiguration: "Release" - - steps: - - checkout: self - fetchDepth: 1 - - checkout: mscorlib - fetchDepth: 100 - submodules: true - - # Download nanoclr from build artifacts - - task: DownloadBuildArtifacts@1 - inputs: - buildType: "current" - artifactName: "nanoclr_cli" - downloadPath: "$(Agent.TempDirectory)/nanoclr_cli" - - # build mscorlib - - - task: InstallNanoMSBuildComponents@1 - condition: succeeded() - displayName: Install .NET nanoFramework MSBuild components - inputs: - GitHubToken: $(GitHubToken) - - - template: azure-pipelines-templates/install-nuget.yml@templates - - - task: NuGetCommand@2 - condition: succeeded() - displayName: NuGet restore - retryCountOnTaskFailure: 5 - inputs: - restoreSolution: "**/nanoFramework.CoreLibrary.sln" - feedsToUse: select - - - task: VSBuild@1 - condition: succeeded() - inputs: - solution: "**/nanoFramework.CoreLibrary.sln" - platform: "Any CPU" - msbuildArgs: "/p:PublicRelease=true" - configuration: "Release" - msbuildArchitecture: "x64" - maximumCpuCount: true - - # run tests - - template: azure-pipelines-templates/run-unit-tests.yml@templates - parameters: - runUnitTests: true - unitTestRunsettings: '$(System.DefaultWorkingDirectory)\nf-interpreter\targets\netcore\pipeline_tests.runsettings' - packagesDirectory: "$(Build.SourcesDirectory)/CoreLibrary/packages" - - - task: CopyFiles@2 - condition: succeededOrFailed() - displayName: Copy vstest dump files - inputs: - SourceFolder: 'D:\a\_temp\' - Contents: "**/*.dmp" - TargetFolder: "$(Build.ArtifactStagingDirectory)/vstest_dumps" - flattenFolders: true - - - powershell: | - $dumpPath = "$(Build.ArtifactStagingDirectory)/vstest_dumps" - $hasFiles = $false - - if (Test-Path $dumpPath -PathType Container) { - $fileCount = (Get-ChildItem $dumpPath -File | Measure-Object).Count - $hasFiles = $fileCount -gt 0 - } - echo "##vso[task.setvariable variable=hasFiles;isOutput=true]$hasFiles" - displayName: "Check for dump files" - name: checkFiles - - - task: PublishPipelineArtifact@1 - condition: eq(variables['hasFiles'], 'true') - displayName: Publish vstest dump files - inputs: - targetPath: "$(Build.ArtifactStagingDirectory)/vstest_dumps" - artifactName: VsTestCrashDumps - artifactType: pipeline - - ###################### - # generate change log - - job: Generate_change_log - dependsOn: - - Build_STM32_targets - - Build_ESP32_targets - - Build_NXP_targets - - Build_TI_SimpleLink_targets - - Build_Azure_RTOS_targets - # skip build if this is a PR, submitted by nfbot and the commit message contains [version update] - condition: >- - and( - succeeded('Build_STM32_targets'), - succeeded('Build_ESP32_targets'), - succeeded('Build_NXP_targets'), - succeeded('Build_TI_SimpleLink_targets'), - succeeded('Build_Azure_RTOS_targets'), - not( eq(variables['Build.Reason'], 'PullRequest') - ), - or( - eq(variables['Build.SourceBranchName'], 'main'), - startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), - ne( variables['StartReleaseCandidate'], true ) - ) - - pool: - vmImage: "windows-latest" - - steps: - - task: DotNetCoreCLI@2 - condition: succeeded() - displayName: Install NBGV tool - inputs: - command: custom - custom: tool - arguments: install --tool-path . nbgv - - - script: nbgv cloud -a -c - condition: succeeded() - displayName: Set build number - - - task: UseRubyVersion@0 - condition: succeeded() - inputs: - versionSpec: "= 3.0" - addToPath: true - - # Cache change log cache files - - task: Cache@2 - displayName: Cache change log cache files - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], ''), - startsWith(variables['Build.SourceBranch'], 'refs/tags/v') - ) - inputs: - key: "changeLogCacheFiles" - restoreKeys: 1_0 - path: | - $(Agent.TempDirectory)/github-changelog-logger.log - $(Agent.TempDirectory)/github-changelog-http-cache - - # generate change log including future version - - powershell: | - gem install github_changelog_generator --quiet --no-document - # need to call it passing both cache options with full path otherwise it won't work - github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$env:NBGV_AssemblyVersion" - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], ''), - startsWith(variables['Build.SourceBranch'], 'refs/tags/v') - ) - displayName: Generate change log - - # push new changelog to GitHub repo - - powershell: | - git config --global gc.auto 0 - git config --global user.name nfbot - git config --global user.email nanoframework@outlook.com - git config --global core.autocrlf true - - git add CHANGELOG.md - git commit -m "Update CHANGELOG" -m"***NO_CI***" - - # compute authorization header in format "AUTHORIZATION: basic 'encoded token'" - # 'encoded token' is the Base64 of the string "nfbot:personal-token" - $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))" - - git -c http.extraheader="AUTHORIZATION: $auth" push origin "HEAD:$(Build.SourceBranchName)" - condition: >- - and( - succeeded(), - eq(variables['System.PullRequest.PullRequestId'], ''), - not( - startsWith(variables['Build.SourceBranch'], 'refs/tags/v') - ), - eq( variables['StartReleaseCandidate'], false ) - ) - continueOnError: true - displayName: Push changelog to GitHub - - ################################# - # report build failure to Discord - - job: Report_Build_Failure - dependsOn: - - Build_STM32_targets - - Build_ESP32_targets - - Build_NXP_targets - - Build_TI_SimpleLink_targets - - Build_Azure_RTOS_targets - - Build_WIN32_nanoCLR - - Build_nanoCLR_CLI - - Generate_change_log - - Check_Code_Style - condition: >- - and( - ne( dependencies.Check_Code_Style.outputs['Check_Code_Style.CODE_STYLE_CHECK_FAILED'], true), - or( - failed('Build_STM32_targets'), - failed('Build_ESP32_targets'), - failed('Build_NXP_targets'), - failed('Build_TI_SimpleLink_targets'), - failed('Build_Azure_RTOS_targets'), - failed('Build_WIN32_nanoCLR'), - failed('Build_nanoCLR_CLI'), - failed('Generate_change_log') - ) - ) - - pool: - vmImage: "windows-latest" - - steps: - - checkout: self - fetchDepth: 1 - - # step from template @ nf-tools repo - - template: azure-pipelines-templates/discord-webhook.yml@templates - parameters: - status: "failure" - webhookUrl: "$(DiscordWebhook)" - message: "" +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +trigger: + branches: + include: + - main + - develop* + - release-* + - refs/tags/* + paths: + exclude: + - .clang-format + - .github_changelog_generator + - .gitignore + - .typo-ci.yml + - build.ps1 + - CHANGELOG.md + - CMakeSettings.json + - CMakeSettings.SAMPLE.json + - LICENSE.md + - nf.props + - nfcore.vssettings + - README.md + - README.zh-cn.md + - RunCmd.bat + - startocd.bat + - .github/* + - .devcontainer/* + - .vscode/* + - .vs/* + - assets/* + - config/* + - install-scripts/* + - VisualStudioDevelopment/* + +pr: + autoCancel: true + +# add nf-tools repo to resources (for Azure Pipelines templates) +resources: + repositories: + - repository: templates + type: github + name: nanoframework/nf-tools + endpoint: nanoframework + - repository: esp32_idf + type: github + name: espressif/esp-idf + endpoint: nanoframework + ref: 'refs/tags/v5.2.2' + - repository: mscorlib + type: github + name: nanoframework/CoreLibrary + endpoint: nanoframework + - repository: littlefs + type: github + name: littlefs-project/littlefs + endpoint: nanoframework + ref: refs/tags/v2.9.3 + +jobs: + ############################## + - job: Check_Build_Options + pool: + vmImage: "windows-latest" + + variables: + DOTNET_NOLOGO: true + + steps: + - checkout: self + fetchDepth: 1 + + # get commit message + - powershell: | + + # set default values + echo "##vso[task.setvariable variable=RUN_MSCORLIB_TESTS;isOutput=true]false" + + if($env:StartReleaseCandidate -like "true") + { + # this is a release prep so NO build + echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true" + + Write-Host "##[command] Release preparation, skipping build." + } + else + { + # get commit details, if this is a PR + if($env:System_PullRequest_PullRequestId -ne $null) + { + Write-Host "##[command] **This is a PR build**" + + $commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -ContentType "application/json" -Method GET + + if( ($commit.commit.author.name -eq "nfbot") -and ($commit.commit.message -like "*[version update]*") ) + { + echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true" + } + else + { + echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false" + } + + # check if Unit Tests for mscorlib should be run + if($commit.commit.message -like "*[run mscorlib tests]*") + { + echo "##vso[task.setvariable variable=RUN_MSCORLIB_TESTS;isOutput=true]true" + } + + } + else + { + Write-Host "##[command] **build for other reasons**" + + echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false" + } + } + + name: BuildOptions + displayName: Get build options + + # check what changed + - powershell: | + git config --global user.email "nfbot" + git config --global user.name "nanoframework@outlook.com" + + $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$(GitHubToken)")))" + + if($env:StartReleaseCandidate -like "true") + { + # this is a release prep so NO build + } + elseif($env:Build_Reason -eq "Manual") + { + # this is a manual build, no need to check anything + Write-host "##[command] Manual build" + } + else + { + # check if this build was triggered by the pipeline itself + if($env:Build_Reason -eq "Manual") + { + # this is a manual build, no need to check anything + Write-host "##[command] Manual build" + } + if($env:System_PullRequest_PullRequestId -ne $null) + { + # get files changed in PR, if this is a PR + $commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/pulls/$env:System_PullRequest_PullRequestNumber/files" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET + + # filter removed files + $files = $commit.where{$_.status -ne 'removed'} + } + else + { + # get files changed in the commit, if this is NOT a PR + $commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET + + # filter removed files + $files = $commit.files.where{$_.status -ne 'removed'} + } + + # get file names only + $files = $files | % {$_.filename} + + Write-host "##[group] Files changed:" + $files | % { Write-host $_ } + Write-host "##[endgroup]" + + # set default values + echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]false" + echo "##vso[task.setvariable variable=BUILD_FREERTOS;isOutput=true]false" + echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]false" + echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]false" + echo "##vso[task.setvariable variable=BUILD_AZURERTOS;isOutput=true]false" + echo "##vso[task.setvariable variable=BUILD_WIN32;isOutput=true]false" + echo "##vso[task.setvariable variable=BUILD_NANOCLR_CLI;isOutput=true]false" + echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]false" + + if( + (($files.where{$_.Contains('/')}).Count -eq 0) -Or + (($files.where{$_.StartsWith('azure-pipelines-templates')}).Count -gt 0) -Or + (($files.where{$_.StartsWith('CMake')}).Count -gt 0) -Or + (($files.where{$_.StartsWith('src')}).Count -gt 0) + ) + { + # files at: + # - repo root + # - azure-pipelines-templates + # - CMake + # - src + + echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]true" + + Write-host "##[command] Building ALL targets" + } + + if( ($files.where{$_.Contains('targets/ChibiOS')}).Count -gt 0) + { + # files at ChibiOS folder + echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true" + + Write-host "##[command] Building ChibiOS targets" + } + + if( ($files.where{$_.Contains('targets/FreeRTOS')}).Count -gt 0) + { + # files at FreeRTOS folder + echo "##vso[task.setvariable variable=BUILD_FREERTOS;isOutput=true]true" + + Write-host "##[command] Building FreeRTOS targets" + } + + if( ($files.where{$_.Contains('targets/ESP32')}).Count -gt 0) + { + # files at ESP32 folder + echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]true" + + Write-host "##[command] Building ESP32 targets" + } + + if( ($files.where{$_.Contains('targets/TI_SimpleLink')}).Count -gt 0) + { + # files at TI_SimpleLink folder + echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]true" + + Write-host "##[command] Building TI SimpleLink targets" + } + + if( ($files.where{$_.Contains('targets/AzureRTOS')}).Count -gt 0) + { + # files at AzureRTOS folder + echo "##vso[task.setvariable variable=BUILD_AZURERTOS;isOutput=true]true" + + Write-host "##[command] Building Azure RTOS targets" + } + + if( + (($files.where{$_.Contains('targets/netcore/nanoFramework.nanoCLR')}).Count -gt 0) -Or + (($files.where{$_.Contains('targets/netcore/nanoCLR.sln')}).Count -gt 0) -Or + (($files.where{$_.Contains('targets/netcore/littlefs')}).Count -gt 0) -Or + (($files.where{$_.Contains('targets/win32')}).Count -gt 0) + ) + { + # files at win32 or netcore folders + echo "##vso[task.setvariable variable=BUILD_WIN32;isOutput=true]true" + + Write-host "##[command] Building nanoCLR target" + } + + if( + (($files.where{$_.Contains('targets/netcore/nanoFramework.nanoCLR.CLI')}).Count -gt 0) -Or + (($files.where{$_.Contains('targets/netcore/nanoCLR.sln')}).Count -gt 0) -Or + (($files.where{$_.Contains('targets/netcore/nanoFramework.nanoCLR.Host')}).Count -gt 0) + ) + { + # files at nanoCLR CLI or Host folders + echo "##vso[task.setvariable variable=BUILD_NANOCLR_CLI;isOutput=true]true" + + Write-host "##[command] Building nanoCLR CLI target" + } + + } + + name: TargetsToBuild + displayName: Get targets to build + + - task: DotNetCoreCLI@2 + condition: eq( variables['StartReleaseCandidate'], true ) + displayName: Install NBGV tool + inputs: + command: custom + custom: tool + arguments: install -g nbgv + + - powershell: | + + # compute authorization header in format "AUTHORIZATION: basic 'encoded token'" + # 'encoded token' is the Base64 of the string "nfbot:personal-token" + $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))" + + cd "$env:Agent_TempDirectory" > $null + + git init "$env:Agent_TempDirectory\repo" + cd repo > $null + git remote add origin "$env:Build_Repository_Uri" + git config --global gc.auto 0 + git config --global user.name nfbot + git config --global user.email nanoframework@outlook.com + git config --global core.autocrlf true + git -c http.extraheader="AUTHORIZATION: $auth" fetch --progress origin + + git checkout develop + + # prepare release and capture output + $release = nbgv prepare-release + + # push all changes to github + git -c http.extraheader="AUTHORIZATION: $auth" push --all origin + + # get release branch name + $branch = $release.Split(' ')[0] + + # start PR for release + $prRequestBody = @{title="Release $branch";body="";head="$branch";base="main"} | ConvertTo-Json + $githubApiEndpoint = "https://api.github.com/repos/$env:Build_Repository_Name/pulls" + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + + $headers = @{} + $headers.Add("Authorization","$auth") + $headers.Add("Accept","application/vnd.github.symmetra-preview+json") + + try + { + $result = Invoke-RestMethod -Method Post -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Uri $githubApiEndpoint -Header $headers -ContentType "application/json" -Body $prRequestBody + 'Started PR for new release...' | Write-Host -NoNewline + '##[error] OK' | Write-Host -ForegroundColor Green + } + catch + { + $result = $_.Exception.Response.GetResponseStream() + $reader = New-Object System.IO.StreamReader($result) + $reader.BaseStream.Position = 0 + $reader.DiscardBufferedData() + $responseBody = $reader.ReadToEnd(); + + "##[error] Error starting PR: $responseBody" | Write-Host -ForegroundColor Red + } + + condition: eq( variables['StartReleaseCandidate'], true ) + displayName: NBGV prepare release + + ############################## + - job: Check_Code_Style + condition: >- + and( + ne(dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ESP32'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_FREERTOS'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_AZURERTOS'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_WIN32'], true) + ) + ) + + dependsOn: + - Check_Build_Options + + pool: + vmImage: "windows-latest" + + steps: + - checkout: self + fetchDepth: 1 + condition: ne(variables['System.PullRequest.PullRequestId'], '') + + - template: azure-pipelines-templates/download-install-llvm.yml + - template: azure-pipelines-templates/check-code-style.yml + + ################ + # STM32 + - job: Build_STM32_targets + condition: >- + or( + and( + succeeded('Check_Code_Style'), + ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true) + ) + ), + and( + eq(variables['Build.Reason'], 'Manual'), + or( + eq(variables['BUILD_ALL__'], 'true'), + eq(variables['BUILD_CHIBIOS__'], 'true') + ) + ) + ) + + dependsOn: + - Check_Build_Options + - Check_Code_Style + + pool: + vmImage: "windows-latest" + + strategy: + matrix: + ST_STM32F429I_DISCOVERY: + TargetBoard: ST_STM32F429I_DISCOVERY + TargetSeries: "stm32f4xx" + BuildOptions: + NeedsDFU: false + NeedsSRECORD: false + CMakePreset: ST_STM32F429I_DISCOVERY + + ST_STM32F769I_DISCOVERY: + TargetBoard: ST_STM32F769I_DISCOVERY + TargetSeries: "stm32f7xx" + BuildOptions: + NeedsDFU: false + NeedsSRECORD: true + CMakePreset: ST_STM32F769I_DISCOVERY + + variables: + DOTNET_NOLOGO: true + # creates a counter and assigns it to the revision variable + REVISION: $[counter('STM32_1_12_0_versioncounter', 0)] + HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] + TargetPlatform: "stm32" + + steps: + - template: azure-pipelines-templates/build-preparations.yml + - template: azure-pipelines-templates/nb-gitversioning.yml + - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml + - template: azure-pipelines-templates/download-install-ninja.yml + - template: azure-pipelines-templates/download-srecord.yml + - template: azure-pipelines-templates/download-hexdfu.yml + - template: azure-pipelines-templates/build-chibios-stm32-targets.yml + - template: azure-pipelines-templates/pack-publish-artifacts.yml + - template: azure-pipelines-templates/publish-cloudsmith.yml + - template: azure-pipelines-templates/pack-publish-managed-helpers.yml + + ################# + # ESP32 targets + - job: Build_ESP32_targets + condition: >- + or( + and( + succeeded('Check_Code_Style'), + ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ESP32'], true) + ) + ), + and( + eq(variables['Build.Reason'], 'Manual'), + or( + eq(variables['BUILD_ALL__'], 'true'), + eq(variables['BUILD_ESP32__'], 'true') + ) + ) + ) + + dependsOn: + - Check_Build_Options + - Check_Code_Style + + pool: + vmImage: "windows-latest" + + # there is only a single ESP32 target, but this is already config as a matrix to make it easy to add new ones + strategy: + matrix: + ESP32_PSRAM_REV0: + TargetBoard: ESP32 + TargetSeries: "esp32" + BuildOptions: + IDF_Target: esp32 + TargetName: ESP32 + PackageName: ESP32_PSRAM_REV0 + CMakePreset: ESP32_PSRAM_REV0 + + ESP32_BLE_REV0: + TargetBoard: ESP32 + TargetSeries: "esp32" + BuildOptions: + IDF_Target: esp32 + TargetName: ESP32 + PackageName: ESP32_BLE_REV0 + CMakePreset: ESP32_BLE_REV0 + + ESP_WROVER_KIT: + TargetBoard: ESP32 + TargetSeries: "esp32" + BuildOptions: + IDF_Target: esp32 + TargetName: ESP_WROVER_KIT + PackageName: ESP_WROVER_KIT + CMakePreset: ESP_WROVER_KIT + + ESP32_LILYGO: + TargetBoard: ESP32 + TargetSeries: "esp32" + BuildOptions: + IDF_Target: esp32 + TargetName: ESP32_LILYGO + PackageName: ESP32_LILYGO + CMakePreset: ESP32_LILYGO + + FEATHER_S2: + TargetBoard: ESP32_S2 + TargetSeries: "esp32_s2" + BuildOptions: + IDF_Target: esp32s2 + TargetName: FEATHER_S2 + PackageName: FEATHER_S2 + CMakePreset: FEATHER_S2 + + ESP32_C3: + TargetBoard: ESP32_C3 + TargetSeries: "esp32c3" + BuildOptions: + IDF_Target: esp32c3 + TargetName: ESP32_C3 + PackageName: ESP32_C3 + CMakePreset: ESP32_C3 + + ESP32_C6_THREAD: + TargetBoard: ESP32_C6 + TargetSeries: "esp32c6" + BuildOptions: + IDF_Target: esp32c6 + TargetName: ESP32_C6_THREAD + PackageName: ESP32_C6_THREAD + CMakePreset: ESP32_C6_THREAD + + ESP32_H2_THREAD: + TargetBoard: ESP32_H2 + TargetSeries: "esp32h2" + BuildOptions: + IDF_Target: esp32h2 + TargetName: ESP32_H2_THREAD + PackageName: ESP32_H2_THREAD + CMakePreset: ESP32_H2_THREAD + + ESP32_S3: + TargetBoard: ESP32_S3 + TargetSeries: "esp32s3" + BuildOptions: + IDF_Target: esp32s3 + TargetName: ESP32_S3 + PackageName: ESP32_S3 + CMakePreset: ESP32_S3 + + ESP32_S3_ALL: + TargetBoard: ESP32_S3 + TargetSeries: "esp32s3" + BuildOptions: + IDF_Target: esp32s3 + TargetName: ESP32_S3_ALL + PackageName: ESP32_S3_ALL + CMakePreset: ESP32_S3_ALL + + ESP32_ETHERNET_KIT_1.2: + TargetBoard: ESP32 + TargetSeries: "esp32" + BuildOptions: + IDF_Target: esp32 + TargetName: ESP32_ETHERNET_KIT_1.2 + PackageName: ESP32_ETHERNET_KIT_1.2 + CMakePreset: ESP32_ETHERNET_KIT_1.2 + + variables: + DOTNET_NOLOGO: true + # creates a counter and assigns it to the revision variable + REVISION: $[counter('ESP32_1_12_0_versioncounter', 0)] + IDF_PATH: "D:/a/1/s/esp-idf" + PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip + TargetPlatform: "esp32" + + steps: + - checkout: self + - checkout: esp32_idf + fetchDepth: 1 + + - template: azure-pipelines-templates/build-preparations.yml + parameters: + repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' + - template: azure-pipelines-templates/nb-gitversioning.yml + parameters: + repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' + - template: azure-pipelines-templates/download-install-esp32-build-components.yml + - template: azure-pipelines-templates/download-install-ninja.yml + parameters: + repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' + - template: azure-pipelines-templates/build-espressif-esp32-targets.yml + + - task: CopyFiles@2 + condition: succeeded() + displayName: Copying bootloader + inputs: + sourceFolder: '$(Build.SourcesDirectory)\nf-interpreter\build\bootloader' + Contents: | + bootloader.bin + TargetFolder: '$(Build.ArtifactStagingDirectory)\$(TargetPublishName)' + flattenFolders: true + ignoreMakeDirErrors: true + + - template: azure-pipelines-templates/copy-sdkconfig.yml + - template: azure-pipelines-templates/pack-publish-artifacts.yml + parameters: + buildDirectory: '$(Build.SourcesDirectory)\nf-interpreter\build' + - template: azure-pipelines-templates/publish-cloudsmith.yml + - template: azure-pipelines-templates/publish-sdkconfig.yml + + ################# + # NXP + - job: Build_NXP_targets + condition: >- + or( + and( + succeeded('Check_Code_Style'), + ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_FREERTOS'], true) + ) + ), + and( + eq(variables['Build.Reason'], 'Manual'), + or( + eq(variables['BUILD_ALL__'], 'true'), + eq(variables['BUILD_NXP__'], 'true') + ) + ) + ) + + dependsOn: + - Check_Build_Options + - Check_Code_Style + + pool: + vmImage: "windows-latest" + + strategy: + matrix: + NXP_MIMXRT1060_EVK: + TargetBoard: NXP_MIMXRT1060_EVK + TargetSeries: "imxrt10xx" + BuildOptions: + NeedsSRECORD: true + CMakePreset: NXP_MIMXRT1060_EVK + + variables: + DOTNET_NOLOGO: true + # creates a counter and assigns it to the revision variable + REVISION: $[counter('NXP_1_12_0_versioncounter', 0)] + GIT_LFS_SKIP_SMUDGE: 1 + TargetPlatform: "freertos" + + steps: + - template: azure-pipelines-templates/build-preparations.yml + - template: azure-pipelines-templates/nb-gitversioning.yml + - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml + - template: azure-pipelines-templates/download-install-ninja.yml + - template: azure-pipelines-templates/download-srecord.yml + - template: azure-pipelines-templates/build-freertos-nxp-targets.yml + - template: azure-pipelines-templates/pack-publish-artifacts.yml + - template: azure-pipelines-templates/publish-cloudsmith.yml + - template: azure-pipelines-templates/pack-publish-managed-helpers.yml + + ################# + # TI SimpleLink + - job: Build_TI_SimpleLink_targets + condition: >- + or( + and( + succeeded('Check_Code_Style'), + ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true) + ) + ), + and( + eq(variables['Build.Reason'], 'Manual'), + or( + eq(variables['BUILD_ALL__'], 'true'), + eq(variables['BUILD_TI__'], 'true') + ) + ) + ) + + dependsOn: + - Check_Build_Options + - Check_Code_Style + + pool: + vmImage: "windows-latest" + + strategy: + matrix: + # disabled: waiting to update SDK to latest version with Sys Config + # TI_CC3220SF_LAUNCHXL: + # TargetBoard: TI_CC3220SF_LAUNCHXL + # TargetSeries: 'cc32xx' + # BuildOptions: >- + # -DTARGET_SERIES=CC32xx + # -DRTOS=TI_SimpleLink + # -DSUPPORT_ANY_BASE_CONVERSION=OFF + # -DNF_FEATURE_DEBUGGER=ON + # -DNF_FEATURE_RTC=ON + # -DNF_FEATURE_WATCHDOG=OFF + # -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + # -DAPI_System.Device.Gpio=ON + # -DAPI_System.Device.Spi=ON + # -DAPI_System.Device.I2c=ON + # -DAPI_System.Device.Pwm=ON + # -DAPI_System.Device.Adc=ON + # -DAPI_System.Net=ON + # -DAPI_nanoFramework.System.Collections=ON + # -DAPI_nanoFramework.System.Text=ON + + TI_CC1352R1_LAUNCHXL_915: + TargetBoard: TI_CC1352R1_LAUNCHXL + PackageName: TI_CC1352R1_LAUNCHXL_915 + TargetSeries: "CC13X2" + BuildOptions: >- + -DRADIO_FREQUENCY=915 + CMakePreset: TI_CC1352R1_LAUNCHXL + + variables: + DOTNET_NOLOGO: true + # creates a counter and assigns it to the revision variable + REVISION: $[counter('TI_1_12_0_versioncounter', 0)] + HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] + TargetPlatform: "ti_simplelink" + + steps: + - template: azure-pipelines-templates/build-preparations.yml + - template: azure-pipelines-templates/nb-gitversioning.yml + - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml + - template: azure-pipelines-templates/download-install-ninja.yml + - template: azure-pipelines-templates/build-ti-simplelink-targets.yml + - template: azure-pipelines-templates/pack-publish-artifacts.yml + - template: azure-pipelines-templates/publish-cloudsmith.yml + - template: azure-pipelines-templates/pack-publish-ti-sl-managed-helpers.yml + + ################# + # Azure RTOS + - job: Build_Azure_RTOS_targets + condition: >- + or( + and( + succeeded('Check_Code_Style'), + ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_AZURERTOS'], true) + ) + ), + and( + eq(variables['Build.Reason'], 'Manual'), + or( + eq(variables['BUILD_ALL__'], 'true'), + eq(variables['BUILD_AZURERTOS__'], 'true') + ) + ) + ) + + dependsOn: + - Check_Build_Options + - Check_Code_Style + + pool: + vmImage: "windows-latest" + + strategy: + matrix: + # ST_B_L475E_IOT01A: + # TargetBoard: ST_B_L475E_IOT01A + # TargetSeries: 'stm32l4xx' + # BuildOptions: + # NeedsDFU: true + # NeedsSRECORD: false + # CMakePreset: ST_B_L475E_IOT01A + + # ORGPAL_PALTHREE: + # TargetBoard: ORGPAL_PALTHREE + # TargetSeries: 'stm32f7xx' + # BuildOptions: + # NeedsDFU: true + # NeedsSRECORD: false + # CMakePreset: ORGPAL_PALTHREE + + SL_STK3701A: + TargetBoard: SL_STK3701A + TargetSeries: "efm32gg11" + BuildOptions: + NeedsDFU: false + NeedsSRECORD: false + CMakePreset: SL_STK3701A + + variables: + # creates a counter and assigns it to the revision variable + REVISION: $[counter('AZURERTOS_1_12_0_versioncounter', 0)] + HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)] + TargetPlatform: "azure_rtos" + + steps: + - template: azure-pipelines-templates/build-preparations.yml + - template: azure-pipelines-templates/nb-gitversioning.yml + - template: azure-pipelines-templates/download-install-arm-gcc-toolchain.yml + - template: azure-pipelines-templates/download-install-ninja.yml + - template: azure-pipelines-templates/download-hexdfu.yml + - template: azure-pipelines-templates/download-srecord.yml + - template: azure-pipelines-templates/build-azurertos-targets.yml + - template: azure-pipelines-templates/pack-publish-artifacts.yml + - template: azure-pipelines-templates/publish-cloudsmith.yml + - template: azure-pipelines-templates/pack-publish-managed-helpers.yml + + ################# + # WIN32 executable + - job: Build_WIN32_nanoCLR + condition: >- + or( + and( + succeeded('Check_Code_Style'), + ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_WIN32'], true) + ) + ), + and( + eq(variables['Build.Reason'], 'Manual'), + or( + eq(variables['BUILD_ALL__'], 'true'), + eq(variables['BUILD_WINDOWS_NANOCLR__'], 'true') + ) + ) + ) + + dependsOn: + - Check_Build_Options + - Check_Code_Style + + pool: + vmImage: "windows-latest" + + variables: + - group: sign-client-credentials + - name: DOTNET_NOLOGO + value: true + # creates a counter and assigns it to the revision variable + - name: REVISION + value: $[counter('WIN32_1_12_0_versioncounter', 0)] + - name: LITTLEFS_PATH + value: "D:/a/1/s/littlefs" + + steps: + - checkout: self + - checkout: littlefs + fetchDepth: 1 + + - template: azure-pipelines-templates/nb-gitversioning.yml + parameters: + repoDirectory: '$(Build.SourcesDirectory)/nf-interpreter' + + - task: PowerShell@2 + displayName: Store CLR DLL revision + name: SetRevision + inputs: + targetType: "inline" + script: | + Write-Host "$("##vso[task.setvariable variable=CLR_REVISION;isOutput=true]")$(REVISION)" + + - task: PowerShell@2 + displayName: Store package version + inputs: + targetType: "inline" + script: | + Write-Host "$("##vso[task.setvariable variable=WINCLR_PACKAGE_VERSION]")$(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$(TARGET_BUILD_COUNTER)" + Write-Host "$("##vso[task.setvariable variable=WINCLR_AssemblyInformationalVersion]")$(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$(TARGET_BUILD_COUNTER)$(NBGV_BuildMetadataFragment)" + + - template: azure-pipelines-templates/install-nuget.yml@templates + + - task: DotNetCoreCLI@2 + displayName: Restore NuGet packages + inputs: + command: restore + restoreArguments: "--locked-mode" + verbosityRestore: minimal + projects: nf-interpreter/targets/netcore/nanoCLR.sln + feedsToUse: select + includeNuGetOrg: true + + - task: VSBuild@1 + displayName: Build WIN32 EXE target + inputs: + solution: "nf-interpreter/targets/win32/nanoCLR.sln" + platform: "x86" + maximumCpuCount: true + msbuildArgs: "/p:PublicRelease=true" + configuration: "Release" + + - task: VSBuild@1 + displayName: Build WIN DLL target + inputs: + solution: "nf-interpreter/targets/netcore/nanoCLR.sln" + platform: "Any CPU" + maximumCpuCount: true + msbuildArgs: "/p:PublicRelease=true" + configuration: "Release" + + - task: DotNetCoreCLI@2 + displayName: Install Sign Client CLI + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], '') + ) + inputs: + command: custom + custom: tool + arguments: install --tool-path . sign --version 0.9.1-beta.23530.1 + + - pwsh: | + .\sign code azure-key-vault ` + "**/nanoFramework.nanoCLR.*" ` + --base-directory "$(Build.SourcesDirectory)/nf-interpreter/build/bin/Release" ` + --publisher-name ".NET nanoFramework" ` + --description "nanoFramework.nanoCLR" ` + --description-url "https://github.com/$env:Build_Repository_Name" ` + --azure-key-vault-tenant-id "$(SignTenantId)" ` + --azure-key-vault-client-id "$(SignClientId)" ` + --azure-key-vault-client-secret "$(SignClientSecret)" ` + --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` + --azure-key-vault-url "$(SignKeyVaultUrl)" ` + --timestamp-url http://timestamp.digicert.com + displayName: Sign nanoCLR assemblies + continueOnError: true + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], '') + ) + + - task: NuGetCommand@2 + condition: succeeded() + displayName: Pack nanoCLR WIN32 + inputs: + command: "custom" + arguments: "pack nf-interpreter/targets/win32/nanoFramework.nanoCLR.Win32.nuspec -Version $(NBGV_NuGetPackageVersion)" + + - task: CopyFiles@2 + condition: succeeded() + displayName: Collecting NuGet packages + inputs: + sourceFolder: $(Build.SourcesDirectory) + Contents: | + **\nanoFramework.nanoCLR.Win32*.nupkg + TargetFolder: "$(Build.ArtifactStagingDirectory)" + flattenFolders: true + ignoreMakeDirErrors: true + + - task: CopyFiles@2 + condition: succeeded() + displayName: Adding nanoCLR WIN32 to deployable artifacts + inputs: + sourceFolder: $(Build.SourcesDirectory) + Contents: | + **\nanoFramework.nanoCLR.exe + TargetFolder: '$(Build.ArtifactStagingDirectory)\WIN32_nanoCLR' + flattenFolders: true + ignoreMakeDirErrors: true + + - task: CopyFiles@2 + condition: succeeded() + displayName: Adding nanoCLR DLL to deployable artifacts + inputs: + sourceFolder: $(Build.SourcesDirectory) + Contents: | + **\nanoFramework.nanoCLR.dll + TargetFolder: '$(Build.ArtifactStagingDirectory)\WIN_DLL_nanoCLR' + flattenFolders: true + ignoreMakeDirErrors: true + + - pwsh: | + .\sign code azure-key-vault ` + "**/*.nupkg" ` + --base-directory "$(Build.ArtifactStagingDirectory)" ` + --publisher-name ".NET nanoFramework" ` + --description "nanoFramework.nanoCLR NuGets" ` + --description-url "https://github.com/$env:Build_Repository_Name" ` + --azure-key-vault-tenant-id "$(SignTenantId)" ` + --azure-key-vault-client-id "$(SignClientId)" ` + --azure-key-vault-client-secret "$(SignClientSecret)" ` + --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` + --azure-key-vault-url "$(SignKeyVaultUrl)" ` + --timestamp-url http://timestamp.digicert.com + displayName: Sign packages + continueOnError: true + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], '') + ) + + # publish artifacts + - task: PublishPipelineArtifact@1 + condition: succeeded() + displayName: Publish deployables artifacts + inputs: + targetPath: "$(Build.ArtifactStagingDirectory)" + artifactName: nanoclr_win32 + artifactType: pipeline + + # push NuGet packages to Azure Artifacts feed (always happens when building from main, except on PR builds) + - task: NuGetCommand@2 + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], ''), + or( + eq(variables['ForceUpload'], true), + eq(variables['Build.SourceBranchName'], 'main') + ) + ) + continueOnError: true + displayName: Push NuGet packages to Azure Artifacts + inputs: + command: push + nuGetFeedType: external + packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" + publishFeedCredentials: "AzureArtifacts-nf-interpreter" + allowPackageConflicts: true + + # push NuGet packages to NuGet (always happens when building from main, except on PR builds) + - task: NuGetCommand@2 + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], ''), + or( + eq(variables['ForceUpload'], true), + eq(variables['Build.SourceBranchName'], 'main') + ) + ) + continueOnError: true + displayName: Push NuGet packages to NuGet + inputs: + command: push + nuGetFeedType: external + allowPackageConflicts: true + packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" + publishFeedCredentials: "NuGet-nf-interpreter" + + - template: azure-pipelines-templates/publish-nanoclr.yml + + ################# + # nanoCLR CLI tool + - job: Build_nanoCLR_CLI + condition: >- + or( + and( + succeeded('Check_Code_Style'), + ne(dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_NANOCLR_CLI'], true) + ) + ), + and( + eq(variables['Build.Reason'], 'Manual'), + or( + eq(variables['BUILD_ALL__'], 'true'), + eq(variables['BUILD_NANOCLR_CLI__'], 'true') + ) + ) + ) + + dependsOn: + - Check_Build_Options + - Check_Code_Style + - Build_WIN32_nanoCLR + + pool: + vmImage: "windows-latest" + + variables: + - group: sign-client-credentials + - name: DOTNET_NOLOGO + value: true + - name: LITTLEFS_PATH + value: "D:/a/1/s/littlefs" + - name: REVISION + value: $[dependencies.Build_WIN32_nanoCLR.outputs['SetRevision.CLR_REVISION']] + + steps: + - checkout: self + - checkout: littlefs + fetchDepth: 1 + + - template: azure-pipelines-templates/nb-gitversioning.yml + parameters: + repoDirectory: '$(Build.SourcesDirectory)/nf-interpreter' + + - template: azure-pipelines-templates/install-nuget.yml@templates + + - task: DotNetCoreCLI@2 + displayName: Restore NuGet packages + inputs: + command: restore + restoreArguments: "--locked-mode" + verbosityRestore: minimal + projects: "nf-interpreter/targets/netcore/nanoCLR.sln" + feedsToUse: select + includeNuGetOrg: true + + - task: VSBuild@1 + displayName: Build .NET tool + condition: succeeded() + inputs: + solution: "nf-interpreter/targets/netcore/nanoCLR.sln" + platform: "Any CPU" + maximumCpuCount: true + msbuildArgs: "/p:PublicRelease=true" + configuration: "Release" + + - task: DotNetCoreCLI@2 + displayName: Install Sign Client CLI + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], '') + ) + inputs: + command: custom + custom: tool + arguments: install --tool-path . sign --version 0.9.1-beta.23530.1 + + - pwsh: | + .\sign code azure-key-vault ` + "**/nanoFramework.nanoCLR.*" ` + --base-directory "$(Build.SourcesDirectory)/nf-interpreter/build/bin/Release" ` + --publisher-name ".NET nanoFramework" ` + --description "nanoFramework.nanoCLR.CLI" ` + --description-url "https://github.com/$env:Build_Repository_Name" ` + --azure-key-vault-tenant-id "$(SignTenantId)" ` + --azure-key-vault-client-id "$(SignClientId)" ` + --azure-key-vault-client-secret "$(SignClientSecret)" ` + --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` + --azure-key-vault-url "$(SignKeyVaultUrl)" ` + --timestamp-url http://timestamp.digicert.com + displayName: Sign nanoCLR assemblies + continueOnError: true + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], '') + ) + + - task: MSBuild@1 + condition: succeeded() + displayName: Pack nanoCLR CLI + inputs: + solution: "nf-interpreter/targets/netcore/nanoFramework.nanoCLR.CLI/nanoFramework.nanoCLR.CLI.csproj" + platform: "Any CPU" + msbuildArguments: "/p:PublicRelease=true /t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) " + configuration: "Release" + maximumCpuCount: true + + - pwsh: | + .\sign code azure-key-vault ` + "**/*.nupkg" ` + --base-directory "$(Build.ArtifactStagingDirectory)" ` + --publisher-name ".NET nanoFramework" ` + --description "nanoFramework.nanoCLR.CLI NuGet" ` + --description-url "https://github.com/$env:Build_Repository_Name" ` + --azure-key-vault-tenant-id "$(SignTenantId)" ` + --azure-key-vault-client-id "$(SignClientId)" ` + --azure-key-vault-client-secret "$(SignClientSecret)" ` + --azure-key-vault-certificate "$(SignKeyVaultCertificate)" ` + --azure-key-vault-url "$(SignKeyVaultUrl)" ` + --timestamp-url http://timestamp.digicert.com + displayName: Sign packages + continueOnError: true + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], '') + ) + + - task: CopyFiles@2 + condition: succeeded() + displayName: Copy nanoclr + inputs: + SourceFolder: "nf-interpreter/build/bin/Release" + Contents: "nanoFramework.nanoCLR.dll" + TargetFolder: "$(Build.ArtifactStagingDirectory)/nanoclr" + + - task: PublishPipelineArtifact@1 + condition: succeeded() + displayName: Publish nanoclr + inputs: + targetPath: "$(Build.ArtifactStagingDirectory)/nanoclr" + artifactName: nanoclr_cli + artifactType: pipeline + + # push NuGet packages to Azure Artifacts feed (always happens when building from main, except on PR builds) + - task: NuGetCommand@2 + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], ''), + or( + eq(variables['ForceUpload'], true), + eq(variables['Build.SourceBranchName'], 'main') + ) + ) + continueOnError: true + displayName: Push NuGet packages to Azure Artifacts + inputs: + command: push + nuGetFeedType: external + packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" + publishFeedCredentials: "AzureArtifacts-nf-interpreter" + allowPackageConflicts: true + + # push NuGet packages to NuGet (always happens when building from main, except on PR builds) + - task: NuGetCommand@2 + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], ''), + or( + eq(variables['ForceUpload'], true), + eq(variables['Build.SourceBranchName'], 'main') + ) + ) + continueOnError: true + displayName: Push NuGet packages to NuGet + inputs: + command: push + nuGetFeedType: external + allowPackageConflicts: true + packagesToPush: "$(Build.ArtifactStagingDirectory)/*.nupkg" + publishFeedCredentials: "NuGet-nf-interpreter" + + ######################### + # Run mscorlib Unit Tests + + - job: Run_UnitTests_mscorlib + condition: >- + and( + succeeded('Build_nanoCLR_CLI'), + ne(dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true), + or( + eq(variables['BUILD_NANOCLR_CLI__'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_NANOCLR_CLI'], true), + eq(dependencies.Check_Build_Options.outputs['BuildOptions.RUN_MSCORLIB_TESTS'], true) + ) + ) + + dependsOn: + - Build_nanoCLR_CLI + + pool: + vmImage: "windows-latest" + + variables: + DOTNET_NOLOGO: true + solution: "nanoFramework.CoreLibrary.sln" + buildPlatform: "Any CPU" + buildConfiguration: "Release" + + steps: + - checkout: self + fetchDepth: 1 + - checkout: mscorlib + fetchDepth: 100 + submodules: true + + # Download nanoclr from build artifacts + - task: DownloadBuildArtifacts@1 + inputs: + buildType: "current" + artifactName: "nanoclr_cli" + downloadPath: "$(Agent.TempDirectory)/nanoclr_cli" + + # build mscorlib + + - task: InstallNanoMSBuildComponents@1 + condition: succeeded() + displayName: Install .NET nanoFramework MSBuild components + inputs: + GitHubToken: $(GitHubToken) + + - template: azure-pipelines-templates/install-nuget.yml@templates + + - task: NuGetCommand@2 + condition: succeeded() + displayName: NuGet restore + retryCountOnTaskFailure: 5 + inputs: + restoreSolution: "**/nanoFramework.CoreLibrary.sln" + feedsToUse: select + + - task: VSBuild@1 + condition: succeeded() + inputs: + solution: "**/nanoFramework.CoreLibrary.sln" + platform: "Any CPU" + msbuildArgs: "/p:PublicRelease=true" + configuration: "Release" + msbuildArchitecture: "x64" + maximumCpuCount: true + + # run tests + - template: azure-pipelines-templates/run-unit-tests.yml@templates + parameters: + runUnitTests: true + unitTestRunsettings: '$(System.DefaultWorkingDirectory)\nf-interpreter\targets\netcore\pipeline_tests.runsettings' + packagesDirectory: "$(Build.SourcesDirectory)/CoreLibrary/packages" + + - task: CopyFiles@2 + condition: succeededOrFailed() + displayName: Copy vstest dump files + inputs: + SourceFolder: 'D:\a\_temp\' + Contents: "**/*.dmp" + TargetFolder: "$(Build.ArtifactStagingDirectory)/vstest_dumps" + flattenFolders: true + + - powershell: | + $dumpPath = "$(Build.ArtifactStagingDirectory)/vstest_dumps" + $hasFiles = $false + + if (Test-Path $dumpPath -PathType Container) { + $fileCount = (Get-ChildItem $dumpPath -File | Measure-Object).Count + $hasFiles = $fileCount -gt 0 + } + echo "##vso[task.setvariable variable=hasFiles;isOutput=true]$hasFiles" + displayName: "Check for dump files" + name: checkFiles + + - task: PublishPipelineArtifact@1 + condition: eq(variables['hasFiles'], 'true') + displayName: Publish vstest dump files + inputs: + targetPath: "$(Build.ArtifactStagingDirectory)/vstest_dumps" + artifactName: VsTestCrashDumps + artifactType: pipeline + + ###################### + # generate change log + - job: Generate_change_log + dependsOn: + - Build_STM32_targets + - Build_ESP32_targets + - Build_NXP_targets + - Build_TI_SimpleLink_targets + - Build_Azure_RTOS_targets + # skip build if this is a PR, submitted by nfbot and the commit message contains [version update] + condition: >- + and( + succeeded('Build_STM32_targets'), + succeeded('Build_ESP32_targets'), + succeeded('Build_NXP_targets'), + succeeded('Build_TI_SimpleLink_targets'), + succeeded('Build_Azure_RTOS_targets'), + not( eq(variables['Build.Reason'], 'PullRequest') + ), + or( + eq(variables['Build.SourceBranchName'], 'main'), + startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), + ne( variables['StartReleaseCandidate'], true ) + ) + + pool: + vmImage: "windows-latest" + + steps: + - task: DotNetCoreCLI@2 + condition: succeeded() + displayName: Install NBGV tool + inputs: + command: custom + custom: tool + arguments: install --tool-path . nbgv + + - script: nbgv cloud -a -c + condition: succeeded() + displayName: Set build number + + - task: UseRubyVersion@0 + condition: succeeded() + inputs: + versionSpec: "= 3.0" + addToPath: true + + # Cache change log cache files + - task: Cache@2 + displayName: Cache change log cache files + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], ''), + startsWith(variables['Build.SourceBranch'], 'refs/tags/v') + ) + inputs: + key: "changeLogCacheFiles" + restoreKeys: 1_0 + path: | + $(Agent.TempDirectory)/github-changelog-logger.log + $(Agent.TempDirectory)/github-changelog-http-cache + + # generate change log including future version + - powershell: | + gem install github_changelog_generator --quiet --no-document + # need to call it passing both cache options with full path otherwise it won't work + github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$env:NBGV_AssemblyVersion" + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], ''), + startsWith(variables['Build.SourceBranch'], 'refs/tags/v') + ) + displayName: Generate change log + + # push new changelog to GitHub repo + - powershell: | + git config --global gc.auto 0 + git config --global user.name nfbot + git config --global user.email nanoframework@outlook.com + git config --global core.autocrlf true + + git add CHANGELOG.md + git commit -m "Update CHANGELOG" -m"***NO_CI***" + + # compute authorization header in format "AUTHORIZATION: basic 'encoded token'" + # 'encoded token' is the Base64 of the string "nfbot:personal-token" + $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))" + + git -c http.extraheader="AUTHORIZATION: $auth" push origin "HEAD:$(Build.SourceBranchName)" + condition: >- + and( + succeeded(), + eq(variables['System.PullRequest.PullRequestId'], ''), + not( + startsWith(variables['Build.SourceBranch'], 'refs/tags/v') + ), + eq( variables['StartReleaseCandidate'], false ) + ) + continueOnError: true + displayName: Push changelog to GitHub + + ################################# + # report build failure to Discord + - job: Report_Build_Failure + dependsOn: + - Build_STM32_targets + - Build_ESP32_targets + - Build_NXP_targets + - Build_TI_SimpleLink_targets + - Build_Azure_RTOS_targets + - Build_WIN32_nanoCLR + - Build_nanoCLR_CLI + - Generate_change_log + - Check_Code_Style + condition: >- + and( + ne( dependencies.Check_Code_Style.outputs['Check_Code_Style.CODE_STYLE_CHECK_FAILED'], true), + or( + failed('Build_STM32_targets'), + failed('Build_ESP32_targets'), + failed('Build_NXP_targets'), + failed('Build_TI_SimpleLink_targets'), + failed('Build_Azure_RTOS_targets'), + failed('Build_WIN32_nanoCLR'), + failed('Build_nanoCLR_CLI'), + failed('Generate_change_log') + ) + ) + + pool: + vmImage: "windows-latest" + + steps: + - checkout: self + fetchDepth: 1 + + # step from template @ nf-tools repo + - template: azure-pipelines-templates/discord-webhook.yml@templates + parameters: + status: "failure" + webhookUrl: "$(DiscordWebhook)" + message: "" diff --git a/targets/ESP32/CMakeLists.txt b/targets/ESP32/CMakeLists.txt index e047b8292a..632946f7fb 100644 --- a/targets/ESP32/CMakeLists.txt +++ b/targets/ESP32/CMakeLists.txt @@ -60,7 +60,7 @@ endif() # WHEN CHANGING THIS MAKE SURE TO UPDATE: # 1. the dev containers # 2. ref in AZDO pipeline yaml in Community Targets repo -set(ESP32_IDF_TAG "5.1.4" CACHE INTERNAL "ESP32 IDF tag") +set(ESP32_IDF_TAG "5.2.2" CACHE INTERNAL "ESP32 IDF tag") if(NO_ESP32_IDF_PATH) # no ESP32 IDF source specified, download it from official repo diff --git a/targets/ESP32/_Network/NF_ESP32_OpenThread.cpp b/targets/ESP32/_Network/NF_ESP32_OpenThread.cpp index e6f02911fd..ed1a9a7023 100644 --- a/targets/ESP32/_Network/NF_ESP32_OpenThread.cpp +++ b/targets/ESP32/_Network/NF_ESP32_OpenThread.cpp @@ -43,7 +43,7 @@ extern void ThreadSetInterfaceNumber(int networkInterfaceNumber); .host_connection_mode = HOST_CONNECTION_MODE_RCP_UART, \ .host_uart_config = \ { \ - .port = 0, \ + .port = (uart_port_t)0, \ .uart_config = \ { \ .baud_rate = 460800, \ @@ -72,7 +72,7 @@ extern void ThreadSetInterfaceNumber(int networkInterfaceNumber); .sclk_io_num = 0, \ .quadwp_io_num = -1, \ .quadhd_io_num = -1, \ - .isr_cpu_id = INTR_CPU_ID_0, \ + .isr_cpu_id = ESP_INTR_CPU_AFFINITY_0, \ }, \ .slave_config = \ { \ @@ -384,7 +384,7 @@ esp_err_t initOpenThread(ThreadDeviceType deviceType, esp_openthread_radio_mode_ config.host_config = ESP_OPENTHREAD_DEFAULT_UART_HOST_CONFIG(); // Set COM port using ESP32 configured pins - config.host_config.host_uart_config.port = port; + config.host_config.host_uart_config.port = (uart_port_t)port; config.host_config.host_uart_config.uart_config.baud_rate = baud_rate; diff --git a/targets/ESP32/_nanoCLR/System.Device.Pwm/sys_dev_pwm_native_System_Device_Pwm_PwmChannel.cpp b/targets/ESP32/_nanoCLR/System.Device.Pwm/sys_dev_pwm_native_System_Device_Pwm_PwmChannel.cpp index f96af892ee..1edc4395f9 100644 --- a/targets/ESP32/_nanoCLR/System.Device.Pwm/sys_dev_pwm_native_System_Device_Pwm_PwmChannel.cpp +++ b/targets/ESP32/_nanoCLR/System.Device.Pwm/sys_dev_pwm_native_System_Device_Pwm_PwmChannel.cpp @@ -160,7 +160,7 @@ HRESULT sys_dev_pwm_native_System_Device_Pwm_PwmChannelHelpers::ConfigureAndStar duty_res = (ledc_timer_bit_t)optimumDutyResolution; - timer_conf = {mode, duty_res, timer_sel, (uint32_t)desiredFrequency, LEDC_AUTO_CLK}; + timer_conf = {mode, duty_res, timer_sel, (uint32_t)desiredFrequency, LEDC_AUTO_CLK, true}; result = ledc_timer_config(&timer_conf); @@ -316,7 +316,7 @@ HRESULT Library_sys_dev_pwm_native_System_Device_Pwm_PwmChannel::NativeSetDesire duty_res = (ledc_timer_bit_t)optimumDutyResolution; - timer_conf = {mode, duty_res, timer, (uint32_t)desiredFrequency, LEDC_AUTO_CLK}; + timer_conf = {mode, duty_res, timer, (uint32_t)desiredFrequency, LEDC_AUTO_CLK, true}; result = ledc_timer_config(&timer_conf); diff --git a/targets/ESP32/_nanoCLR/System.Device.Spi/cpu_spi.cpp b/targets/ESP32/_nanoCLR/System.Device.Spi/cpu_spi.cpp index 8b2057158c..7f1213960b 100644 --- a/targets/ESP32/_nanoCLR/System.Device.Spi/cpu_spi.cpp +++ b/targets/ESP32/_nanoCLR/System.Device.Spi/cpu_spi.cpp @@ -174,12 +174,13 @@ bool CPU_SPI_Initialize(uint8_t busIndex, const SPI_DEVICE_CONFIGURATION &spiDev max_transfer_sz : 16384, // SPICOMMON_BUSFLAG_* flags flags : 0, - isr_cpu_id : INTR_CPU_ID_0, + isr_cpu_id : ESP_INTR_CPU_AFFINITY_AUTO, intr_flags : ESP_INTR_FLAG_IRAM }; // Try with DMA first -#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) +#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) // First available bus on ESP32_C3/S3 is SPI2_HOST esp_err_t ret = spi_bus_initialize((spi_host_device_t)(busIndex + SPI2_HOST), &bus_config, SPI_DMA_CH_AUTO); #else @@ -189,7 +190,8 @@ bool CPU_SPI_Initialize(uint8_t busIndex, const SPI_DEVICE_CONFIGURATION &spiDev if (ret != ESP_OK) { -#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) +#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) // First available bus on ESP32_C3/S3/C6/H2 is SPI2_HOST ESP_LOGE(TAG, "Unable to init SPI bus %d esp_err %d", busIndex + SPI2_HOST, ret); #else @@ -210,7 +212,8 @@ bool CPU_SPI_Initialize(uint8_t busIndex, const SPI_DEVICE_CONFIGURATION &spiDev // Uninitialise the bus bool CPU_SPI_Uninitialize(uint8_t busIndex) { -#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) +#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) // First available bus on ESP32_C3/S3/C6/H2 is SPI2_HOST esp_err_t ret = spi_bus_free((spi_host_device_t)(busIndex + SPI2_HOST)); #else @@ -220,7 +223,8 @@ bool CPU_SPI_Uninitialize(uint8_t busIndex) if (ret != ESP_OK) { -#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) +#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) // First available bus on ESP32_C3/S3/C6/H2 is SPI2_HOST ESP_LOGE(TAG, "spi_bus_free bus %d esp_err %d", busIndex + SPI2_HOST, ret); #else @@ -303,21 +307,21 @@ spi_device_interface_config_t GetConfig(const SPI_DEVICE_CONFIGURATION &spiDevic // Fill in device config spi_device_interface_config_t dev_config{ - 0, // Command bits - 0, // Address bits - 0, // Dummy bits - spiMode, // SPi Mode - SPI_CLK_SRC_DEFAULT,// Clock source - 0, // Duty cycle 50/50 - 0, // cs_ena_pretrans - 0, // cs_ena_posttrans - clockHz, // Clock speed in Hz - 0, // Input_delay_ns - -1, // Chip select, we will use manual chip select - flags, // SPI_DEVICE flags - 1, // Queue size - 0, // Callback before - spi_trans_ready, // Callback after transaction complete + 0, // Command bits + 0, // Address bits + 0, // Dummy bits + spiMode, // SPi Mode + SPI_CLK_SRC_DEFAULT, // Clock source + 0, // Duty cycle 50/50 + 0, // cs_ena_pretrans + 0, // cs_ena_posttrans + clockHz, // Clock speed in Hz + 0, // Input_delay_ns + -1, // Chip select, we will use manual chip select + flags, // SPI_DEVICE flags + 1, // Queue size + 0, // Callback before + spi_trans_ready, // Callback after transaction complete }; return dev_config; @@ -357,7 +361,8 @@ HRESULT CPU_SPI_Add_Device(const SPI_DEVICE_CONFIGURATION &spiDeviceConfig, uint // Add device to bus spi_device_handle_t deviceHandle; -#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) +#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C6) || \ + defined(CONFIG_IDF_TARGET_ESP32H2) // First available bus on ESP32_C3/S3 is SPI2_HOST esp_err_t ret = spi_bus_add_device((spi_host_device_t)(spiDeviceConfig.Spi_Bus + SPI2_HOST), &dev_config, &deviceHandle); diff --git a/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp b/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp index 8de079e59d..d4062e7166 100644 --- a/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp +++ b/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp @@ -20,9 +20,12 @@ static const char *TAG = "SerialDevice"; NF_PAL_UART Uart0_PAL; NF_PAL_UART Uart1_PAL; -#if defined(UART_NUM_2) +#if SOC_UART_HP_NUM > 2 NF_PAL_UART Uart2_PAL; #endif +#if SOC_UART_HP_NUM > 3 +NF_PAL_UART Uart3_PAL; +#endif NF_PAL_UART *GetPalUartFromUartNum_sys(int uart_num) { @@ -36,12 +39,18 @@ NF_PAL_UART *GetPalUartFromUartNum_sys(int uart_num) // set UART PAL return &Uart1_PAL; -#if defined(UART_NUM_2) +#if SOC_UART_HP_NUM > 2 case UART_NUM_2: // set UART PAL return &Uart2_PAL; #endif +#if SOC_UART_HP_NUM > 3 + case UART_NUM_2: + // set UART PAL + return &Uart3_PAL; +#endif + default: break; } @@ -1433,11 +1442,14 @@ HRESULT Library_sys_io_ser_native_System_IO_Ports_SerialPort::GetDeviceSelector_ #if defined(CONFIG_TINYUSB_CDC_ENABLED) || defined(CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED) "COM1," #endif -#if defined(UART_NUM_1) +#if SOC_UART_HP_NUM > 1 "COM2," #endif -#if defined(UART_NUM_2) +#if SOC_UART_HP_NUM > 2 "COM3," +#endif +#if SOC_UART_HP_NUM > 3 + "COM4," #endif ; diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_Hardware_Esp32_Sleep.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_Hardware_Esp32_Sleep.cpp index db6b5e0632..0ad6616519 100644 --- a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_Hardware_Esp32_Sleep.cpp +++ b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_Hardware_Esp32_Sleep.cpp @@ -239,11 +239,11 @@ HRESULT Library_nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32 NANOCLR_HEADER(); { esp_err_t err; - int uartNum; + uart_port_t uartNum; int threshold; // Static arguments starts at 0 - uartNum = stack.Arg0().NumericByRef().s4; + uartNum = (uart_port_t)stack.Arg0().NumericByRef().s4; threshold = stack.Arg1().NumericByRef().s4; uart_set_wakeup_threshold(uartNum, threshold); err = esp_sleep_enable_uart_wakeup(uartNum); diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32_Touch_TouchPad.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32_Touch_TouchPad.cpp index cef6bfa394..558594ec6e 100644 --- a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32_Touch_TouchPad.cpp +++ b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32_Touch_TouchPad.cpp @@ -38,7 +38,8 @@ static void IsrCallBack(void *arg) #if defined(CONFIG_IDF_TARGET_ESP32) touch_pad_intr_clear(); #else - touch_pad_intr_clear(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | TOUCH_PAD_INTR_MASK_TIMEOUT); + touch_pad_intr_clear((touch_pad_intr_mask_t)(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | + TOUCH_PAD_INTR_MASK_TIMEOUT)); #endif for (int i = 0; i < TOUCH_PAD_MAX; i++) { @@ -71,7 +72,8 @@ static void TouchPad_Uninitialize() #if defined(CONFIG_IDF_TARGET_ESP32) touch_pad_intr_disable(); #else - touch_pad_intr_disable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | TOUCH_PAD_INTR_MASK_TIMEOUT); + touch_pad_intr_disable((touch_pad_intr_mask_t)(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | + TOUCH_PAD_INTR_MASK_TIMEOUT)); #endif touch_pad_isr_deregister(IsrCallBack, NULL); // Clean filter and uninstall the driver @@ -1014,7 +1016,8 @@ HRESULT Library_nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32 uint16_t meas = (uint16_t)stack.Arg1().NumericByRef().u2; #if defined(CONFIG_IDF_TARGET_ESP32) - if ((touch_pad_set_measurement_clock_cycles(sleep) != ESP_OK) || (touch_pad_set_measurement_interval(meas) != ESP_OK)) + if ((touch_pad_set_measurement_clock_cycles(sleep) != ESP_OK) || + (touch_pad_set_measurement_interval(meas) != ESP_OK)) { NANOCLR_SET_AND_LEAVE(CLR_E_INVALID_OPERATION); } @@ -1044,12 +1047,14 @@ HRESULT Library_nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32 uint16_t meas; #if defined(CONFIG_IDF_TARGET_ESP32) - if ((touch_pad_get_measurement_clock_cycles(&sleep) != ESP_OK) || (touch_pad_get_measurement_interval(&meas) != ESP_OK)) + if ((touch_pad_get_measurement_clock_cycles(&sleep) != ESP_OK) || + (touch_pad_get_measurement_interval(&meas) != ESP_OK)) { NANOCLR_SET_AND_LEAVE(CLR_E_INVALID_OPERATION); } #else - if ((touch_pad_get_charge_discharge_times(&sleep) != ESP_OK) || (touch_pad_get_measurement_interval(&meas) != ESP_OK)) + if ((touch_pad_get_charge_discharge_times(&sleep) != ESP_OK) || + (touch_pad_get_measurement_interval(&meas) != ESP_OK)) { NANOCLR_SET_AND_LEAVE(CLR_E_INVALID_OPERATION); } diff --git a/version.json b/version.json index 981fe6bd3c..8a224cd76b 100644 --- a/version.json +++ b/version.json @@ -1,28 +1,28 @@ -{ - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.11.0", - "assemblyVersion": { - "precision": "revision" - }, - "semVer1NumericIdentifierPadding": 3, - "nuGetPackageVersion": { - "semVer": 2.0 - }, - "publicReleaseRefSpec": [ - "refs/head/*" - ], - "cloudBuild": { - "setAllVariables": true, - "buildNumber": { - "enabled": false, - "includeCommitId": { - "when": "always" - } - } - }, - "release": { - "branchName": "release-v{version}", - "versionIncrement": "build", - "firstUnstableTag": "preview" - } -} +{ + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.12.0", + "assemblyVersion": { + "precision": "revision" + }, + "semVer1NumericIdentifierPadding": 3, + "nuGetPackageVersion": { + "semVer": 2.0 + }, + "publicReleaseRefSpec": [ + "refs/head/*" + ], + "cloudBuild": { + "setAllVariables": true, + "buildNumber": { + "enabled": false, + "includeCommitId": { + "when": "always" + } + } + }, + "release": { + "branchName": "release-v{version}", + "versionIncrement": "build", + "firstUnstableTag": "preview" + } +}