diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 18a9ddd0..d2da3256 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -10,7 +10,7 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: emfcamp/esp_idf - IDF_VERSION: v5.2.1 + IDF_VERSION: v5.4.1 jobs: build-and-push-image: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81039919..28e0f5e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@v4 with: repository: espressif/esp-idf - ref: v5.2.1 + ref: v5.4.1 path: esp-idf submodules: true - name: Submodules diff --git a/Dockerfile b/Dockerfile index 8cc04109..facbd13d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG IDF_VERSION=v5.2.1 +ARG IDF_VERSION=v5.4.1 FROM espressif/idf:$IDF_VERSION # Mark the firmware as a safe include directory for git diff --git a/README.md b/README.md index 290abd3d..1cc92ad3 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ To build with a consistent toolchain, use docker. Pull the firmware build image: - docker pull ghcr.io/emfcamp/esp_idf:v5.2.1 + docker pull ghcr.io/emfcamp/esp_idf:v5.4.1 (Or build it yourself, if you prefer): - docker build . -t ghcr.io/emfcamp/esp_idf:v5.2.1 + docker build . -t ghcr.io/emfcamp/esp_idf:v5.4.1 Initialize submodules: @@ -41,12 +41,12 @@ Before you build the first time, apply any patches to vendored content: Then to build the images run: - docker run -it --rm --env "TARGET=esp32s3" -v "$(pwd)"/:/firmware ghcr.io/emfcamp/esp_idf:v5.2.1 + docker run -it --rm --env "TARGET=esp32s3" -v "$(pwd)"/:/firmware -u $UID -e HOME=/tmp ghcr.io/emfcamp/esp_idf:v5.4.1 Alternatively, to flash a badge: put the badge into bootloader by disconnecting the usb in, press and hold bat and boop buttons for 20 seconds then reconnect the usb in and run: - docker run -it --rm --device /dev/ttyACM0:/dev/ttyUSB0 --env "TARGET=esp32s3" -v "$(pwd)"/:/firmware ghcr.io/emfcamp/esp_idf:v5.2.1 deploy + docker run -it --rm --device /dev/ttyACM0:/dev/ttyUSB0 --env "TARGET=esp32s3" -v "$(pwd)"/:/firmware -u $UID -e HOME=/tmp ghcr.io/emfcamp/esp_idf:v5.4.1 deploy where /dev/ttyACM0 is the device's endpoint. This value is correct on Linux. diff --git a/components/flow3r_bmi270/CMakeLists.txt b/components/flow3r_bmi270/CMakeLists.txt index 98d4ad93..8222a932 100644 --- a/components/flow3r_bmi270/CMakeLists.txt +++ b/components/flow3r_bmi270/CMakeLists.txt @@ -6,5 +6,5 @@ idf_component_register( . ../st3m REQUIRES - main_esp32s3 + main ) \ No newline at end of file diff --git a/components/flow3r_bsp/CMakeLists.txt b/components/flow3r_bsp/CMakeLists.txt index fa2f5e81..62676371 100644 --- a/components/flow3r_bsp/CMakeLists.txt +++ b/components/flow3r_bsp/CMakeLists.txt @@ -10,5 +10,5 @@ idf_component_register( REQUIRES driver vfs - main_esp32s3 + main ) diff --git a/drivers/tildagon_usb/tildagon_usb.c b/drivers/tildagon_usb/tildagon_usb.c index 8fb1c673..943ac6ba 100644 --- a/drivers/tildagon_usb/tildagon_usb.c +++ b/drivers/tildagon_usb/tildagon_usb.c @@ -1,6 +1,7 @@ #include "driver/gpio.h" #include "freertos/FreeRTOS.h" +#include "freertos/idf_additions.h" #include "freertos/task.h" #define DEBUG_LED GPIO_NUM_35 diff --git a/flasher/README.md b/flasher/README.md index f3fdf8ff..3888c142 100644 --- a/flasher/README.md +++ b/flasher/README.md @@ -2,7 +2,7 @@ First, create a merged firmware binary. This can be done by building as normal, then using: - docker run -it --entrypoint /firmware/scripts/merge-firmwares.sh --env "TARGET=esp32s3" -v "$(pwd)"/:/firmware matthewwilkes/esp_idf:5.2.1 + docker run -it --entrypoint /firmware/scripts/merge-firmwares.sh --env "TARGET=esp32s3" -v "$(pwd)"/:/firmware -u $UID -e HOME=/tmp ghcr.io/emfcamp/esp_idf:5.4.1 Then, copy the merged firmware to this directory: diff --git a/micropython b/micropython index 5114f2c1..f498a16c 160000 --- a/micropython +++ b/micropython @@ -1 +1 @@ -Subproject commit 5114f2c1ea7c05fc7ab920299967595cfc5307de +Subproject commit f498a16c7db6d4b2de200b3e0856528dfe0613c3 diff --git a/patches/micropython-lib.diff b/patches/micropython-lib.diff index e642ae61..2a86cf52 100644 --- a/patches/micropython-lib.diff +++ b/patches/micropython-lib.diff @@ -1,5 +1,5 @@ diff --git a/python-ecosys/requests/requests/__init__.py b/python-ecosys/requests/requests/__init__.py -index 7401029..e55840b 100644 +index 4ca7489..04481e3 100644 --- a/python-ecosys/requests/requests/__init__.py +++ b/python-ecosys/requests/requests/__init__.py @@ -43,6 +43,7 @@ def request( @@ -8,14 +8,14 @@ index 7401029..e55840b 100644 parse_headers=True, + allow_redirects=True, ): - redirect = None # redirection url, None means no redirection - chunked_data = data and getattr(data, "__next__", None) and not getattr(data, "__len__", None) -@@ -159,7 +160,7 @@ def request( + if headers is None: + headers = {} +@@ -180,7 +181,7 @@ def request( s.close() raise - if redirect: + if redirect and allow_redirects: s.close() - if status in [301, 302, 303]: - return request("GET", redirect, None, None, headers, stream) + # Use the host specified in the redirect URL, as it may not be the same as the original URL. + headers.pop("Host", None) diff --git a/patches/micropython.diff b/patches/micropython.diff index b298e8be..955fab1b 100644 --- a/patches/micropython.diff +++ b/patches/micropython.diff @@ -1,8 +1,18 @@ +diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile +index 7f31ea691..1eb783685 100644 +--- a/ports/esp32/Makefile ++++ b/ports/esp32/Makefile +@@ -112,4 +112,4 @@ size-files: + # This is done in a dedicated build directory as some CMake cache values are not + # set correctly if not all submodules are loaded yet. + submodules: +- $(Q)IDF_COMPONENT_MANAGER=0 idf.py $(IDFPY_FLAGS) -B $(BUILD)/submodules -D UPDATE_SUBMODULES=1 reconfigure ++ $(Q)idf.py $(IDFPY_FLAGS) -B $(BUILD)/submodules -D UPDATE_SUBMODULES=1 reconfigure diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake -index e928fb439..fde5160a5 100644 +index dedef6d78..f1fbb5897 100644 --- a/ports/esp32/esp32_common.cmake +++ b/ports/esp32/esp32_common.cmake -@@ -11,6 +11,9 @@ endif() +@@ -31,6 +31,9 @@ endif() # Include core source components. include(${MICROPY_DIR}/py/py.cmake) @@ -12,7 +22,7 @@ index e928fb439..fde5160a5 100644 # CMAKE_BUILD_EARLY_EXPANSION is set during the component-discovery phase of # `idf.py build`, so none of the extmod/usermod (and in reality, most of the # micropython) rules need to happen. Specifically, you cannot invoke add_library. -@@ -69,7 +72,7 @@ list(APPEND MICROPY_SOURCE_PORT +@@ -122,7 +125,7 @@ list(APPEND MICROPY_SOURCE_PORT machine_pin.c machine_touchpad.c machine_dac.c diff --git a/scripts/build.sh b/scripts/build.sh index 11cf9b8d..5de080c9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -o pipefail -source ~/.profile - find /firmware -name '.git' -exec bash -c 'git config --global --add safe.directory ${0%/.git}' {} \; cd /firmware diff --git a/scripts/hard-reset.sh b/scripts/hard-reset.sh new file mode 100755 index 00000000..5a0147c7 --- /dev/null +++ b/scripts/hard-reset.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Hard resets micropython submodules. Should not touch changes to this repository itself. +# Assumes submodules are initialised. +# scripts/firstTime.sh will need to be rerun after this. + +# Use: sudo scripts/hard-reset.sh + +cd micropython +git submodule foreach git clean -fdx +git clean -fdx +git reset --hard --recurse-submodules + +echo "NOTE: Remember to run scripts/firstTime.sh before trying to compile!" diff --git a/tildagon/sdkconfig.board b/tildagon/sdkconfig.board index b2b91809..f231fd97 100644 --- a/tildagon/sdkconfig.board +++ b/tildagon/sdkconfig.board @@ -27,8 +27,6 @@ CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=n CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=n CONFIG_APP_PROJECT_VER_FROM_CONFIG=y -CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y - CONFIG_COMPILER_OPTIMIZATION_DEBUG=n CONFIG_COMPILER_OPTIMIZATION_PERF=n CONFIG_COMPILER_OPTIMIZATION_NONE=n