Build micropython for ESP32 ports & ESP-IDF v5.06. failed with static-assert
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
esp32 port, ESP32-boards, all variants
MicroPython version
MicroPython v1.22.2-dirty on 2024-04-18; Generic ESP32 module with ESP32; ESP-IDF v.5.0.6
Reproduction
make
Expected behaviour
Build micrpopython port for ESP32, simply make. ;))
Observed behaviour
Build process failed by the static assert with message:
"Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h"
Additional Information
I discover this trouble and detect, that Espressif upgrade it's code in all 5.x.y branches.
Now:
- location in file: - ports/esp32/network_common.c
- line: 171
- source code:
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 1, 1)
_Static_assert(WIFI_AUTH_MAX == 11, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
#else
_Static_assert(WIFI_AUTH_MAX == 10, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
#endif
- Solition: update code as below:
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 1, 1)
_Static_assert(WIFI_AUTH_MAX == 11, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
//-- Upd begin -----------------------------------------------------------------------
#elif ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0, 4)
_Static_assert(WIFI_AUTH_MAX == 11, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
//-- Upd end -------------------------------------------------------------------------
#else
_Static_assert(WIFI_AUTH_MAX == 10, "Synchronize WIFI_AUTH_XXX constants with the ESP-IDF. Look at esp-idf/components/esp_wifi/include/esp_wifi_types.h");
#endif
Upd: I'm detect, that in ESP-IDF, branch v5.2.x - WIFI_AUTH_MAX == 13
esp32: Drop support for ESP-IDF <v5.3, fix build on ESP-IDF v5.3
Summary
- We try to support at least some older ESP-IDF versions, so that people making custom MicroPython builds on esp32 aren't always forced to upgrade. Unfortunately we've sometimes merged fixes that break on older ESP-IDF and not noticed until later (recent example: https://github.com/micropython/micropython/pull/18894#issuecomment-4016278894)
- This PR drops support for ESP-IDF v5.2.x, leaving us with three minor versions to support.
- Also applies necessary fixes to build the esp32 port under ESP-IDF v5.3.
Testing
- Built with ESP-IDF v5.3 and v5.4 locally. Also built with ESP-IDF v5.3 in CI (those changes split off to a new PR, however).
Trade-offs and Alternatives
- Could more aggressively drop older versions. This makes our lives easier, and is arguably better than the current situation where we "support" older ESP-IDF but the port doesn't actually build. However, having some support for older ESP-IDF seems like a very helpful thing if you're maintaining a custom MicroPython build and want to update MicroPython without always updating ESP-IDF.
Generative AI
I did not use generative AI tools when creating this PR.