Repository navigation
esp32: IDF v5.4(v5.5-dev) compile. - #16565
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #16565 +/- ##
=======================================
Coverage 98.58% 98.58%
=======================================
Files 167 167
Lines 21596 21596
=======================================
Hits 21291 21291
Misses 305 305 ☔ View full report in Codecov by Sentry. |
|
Code size report: |
DvdGiessen
left a comment
There was a problem hiding this comment.
I made the same changes locally to compile against IDF v5.4; found this PR so adding a few comments here instead of opening a new one.
I think this commit/PR should probably be referring to v5.4 instead of v5.5, since the latter is not out yet.
There was a problem hiding this comment.
Instead of erasing the callback type, since the function is IDF-specific anyway wouldn't it be better to update its signature? That way we'll still get compiler errors if there's potentially incompatible changes in the future.
diff --git a/ports/esp32/network_ppp.c b/ports/esp32/network_ppp.c
index c739264b9..a6e3b152f 100644
--- a/ports/esp32/network_ppp.c
+++ b/ports/esp32/network_ppp.c
@@ -101,7 +101,7 @@ static mp_obj_t ppp_make_new(mp_obj_t stream) {
}
MP_DEFINE_CONST_FUN_OBJ_1(esp_network_ppp_make_new_obj, ppp_make_new);
-static u32_t ppp_output_callback(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) {
+static u32_t ppp_output_callback(ppp_pcb *pcb, const void *data, u32_t len, void *ctx) {
ppp_if_obj_t *self = ctx;
mp_obj_t stream = self->stream;
@@ -110,7 +110,7 @@ static u32_t ppp_output_callback(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx)
}
int err;
- return mp_stream_rw(stream, data, len, &err, MP_STREAM_RW_WRITE);
+ return mp_stream_rw(stream, (void *)data, len, &err, MP_STREAM_RW_WRITE);
}
static void pppos_client_task(void *self_in) {
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
This change is unrelated to this PR, and shouldn't be needed.
There was a problem hiding this comment.
I discovered independently this change is required to prevent an error while building against IDFv5.4 with a compiler error; perhaps a change in the compiler version included used by the IDF caused this issue to be exposed?
Without this change:
-- The C compiler identification is GNU 14.2.0
(...)
[1325/1467] Building C object esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3.dir/build/micropython/py/persistentcode.c.obj
FAILED: esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3.dir/build/micropython/py/persistentcode.c.obj (...)
/build/micropython/py/persistentcode.c: In function 'load_raw_code':
/build/micropython/py/persistentcode.c:439:38: error: 'prelude_ptr' may be used uninitialized [-Werror=maybe-uninitialized]
439 | children[n_children] = (void *)prelude_ptr;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/build/micropython/py/persistentcode.c:405:24: note: 'prelude_ptr' was declared here
405 | const uint8_t *prelude_ptr; // = NULL;
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
(...)
ninja failed with exit code 1
EDIT: Although I agree it shouldn't be needed; reading it myself it appears correct regardless of which ifdef block is used. Not sure why the compiler disagrees.
There was a problem hiding this comment.
Although I agree it shouldn't be needed; reading it myself it appears correct regardless of which ifdef block is used. Not sure why the compiler disagrees.
Yeah, it looks like a compiler optimisation bug here.
I'm using gcc 14.2.1 and arm-none-eabi-gcc 14.2.0 here, and neither of them complain (with MICROPY_EMIT_NATIVE_PRELUDE_SEPARATE_FROM_MACHINE_CODE enabled).
There was a problem hiding this comment.
In the end, are we forced to leave this fix as is?
There was a problem hiding this comment.
Yes, we can leave this change in. It doesn't affect any other ports (the code size diff is zero for them all).
|
@IhorNehrutsa when you open a pull request, can you please make sure you fill in the GitHub PR template, with a summary, testing that you did, and a list of trade-offs/alternatives. Otherwise we may just close the PR. |
The latest line in the template is
It seems that these small fixes are described in the PR/commit title. Thanks. |
That line is only referring to the Please can you update the top post of this PR with the following template filled out: |
1212006 to
70ffd8e
Compare
70ffd8e to
3a9088c
Compare
DvdGiessen
left a comment
There was a problem hiding this comment.
Combined changes seem correct to me, but the commits can perhaps be organized to provide a bit more context to future readers.
- The first commit message still mentions this is for IDFv5.5 which isn't out yet; I think it should only mention v5.4?
- The other two commits could probably be squashed into the first one; they belong together after all.
- It might make sense to split out the change to
py/persistentcode.cinto a separate commit and add a short comment that this is to work around a compiler optimization bug in the compiler used by ESP-IDFv5.4. That way it'll be clear why that change is there, instead of being grouped in with the ESP32 port-specific changes. The change itself seems harmless enough to me; and with a clear separate commit documenting the reason for it I think it should be alright.
3a9088c to
74cf76b
Compare
2dcdcaa to
46ee241
Compare
|
@DvdGiessen |
There was a problem hiding this comment.
This change now gives a compiler warning for IDF 5.2.2 (at least, probably also 5.3). So I suggest having something like:
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
static u32_t ppp_output_callback(ppp_pcb *pcb, const void *data, u32_t len, void *ctx)
#else
static u32_t ppp_output_callback(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx)
#endif
{
...46ee241 to
9ef55a6
Compare
dpgeorge
left a comment
There was a problem hiding this comment.
Thanks for updating, this looks good now.
Add WIFI_AUTH_WPA3_ENTERPRISE and WIFI_AUTH_WPA2_WPA3_ENTERPRISE, and update PPP callback signature for latest lwIP. Co-authored-by: Daniel van de Giessen <[email protected]> Signed-off-by: IhorNehrutsa <[email protected]>
The esp32 IDF toolchain can give a "may be used uninitialized" warning, at least for ESP32-S3 with gcc 14.2.0. Silence that warning by initializing the variable with NULL. Co-authored-by: Daniel van de Giessen <[email protected]> Signed-off-by: IhorNehrutsa <[email protected]>
9ef55a6 to
a4ab847
Compare
|
I updated the esp32 README to note that IDF v5.4 is now supported. |
|
Thanks, Daniel. |
Summary
This PR attempts to fix the esp32 compilation with IDF v5.4 (v5.5-dev)
Testing
ESP32 generic, ESP32-S3 boards tested with esp32/machine_pin: Add mode and pull in machine_pin_print() as repr() function. #12293.