-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/esp32: fixes for boot issues and crashes on ESP32 #19192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In syscalls_init() there is a call to malloc(), which will return NULL if the heap is not initialized before, causing the entire board to fail booting if MODULE_ESP_IDF_HEAP is used.
5dfae81 to
1319297
Compare
1319297 to
56d2997
Compare
|
Oops, thank you for figuring out that issue. It is is a side effect of the recent change d5a28ec in PR #19146 where I'm not sure whether calling RIOT/cpu/esp_common/syscalls.c Lines 534 to 535 in f85366a
|
|
I went through the code to check for potential other issues but haven't seen anything that could potentially break. I guess environ is realloc()ed if it's resized, or at least that's what I would expect. So static would not work. |
Ok, then it has to be dynamic. |
|
@Flole998 Could you add some hints or just a make command how the issue can be reproduced and tested in your description? |
That's just a wild guess, I haven't checked but allocating a single char buffer indicates that. |
Just compiling on the ESP32S2 and running it with WiFi caused it to not start anymore, no output, nothing. When Null is written to that null-pointer it hangs. The second commit fixed an issue that happens when the WiFi connection drops/disconnects. |
Are you sure, I haven't seen that? Anyway, it seems to be a bug. |
Yes, absolutely sure. It might only happen on WPA Enterprise connections though. |
gschorcht
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, works as expected.
|
@gschorcht It looks like you accidentally added a wrong "Fixes:" entry right at the beginning of the description, could you double check that? The issue seems unrelated |
|
bors merge |
19192: cpu/esp32: fixes for boot issues and crashes on ESP32 r=gschorcht a=Flole998 ### Contribution description In syscalls_init() there is a call to malloc(), which will return NULL if the heap is not initialized before, causing the entire board to fail booting if MODULE_ESP_IDF_HEAP is used. API of [vTaskDelete()](https://www.freertos.org/a00126.html) says, that if NULL is passed to vTaskDelete the calling task should be deleted. This PR needs a backport to 2023.01. ### Testing procedure Just compiling on the ESP32S2 and running it with WiFi caused it to not start anymore, no output, nothing. When Null is written to that null-pointer it hangs. The second commit fixed an issue/assertion fail that happens when the WiFi connection drops/disconnects. ### Issues/PRs references Issue was introduced with PR #19146 Co-authored-by: Flole998 <[email protected]>
|
bors cancel |
|
Canceled. |
|
Build succeeded: |
|
@Flole998 Thanks for providing the bug fix. |
19196: cpu/esp32: fixes for boot issues and crashes on ESP32 [backport 2023.1] r=benpicco a=gschorcht # Backport of PR #19192 ### Contribution description In `syscalls_init()` there is a call to `malloc()`, which will return `NULL` if the heap is not initialized before, causing the entire board to fail booting if module `esp_idf_heap` is used, for example if the WiFi network interface is used. API of [vTaskDelete()](https://www.freertos.org/a00126.html) says, that if NULL is passed to vTaskDelete the calling task should be deleted. This PR needs a backport to 2023.01. ### Testing procedure ``` USEMODULE=esp_idf_heap BOARD=esp32-wroom-32 make -C tests/malloc ```` should work now but hangs in startup without the PR. ### Issues/PRs references Issue was introduced with PR #19146 Co-authored-by: Flole998 <[email protected]>
Contribution description
In syscalls_init() there is a call to malloc(), which will return NULL if the heap is not initialized before, causing the entire board to fail booting if MODULE_ESP_IDF_HEAP is used.
API of vTaskDelete() says, that if NULL is passed to vTaskDelete the calling task should be deleted.
This PR needs a backport to 2023.01.
Testing procedure
Just compiling on the ESP32S2 and running it with WiFi caused it to not start anymore, no output, nothing. When Null is written to that null-pointer it hangs.
The second commit fixed an issue/assertion fail that happens when the WiFi connection drops/disconnects.
Issues/PRs references
Issue was introduced with PR #19146