Skip to content
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
merged 5 commits into from
Mar 28, 2023

Conversation

gschorcht
Copy link
Contributor

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 type gpio_num_t. However, driver/gpio.h does not only define gpio_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 file driver/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 own driver/gpio.h that is included by ESP-IDF header files instead of the original ESP-IDF header file driver/gpio.h. It defines only the required gpio_num_t when RIOT code is compiled but includes the original ESP-IDF header file driver/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

@gschorcht gschorcht force-pushed the cpu/esp32/esp_idf_api_cleanup branch from 3e52e73 to 1c62f66 Compare March 27, 2023 00:05
@github-actions 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 gschorcht force-pushed the cpu/esp32/esp_idf_api_cleanup branch from 1c62f66 to 9bf333d Compare March 27, 2023 00:08
@gschorcht 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 gschorcht force-pushed the cpu/esp32/esp_idf_api_cleanup branch from 9bf333d to 3433694 Compare March 27, 2023 01:11
@riot-ci
Copy link

riot-ci commented Mar 27, 2023

Murdock results

✔️ PASSED

3433694 cpu/esp32: remove ESP-IDF periph_ctrl interface API

Success Failures Total Runtime
6882 0 6882 10m:30s

Artifacts

@benpicco
Copy link
Contributor

bors merge

@bors
Copy link
Contributor

bors bot commented Mar 28, 2023

Build succeeded:

@bors bors bot merged commit f8d7762 into RIOT-OS:master Mar 28, 2023
@gschorcht gschorcht deleted the cpu/esp32/esp_idf_api_cleanup branch April 12, 2023 05:49
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.04 milestone Apr 25, 2023
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants