From bcce1d1ada57d212fc695d072e67f7cb5d165eee Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Fri, 15 Oct 2021 18:08:03 +0300 Subject: [PATCH] Adjusting Dockerfiles for ESP32 IDF4.3 --- .devcontainer/Dockerfile.All | 2 +- .devcontainer/Dockerfile.ESP32 | 2 +- .devcontainer/sources/Dockerfile.All | 46 ++++++++-------------- .devcontainer/sources/Dockerfile.ESP32 | 49 ++++++------------------ .github/workflows/all.yaml | 2 +- .github/workflows/esp32.yml | 2 +- .vscode/cmake-variants-DEVCONTAINER.json | 32 ++++++++-------- 7 files changed, 49 insertions(+), 86 deletions(-) diff --git a/.devcontainer/Dockerfile.All b/.devcontainer/Dockerfile.All index d50a26c208..dcadaec59c 100644 --- a/.devcontainer/Dockerfile.All +++ b/.devcontainer/Dockerfile.All @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-all:v1.3 \ No newline at end of file +FROM ghcr.io/nanoframework/dev-container-all:v2.0 \ No newline at end of file diff --git a/.devcontainer/Dockerfile.ESP32 b/.devcontainer/Dockerfile.ESP32 index 33e589ef00..df7e90199c 100644 --- a/.devcontainer/Dockerfile.ESP32 +++ b/.devcontainer/Dockerfile.ESP32 @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-esp32:v1.2 \ No newline at end of file +FROM ghcr.io/nanoframework/dev-container-esp32:v2.0 \ No newline at end of file diff --git a/.devcontainer/sources/Dockerfile.All b/.devcontainer/sources/Dockerfile.All index ecbb785ba4..574fd7f1bf 100644 --- a/.devcontainer/sources/Dockerfile.All +++ b/.devcontainer/sources/Dockerfile.All @@ -17,27 +17,6 @@ RUN curl -o /tmp/dc-downloads/cmake.sh $CMAKE_SCRIPT \ && chmod +x /tmp/dc-downloads/cmake.sh \ && bash /tmp/dc-downloads/cmake.sh --skip-license --prefix=/tmp/dc-extracted/cmake -ARG IDF_URI=https://dl.espressif.com/dl/esp-idf/releases/esp-idf-v3.3.5.zip -RUN curl -o /tmp/dc-downloads/esp-idf.zip $IDF_URI \ - && unzip -d /tmp/dc-extracted/esp-idf /tmp/dc-downloads/esp-idf.zip - -ARG IDF_LIBS_URI=https://dl.cloudsmith.io/public/net-nanoframework/internal-build-tools/raw/names/IDF_libs/versions/v3.3.5/IDF_libs-v3.3.5.zip -RUN curl -o /tmp/dc-downloads/esp-idf-libs.zip $IDF_LIBS_URI -L \ - && unzip -d /tmp/dc-extracted/esp-idf-libs /tmp/dc-downloads/esp-idf-libs.zip - -ARG IDF_LIBS_URI=https://dl.cloudsmith.io/public/net-nanoframework/internal-build-tools/raw/names/IDF_libs/versions/v3.3.5_BLE/IDF_libs-v3.3.5_BLE.zip -RUN curl -o /tmp/dc-downloads/esp-idf-libs-ble.zip $IDF_LIBS_URI -L \ - && unzip -d /tmp/dc-extracted/esp-idf-libs_BLE /tmp/dc-downloads/esp-idf-libs-ble.zip - -ARG IDF_LIBS_URI=https://dl.cloudsmith.io/public/net-nanoframework/internal-build-tools/raw/names/IDF_libs/versions/v3.3.5_V3/IDF_libs-v3.3.5_V3.zip -RUN curl -o /tmp/dc-downloads/esp-idf-libs-v3.zip $IDF_LIBS_URI -L \ - && unzip -d /tmp/dc-extracted/esp-idf-libs_V3 /tmp/dc-downloads/esp-idf-libs-v3.zip - -ARG XTENSA_URI=https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-97-gc752ad5-5.2.0.tar.gz -RUN mkdir -p /tmp/dc-extracted/xtensa \ - && curl -o /tmp/dc-downloads/xtensa.tar.gz $XTENSA_URI \ - && tar -xzf /tmp/dc-downloads/xtensa.tar.gz -C /tmp/dc-extracted/xtensa --strip-components 1 - # This is TI XDC tools for linux. Cheack all versions here: http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/index.html ARG TI_TOOL_URL=http://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 \ @@ -66,11 +45,11 @@ RUN apt-get update \ srecord \ python3 \ python3-pip \ - nodejs + nodejs \ + libffi-dev # Create needed directories RUN mkdir -p /usr/local/bin/gcc \ - && mkdir -p /usr/local/bin/xtensa \ && mkdir -p /usr/local/bin/titools # Clone repos for STM32 including AzureRTOS @@ -87,8 +66,16 @@ RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --d # 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 \ - && git clone --branch STABLE-2_0_3_RELEASE https://git.savannah.nongnu.org/git/lwip.git --depth 1 ./sources/lwip \ && git clone --branch nf-build https://github.com/nanoframework/spiffs.git --depth 1 ./sources/spiffs + +# The certificate of this one is not prolely propagated in the base image, ignoring the verification of this clone +ENV GIT_SSL_NO_VERIFY=1 +RUN git clone --branch STABLE-2_0_3_RELEASE https://git.savannah.nongnu.org/git/lwip.git --depth 1 ./sources/lwip +ENV GIT_SSL_NO_VERIFY=0 + +# Clone ESP-IDF +RUN git clone --branch release/v4.3 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 @@ -100,11 +87,6 @@ RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC # Copy from our other container COPY --from=downloader /tmp/dc-extracted/gcc /usr/local/bin/gcc COPY --from=downloader /tmp/dc-extracted/cmake /usr -COPY --from=downloader /tmp/dc-extracted/esp-idf /sources/esp-idf -COPY --from=downloader /tmp/dc-extracted/esp-idf-libs_BLE /sources/esp-idf-libs_BLE -COPY --from=downloader /tmp/dc-extracted/esp-idf-libs_V3 /sources/esp-idf-libs_V3 -COPY --from=downloader /tmp/dc-extracted/esp-idf-libs /sources/esp-idf-libs -COPY --from=downloader /tmp/dc-extracted/xtensa /usr/local/bin/xtensa COPY --from=downloader /tmp/dc-extracted/titools/xdctools_3_62_00_08_core /usr/local/bin/titools # COPY ./scripts/git-pull-repos.sh /usr/local/git-pull-repos.sh @@ -118,6 +100,12 @@ RUN mkdir -p /usr/local/bin/hex2dfu \ RUN ln -fs /usr/bin/python3 /usr/bin/python \ && pip3 install pyserial +# Install ESP-IDF +ENV IDF_PATH=/sources/esp-idf +RUN python -m pip install -r $IDF_PATH/requirements.txt +RUN $IDF_PATH/install.sh +ENV PATH=$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-2021r1-8.4.0/xtensa-esp32-elf/bin:/root/.espressif/tools/xtensa-esp32s2-elf/esp-2021r1-8.4.0/xtensa-esp32s2-elf/bin:/root/.espressif/tools/riscv32-esp-elf/esp-2021r1-8.4.0/riscv32-esp-elf/bin + # Clean up downloaded files RUN apt-get autoremove -y \ && apt-get clean -y \ diff --git a/.devcontainer/sources/Dockerfile.ESP32 b/.devcontainer/sources/Dockerfile.ESP32 index 71f2f0eb21..04f210098c 100644 --- a/.devcontainer/sources/Dockerfile.ESP32 +++ b/.devcontainer/sources/Dockerfile.ESP32 @@ -17,27 +17,6 @@ RUN curl -o /tmp/dc-downloads/cmake.sh $CMAKE_SCRIPT \ && chmod +x /tmp/dc-downloads/cmake.sh \ && bash /tmp/dc-downloads/cmake.sh --skip-license --prefix=/tmp/dc-extracted/cmake -ARG IDF_URI=https://dl.espressif.com/dl/esp-idf/releases/esp-idf-v3.3.5.zip -RUN curl -o /tmp/dc-downloads/esp-idf.zip $IDF_URI \ - && unzip -d /tmp/dc-extracted/esp-idf /tmp/dc-downloads/esp-idf.zip - -ARG IDF_LIBS_URI=https://dl.cloudsmith.io/public/net-nanoframework/internal-build-tools/raw/names/IDF_libs/versions/v3.3.5/IDF_libs-v3.3.5.zip -RUN curl -o /tmp/dc-downloads/esp-idf-libs.zip $IDF_LIBS_URI -L \ - && unzip -d /tmp/dc-extracted/esp-idf-libs /tmp/dc-downloads/esp-idf-libs.zip - -ARG IDF_LIBS_URI=https://dl.cloudsmith.io/public/net-nanoframework/internal-build-tools/raw/names/IDF_libs/versions/v3.3.5_BLE/IDF_libs-v3.3.5_BLE.zip -RUN curl -o /tmp/dc-downloads/esp-idf-libs-ble.zip $IDF_LIBS_URI -L \ - && unzip -d /tmp/dc-extracted/esp-idf-libs_BLE /tmp/dc-downloads/esp-idf-libs-ble.zip - -ARG IDF_LIBS_URI=https://dl.cloudsmith.io/public/net-nanoframework/internal-build-tools/raw/names/IDF_libs/versions/v3.3.5_V3/IDF_libs-v3.3.5_V3.zip -RUN curl -o /tmp/dc-downloads/esp-idf-libs-v3.zip $IDF_LIBS_URI -L \ - && unzip -d /tmp/dc-extracted/esp-idf-libs_V3 /tmp/dc-downloads/esp-idf-libs-v3.zip - -ARG XTENSA_URI=https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-97-gc752ad5-5.2.0.tar.gz -RUN mkdir -p /tmp/dc-extracted/xtensa \ - && curl -o /tmp/dc-downloads/xtensa.tar.gz $XTENSA_URI \ - && tar -xzf /tmp/dc-downloads/xtensa.tar.gz -C /tmp/dc-extracted/xtensa --strip-components 1 - FROM debian:10.4-slim AS devcontainer # Avoid warnings by switching to noninteractive @@ -59,12 +38,11 @@ RUN apt-get update \ srecord \ python3 \ python3-pip \ - nodejs + nodejs \ + libffi-dev # Create needed directories -RUN mkdir -p /usr/local/bin/gcc \ - && mkdir -p /usr/local/bin/xtensa \ - && mkdir -p /usr/local/bin/titools +RUN mkdir -p /usr/local/bin/gcc # Clone mbedtls and fatfs RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ @@ -72,29 +50,26 @@ RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --d # 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 \ - && git clone --branch STABLE-2_0_3_RELEASE https://git.savannah.nongnu.org/git/lwip.git --depth 1 ./sources/lwip \ && git clone --branch nf-build https://github.com/nanoframework/spiffs.git --depth 1 ./sources/spiffs +# Clone ESP-IDF +RUN git clone --branch release/v4.3 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf + # Copy from our other container COPY --from=downloader /tmp/dc-extracted/gcc /usr/local/bin/gcc COPY --from=downloader /tmp/dc-extracted/cmake /usr -COPY --from=downloader /tmp/dc-extracted/esp-idf /sources/esp-idf -COPY --from=downloader /tmp/dc-extracted/esp-idf-libs_BLE /sources/esp-idf-libs_BLE -COPY --from=downloader /tmp/dc-extracted/esp-idf-libs_V3 /sources/esp-idf-libs_V3 -COPY --from=downloader /tmp/dc-extracted/esp-idf-libs /sources/esp-idf-libs -COPY --from=downloader /tmp/dc-extracted/xtensa /usr/local/bin/xtensa # COPY ./scripts/git-pull-repos.sh /usr/local/git-pull-repos.sh -# Putting hex2dfu in the container -ARG HEX2DFU=https://github.com/nanoframework/hex2dfu/releases/download/v2.0.9/hex2dfu -RUN mkdir -p /usr/local/bin/hex2dfu \ - && curl -o /usr/local/bin/hex2dfu/hex2dfu $HEX2DFU -L \ - && chmod +x /usr/local/bin/hex2dfu/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 +RUN python -m pip install -r $IDF_PATH/requirements.txt +RUN $IDF_PATH/install.sh +ENV PATH=$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-2021r1-8.4.0/xtensa-esp32-elf/bin:/root/.espressif/tools/xtensa-esp32s2-elf/esp-2021r1-8.4.0/xtensa-esp32s2-elf/bin:/root/.espressif/tools/riscv32-esp-elf/esp-2021r1-8.4.0/riscv32-esp-elf/bin + # Clean up downloaded files RUN apt-get autoremove -y \ && apt-get clean -y \ diff --git a/.github/workflows/all.yaml b/.github/workflows/all.yaml index 8f8ef71e52..c1fb5ec31b 100644 --- a/.github/workflows/all.yaml +++ b/.github/workflows/all.yaml @@ -2,7 +2,7 @@ name: Build and push image for all RTOS env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-all - GCR_VERSION: v1.3 + GCR_VERSION: v2.0 GCR_FILE: .devcontainer/sources/Dockerfile.All # Controls when the action will run. diff --git a/.github/workflows/esp32.yml b/.github/workflows/esp32.yml index e068532b1f..e4f212e897 100644 --- a/.github/workflows/esp32.yml +++ b/.github/workflows/esp32.yml @@ -2,7 +2,7 @@ name: Build and push ESP32 image env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-esp32 - GCR_VERSION: v1.2 + GCR_VERSION: v2.0 GCR_FILE: .devcontainer/sources/Dockerfile.ESP32 # Controls when the action will run. diff --git a/.vscode/cmake-variants-DEVCONTAINER.json b/.vscode/cmake-variants-DEVCONTAINER.json index 7aa2b4c753..93ac616b32 100644 --- a/.vscode/cmake-variants-DEVCONTAINER.json +++ b/.vscode/cmake-variants-DEVCONTAINER.json @@ -279,17 +279,17 @@ "API_System.Math": "ON" } }, - "ESP32_REV1": { - "short": "ESP32_REV1", + "ESP32_REV0": { + "short": "ESP32_REV0", "settings": { "BUILD_VERBOSE": "OFF", "BUILD_VERSION": "0.9.99.999", "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.xtensa-esp32-elf.cmake", "TARGET_SERIES": "ESP32", "TARGET_BOARD": "ESP32", - "TARGET_NAME": "ESP32_REV1", + "TARGET_NAME": "ESP32_REV0", "SDK_CONFIG_FILE": "", - "ESP32_IDF_PATH": "", + "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", "NF_FEATURE_DEBUGGER": "ON", @@ -300,7 +300,7 @@ "SUPPORT_ANY_BASE_CONVERSION": "ON", "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", - "MBEDTLS_SOURCE": "", + "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", @@ -323,17 +323,17 @@ "API_nanoFramework.Graphics": "OFF" } }, - "ESP32_REV1_BLE": { - "short": "ESP32_REV1_BLE", + "ESP32_REV0_BLE": { + "short": "ESP32_REV0_BLE", "settings": { "BUILD_VERBOSE": "OFF", "BUILD_VERSION": "0.9.99.999", "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.xtensa-esp32-elf.cmake", "TARGET_SERIES": "ESP32", "TARGET_BOARD": "ESP32", - "TARGET_NAME": "ESP32_REV1_BLE", + "TARGET_NAME": "ESP32_REV0_BLE", "SDK_CONFIG_FILE": "sdkconfig.default_ble.esp32", - "ESP32_IDF_PATH": "", + "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", "NF_FEATURE_DEBUGGER": "ON", @@ -344,7 +344,7 @@ "SUPPORT_ANY_BASE_CONVERSION": "ON", "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", - "MBEDTLS_SOURCE": "", + "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", @@ -378,7 +378,7 @@ "TARGET_BOARD": "ESP32", "TARGET_NAME": "ESP32_PICO", "SDK_CONFIG_FILE": "sdkconfig.default_pico", - "ESP32_IDF_PATH": "", + "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "TARGET_SERIAL_BAUDRATE": "115200", "NF_BUILD_RTM": "OFF", @@ -390,7 +390,7 @@ "SUPPORT_ANY_BASE_CONVERSION": "ON", "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", - "MBEDTLS_SOURCE": "", + "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", @@ -423,7 +423,7 @@ "TARGET_BOARD": "ESP32", "TARGET_NAME": "ESP_WROVER_KIT", "SDK_CONFIG_FILE": "", - "ESP32_IDF_PATH": "", + "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", "NF_FEATURE_DEBUGGER": "ON", @@ -434,7 +434,7 @@ "SUPPORT_ANY_BASE_CONVERSION": "ON", "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", - "MBEDTLS_SOURCE": "", + "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", @@ -469,7 +469,7 @@ "TARGET_BOARD": "ESP32", "TARGET_NAME": "ESP32_LILYGO", "SDK_CONFIG_FILE": "", - "ESP32_IDF_PATH": "", + "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", "NF_FEATURE_DEBUGGER": "ON", @@ -482,7 +482,7 @@ "SUPPORT_ANY_BASE_CONVERSION": "ON", "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", - "MBEDTLS_SOURCE": "", + "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON",