From 5e06963f3f6e63c83eb8899952c7fdccd2d144de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Tue, 15 Mar 2022 22:25:36 +0200 Subject: [PATCH] Clean up Dockerfile --- Dockerfile | 9 +++++---- README.md | 13 +++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile index fb907e8..484a4e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,9 @@ RUN : \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* RUN git clone --depth 1 -b v1.17 https://github.com/micropython/micropython.git /src -RUN cd /src/mpy-cross && make -RUN cd /src/ports/unix && make submodules && make -RUN cd /src/ports/esp32 && bash -c "source /opt/esp/idf/export.sh && make" +WORKDIR /src +RUN make -C mpy-cross +WORKDIR /src/ports/esp32 +RUN bash -c "source /opt/esp/idf/export.sh && make submodules && make" RUN rm /src/ports/esp32/build-GENERIC/frozen_content.c -CMD /src/ports/unix/micropython +CMD make && cp build-GENERIC/firmware.bin /build/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..9fbbf9b --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +This Docker image drastically simplifies building MicroPython binaries for ESP32 microcontrollers with +[frozen modules](https://docs.micropython.org/en/latest/reference/manifest.html#freezing-source-code) +-- that is flashable MicroPython images that include your payload as bytecode so they're easy to deploy. + +Place your source code under `modules/` and the Docker image should pick them +up and bundle them into the resulting firmware image placed under `build/` + +``` +docker run --rm -v $PWD/modules:/src/ports/esp32/modules -v $PWD/build:/build harbor.k-space.ee/k-space/micropython-esp32 +esptool.py -p /dev/ttyUSB0 --chip esp32 -b 460800 write_flash -z 0x1000 build/firmware.bin +``` + +Currently stuck with MicroPytyhon 1.17 until [this](https://github.com/micropython/micropython/issues/8410) fix is included with 1.19+.