Skip to content

cpu/esp32: Migration to ESP-IDF v5.4 #21261

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

Merged
merged 80 commits into from
Jun 2, 2025

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Mar 2, 2025

Contribution description

This PR provides the migration to ESP-IDF v5.4. There are some very small problems to be fixed:

Module implemented esp32 esp32s2 esp32s3 esp32c3
periph/adc x OK OK OK OK
periph/can x OK - - -
periph/cpuid x OK OK OK OK
periph/dac x OK OK - -
periph/flash x OK OK OK OK
periph/flashpage x OK OK OK OK
periph/gpio x OK OK OK OK
periph/gpio_ll x OK OK OK OK
periph/gpio_ll_irq x OK OK OK OK
periph/hwrng x OK OK OK OK
periph/i2c_sw x OK OK OK OK
periph/i2c_hw x OK OK OK OK
periph/pm x OK OK OK OK
periph/pwm x OK OK OK OK
periph/rtt_sys x OK OK OK OK
periph/rtt_hw x OK OK - -
periph/sdmmc x OK - OK -
periph/spi x OK OK OK OK
periph/timer x OK OK OK OK
esp_hw_counter x OK OK OK -
esp_spi_ram x OK OK OK -
esp_eth x OK - - -
esp_now x OK OK OK OK
esp_wifi x OK OK OK OK
esp_wifi_ap x OK OK OK OK
esp_wifi_enterprise x OK OK OK OK
esp_ble_nimble x OK - OK OK
esp_ble_nimble + esp_wifi x OK - OK OK
esp_idf_gpio_hal x OK OK OK OK
esp_idf_usb x - OK OK -
esp_idf_heap x OK OK OK OK
stdio_usb_serial_jtag x - - OK OK
tinyusb x - OK OK -
ztimer x OK OK OK OK

OK - means that it has been tested successfully
* - means that the feature is not supported by the ESP32x variant

Problems to be solved (checked when solved)

  • WiFi Enterprise is not working
  • Wake-up on UART doesn't work for ESP32
  • Ethernet send process hangs while receiving packets
  • SDMMC doesn't work reliable on ESP32-S3 (workaround)
  • ws281x RMT peripheral uses the legacy driver
  • Legacy driver used for esp_i2c_hw
  • pkg/tinyusb is not compilable

The PR includes PR #21144 for now to be compilable with local toolchain installtion.

Testing procedure

Tests should still work for supported ESP32x variants.
All features in the table above have been tested for all ESP32x variants.

Issues/PRs references

Depends on PR #21144
Depends on PR RIOT-OS/riotdocker#255 to be compilable in riotdocker and CI

@gschorcht gschorcht requested a review from kaspar030 as a code owner March 2, 2025 15:22
@github-actions github-actions bot added Area: doc Area: Documentation Area: build system Area: Build system Area: pkg Area: External package ports Area: tools Area: Supplementary tools Area: boards Area: Board ports Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: cpu Area: CPU/MCU ports labels Mar 2, 2025
@gschorcht gschorcht added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label Mar 2, 2025
@gschorcht gschorcht force-pushed the cpu/esp32/migration_to_esp-idf.5.4 branch 2 times, most recently from cb7fef6 to 87d66cf Compare March 2, 2025 15:58
@crasbe
Copy link
Contributor

crasbe commented Mar 4, 2025

This PR supersedes PR #18767, doesn't it?

@gschorcht gschorcht added the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Mar 4, 2025
@gschorcht gschorcht force-pushed the cpu/esp32/migration_to_esp-idf.5.4 branch from 87d66cf to a72bdd3 Compare March 4, 2025 14:06
@gschorcht
Copy link
Contributor Author

This PR supersedes PR #18767, doesn't it?

Yes.

@gschorcht gschorcht force-pushed the cpu/esp32/migration_to_esp-idf.5.4 branch 3 times, most recently from cc47218 to cb22538 Compare March 14, 2025 17:35
@gschorcht gschorcht requested a review from maribu as a code owner March 14, 2025 17:35
@github-actions github-actions bot added the Area: drivers Area: Device drivers label Mar 14, 2025
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, looks good to me. Some comments/questions inline.

@gschorcht gschorcht force-pushed the cpu/esp32/migration_to_esp-idf.5.4 branch from cb22538 to ef490ba Compare March 15, 2025 09:18
@gschorcht gschorcht force-pushed the cpu/esp32/migration_to_esp-idf.5.4 branch from 9a69c42 to ca07ce6 Compare March 25, 2025 09:36
@gschorcht gschorcht force-pushed the cpu/esp32/migration_to_esp-idf.5.4 branch 3 times, most recently from 933de45 to 6491ce3 Compare April 5, 2025 10:43
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 7, 2025
@maribu maribu added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 7, 2025
@gschorcht gschorcht force-pushed the cpu/esp32/migration_to_esp-idf.5.4 branch from 61ba9f0 to 3a81390 Compare May 28, 2025 16:06
@maribu maribu enabled auto-merge May 28, 2025 16:08
@maribu maribu added this pull request to the merge queue May 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 28, 2025
@gschorcht
Copy link
Contributor Author

Murdock is complaining 🤔 Strange, before I opened the PR, I compiled all application for one board of each ESP32x variant without any problems.

Copy link
Contributor

@mcr mcr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out the branch, got the esp-14.2.0_20241119 installed via dist/tools/esptools on laptop, and built gnrc_networking. Worked for me.

@crasbe crasbe added CI: full build disable CI build filter CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 29, 2025
gschorcht added 2 commits May 30, 2025 09:08
For ESP8266, the `heap_caps_*_default` functions are simply mapped to the corresponding `heap_caps_*` functions because SPI RAM is not supported. But for ESP32x, where SPI RAM might be enabled, the implementation of the `heap_caps_*_default` functions of the ESP-IDF must be used, as these try to allocate memory blocks smaller than `CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL` from the internal memory first. This is important for some control data structures that must be located in the internal memory, such as the NVS partition table, in order to avoid access conflicts between SPI RAM and SPI flash memory.
@maribu maribu enabled auto-merge May 30, 2025 08:04
@gschorcht gschorcht removed the CI: no fast fail don't abort PR build after first error label May 30, 2025
@gschorcht gschorcht added the CI: no fast fail don't abort PR build after first error label May 30, 2025
@crasbe crasbe added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 30, 2025
@gschorcht
Copy link
Contributor Author

🙈 Murdock failed because the CI boards are the only boards that use the software implementation of the WS281X driver.

@gschorcht gschorcht disabled auto-merge May 31, 2025 09:08
@gschorcht
Copy link
Contributor Author

@maribu I still had to migrate the software implementation of the WS281x driver 🙈 I didn't realize it before because only the CI boards enable the software implementation. Is your approval still valid? Murdock is happy now.

@maribu maribu added this pull request to the merge queue Jun 2, 2025
Merged via the queue into RIOT-OS:master with commit 3fa8d00 Jun 2, 2025
25 checks passed
@gschorcht
Copy link
Contributor Author

@maribu @crasbe Many thanks for reviewing this PR.

@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
@gschorcht gschorcht deleted the cpu/esp32/migration_to_esp-idf.5.4 branch July 30, 2025 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: pkg Area: External package ports CI: full build disable CI build filter CI: no fast fail don't abort PR build after first error 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: 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.

8 participants