Skip to content

Commit

Permalink
Create a single ESP32 (ESP-IDF) docker image
Browse files Browse the repository at this point in the history
* Supports ESP32, ESP32-S3 and ESP32-C3
  • Loading branch information
duncandrennan committed Jun 12, 2022
1 parent d26d43b commit f9ef29f
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 156 deletions.
23 changes: 17 additions & 6 deletions tools/docker/esp32/Dockerfile-esp32-build
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
RUN useradd -d /opt/Espressif -m -s /bin/bash user && chown -R user /opt

ARG TARGETARCH
ARG TOOLCHAIN_URL=https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch3-linux-${TARGETARCH}.tar.gz
RUN cd /opt/Espressif && wget -q $TOOLCHAIN_URL && \
tar xf `basename $TOOLCHAIN_URL` && \
rm `basename $TOOLCHAIN_URL`
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/Espressif/xtensa-esp32-elf/bin
ARG TOOLCHAIN_URL_ESP32=https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch3-linux-${TARGETARCH}.tar.gz
RUN cd /opt/Espressif && wget -q $TOOLCHAIN_URL_ESP32 && \
tar xf `basename $TOOLCHAIN_URL_ESP32` && \
rm `basename $TOOLCHAIN_URL_ESP32`
ARG TOOLCHAIN_URL_ESP32S3=https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch3-linux-${TARGETARCH}.tar.gz
RUN cd /opt/Espressif && wget -q $TOOLCHAIN_URL_ESP32S3 && \
tar xzf `basename $TOOLCHAIN_URL_ESP32S3` && \
rm `basename $TOOLCHAIN_URL_ESP32S3`
ARG TOOLCHAIN_URL_ESP32C3=https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch3-linux-${TARGETARCH}.tar.gz
RUN cd /opt/Espressif && wget -q $TOOLCHAIN_URL_ESP32C3 && \
tar xzf `basename $TOOLCHAIN_URL_ESP32C3` && \
rm `basename $TOOLCHAIN_URL_ESP32C3`
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/Espressif/xtensa-esp32-elf/bin:/opt/Espressif/xtensa-esp32s3-elf/bin:/opt/Espressif/riscv32-esp-elf/bin
ADD ct_path.sh /etc/profile.d

ARG DOCKER_TAG
Expand All @@ -42,7 +50,8 @@ RUN pip3 install --no-cache-dir -r /opt/Espressif/esp-idf/requirements.txt
# Pre-build configuration tools
RUN cd $IDF_PATH/tools/kconfig && make conf-idf

ADD rom.bin rom.elf /opt/Espressif/rom/
# TODO: add esp32s3 rom files
ADD rom.bin rom.elf esp32c3_rev3_rom.bin esp32c3_rev3_rom.elf /opt/Espressif/rom/

ARG TARGETARCH
ADD mgos_fw_meta.py $TARGETARCH/mklfs $TARGETARCH/mkspiffs $TARGETARCH/mkspiffs8 /usr/local/bin/
Expand All @@ -51,5 +60,7 @@ RUN ln -s /opt/serve_core/serve_core.py /usr/local/bin/serve_core.py

ARG DOCKER_TAG
ENV MGOS_TARGET_GDB /opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb
ENV MGOS_TARGET_GDB_ESP32S3 /opt/Espressif/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gdb
ENV MGOS_TARGET_GDB_ESP32C3 /opt/Espressif/riscv32-esp-elf/bin/riscv32-esp-elf-gdb
ENV MGOS_SDK_REVISION $DOCKER_TAG
ENV MGOS_SDK_BUILD_IMAGE docker.io/mgos/esp32-build:$DOCKER_TAG
2 changes: 1 addition & 1 deletion tools/docker/esp32/ct_path.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export PATH="$PATH:/opt/Espressif/xtensa-esp32-elf/bin"
export PATH="$PATH:/opt/Espressif/xtensa-esp32-elf/bin:/opt/Espressif/xtensa-esp32s3-elf/bin:/opt/Espressif/riscv32-esp-elf/bin"
export SDK_PATH=/opt/Espressif/esp-idf
Binary file added tools/docker/esp32/esp32c3_rev3_rom.bin
Binary file not shown.
Binary file added tools/docker/esp32/esp32c3_rev3_rom.elf
Binary file not shown.
60 changes: 0 additions & 60 deletions tools/docker/esp32c3/Dockerfile-esp32c3-build

This file was deleted.

11 changes: 0 additions & 11 deletions tools/docker/esp32c3/Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions tools/docker/esp32c3/ct_path.sh

This file was deleted.

Binary file removed tools/docker/esp32c3/rom.bin
Binary file not shown.
Binary file removed tools/docker/esp32c3/rom.elf
Binary file not shown.
60 changes: 0 additions & 60 deletions tools/docker/esp32s3/Dockerfile-esp32s3-build

This file was deleted.

14 changes: 0 additions & 14 deletions tools/docker/esp32s3/Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions tools/docker/esp32s3/ct_path.sh

This file was deleted.

0 comments on commit f9ef29f

Please sign in to comment.