Post

#41: A Look at IDF 6 Changes

A lot of changes are coming in IDF 6. Here is a look at the ones that are likely to affect your project.

#41: A Look at IDF 6 Changes

If you’ve taken a look at the IDF 6.x Migration Guide you know that there are a LOT of changes coming in IDF 6. And if you are considering updating your project you should definitely read through the entire migration guide. This post goes through a subset of the changes that I think are most likely to affect your project. Some are breaking changes and some are exciting improvements.

Ping API “Removal”

I’m not sure why the migration guide says removal when they really just mean renamed. Instead of the deprecated API in ping.h and esp_ping.h, you will need to migrate to the ping/ping_sock.h API.

Lots of Peripheral Driver Changes

The APIs have remained fairly stable but a lot of header file name changes to be aware of. If your code doesn’t compile, check the full list.

Legacy I2C Driver Marked End-Of-Life

It’s been well documented that I2C on the ESP32 has had some struggles over the years. Espressif did a major refactor during the IDF 5.x release cycle to address those and marked the old I2C driver as legacy. That legacy driver/i2c.h has now been marked End-Of-Life(EOL) in IDF 6 and will be completely removed in IDF 7.0. The legacy I2C driver will no longer get timely bug fixes or security updates.

If you are still using the legacy driver you should start migrating now. Espressif has provided a migration guide just for I2C you should check out.

⚠️ WiFi Provisioning Breaking Change ⚠️

This is a big one and is likely to affect a lot of projects. The wifi_provisioning component has been removed and replaced with the network_provisioning component. Additionally, the API calls have all been renamed and will need to be updated in your project to support IDF 6.

Removed Built-in JSON Component

Typically you would access cJSON by including the json component in your idf_component_register statements. The proper way to include cJSON in IDF 6.x is to include the espressif/cjson dependency in your idf_component.yml file.

ESP-MQTT Now a Managed Component

Similar to the cJSON change, the Espressif MQTT component has now been moved to a managed component and should be included as espressif/mqtt in your idf_component.yml file. The mqtt_client.h header remains the same and the API has not changed. The only difference is how the component is included in your project.

WiFi Variable, Macro, and Enum Value Changes

It’s a pretty small list but this is likely to cause a compilation error when you first migrate to IDF 6 and try to build your project. You’ll just need to rename things accordingly.

Mbed TLS v4.0

IDF 6.x moves to Mbed TLS v4.0 which is a major update to that library. Specifically, “most legacy cryptography APIs have been removed and PSA Crypto is the primary interface”. If you are using only the IDF-wrapped usages of MbedTLS you are unlikely to notice a change. However, if you use any of the Mbed TLS cryptography interaces directly, you will need to refactor to support the new Mbed TLS v4.0 APIs.

Default LibC Now PicolibC instead of Newlib

In most cases you shouldn’t notice a difference here. Newlib is still maintained in the toolchain and can be selected if you have a need (you link to external libraries that require newlib).

The move to Picolibc, in most cases, results in significant improvements in binary size, stack usage, and heap usage. It does show a slight decrease in CPU performance as a tradeoff.

Comparison of Newlib vs Picolibc

Core Dump Supports ELF Format Only

Core dumps will only support the ELF format from this release onward and will no longer support the binary format. The writing was on the wall for this one as they have been heavily recommending this for some time.

ULP Wakes Main CPU on Crash

I’m including this one only because I did an entire series on the ULP and specifcally covered how the ULP could crash and you’d never know it.

GCC Version Upgrade

Most projects are unlikely to notice a difference here but IDF 6 uses GCC 15.1.0. This is always good information to have if you are messing with low level build options.

© Kevin Sidwar