-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/esp32: fix malloc thread safety #18209
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
cpu/esp32: fix malloc thread safety #18209
Conversation
Strange, there are sporadic compilation errors in CI due to different hashes in this PR, other PRs and for different applications, which I can't reproduce locally log |
@kaspar030 traced it down to differences in the debug information of the elf files - the hash of stripped binaries matches again. I was able to reproduce the issue with |
Do you mean this time or when we already had this problem two weeks ago? I remember that @kaspar030 said at the time that the debugging information differ, but in fact it was an actual difference in the bootloader binary. |
The question is what could be the cause that the debug information is different, why this only happens in the RIOT docker and why this only happens with one app and one board? The generated code is the same, so Kconfig generates the same dependencies as the Makefiles. The compiler options are the same except for the |
The full Murdock run was recent enough and the only failure was a hash mismatch due to different |
Yes, but we should still find out the reason. However, I myself have no idea how. |
@maribu Thanks for reviewing and merging |
Contribution description
This PR fixes the thread safety of heap allocation functions for ESP32.
Heap allocation functions in
newlibc-nano
for ESP32 (malloc
/free
/...
) seem not to be thread save.tests/malloc_thread_safety
fails either withor with
Therefore, if heap allocation functions from
newlibc-nano
are used (moduleesp-idf-heap
is not enabled) modulemalloc_thread_safe
has to be used to make heap allocation thread safe. Heap allocation functions in ESP-IDF (moduleesp-idf-heap
) that are used with SPI RAM oresp-wifi
are already thread safe.Testing procedure
Use
With this PR the test has to work, without this PR the test crashes or fails.
Issues/PRs references
Found while testing PR #18202.