|
| 1 | +FROM ubuntu:latest AS downloader |
| 2 | +RUN apt-get update \ |
| 3 | + && apt-get -y install --no-install-recommends apt-utils \ |
| 4 | + && apt-get install -y \ |
| 5 | + curl \ |
| 6 | + xz-utils \ |
| 7 | + unzip \ |
| 8 | + wget |
| 9 | + |
| 10 | +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted |
| 11 | + |
| 12 | +ARG GCC_VERSION=13.3.rel1 |
| 13 | +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 |
| 14 | +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \ |
| 15 | + && curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \ |
| 16 | + && xz -d /tmp/dc-downloads/gcc-arm.tar.xz \ |
| 17 | + && tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \ |
| 18 | + && rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/ |
| 19 | + |
| 20 | +ARG CMAKE_VERSION=3.31.6 |
| 21 | +ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh |
| 22 | +RUN wget $CMAKE_SCRIPT \ |
| 23 | + -q -O /tmp/dc-downloads/cmake-install.sh \ |
| 24 | + && chmod u+x /tmp/dc-downloads/cmake-install.sh \ |
| 25 | + && mkdir -p /tmp/dc-extracted/cmake \ |
| 26 | + && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ |
| 27 | + && rm /tmp/dc-downloads/cmake-install.sh |
| 28 | + |
| 29 | +# This is TI XDC tools for linux. Check all versions here: https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/index.html |
| 30 | +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 |
| 31 | +RUN mkdir -p /tmp/dc-extracted/titools \ |
| 32 | + && curl -o /tmp/dc-downloads/titools.zip $TI_TOOL_URL -L \ |
| 33 | + && unzip -d /tmp/dc-extracted/titools /tmp/dc-downloads/titools.zip |
| 34 | + |
| 35 | +FROM python:3.11 AS devcontainer |
| 36 | + |
| 37 | +# Avoid warnings by switching to noninteractive |
| 38 | +ENV DEBIAN_FRONTEND=noninteractive |
| 39 | + |
| 40 | +# You can set up non-root user |
| 41 | +# ARG USERNAME=vscode |
| 42 | +# ARG USER_UID=1000 |
| 43 | +# ARG USER_GID=$USER_UID |
| 44 | + |
| 45 | +# Configure apt and install packages |
| 46 | +RUN apt-get update \ |
| 47 | + && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ |
| 48 | + && apt-get install -y \ |
| 49 | + git \ |
| 50 | + git-lfs \ |
| 51 | + git-svn \ |
| 52 | + subversion \ |
| 53 | + clang-format \ |
| 54 | + curl \ |
| 55 | + ninja-build \ |
| 56 | + srecord \ |
| 57 | + nodejs \ |
| 58 | + libffi-dev |
| 59 | + |
| 60 | +# Create needed directories |
| 61 | +RUN mkdir -p /usr/local/bin/gcc \ |
| 62 | + && mkdir -p /usr/local/bin/titools |
| 63 | + |
| 64 | +# Clone ChibiOS repo |
| 65 | +# RUN git svn clone http://svn.code.sf.net/p/chibios/code/branches/stable_21.11.x -rHEAD ./sources/ChibiOs |
| 66 | +# Alternative source for those having issues with git svn downloads: |
| 67 | +RUN git clone --branch stable_21.11.x https://github.com/ArduPilot/ChibiOS.svn.git --depth 1 ./sources/ChibiOs |
| 68 | + |
| 69 | +# Clone support repos for STM32 including Eclipse ThreadX (a.k.a. Azure RTOS) |
| 70 | +RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git --depth 1 ./sources/STM32CubeL4 \ |
| 71 | + && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF7.git --depth 1 ./sources/STM32CubeF7 \ |
| 72 | + && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF4.git --depth 1 ./sources/STM32CubeF4 \ |
| 73 | + && git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git --depth 1 ./sources/STM32CubeH7 \ |
| 74 | + && git clone --branch chibios-21.11.x https://github.com/ChibiOS/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib |
| 75 | + |
| 76 | +# Clone repos for Eclipse ThreadX (a.k.a. Azure RTOS) |
| 77 | +RUN git clone --branch v6.4.0_rel --recursive https://github.com/eclipse-threadx/threadx.git --depth 1 ./sources/AzureRTOS \ |
| 78 | + && git clone --branch v6.3.0_rel --recursive https://github.com/eclipse-threadx/netxduo.git --depth 1 ./sources/NetxDuo |
| 79 | + |
| 80 | +# Clone dependent repos (mbedtls, fatfs and littlefs) |
| 81 | +RUN git clone --branch R0.15 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ |
| 82 | + && git clone --branch v2.9.3 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs \ |
| 83 | + && git clone --branch mbedtls-3.6.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ |
| 84 | + && cd ./sources/mbedtls \ |
| 85 | + && git submodule update --init --recursive |
| 86 | + |
| 87 | +# Clone FreeRTOS and what is needed for ESP32 |
| 88 | +RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \ |
| 89 | + && git clone --branch 5.5.1 https://github.com/ARM-software/CMSIS_5.git --depth 1 ./sources/CMSIS_5 |
| 90 | + |
| 91 | +# Clone lwIP for STM32 and NXP |
| 92 | +RUN git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip |
| 93 | + |
| 94 | +# Clone ESP-IDF |
| 95 | +RUN git clone --branch v5.2.3 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf |
| 96 | + |
| 97 | +# Clone what is needed for TI |
| 98 | +RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC32xx_SDK.git --depth 1 ./sources/SimpleLinkCC32 \ |
| 99 | + # you can't use the nanoFramework repository as it's Windows only |
| 100 | + # && git clone --branch 3.61.00.16 https://github.com/nanoframework/TI_XDCTools.git --depth 1 ./sources/TI_XDCTools \ |
| 101 | + && git clone --branch 5.40.00.40 https://github.com/nanoframework/SimpleLink_CC13xx_26xx_SDK.git --depth 1 ./sources/SimpleLinkCC13 \ |
| 102 | + && git clone --branch 1.10.0 https://github.com/nanoframework/TI_SysConfig.git --depth 1 ./sources/TI_SysConfig \ |
| 103 | + && chmod +x ./sources/TI_SysConfig/sysconfig_cli.sh |
| 104 | + |
| 105 | +# set gcc location |
| 106 | +ARG TMP_GCC_PATH=/usr/local/bin/gcc |
| 107 | +ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin |
| 108 | + |
| 109 | +# Copy from our other container |
| 110 | +COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH |
| 111 | +COPY --from=downloader /tmp/dc-extracted/titools/xdctools_3_62_00_08_core /usr/local/bin/titools |
| 112 | +COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake |
| 113 | + |
| 114 | +ENV PATH=/usr/bin/cmake/bin:${PATH} |
| 115 | + |
| 116 | +# Putting hex2dfu in the container |
| 117 | +ENV HEX2DFU_PATH=/usr/local/bin/hex2dfu |
| 118 | + |
| 119 | +ARG HEX2DFU=https://github.com/nanoframework/hex2dfu/releases/latest/download/hex2dfu |
| 120 | +RUN mkdir -p $HEX2DFU_PATH \ |
| 121 | + && curl -o $HEX2DFU_PATH/hex2dfu $HEX2DFU -L \ |
| 122 | + && chmod +x $HEX2DFU_PATH/hex2dfu |
| 123 | + |
| 124 | +# Creating static link python for pyhton3 |
| 125 | +RUN ln -fs /usr/bin/python3 /usr/bin/python \ |
| 126 | + && pip3 install pyserial |
| 127 | + |
| 128 | +# Install ESP-IDF |
| 129 | +ENV IDF_PATH=/sources/esp-idf |
| 130 | +ENV ESP_PATCH_VER=esp-13.2.0_20230928 |
| 131 | +# This is now taking care in the following line |
| 132 | +# RUN python -m pip install -r $IDF_PATH/requirements.txt |
| 133 | +RUN $IDF_PATH/install.sh |
| 134 | + |
| 135 | +ENV PATH=/root/.espressif/python_env/idf5.2_py3.11_env/bin:$PATH:\ |
| 136 | +$IDF_PATH/components/esptool_py/esptool:\ |
| 137 | +$IDF_PATH/components/espcoredump:\ |
| 138 | +$IDF_PATH/components/partition_table/:\ |
| 139 | +$IDF_PATH/tools/:\ |
| 140 | +$IDF_PATH/components/app_update:\ |
| 141 | +/root/.espressif/tools/xtensa-esp-elf/$ESP_PATCH_VER/xtensa-esp-elf/bin:\ |
| 142 | +/root/.espressif/tools/riscv32-esp-elf/$ESP_PATCH_VER/riscv32-esp-elf/bin |
| 143 | + |
| 144 | +# Clean up downloaded files |
| 145 | +RUN apt-get autoremove -y \ |
| 146 | + && apt-get clean -y \ |
| 147 | + && rm -rf /var/lib/apt/lists/* |
| 148 | + |
| 149 | +# Switch back to dialog for any ad-hoc use of apt-get |
| 150 | +ENV DEBIAN_FRONTEND=dialog |
0 commit comments