-
Notifications
You must be signed in to change notification settings - Fork 2k
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: cleanup of ESP-IDF interface API (module esp_idf_api
)
#19426
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gschorcht
force-pushed
the
cpu/esp32/esp_idf_api_cleanup
branch
from
March 27, 2023 00:05
3e52e73
to
1c62f66
Compare
github-actions
bot
added
Area: build system
Area: Build system
Area: cpu
Area: CPU/MCU ports
Platform: ESP
Platform: This PR/issue effects ESP-based platforms
labels
Mar 27, 2023
gschorcht
force-pushed
the
cpu/esp32/esp_idf_api_cleanup
branch
from
March 27, 2023 00:08
1c62f66
to
9bf333d
Compare
gschorcht
added
Type: enhancement
The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
Type: cleanup
The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
labels
Mar 27, 2023
A number of ESP-IDF header files that are needed to compile RIOT include the header file `driver/gpio.h` only because of the definition of the type `gpio_num_t`. However, this header file contains the entire GPIO API definition of the ESP-IDF, which conflicts with that of RIOT. The solution was to use a wrapper library that does not need to include the `driver/gpio.h` file of the ESP-IDF during compilation of RIOT code. This commit provides another approach which does not require such a wrapper library. It just provides its own `driver/gpio.h` in RIOT that is included by ESP-IDF header files instead of the original `driver/gpio.h` in ESP-IDF. It defines only the required `gpio_num_t` if RIOT code is compiled but includes the original `driver/gpio.h` of ESP-IDF if ESP-IDF code is compiled. This avoids to create a wrapper library for each module.
gschorcht
force-pushed
the
cpu/esp32/esp_idf_api_cleanup
branch
from
March 27, 2023 01:11
9bf333d
to
3433694
Compare
benpicco
approved these changes
Mar 28, 2023
bors merge |
Build succeeded: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: build system
Area: Build system
Area: cpu
Area: CPU/MCU ports
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
Platform: ESP
Platform: This PR/issue effects ESP-based platforms
Type: cleanup
The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Type: enhancement
The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
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.
Contribution description
This PR cleans up the wrapper library (module
esp_idf_api
) that is used to interface to ESP-IDF driver modules.A number of ESP-IDF header files needed to compile RIOT include the ESP-IDF header file
driver/gpio.h
only because of the definition of the typegpio_num_t
. However,driver/gpio.h
does not only definegpio_num_t
but the complete ESP-IDF GPIO API which conflicts with that in RIOT. The solution was to use a wrapper library when compiling the RIOT code that does not need to include the ESP-IDF header filedriver/gpio.h
. The disadvantage of this approach was that for each ESP-IDF function to be used in RIOT, a corresponding function in the wrapper library had to be defined which does nothing else than calling the corresponding ESP-IDF function.This PR provides another approach which does not require such a wrapper library in most cases and allows to clean up the wrapper library (module
esp_idf_api
). It just provides its owndriver/gpio.h
that is included by ESP-IDF header files instead of the original ESP-IDF header filedriver/gpio.h
. It defines only the requiredgpio_num_t
when RIOT code is compiled but includes the original ESP-IDF header filedriver/gpio.h
when ESP-IDF code is compiled. As a result. most of the functions in the wrapper library could be eliminated. A further advantage is that further ESP-IDF API functions can be used without defining corresponding wrapper functions.Testing procedure
Green CI
Issues/PRs references