cpu/esp_common: fix FreeRTOS rmutex handling [backport 2025.10] #21928
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #21926
Contribution description
This PR fixex issue #21919.
The reason for the issue was that the ESP-IDF WiFi interface wrapper library always calls
xSemaphoreTakeRecursiveandxSemaphoreGiveRecursivefor mutexes, regardless of whether they are recursive or not.It would certainly have been better in ESP-IDF to use functions
xSemaphoreTakeandxSemaphoreGivefor all type of mutexes instead, as these functions already check the type of the mutex and then call the functionsxSemaphoreTakeRecursiveandxSemaphoreGiveRecursivein the case of a recursive mutex.The fix fix now checks the type of the mutex also in recursive mutex functions and then calls the functions for normal mutexes if the mutex is not recursive.
Testing procedure
Flash e.g.
examples/networking/gnrc/networkingon any board from the ESP32 family:You should get an esp-now interface:
Now try to change the channel with
ifconfig 10 set chan 1. Without the PR, you will get an assertion.With the PR changing the channel should succeed:
Issues/PRs references
Fix of issue #21919