esp32: support IDF v5.5.4 and make it the recommended version#19149
esp32: support IDF v5.5.4 and make it the recommended version#19149dpgeorge wants to merge 4 commits into
Conversation
They are provided in a private header that is already included. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19149 +/- ##
=======================================
Coverage 98.46% 98.46%
=======================================
Files 176 176
Lines 22811 22811
=======================================
Hits 22460 22460
Misses 351 351 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Wit esp_idf 5.5.4 it should be possible to drop the call to i2c_master_probe() in machine_i2c.c. As far as I followed the change notes, the required change to |
Signed-off-by: Damien George <damien@micropython.org>
|
No pure joy. A zero length I2C write still causes an error message to be printed. But at least a NAK does not cause an error any more. So I can change the code to use |
|
The code can now use |
|
OK, thanks for testing with I2C. I'll see what I can do there. |
|
I prepared a change already, but wanted to wait until this PR is merged. |
Ah, very good, thank you! I'll leave it to you then. |
I've already looked into this a bit the last few weeks. I think it's possible and had it working, although I've currently disabled it in my tree again after I ran into other Bluetooth bugs and wanted to make sure it wasn't caused by this new feature. I'll see if I can polish that into a PR in the coming weeks. |
|
Note: I've been running against v5.5.4 for a while, but I've been having a few stability problems with it. On my S3 boards I get random MMU entry fault errors which I don't get with older IDF versions (v5.5.2), as well as some issues with Bluetooth bonding. I'm actively investigating these; noting it here because that might be good to know. |
OK, thanks, good to know. In that case we might need to move to a lower release, eg v5.5.2. We can still support v5.5.4, but officially build with v5.5.2 (for example). |
|
In that case I'll note to avoid v5.5.3 as well, as there Bluetooth is broken (see espressif/esp-idf#18323). |
|
From v5.5.3 onwards, the following commits have been added: It will be nice to be on something newer than v5.5.2 in the future, in order to take advantage of this feature, as it is quite a significant improvement for large framebuffers, as they will no longer use a bounce buffer located in internal RAM for the DMA. This is effectively a large reduction in transient internal RAM usage for projects that try to use PSRAM framebuffers, probably due to insufficient internal RAM in the first place. |
|
@DvdGiessen did you make any progress with stability of 5.5.4? If not then we will move only to v5.5.2 for now (but still support v5.5.4 for users wanting to build firmware with that IDF version). |
|
Not yet. Unfortunately I don't have a small and fast reproduction, and there are more things competing for my time. But no need to block this MR; having the option to build against the newer IDF for users that don't touch or hit the bug I'm seeing is useful to merge. |
Summary
This PR updates the esp32 port to support IDF v5.5.4, tests that version in CI, and makes it the recommended version.
Also includes a minor related fix to
extmod/nimble/modbluetooth_nimble.c.Building all generic boards against v5.5.1 and v5.5.4 using
ports/esp32/tools/metrics_esp32.pygives:Firmware size increases on almost all SoCs by quite a bit, around 20k. But it's very nice to see IRAM usage decrease by about 4k on everything except ESP32-P4.
This
metrics_esp32.pyscript is also updated with changes I needed to make to get it to generate the above table.Testing
Tested with ESP32_GENERIC firmware, running as many tests as possible from the test suite. The only regressions are:
tests/multi_espnow/70_channel.pyseems to always fail (between two ESP32's at least) with data sent to a wrong channel being receivedtests/multi_bluetooth/ble_gap_device_name.pyfails with a timeout near the end of the test when run against PYDF_SF6 (but ESP32 <-> ESP32 passes this test)TODO: test some other SoCs.
Trade-offs and Alternatives
This increases code size, but there's not much we can do about that, we need to keep supporting the latest IDF.
I needed to set
CONFIG_BT_NIMBLE_STATIC_TO_DYNAMIC=nbecause otherwise BLE crashes upon start up. Maybe in the future we can fix this and enable this option to save some RAM.I needed to add a small hack to cmake to manually include a missing compile definition to the qstr extraction phase:
list(APPEND MICROPY_CPP_DEF_EXTRA "ESP_PLATFORM"). I'm not sure why this (and a few other definitions) are missing from qstr extraction, but without this one the NimBLE code fails to compile because it picks up the wrong configuration header (the default one instead of the ESP specific config header).Generative AI
I did not use generative AI tools when creating this PR.