text
stringlengths
1
3.82k
__index_level_0__
int64
0
366
Migration Guides ESP-IDF 5.x Migration Guide .. toctree:: :maxdepth: 1 release-5.x/5.0/index release-5.x/5.1/index release-5.x/5.2/index release-5.x/5.3/index
0
Migration from 5.0 to 5.1 .. toctree:: :maxdepth: 1 gcc :SOC_IEEE802154_SUPPORTED: ieee802154 peripherals storage networking system
1
Networking SNTP SNTP module now provides thread safe APIs to access lwIP functionality. It is recommended to use :doc:`ESP_NETIF ` API. Please refer to the chapter :ref:`esp_netif-sntp-api` for more details.
2
GCC *** GCC Version The previous GCC version was GCC 11.2.0. This has now been upgraded to GCC 12.2.0 on all targets. Users that need to port their code from GCC 11.2.0 to 12.2.0 should refer to the series of official GCC porting guides listed below: Warnings The upgrade to GCC 12.2.0 has resulted in the addition of new warnings, or enhancements to existing warnings. The full details of all GCC warnings can be found in `GCC Warning Options `_. Users are advised to double-check their code, then fix the warnings if possible. Unfortunately, depending on the warning and the complexity of the user's code, some warnings will be false positives that require non-trivial fixes. In such cases, users can choose to suppress the warning in multiple ways. This section outlines some common warnings that users are likely to encounter and ways to fix them. ``-Wuse-after-free`` Typically, this warning should not produce false-positives for release-level code. But this may appear in test cases.
3
There is an example of how it was fixed in ESP-IDF's ``test_realloc.c``. .. code-block:: c void *x = malloc(64); void *y = realloc(x, 48); TEST_ASSERT_EQUAL_PTR(x, y); Pointers may be converted to int to avoid warning ``-Wuse-after-free``. .. code-block:: c int x = (int) malloc(64); int y = (int) realloc((void *) x, 48); TEST_ASSERT_EQUAL_UINT32((uint32_t) x, (uint32_t) y); ``-Waddress`` GCC 12.2.0 introduces an enhanced version of the ``-Waddress`` warning option, which is now more eager in detecting the checking of pointers to an array in if-statements. The following code triggers the warning: .. code-block:: c char array[8]; ... if (array) memset(array, 0xff, sizeof(array)); Eliminating unnecessary checks resolves the warning. .. code-block:: c char array[8]; ... memset(array, 0xff, sizeof(array)); RISC-V Builds Outside of ESP-IDF The RISC-V extensions ``zicsr`` and ``zifencei`` have been separated from the ``I`` extension.
3
GCC 12 reflects this change, and as a result, when building for RISC-V ESP32 chips outside of the ESP-IDF framework, you must include the ``_zicsr_zifencei`` postfix when specifying the -march option in your build system. Example: .. code-block:: bash riscv32-esp-elf-gcc main.c -march=rv32imac Now is replaced with: .. code-block:: bash riscv32-esp-elf-gcc main.c -march=rv32imac_zicsr_zifencei
3
System FreeRTOS .. only:: SOC_SPIRAM_SUPPORTED Dynamic Memory Allocation In the past, FreeRTOS commonly utilized the function ``malloc()`` to allocate dynamic memory. As a result, if an application allowed ``malloc()`` to allocate memory from external RAM (by configuring the :ref:`CONFIG_SPIRAM_USE` option as ``CONFIG_SPIRAM_USE_MALLOC``), FreeRTOS had the potential to allocate dynamic memory from external RAM, and the specific location was determined by the heap allocator. .. note:: Dynamic memory allocation for tasks (which are likely to consume the most memory) were an exception to the scenario above. FreeRTOS would use a separate memory allocation function to guarantee that dynamic memory allocate for a task was always placed in internal RAM. Allowing FreeRTOS objects (such as queues and semaphores) to be placed in external RAM becomes an issue if those objects are accessed while the cache is disabled (such as during SPI flash write operations) and would lead to a cache access errors (see :doc:`Fatal Errors ` for more details).
4
Therefore, FreeRTOS has been updated to always use internal memory (i.e., DRAM) for dynamic memory allocation. Calling FreeRTOS creation functions (e.g., :cpp:func:`xTaskCreate`, :cpp:func:`xQueueCreate`) guarantees that the memory allocated for those tasks/objects is from internal memory (see :ref:`freertos-heap` for more details). .. warning:: If you previously relied on :ref:`CONFIG_SPIRAM_USE` to place FreeRTOS objects into external memory, this change will lead to increased usage of internal memory due the FreeRTOS objects now being allocated there. To place a FreeRTOS task/object into external memory, it is now necessary to do so explicitly. The following methods can be employed: - Allocate the task/object using one of the ``...CreateWithCaps()`` API such as :cpp:func:`xTaskCreateWithCaps` and :cpp:func:`xQueueCreateWithCaps` (see :ref:`freertos-idf-additional-api` for more details). - Manually allocate external memory for those objects using :cpp:func:`heap_caps_malloc`, then create the objects from the allocated memory using one of the ``.
4
..CreateStatic()`` FreeRTOS functions. Power Management
4
Storage FatFs ``esp_vfs_fat_sdmmc_unmount()`` is now deprecated, and you can use :cpp:func:`esp_vfs_fat_sdcard_unmount()` instead. This API is deprecated in previous ESP-IDF versions, but without a deprecation warning or migration guide. Since ESP-IDF v5.1, calling this ``esp_vfs_fat_sdmmc_unmount()`` API will generate a deprecation warning. SPI_FLASH - :cpp:func:`spi_flash_get_counters` is deprecated, please use :cpp:func:`esp_flash_get_counters` instead. - :cpp:func:`spi_flash_dump_counters` is deprecated, please use :cpp:func:`esp_flash_dump_counters` instead. - :cpp:func:`spi_flash_reset_counters` is deprecated, please use :cpp:func:`esp_flash_reset_counters` instead.
5
Peripherals .. only:: SOC_DAC_SUPPORTED DAC --- DAC driver has been redesigned (see :doc:`DAC API Reference `), which aims to unify the interface and extend the usage of DAC peripheral. Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/dac.h``. However, by default, including ``driver/dac.h`` will bring a build warning like ``The legacy DAC driver is deprecated, please use 'driver/dac_oneshot.h', 'driver/dac_cosine.h' or 'driver/dac_continuous.h' instead``. The warning can be suppressed by the Kconfig option :ref:`CONFIG_DAC_SUPPRESS_DEPRECATE_WARN`. The major breaking changes in concept and usage are listed as follows: Breaking Changes in Concepts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ``dac_channel_t`` which was used to identify the hardware channel are removed from user space. The channel index now starts from ``0``, so please use `DAC_CHAN_0` and `DAC_CHAN_1` instead. And in the new driver, DAC channels can be selected by using :cpp:type:`dac_channel_mask_t`.
6
And these channels can be allocated in a same channel group which is represented by :cpp:type:`dac_channels_handle_t`. - ``dac_cw_scale_t`` is replaced by :cpp:type:`dac_cosine_atten_t` to decouple the legacy driver and the new driver. - ``dac_cw_phase_t`` is replaced by :cpp:type:`dac_cosine_phase_t`. The enumerate value is now the phase angle directly. - ``dac_cw_config_t`` is replaced by :cpp:type:`dac_cosine_config_t`, but the ``en_ch`` field is removed because it should be specified while allocating the channel group. .. only:: esp32s2 - ``dac_digi_convert_mode_t`` is removed. The driver now can transmit DMA data in different ways by calling :cpp:func:`dac_channels_write_continuously` or :cpp:func:`dac_channels_write_cyclically`. - ``dac_digi_config_t`` is replaced by :cpp:type:`dac_continuous_config_t`. Breaking Changes in Usage ~~~~~~~~~~~~~~~~~~~~~~~~~ - ``dac_pad_get_io_num`` is removed. - ``dac_output_voltage`` is replaced by :cpp:func:`dac_oneshot_output_voltage`.
6
- ``dac_output_enable`` is removed. For oneshot mode, it will be enabled after the channel is allocated. - ``dac_output_disable`` is removed. For oneshot mode, it will be disabled before the channel is deleted. - ``dac_cw_generator_enable`` is replaced by :cpp:func:`dac_cosine_start`. - ``dac_cw_generator_disable`` is replaced by :cpp:func:`dac_cosine_stop`. - ``dac_cw_generator_config`` is replaced by :cpp:func:`dac_cosine_new_channel`. .. only:: esp32 - ``dac_i2s_enable`` is replaced by :cpp:func:`dac_continuous_enable`, but it needs to allocate the continuous DAC channel first by :cpp:func:`dac_continuous_new_channels`. - ``dac_i2s_disable`` is replaced by :cpp:func:`dac_continuous_disable`. .. only:: esp32s2 - ``dac_digi_init`` and ``dac_digi_controller_config`` is merged into :cpp:func:`dac_continuous_new_channels`. - ``dac_digi_deinit`` is replaced by :cpp:func:`dac_continuous_del_channels`. - ``dac_digi_start``, ``dac_digi_fifo_reset`` and ``dac_digi_reset`` are merged into :cpp:func:`dac_continuous_enable`.
6
- ``dac_digi_stop`` is replaced by :cpp:func:`dac_continuous_disable`. .. only:: SOC_GPSPI_SUPPORTED GPSPI Following items are deprecated. Since ESP-IDF v5.1, GPSPI clock source is configurable. - ``spi_get_actual_clock`` is deprecated, you should use :cpp:func:`spi_device_get_actual_freq` instead. .. only:: SOC_LEDC_SUPPORTED LEDC - :cpp:enumerator:`soc_periph_ledc_clk_src_legacy_t::LEDC_USE_RTC8M_CLK` is deprecated. Please use ``LEDC_USE_RC_FAST_CLK`` instead.
6
IEEE 802.15.4 Receive Handle Done .. note:: It is required since IDF v5.1.3 release. User must call the function :cpp:func:`esp_ieee802154_receive_handle_done` to notify 802.15.4 driver after the received frame is handled. Otherwise the frame buffer will not be freed for future use.
7
Migration from 4.4 to 5.0 .. toctree:: :maxdepth: 1 :SOC_BT_CLASSIC_SUPPORTED: bluetooth-classic :SOC_BLE_SUPPORTED: bluetooth-low-energy build-system gcc networking peripherals protocols provisioning removed-components storage system tools
8
Build System Migrating from GNU Make Build System ESP-IDF v5.0 no longer supports GNU make-based projects. Please follow the :ref:`build system ` guide for migration. Update Fragment File Grammar The former grammar, supported in ESP-IDF v3.x, was dropped in ESP-IDF v5.0. Here are a few notes on how to migrate properly: Specify Component Requirements Explicitly In previous versions of ESP-IDF, some components were always added as public requirements (dependencies) to every component in the build, in addition to the :ref:`common component requirements `: This means that it was possible to include header files of those components without specifying them as requirements in ``idf_component_register``. This behavior was caused by transitive dependencies of various common components. In ESP-IDF v5.0, this behavior is fixed and these components are no longer added as public requirements by default. Every component depending on one of the components which isn't part of common requirements has to declare this dependency explicitly.
9
This can be done by adding ``REQUIRES `` or ``PRIV_REQUIRES `` in ``idf_component_register`` call inside component's ``CMakeLists.txt``. See :ref:`Component Requirements ` for more information on specifying requirements. Setting ``COMPONENT_DIRS`` and ``EXTRA_COMPONENT_DIRS`` Variables .. highlight:: cmake ESP-IDF v5.0 includes a number of improvements to support building projects with space characters in their paths. To make that possible, there are some changes related to setting ``COMPONENT_DIRS`` and ``EXTRA_COMPONENT_DIRS`` variables in project CMakeLists.txt files. Adding non-existent directories to ``COMPONENT_DIRS`` or ``EXTRA_COMPONENT_DIRS`` is no longer supported and will result in an error. Using string concatenation to define ``COMPONENT_DIRS`` or ``EXTRA_COMPONENT_DIRS`` variables is now deprecated. These variables should be defined as CMake lists, instead. For example, use:: set(EXTRA_COMPONENT_DIRS path1 path2) list(APPEND EXTRA_COMPONENT_DIRS path3) instead of:: set(EXTRA_COMPONENT_DIRS "path1 path2") set(EXTRA_COMPONENT_DIRS "${EXTRA_COMPONENT_DIRS} path3") Defining these variables as CMake lists is compatible with previous ESP-IDF versions.
9
Update Usage of ``target_link_libraries`` with ``project_elf`` ESP-IDF v5.0 fixes CMake variable propagation issues for components. This issue caused compiler flags and definitions that were supposed to apply to one component to be applied to every component in the project. As a side effect of this, user projects from ESP-IDF v5.0 onwards must use ``target_link_libraries`` with ``project_elf`` explicitly and custom CMake projects must specify ``PRIVATE``, ``PUBLIC``, or ``INTERFACE`` arguments. This is a breaking change and is not backward compatible with previous ESP-IDF versions. For example:: target_link_libraries(${project_elf} PRIVATE "-Wl,--wrap=esp_panic_handler") instead of:: target_link_libraries(${project_elf} "-Wl,--wrap=esp_panic_handler") Update CMake Version In ESP-IDF v5.0 minimal CMake version was increased to 3.16 and versions lower than 3.16 are not supported anymore. Run ``tools/idf_tools.py install cmake`` to install a suitable version if your OS version doesn't have one.
9
This affects ESP-IDF users who use system-provided CMake and custom CMake. Reorder the Applying of the Target-Specific Config Files .. highlight:: none ESP-IDF v5.0 reorders the applying order of target-specific config files and other files listed in SDKCONFIG_DEFAULTS. Now, target-specific files will be applied right after the file brings it in, before all latter files in ``SDKCONFIG_DEFAULTS``. For example:: If ``SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig_devkit1"``, and there is a file ``sdkconfig.defaults.esp32`` in the same folder, then the files will be applied in the following order: (1) sdkconfig.defaults (2) sdkconfig.defaults.esp32 (3) sdkconfig_devkit1. If you have a key with different values in the target-specific files of the former item (e.g., ``sdkconfig.defaults.esp32`` above) and the latter item (e.g., ``sdkconfig_devkit1`` above), please note the latter will override the target-specific file of the former. If you do want to have some target-specific config values, please put it into the target-specific file of the latter item (e.
9
g., ``sdkconfig_devkit1.esp32``).
9
Networking Wi-Fi Callback Function Type ``esp_now_recv_cb_t`` Previously, the first parameter of ``esp_now_recv_cb_t`` was of type ``const uint8_t *mac_addr``, which only included the address of ESP-NOW peer device. This now changes. The first parameter is of type ``esp_now_recv_info_t``, which has members ``src_addr``, ``des_addr`` and ``rx_ctrl``. Therefore, the following updates are required: - Redefine ESP-NOW receive callback function. - ``src_addr`` can be used to replace original ``mac_addr``. - ``des_addr`` is the destination MAC address of ESP-NOW packet, which can be unitcast or broadcast address. With ``des_addr``, the user can distinguish unitcast and broadcast ESP-NOW packets where broadcast ESP-NOW packets can be non-encrypted even when encryption policy is configured for the ESP-NOW. - ``rx_ctrl`` is Rx control info of the ESP-NOW packet, which provides more information about the packet. Please refer to the ESP-NOW example: :example_file:`wifi/espnow/main/espnow_example_main.
10
c` Ethernet ``esp_eth_ioctl()`` API Previously, the :cpp:func:`esp_eth_ioctl` API had the following issues: - The third parameter (which is of type ``void *``) would accept an ``int``/``bool`` type arguments (i.e., not pointers) as input in some cases. However, these cases were not documented properly. - To pass ``int``/``bool`` type argument as the third parameter, the argument had to be "unnaturally" casted to a ``void *`` type, to prevent a compiler warning as demonstrated in the code snippet below. This casting could lead to misuse of the :cpp:func:`esp_eth_ioctl` function. .. code-block:: c esp_eth_ioctl(eth_handle, ETH_CMD_S_FLOW_CTRL, (void *)true); Therefore, the usage of :cpp:func:`esp_eth_ioctl` is now unified. Arguments to the third parameter must be passed as pointers to a specific data type to/from where data is stored/read by :cpp:func:`esp_eth_ioctl`. The code snippets below demonstrate the usage of :cpp:func:`esp_eth_ioctl`. Usage example to set Ethernet configuration: .
10
. code-block:: c eth_duplex_t new_duplex_mode = ETH_DUPLEX_HALF; esp_eth_ioctl(eth_handle, ETH_CMD_S_DUPLEX_MODE, &new_duplex_mode); Usage example to get Ethernet configuration: .. code-block:: c eth_duplex_t duplex_mode; esp_eth_ioctl(eth_handle, ETH_CMD_G_DUPLEX_MODE, &duplex_mode); KSZ8041/81 and LAN8720 Driver Update The KSZ8041/81 and LAN8720 drivers are updated to support more devices (i.e., generations) from their associated product families. The drivers can recognize particular chip numbers and their potential support by the driver. As a result, the specific "chip number" functions calls are replaced by generic ones as follows: ESP NETIF Glue Event Handlers ``esp_eth_set_default_handlers()`` and ``esp_eth_clear_default_handlers()`` functions are removed. Registration of the default IP layer handlers for Ethernet is now handled automatically. If you have already followed the suggestion to fully initialize the Ethernet driver and network interface before registering their Ethernet/IP event handlers, then no action is required (except for deleting the affected functions).
10
Otherwise, you may start the Ethernet driver right after they register the user event handler. PHY Address Auto-detect The Ethernet PHY address auto-detect function ``esp_eth_detect_phy_addr()`` is renamed to :cpp:func:`esp_eth_phy_802_3_detect_phy_addr` and its header declaration is moved to :component_file:`esp_eth/include/esp_eth_phy_802_3.h`. SPI-Ethernet Module Initialization The SPI-Ethernet Module initialization is now simplified. Previously, you had to manually allocate an SPI device using :cpp:func:`spi_bus_add_device` before instantiating the SPI-Ethernet MAC. Now, you no longer need to call :cpp:func:`spi_bus_add_device` as SPI devices are allocated internally. As a result, the :cpp:class:`eth_dm9051_config_t`, :cpp:class:`eth_w5500_config_t`, and :cpp:class:`eth_ksz8851snl_config_t` configuration structures are updated to include members for SPI device configuration (e.g., to allow fine tuning of SPI timing which may be dependent on PCB design). Likewise, the ``ETH_DM9051_DEFAULT_CONFIG``, ``ETH_W5500_DEFAULT_CONFIG``, and ``ETH_KSZ8851SNL_DEFAULT_CONFIG`` configuration initialization macros are updated to accept new input parameters.
10
Refer to :doc:`Ethernet API Reference Guide ` for an example of SPI-Ethernet Module initialization. Ethernet Driver APIs for creating MAC instances (`esp_eth_mac_new_*()`) have been reworked to accept two parameters, instead of one common configuration. Now, the configuration includes This is applicable to internal Ethernet MAC :cpp:func:`esp_eth_mac_new_esp32()` as well as to external MAC devices, such as :cpp:func:`esp_eth_mac_new_ksz8851snl()`, :cpp:func:`esp_eth_mac_new_dm9051()`, and :cpp:func:`esp_eth_mac_new_w5500()` .. _tcpip-adapter: TCP/IP Adapter The TCP/IP Adapter was a network interface abstraction component used in ESP-IDF prior to v4.1. This section outlines migration from ``tcpip_adapter`` API to its successor :doc:`/api-reference/network/esp_netif`. Updating Network Connection Code Network Stack Initialization - You may simply replace ``tcpip_adapter_init()`` with ``esp_netif_init()``. However, please should note that the ``esp_netif_init()`` function now returns standard error codes.
10
See :doc:`/api-reference/network/esp_netif` for more details. - The ``esp_netif_deinit()`` function is provided to de-initialize the network stack. - You should also replace ``#include "tcpip_adapter.h"`` with ``#include "esp_netif.h"``. Network Interface Creation Previously, the TCP/IP Adapter defined the following network interfaces statically: - WiFi Station - WiFi Access Point - Ethernet This now changes. Network interface instance should be explicitly constructed, so that the :doc:`/api-reference/network/esp_netif` can connect to the TCP/IP stack. For example, after the TCP/IP stack and the event loop are initialized, the initialization code for WiFi must explicitly call ``esp_netif_create_default_wifi_sta();`` or ``esp_netif_create_default_wifi_ap();``. Please refer to the example initialization code for these three interfaces: - WiFi Station: :example_file:`wifi/getting_started/station/main/station_example_main.c` - WiFi Access Point: :example_file:`wifi/getting_started/softAP/main/softap_example_main.
10
c` - Ethernet: :example_file:`ethernet/basic/main/ethernet_example_main.c` Other ``tcpip_adapter`` API Replacement All the ``tcpip_adapter`` functions have their ``esp-netif`` counter-part. Please refer to the ``esp_netif.h`` grouped into these sections: Default Event Handlers Event handlers are moved from ``tcpip_adapter`` to appropriate driver code. There is no change from application code perspective, as all events should be handled in the same way. Please note that for IP-related event handlers, application code usually receives IP addresses in the form of an ``esp-netif`` specific struct instead of the LwIP structs. However, both structs are binary compatible. This is the preferred way to print the address: .. code-block:: c ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip)); Instead of .. code-block:: c ESP_LOGI(TAG, "got ip:%s", ip4addr_ntoa(&event->ip_info.ip)); Since ``ip4addr_ntoa()`` is a LwIP API, the esp-netif provides ``esp_ip4addr_ntoa()`` as a replacement.
10
However, the above method using ``IP2STR()`` is generally preferred. IP Addresses You are advised to use ``esp-netif`` defined IP structures. Please note that with default compatibility enabled, the LwIP structs still work.
10
GCC *** GCC Version The previous GCC version was GCC 8.4.0. This has now been upgraded to GCC 11.2.0 on all targets. Users that need to port their code from GCC 8.4.0 to 11.2.0 should refer to the series of official GCC porting guides listed below: Warnings The upgrade to GCC 11.2.0 has resulted in the addition of new warnings, or enhancements to existing warnings. The full details of all GCC warnings can be found in `GCC Warning Options `_. Users are advised to double-check their code, then fix the warnings if possible. Unfortunately, depending on the warning and the complexity of the user's code, some warnings will be false positives that require non-trivial fixes. In such cases, users can choose to suppress the warning in multiple ways. This section outlines some common warnings that users are likely to encounter, and ways to suppress them. .. warning:: Users are advised to check that a warning is indeed a false positive before attempting to suppress them it. ``-Wstringop-overflow``, ``-Wstringop-overread``, ``-Wstringop-truncation``, and ``-Warray-bounds`` Users that use memory/string copy/compare functions will run into one of the ``-Wstringop`` warnings if the compiler cannot properly determine the size of the memory/string.
11
The examples below demonstrate code that triggers these warnings and how to suppress them. .. code-block:: c #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" #pragma GCC diagnostic ignored "-Warray-bounds" memset(RTC_SLOW_MEM, 0, CONFIG_ULP_COPROC_RESERVE_MEM); // = 11 #pragma GCC diagnostic ignored "-Wstringop-overread" // ' may result in an unaligned pointer value [-Waddress-of-packed-member] 105 | btc_to_bta_uuid(&p_dest->uuid, &p_src->uuid); | ^~~~~~~~~~~~~ If the warning occurs in multiple places across multiple source files, users can suppress the warning at the CMake level as demonstrated below. .. code-block:: cmake set_source_files_properties( "host/bluedroid/bta/gatt/bta_gattc_act.c" "host/bluedroid/bta/gatt/bta_gattc_cache.c" "host/bluedroid/btc/profile/std/gatt/btc_gatt_util.c" "host/bluedroid/btc/profile/std/gatt/btc_gatts.c" PROPERTIES COMPILE_FLAGS -Wno-address-of-packed-member) However, if there are only one or two instances, users can suppress the warning directly in the source code itself as demonstrated below.
11
.. code-block:: c #pragma GCC diagnostic push #if __GNUC__ >= 9 #pragma GCC diagnostic ignored "-Waddress-of-packed-member" ``. When using these fixed-width types (e.g., ``uint32_t``), users will need to replace placeholders such as ``%i`` and ``%x`` with ``PRIi32`` and ``PRIx32`` respectively. Types *not* defined in ```` (e.g., ``int``) do *not* need this special formatting. In other cases, it should be noted that enums have the ``int`` type. In common, ``int32_t`` and ``int``, as well as ``uint32_t`` and ``unsigned int``, are different types. If users do not make the aforementioned updates to format strings in their applications, the following error will be reported during compilation: .. code-block:: none /Users/name/esp/esp-rainmaker/components/esp-insights/components/esp_diagnostics/include/esp_diagnostics.h:238:29: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 238 | esp_diag_log_event(tag, "EV (%u) %s: " format, esp_log_timestamp(), tag, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ | | | uint32_t {aka long unsigned int} uint32_t {aka long unsigned int} Removing ``CONFIG_COMPILER_DISABLE_GCC8_WARNINGS`` Build Option ``CONFIG_COMPILER_DISABLE_GCC8_WARNINGS`` option was introduced to allow building of legacy code dating from the rigid GCC 5 toolchain.
11
However, enough time has passed to allow for the warnings to be fixed, thus this option has been removed. For now in GCC 11, users are advised to review their code and fix the compiler warnings where possible.
11
Tools ESP-IDF Monitor ESP-IDF Monitor makes the following changes regarding baud-rate: - ESP-IDF monitor now uses the custom console baud-rate (:ref:`CONFIG_ESP_CONSOLE_UART_BAUDRATE`) by default instead of 115200. - Setting a custom baud from menuconfig is no longer supported. - A custom baud-rate can be specified from command line with the ``idf.py monitor -b `` command or through setting environment variables. - Please note that the baud-rate argument has been renamed from ``-B`` to ``-b`` in order to be consistent with the global baud-rate ``idf.py -b ``. Run ``idf.py monitor --help`` for more information. Deprecated Commands ``idf.py`` sub-commands and ``cmake`` target names have been unified to use hyphens (``-``) instead of underscores (``_``). Using a deprecated sub-command or target name will produce a warning. Users are advised to migrate to using the new sub-commands and target names. The following changes have been made: .. list-table:: Deprecated Sub-command and Target Names :widths: 50 50 :header-rows: 1 - New Name - efuse-common-table - efuse-custom-table - erase-flash - partition-table - partition-table-flash - post-debug - show-efuse-table - erase-otadata - read-otadata Esptool The ``CONFIG_ESPTOOLPY_FLASHSIZE_DETECT`` option has been renamed to :ref:`CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE` and has been disabled by default.
12
New and existing projects migrated to ESP-IDF v5.0 have to set :ref:`CONFIG_ESPTOOLPY_FLASHSIZE`. If this is not possible due to an unknown flash size at build time, then :ref:`CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE` can be enabled. However, once enabled, to keep the digest valid, an SHA256 digest is no longer appended to the image when updating the binary header with the flash size during flashing. Windows Environment The Msys/Mingw-based Windows environment support got deprecated in ESP-IDF v4.0 and was entirely removed in v5.0. Please use :ref:`get-started-windows-tools-installer` to set up a compatible environment. The options include Windows Command Line, Power Shell and the graphical user interface based on Eclipse IDE. In addition, a VS Code-based environment can be set up with the supported plugin: https://github.com/espressif/vscode-esp-idf-extension.
12
System Inter-Processor Call IPC (Inter-Processor Call) feature is no longer a stand-alone component and has been integrated into the ``esp_system`` component. Thus, any project presenting a ``CMakeLists.txt`` file with the parameters ``PRIV_REQUIRES esp_ipc`` or ``REQUIRES esp_ipc`` should be modified to simply remove these options as the ``esp_system`` component is included by default. ESP Clock The ESP Clock API (functions/types/macros prefixed with ``esp_clk``) has been made into a private API. Thus, the previous include paths ``#include "{IDF_TARGET_NAME}/clk.h"`` and ``#include "esp_clk.h"`` have been removed. If users still require usage of the ESP Clock API (though this is not recommended), it can be included via ``#include "esp_private/esp_clk.h"``. .. note:: Private APIs are not stable and no are longer subject to the ESP-IDF versioning scheme's breaking change rules. Thus, it is not recommended for users to continue calling private APIs in their applications.
13
Cache Error Interrupt The Cache Error Interrupt API (functions/types/macros prefixed with ``esp_cache_err``) has been made into a private API. Thus, the previous include path ``#include "{IDF_TARGET_NAME}/cache_err_int.h"`` has been removed. If users still require usage of the Cache Error Interrupt API (though this is not recommended), it can be included via ``#include "esp_private/cache_err_int.h"``. ``bootloader_support`` Brownout The Brownout API (functions/types/macros prefixed with ``esp_brownout``) has been made into a private API. Thus, the previous include path ``#include "brownout.h"`` has been removed. If users still require usage of the Brownout API (though this is not recommended), it can be included via ``#include "esp_private/brownout.h"``. Trax The Trax API (functions/types/macros prefixed with ``trax_``) has been made into a private API. Thus, the previous include path ``#include "trax.h"`` has been removed. If users still require usage of the Trax API (though this is not recommended), it can be included via ``#include "esp_private/trax.
13
h"``. ROM --- The previously deprecated ROM-related header files located in ``components/esp32/rom/`` (old include path: ``rom/*.h``) have been moved. Please use the new target-specific path from ``components/esp_rom/include/{IDF_TARGET_NAME}/`` (new include path: ``{IDF_TARGET_NAME}/rom/*.h``). ``esp_hw_support`` - The header files ``soc/cpu.h`` have been deleted and deprecated CPU util functions have been removed. ESP-IDF developers should include ``esp_cpu.h`` instead for equivalent functions. - The header files ``hal/cpu_ll.h``, ``hal/cpu_hal.h``, ``hal/soc_ll.h``, ``hal/soc_hal.h`` and ``interrupt_controller_hal.h`` CPU API functions have been deprecated. ESP-IDF developers should include ``esp_cpu.h`` instead for equivalent functions. - The header file ``compare_set.h`` have been deleted. ESP-IDF developers should use ``esp_cpu_compare_and_set()`` function provided in ``esp_cpu.h`` instead. - ``esp_cpu_get_ccount()``, ``esp_cpu_set_ccount()`` and ``esp_cpu_in_ocd_debug_mode()`` were removed from ``esp_cpu.
13
h``. ESP-IDF developers should use respectively ``esp_cpu_get_cycle_count()``, ``esp_cpu_set_cycle_count()`` and ``esp_cpu_dbgr_is_attached()`` instead. - The header file ``esp_intr.h`` has been deleted. Please include ``esp_intr_alloc.h`` to allocate and manipulate interrupts. - The Panic API (functions/types/macros prefixed with ``esp_panic``) has been made into a private API. Thus, the previous include path ``#include "esp_panic.h"`` has been removed. If users still require usage of the Trax API (though this is not recommended), it can be included via ``#include "esp_private/panic_reason.h"``. Besides, developers should include ``esp_debug_helpers.h`` instead to use any debug-related helper functions, e.g., print backtrace. - The header file ``soc_log.h`` is now renamed to ``esp_hw_log.h`` and has been made private. Users are encouraged to use logging APIs provided under ``esp_log.h`` instead. - The header files ``spinlock.h``, ``clk_ctrl_os.h``, and ``rtc_wdt.h`` must now be included without the ``soc`` prefix.
13
For example, ``#include "spinlock.h"``. - ``esp_chip_info()`` returns the chip version in the format = 100 * ``major eFuse version`` + ``minor eFuse version``. Thus, the ``revision`` in the ``esp_chip_info_t`` structure is expanded to ``uint16_t`` to fit the new format. PSRAM - The target-specific header file ``spiram.h`` and the header file ``esp_spiram.h`` have been removed. A new component ``esp_psram`` is created instead. For PSRAM/SPIRAM-related functions, users now include ``esp_psram.h`` and set the ``esp_psram`` component as a component requirement in their ``CMakeLists.txt`` project files. - ``esp_spiram_get_chip_size`` and ``esp_spiram_get_size`` have been deleted. You should use ``esp_psram_get_size`` instead. eFuse - The parameter type of function ``esp_secure_boot_read_key_digests()`` changed from ``ets_secure_boot_key_digests_t*`` to ``esp_secure_boot_key_digests_t*``. The new type is the same as the old one, except that the ``allow_key_revoke`` flag has been removed.
13
The latter was always set to ``true`` in current code, not providing additional information. - Added eFuse wafer revisions: major and minor. The ``esp_efuse_get_chip_ver()`` API is not compatible with these changes, so it was removed. Instead, please use the following APIs: ``efuse_hal_get_major_chip_version()``, ``efuse_hal_get_minor_chip_version()`` or ``efuse_hal_chip_revision()``. ``esp_common`` ``EXT_RAM_ATTR`` is deprecated. Use the new macro ``EXT_RAM_BSS_ATTR`` to put ``.bss`` on PSRAM. ``esp_system`` - The header files ``esp_random.h``, ``esp_mac.h``, and ``esp_chip_info.h``, which were all previously indirectly included via the header file ``esp_system.h``, must now be included directly. These indirect inclusions from ``esp_system.h`` have been removed. - The Backtrace Parser API (functions/types/macros prefixed with ``esp_eh_frame_``) has been made into a private API. Thus, the previous include path ``#include "eh_frame_parser.h"`` has been removed. If users still require usage of the Backtrace Parser API (though this is not recommended), it can be included via ``#include "esp_private/eh_frame_parser.
13
h"``. - The Interrupt Watchdog API (functions/types/macros prefixed with ``esp_int_wdt_``) has been made into a private API. Thus, the previous include path ``#include "esp_int_wdt.h"`` has been removed. If users still require usage of the Interrupt Watchdog API (though this is not recommended), it can be included via ``#include "esp_private/esp_int_wdt.h"``. SoC Dependency - Public API headers listed in the Doxyfiles will not expose unstable and unnecessary SoC header files, such as ``soc/soc.h`` and ``soc/rtc.h``. That means the user has to explicitly include them in their code if these "missing" header files are still wanted. - Kconfig option ``LEGACY_INCLUDE_COMMON_HEADERS`` is also removed. - The header file ``soc/soc_memory_types.h`` has been deprecated. Users should use the ``esp_memory_utils.h`` instead. Including ``soc/soc_memory_types.h`` will bring a build warning like ``soc_memory_types.h is deprecated, please migrate to esp_memory_utils.h`` APP Trace One of the timestamp sources has changed from the legacy timer group driver to the new :doc:`GPTimer `.
13
Kconfig choices like ``APPTRACE_SV_TS_SOURCE_TIMER00`` has been changed to ``APPTRACE_SV_TS_SOURCE_GPTIMER``. User no longer need to choose the group and timer ID. ``esp_timer`` The FRC2-based legacy implementation of ``esp_timer`` available on ESP32 has been removed. The simpler and more efficient implementation based on the LAC timer is now the only option. ESP Image The image SPI speed enum definitions have been renamed. - Enum ``ESP_IMAGE_SPI_SPEED_80M`` has been renamed to ``ESP_IMAGE_SPI_SPEED_DIV_1``. - Enum ``ESP_IMAGE_SPI_SPEED_40M`` has been renamed to ``ESP_IMAGE_SPI_SPEED_DIV_2``. - Enum ``ESP_IMAGE_SPI_SPEED_26M`` has been renamed to ``ESP_IMAGE_SPI_SPEED_DIV_3``. - Enum ``ESP_IMAGE_SPI_SPEED_20M`` has been renamed to ``ESP_IMAGE_SPI_SPEED_DIV_4``. Task Watchdog Timers - The API for ``esp_task_wdt_init()`` has changed as follows: - Configuration is now passed as a configuration structure. - The function will now handle subscribing of the idle tasks if configured to do so.
13
- The former ``CONFIG_ESP_TASK_WDT`` configuration option has been renamed to :ref:`CONFIG_ESP_TASK_WDT_INIT` and a new :ref:`CONFIG_ESP_TASK_WDT_EN` option has been introduced. FreeRTOS Legacy API and Data Types Previously, the ``configENABLE_BACKWARD_COMPATIBILITY`` option was set by default, thus allowing pre FreeRTOS v8.0.0 function names and data types to be used. The ``configENABLE_BACKWARD_COMPATIBILITY`` is now disabled by default, thus legacy FreeRTOS names/types are no longer supportd by default. Users should do one of the followings: - Update their code to remove usage of legacy FreeRTOS names/types. - Enable the :ref:`CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY` to explicitly allow the usage of legacy names/types. Tasks Snapshot The header ``task_snapshot.h`` has been removed from ``freertos/task.h``. ESP-IDF developers should include ``freertos/task_snapshot.h`` if they need tasks snapshot API. The function :cpp:func:`vTaskGetSnapshot` now returns ``BaseType_t``.
13
Return value shall be ``pdTRUE`` on success and ``pdFALSE`` otherwise. FreeRTOS Asserts Previously, FreeRTOS asserts were configured separately from the rest of the system using the ``FREERTOS_ASSERT`` kconfig option. This option has now been removed and the configuration is now done through ``COMPILER_OPTIMIZATION_ASSERTION_LEVEL``. Port Macro API The file ``portmacro_deprecated.h`` which was added to maintain backward compatibility for deprecated APIs is removed. Users are advised to use the alternate functions for the deprecated APIs as listed below: - ``portENTER_CRITICAL_NESTED()`` is removed. Users should use the ``portSET_INTERRUPT_MASK_FROM_ISR()`` macro instead. - ``portEXIT_CRITICAL_NESTED()`` is removed. Users should use the ``portCLEAR_INTERRUPT_MASK_FROM_ISR()`` macro instead. - ``vPortCPUInitializeMutex()`` is removed. Users should use the ``spinlock_initialize()`` function instead. - ``vPortCPUAcquireMutex()`` is removed. Users should use the ``spinlock_acquire()`` function instead.
13
- ``vPortCPUAcquireMutexTimeout()`` is removed. Users should use the ``spinlock_acquire()`` function instead. - ``vPortCPUReleaseMutex()`` is removed. Users should use the ``spinlock_release()`` function instead. App Update - The functions :cpp:func:`esp_ota_get_app_description` and :cpp:func:`esp_ota_get_app_elf_sha256` have been termed as deprecated. Please use the alternative functions :cpp:func:`esp_app_get_description` and :cpp:func:`esp_app_get_elf_sha256` respectively. These functions have now been moved to a new component :component:`esp_app_format`. Please refer to the header file :component_file:`esp_app_desc.h `. Bootloader Support - The :cpp:type:`esp_app_desc_t` structure, which used to be declared in :component_file:`esp_app_format.h `, is now declared in :component_file:`esp_app_desc.h `. - The function :cpp:func:`bootloader_common_get_partition_description` has now been made private. Please use the alternative function :cpp:func:`esp_ota_get_partition_description`.
13
Note that this function takes :cpp:type:`esp_partition_t` as its first argument instead of :cpp:type:`esp_partition_pos_t`. Chip Revision The bootloader checks the chip revision at the beginning of the application loading. The application can only be loaded if the version is ``>=`` :ref:`CONFIG_{IDF_TARGET_CFG_PREFIX}_REV_MIN` and ``=`` :ref:`CONFIG_{IDF_TARGET_CFG_PREFIX}_REV_MIN` and ``<`` ``CONFIG_{IDF_TARGET_CFG_PREFIX}_REV_MAX_FULL``.
13
Bluetooth Classic Bluedroid - :component_file:`bt/host/bluedroid/api/include/api/esp_hf_defs.h` - In :cpp:enum:`esp_hf_cme_err_t` - ``ESP_HF_CME_MEMEORY_FULL`` renamed to ``ESP_HF_CME_MEMORY_FULL`` - ``ESP_HF_CME_MEMEORY_FAILURE`` renamed to ``ESP_HF_CME_MEMORY_FAILURE`` - :component_file:`bt/host/bluedroid/api/include/api/esp_hf_ag_api.h` - ``esp_bt_hf_init(esp_bd_addr_t remote_addr)`` changes into ``esp_hf_ag_init(void)`` - ``esp_bt_hf_deinit(esp_bd_addr_t remote_addr)`` changes into ``esp_hf_ag_deinit(void)`` Along with this change, the `bt_bdaddr_t init` and `bt_bdaddr_t deinit` has been removed from `union btc_arg_t`. - ``esp_bt_hf_register_callback`` changes into ``esp_hf_ag_register_callback`` - ``esp_bt_hf_connect`` changes into ``esp_hf_ag_slc_connect`` - ``esp_bt_hf_disconnect`` changes into ``esp_hf_ag_slc_disconnect`` - ``esp_bt_hf_connect_audio`` changes into ``esp_hf_ag_audio_connect`` - ``esp_bt_hf_disconnect_audio`` changes into ``esp_hf_ag_audio_disconnect`` - ``esp_bt_hf_vra`` changes into ``esp_hf_ag_vra_control`` - ``esp_bt_hf_volume_control`` changes into ``esp_hf_ag_volume_control`` - ``esp_hf_unat_response`` changes into ``esp_hf_ag_unknown_at_send`` - ``esp_bt_hf_cmee_response`` changes into ``esp_hf_ag_cmee_send`` - ``esp_bt_hf_indchange_notification`` changes into ``esp_hf_ag_devices_status_indchange`` - ``esp_bt_hf_cind_response`` changes into ``esp_hf_ag_cind_response`` - ``esp_bt_hf_cops_response`` changes into ``esp_hf_ag_cops_response`` - ``esp_bt_hf_clcc_response`` changes into ``esp_hf_ag_clcc_response`` - ``esp_bt_hf_cnum_response`` changes into ``esp_hf_ag_cnum_response`` - ``esp_bt_hf_bsir`` changes into ``esp_hf_ag_bsir`` - ``esp_bt_hf_answer_call`` changes into ``esp_hf_ag_answer_call`` - ``esp_bt_hf_reject_call`` changes into ``esp_hf_ag_reject_call`` - ``esp_bt_hf_out_call`` changes into ``esp_hf_ag_out_call`` - ``esp_bt_hf_end_call`` changes into ``esp_hf_ag_end_call`` - ``esp_bt_hf_register_data_callback`` changes into ``esp_hf_ag_register_data_callback`` - ``esp_hf_outgoing_data_ready`` changes into ``esp_hf_ag_outgoing_data_ready``
14
Removed or Deprecated Components Components Moved to ESP-IDF Component Registry Following components are removed from ESP-IDF and moved to `ESP-IDF Component Registry `_: .. note:: Please note that http parser functionality which was previously part of ``nghttp`` component is now part of :component:`http_parser ` component. These components can be installed using ``idf.py add-dependency`` command. For example, to install libsodium component with the exact version X.Y, run ``idf.py add-dependency libsodium==X.Y``. To install libsodium component with the latest version compatible to X.Y according to `semver `_ rules, run ``idf.py add-dependency libsodium~X.Y``. To find out which versions of each component are available, open https://components.espressif.com, search for the component by its name and check the versions listed on the component page. Deprecated Components The following components are removed since they were deprecated in ESP-IDF v4.x: .. note:: OpenSSL-API component is no longer supported.
15
It is not available in the IDF Component Registry, either. Please use :doc:`ESP-TLS ` or :component:`mbedtls` API directly. .. note:: ``esp_adc_cal`` component is no longer supported. New adc calibration driver is in ``esp_adc`` component. Legacy adc calibration driver has been moved into ``esp_adc`` component. To use legacy ``esp_adc_cal`` driver APIs, you should add ``esp_adc`` component to the list of component requirements in CMakeLists.txt. Also check :doc:`Peripherals Migration Guide ` for more details. The targets components are no longer necessary after refactoring and have been removed:
15
Protocols .. _migration_guide_mbedtls: Mbed TLS For ESP-IDF v5.0, `Mbed TLS `_ has been updated from v2.x to v3.1.0. For more details about Mbed TLS's migration from version 2.x to version 3.0 or greater, please refer to the `official guide `__. Breaking Changes (Summary) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Most Structure Fields Are Now Private - Direct access to fields of structures (``struct`` types) declared in public headers is no longer supported. - Appropriate accessor functions (getter/setter) must be used for the same. A temporary workaround would be to use ``MBEDTLS_PRIVATE`` macro (**not recommended**). - For more details, refer to the `official guide `__. SSL ^^^ - Removed support for TLS 1.0, 1.1, and DTLS 1.0 - Removed support for SSL 3.0 Deprecated Functions Were Removed from Cryptography Modules - The functions ``mbedtls_*_ret()`` (related to MD, SHA, RIPEMD, RNG, HMAC modules) was renamed to replace the corresponding functions without ``_ret`` appended and updated return value.
16
- For more details, refer to the `official guide `__. Deprecated Config Options Following are some of the important config options deprecated by this update. The configs related to and/or dependent on these have also been deprecated. - ``MBEDTLS_SSL_PROTO_SSL3`` : Support for SSL 3.0 - ``MBEDTLS_SSL_PROTO_TLS1`` : Support for TLS 1.0 - ``MBEDTLS_SSL_PROTO_TLS1_1``: Support for TLS 1.1 - ``MBEDTLS_SSL_PROTO_DTLS`` : Support for DTLS 1.1 (Only DTLS 1.2 is supported now) - ``MBEDTLS_DES_C`` : Support for 3DES ciphersuites - ``MBEDTLS_RC4_MODE`` : Support for RC4-based ciphersuites .. note:: This list includes only major options configurable through ``idf.py menuconfig``. For more details on deprecated options, refer to the `official guide `__. Miscellaneous Disabled Diffie-Hellman Key Exchange Modes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Diffie-Hellman Key Exchange modes have now been disabled by default due to security risks (see warning text `here `__).
16
Related configs are given below: - ``MBEDTLS_DHM_C`` : Support for the Diffie-Hellman-Merkle module - ``MBEDTLS_KEY_EXCHANGE_DHE_PSK`` : Support for Diffie-Hellman PSK (pre-shared-key) TLS authentication modes - ``MBEDTLS_KEY_EXCHANGE_DHE_RSA`` : Support for cipher suites with the prefix ``TLS-DHE-RSA-WITH-`` .. note:: During the initial step of the handshake (i.e., ``client_hello``), the server selects a cipher from the list that the client publishes. As the DHE_PSK/DHE_RSA ciphers have now been disabled by the above change, the server would fall back to an alternative cipher; if in a rare case, it does not support any other cipher, the handshake would fail. To retrieve the list of ciphers supported by the server, one must attempt to connect with the server with a specific cipher from the client-side. Few utilities can help do this, e.g., ``sslscan``. Remove ``certs`` Module from X509 Library ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - The ``mbedtls/certs.h`` header is no longer available in mbedtls 3.
16
1. Most applications can safely remove it from the list of includes. Breaking Change for ``esp_crt_bundle_set`` API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - The :cpp:func:`esp_crt_bundle_set()` API now requires one additional argument named ``bundle_size``. The return type of the API has also been changed to :cpp:type:`esp_err_t` from ``void``. Breaking Change for ``esp_ds_rsa_sign`` API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - The :cpp:func:`esp_ds_rsa_sign()` API now requires one less argument. The argument ``mode`` is no longer required. HTTPS Server Breaking Changes (Summary) ~~~~~~~~~~~~~~~~~~~~~~~~~~ Names of variables holding different certs in :cpp:type:`httpd_ssl_config_t` structure have been updated. .. list:: The return type of the :cpp:func:`httpd_ssl_stop` API has been changed to :cpp:type:`esp_err_t` from ``void``. ESP HTTPS OTA Breaking Changes (Summary) ~~~~~~~~~~~~~~~~~~~~~~~~~~ - The function :cpp:func:`esp_https_ota` now requires pointer to :cpp:type:`esp_https_ota_config_t` as argument instead of pointer to :cpp:type:`esp_http_client_config_t`.
16
ESP-TLS Breaking Changes (Summary) ~~~~~~~~~~~~~~~~~~~~~~~~~~ ``esp_tls_t`` Structure Is Now Private The :cpp:type:`esp_tls_t` has now been made completely private. You cannot access its internal structures directly. Any necessary data that needs to be obtained from the ESP-TLS handle can be done through respective getter/setter functions. If there is a requirement of a specific getter/setter function, please raise an `issue `__ on ESP-IDF. The list of newly added getter/setter function is as as follows: .. list:: Function Deprecations And Recommended Alternatives Following table summarizes the deprecated functions removed and their alternatives to be used from ESP-IDF v5.0 onwards. .. list-table:: :widths: 50 50 :header-rows: 1 - Alternative - :cpp:func:`esp_tls_conn_new_sync` - :cpp:func:`esp_tls_conn_destroy` - The function :cpp:func:`esp_tls_conn_http_new` has now been termed as deprecated. Please use the alternative function :cpp:func:`esp_tls_conn_http_new_sync` (or its asynchronous :cpp:func:`esp_tls_conn_http_new_async`).
16
Note that the alternatives need an additional parameter :cpp:type:`esp_tls_t`, which has to be initialized using the :cpp:func:`esp_tls_init` function. HTTP Server Breaking Changes (Summary) ~~~~~~~~~~~~~~~~~~~~~~~~~~ - ``http_server.h`` header is no longer available in ``esp_http_server``. Please use ``esp_http_server.h`` instead. ESP HTTP Client Breaking Changes (Summary) ~~~~~~~~~~~~~~~~~~~~~~~~~~ - The functions :cpp:func:`esp_http_client_read` and :cpp:func:`esp_http_client_fetch_headers` now return an additional return value ``-ESP_ERR_HTTP_EAGAIN`` for timeout errors - call timed-out before any data was ready. TCP Transport Breaking Changes (Summary) ~~~~~~~~~~~~~~~~~~~~~~~~~~ - The function :cpp:func:`esp_transport_read` now returns ``0`` for a connection timeout and ```__ The ``main`` component folder of the new application shall include the component manager manifest file ``idf_component.yml`` as in the example below: .. code-block:: text dependencies: espressif/esp-modbus: version: "^1.
16
0" The ``esp-modbus`` component can be found in `component manager registry `__. Refer to `component manager documentation `__ for more information on how to set up the component manager. For applications targeting v4.x releases of ESP-IDF that need to use new ``esp-modbus`` component, adding the component manager manifest file ``idf_component.yml`` will be sufficient to pull in the new component. However, users should also exclude the legacy ``freemodbus`` component from the build. This can be achieved using the statement below in the project's ``CMakeLists.txt``: .. code-block:: cmake set(EXCLUDE_COMPONENTS freemodbus)
16
Storage New Component for the Partition APIs Breaking change: all the Partition API code has been moved to a new component :component:`esp_partition`. For the complete list of affected functions and data-types, see header file :component_file:`esp_partition.h `. These API functions and data-types were previously a part of the :component:`spi_flash` component, and thus possible dependencies on the ``spi_flash`` in existing applications may cause the build failure, in case of direct esp_partition_* APIs/data-types use (for instance, ``fatal error: esp_partition.h: No such file or directory`` at lines with ``#include "esp_partition.h"``). If you encounter such an issue, please update your project's CMakeLists.txt file as follows: Original dependency setup: .. code-block:: cmake idf_component_register(... REQUIRES spi_flash) Updated dependency setup: .. code-block:: cmake idf_component_register(... REQUIRES spi_flash esp_partition) .
17
. note:: Please update relevant ``REQUIRES`` or ``PRIV_REQUIRES`` section according to your project. The above-presented code snippet is just an example. If the issue persists, please let us know and we will assist you with your code migration. SDMMC/SDSPI SD card frequency on SDMMC/SDSPI interface can be now configured through ``sdmmc_host_t.max_freq_khz`` to a specific value, not only ``SDMMC_FREQ_PROBING`` (400 kHz), ``SDMMC_FREQ_DEFAULT`` (20 MHz), or ``SDMMC_FREQ_HIGHSPEED`` (40 MHz). Previously, in case you have specified a custom frequency other than any of the above-mentioned values, the closest lower-or-equal one was selected anyway. Now, the underlaying drivers calculate the nearest fitting value, given by available frequency dividers instead of an enumeration item selection. This could cause troubles in communication with your SD card without a change of the existing application code.If you encounter such an issue, please, keep trying different frequencies around your desired value unless you find the one working well.
17
To check the frequency value calculated and actually applied, use ``void sdmmc_card_print_info(FILE* stream, const sdmmc_card_t* card)`` function. FatFs FatFs is now updated to v0.14. As a result, the function signature of ``f_mkfs()`` has changed. The new signature is ``FRESULT f_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len);`` which uses ``MKFS_PARM`` struct as a second argument. Partition Table The partition table generator no longer supports misaligned partitions. When generating a partition table, ``ESP-IDF`` only accepts partitions with offsets that align to 4 KB. This change only affects generating new partition tables. Reading and writing to already existing partitions remains unchanged. VFS --- The ``esp_vfs_semihost_register()`` function signature is changed as follows: - The new signature is ``esp_err_t esp_vfs_semihost_register(const char* base_path);`` - The ``host_path`` parameter of the old signature no longer exists. Instead, the OpenOCD command ``ESP_SEMIHOST_BASEDIR`` should be used to set the full path on the host.
17
Function Signature Changes The following functions now return ``esp_err_t`` instead of ``void`` or ``nvs_iterator_t``. Previously, when parameters were invalid or when something goes wrong internally, these functions would ``assert()`` or return a ``nullptr``. With an ``esp_err_t`` returned, you can get better error reporting. - :cpp:func:`nvs_entry_find` - :cpp:func:`nvs_entry_next` - :cpp:func:`nvs_entry_info` Because the ``esp_err_t`` return type changes, the usage patterns of ``nvs_entry_find()`` and ``nvs_entry_next()`` become different. Both functions now modify iterators via parameters instead of returning an iterator. The old programming pattern to iterate over an NVS partition was as follows: .. code-block:: c nvs_iterator_t it = nvs_entry_find(, , NVS_TYPE_ANY); while (it != NULL) { nvs_entry_info_t info; nvs_entry_info(it, &info); it = nvs_entry_next(it); printf("key '%s', type '%d'", info.key, info.type); }; The new programming pattern to iterate over an NVS partition is now: .
17
. code-block:: c nvs_iterator_t it = nullptr; esp_err_t res = nvs_entry_find(, , NVS_TYPE_ANY, &it); while(res == ESP_OK) { nvs_entry_info_t info; nvs_entry_info(it, &info); // Can omit error check if parameters are guaranteed to be non-NULL printf("key '%s', type '%d'", info.key, info.type); res = nvs_entry_next(&it); } nvs_release_iterator(it); Iterator Validity Note that because the function signature changes, if there is a parameter error, you may get an invalid iterator from ``nvs_entry_find()``. Hence, it is important to initialize the iterator to ``NULL`` before using ``nvs_entry_find()``, so that you can avoid complex error checking before calling ``nvs_release_iterator()``. A good example is the programming pattern above. Removed SDSPI Deprecated API Structure ``sdspi_slot_config_t`` and function ``sdspi_host_init_slot()`` are removed, and replaced by structure ``sdspi_device_config_t`` and function ``sdspi_host_init_device()`` respectively.
17
ROM SPI Flash In versions before v5.0, ROM SPI flash functions were included via ``esp32**/rom/spi_flash.h``. Thus, code written to support different ESP chips might be filled with ROM headers of different targets. Furthermore, not all of the APIs could be used on all ESP chips. Now, the common APIs are extracted to ``esp_rom_spiflash.h``. Although it is not a breaking change, you are strongly recommended to only use the functions from this header (i.e., prefixed with ``esp_rom_spiflash`` and included by ``esp_rom_spiflash.h``) for better cross-compatibility between ESP chips. To make ROM SPI flash APIs clearer, the following functions are also renamed: - ``esp_rom_spiflash_lock()`` to ``esp_rom_spiflash_set_bp()`` - ``esp_rom_spiflash_unlock()`` to ``esp_rom_spiflash_clear_bp()`` SPI Flash Driver The ``esp_flash_speed_t`` ``enum`` type is now deprecated. Instead, you may now directly pass the real clock frequency value to the flash configuration structure. The following example demonstrates how to configure a flash frequency of 80MHz: .
17
. code-block:: c esp_flash_spi_device_config_t dev_cfg = { // Other members .freq_mhz = 80, // Other members }; Legacy SPI Flash Driver To make SPI flash drivers more stable, the legacy SPI flash driver is removed from v5.0. The legacy SPI flash driver refers to default spi_flash driver since v3.0, and the SPI flash driver with configuration option ``CONFIG_SPI_FLASH_USE_LEGACY_IMPL`` enabled since v4.0. The major breaking change here is that the legacy spi_flash driver is no longer supported from v5.0. Therefore, the legacy driver APIs and the ``CONFIG_SPI_FLASH_USE_LEGACY_IMPL`` configuration option are both removed. Please use the new spi_flash driver's APIs instead. .. list-table:: :widths: 50 50 :header-rows: 1 - Replacement - ``esp_flash_erase_region()`` - ``esp_flash_erase_region()`` - ``esp_flash_write()`` - ``esp_flash_read()`` - ``esp_flash_write_encrypted()`` - ``esp_flash_read_encrypted()`` .
17
. note:: New functions with prefix ``esp_flash`` accept an additional ``esp_flash_t*`` parameter. You can simply set it to NULL. This will make the function to run the main flash (``esp_flash_default_chip``). The ``esp_spi_flash.h`` header is deprecated as system functions are no longer public. To use flash memory mapping APIs, you may include ``spi_flash_mmap.h`` instead.
17
Peripherals Peripheral Clock Gating As usual, peripheral clock gating is still handled by driver itself, users do not need to take care of the peripheral module clock gating. However, for advanced users who implement their own drivers based on ``hal`` and ``soc`` components, the previous clock gating include path has been changed from ``driver/periph_ctrl.h`` to ``esp_private/periph_ctrl.h``. RTC Subsystem Control RTC control APIs have been moved from ``driver/rtc_cntl.h`` to ``esp_private/rtc_ctrl.h``. ADC --- ADC Oneshot & Continuous Mode Drivers The ADC oneshot mode driver has been redesigned. - The new driver is in ``esp_adc`` component and the include path is ``esp_adc/adc_oneshot.h``. - The legacy driver is still available in the previous include path ``driver/adc.h``. The ADC continuous mode driver has been moved from ``driver`` component to ``esp_adc`` component. - The include path has been changed from ``driver/adc.h`` to ``esp_adc/adc_continuous.h``. Attempting to use the legacy include path ``driver/adc.
18
h`` of either driver triggers the build warning below by default. However, the warning can be suppressed by enabling the :ref:`CONFIG_ADC_SUPPRESS_DEPRECATE_WARN` Kconfig option. .. code-block:: text legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively ADC Calibration Driver The ADC calibration driver has been redesigned. - The new driver is in ``esp_adc`` component and the include path is ``esp_adc/adc_cali.h`` and ``esp_adc/adc_cali_scheme.h``. Legacy driver is still available by including ``esp_adc_cal.h``. However, if users still would like to use the include path of the legacy driver, users should add ``esp_adc`` component to the list of component requirements in CMakeLists.txt. Attempting to use the legacy include path ``esp_adc_cal.h`` triggers the build warning below by default. However, the warning can be suppressed by enabling the :ref:`CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN` Kconfig option.
18
.. code-block:: text legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h API Changes - The ADC power management APIs ``adc_power_acquire`` and ``adc_power_release`` have made private and moved to ``esp_private/adc_share_hw_ctrl.h``. - The two APIs were previously made public due to a HW errata workaround. - Now, ADC power management is completely handled internally by drivers. - Users who still require this API can include ``esp_private/adc_share_hw_ctrl.h`` to continue using these functions. - ``driver/adc2_wifi_private.h`` has been moved to ``esp_private/adc_share_hw_ctrl.h``. - Enums ``ADC_UNIT_BOTH``, ``ADC_UNIT_ALTER``, and ``ADC_UNIT_MAX`` in ``adc_unit_t`` have been removed. - The following enumerations have been removed as some of their enumeration values are not supported on all chips. This would lead to the driver triggering a runtime error if an unsupported value is used. - Enum ``ADC_CHANNEL_MAX`` - Enum ``ADC_ATTEN_MAX`` - Enum ``ADC_CONV_UNIT_MAX`` - API ``hall_sensor_read`` on ESP32 has been removed.
18
Hall sensor is no longer supported on ESP32. - API ``adc_set_i2s_data_source`` and ``adc_i2s_mode_init`` have been deprecated. Related enum ``adc_i2s_source_t`` has been deprecated. Please migrate to use ``esp_adc/adc_continuous.h``. - API ``adc_digi_filter_reset``, ``adc_digi_filter_set_config``, ``adc_digi_filter_get_config`` and ``adc_digi_filter_enable`` have been removed. These APIs behaviours are not guaranteed. Enum ``adc_digi_filter_idx_t``, ``adc_digi_filter_mode_t`` and structure ``adc_digi_iir_filter_t`` have been removed as well. - API ``esp_adc_cal_characterize`` has been deprecated, please migrate to ``adc_cali_create_scheme_curve_fitting`` or ``adc_cali_create_scheme_line_fitting`` instead. - API ``esp_adc_cal_raw_to_voltage`` has been deprecated, please migrate to ``adc_cali_raw_to_voltage`` instead. - API ``esp_adc_cal_get_voltage`` has been deprecated, please migrate to ``adc_oneshot_get_calibrated_result`` instead. GPIO - The previous Kconfig option `RTCIO_SUPPORT_RTC_GPIO_DESC` has been removed, thus the ``rtc_gpio_desc`` array is unavailable.
18
Please use ``rtc_io_desc`` array instead. - The user callback of a GPIO interrupt should no longer read the GPIO interrupt status register to get the GPIO's pin number of triggering the interrupt. You should use the callback argument to determine the GPIO's pin number instead. - Previously, when a GPIO interrupt occurs, the GPIO's interrupt status register is cleared after calling the user callbacks. Thus, it was possible for users to read the GPIO's interrupt status register inside the callback to determine which GPIO was used to trigger the interrupt. - However, clearing the interrupt status register after calling the user callbacks can potentially cause edge-triggered interrupts to be lost. For example, if an edge-triggered interrupt is triggered/retriggered while the user callbacks are being called, that interrupt will be cleared without its registered user callback being handled. - Now, the GPIO's interrupt status register is cleared **before** invoking the user callbacks.
18
Thus, users can no longer read the GPIO interrupt status register to determine which pin has triggered the interrupt. Instead, users should use the callback argument to pass the pin number. .. only:: SOC_SDM_SUPPORTED Sigma-Delta Modulator The Sigma-Delta Modulator driver has been redesigned into :doc:`SDM `. - The new driver implements a factory pattern, where the SDM channels are managed in a pool internally, thus users do not have to fix a SDM channel to a GPIO manually. - All SDM channels can be allocated dynamically. Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/sigmadelta.h``. However, by default, including ``driver/sigmadelta.h`` triggers the build warning below. The warning can be suppressed by Kconfig option :ref:`CONFIG_SDM_SUPPRESS_DEPRECATE_WARN`. .. code-block:: text The legacy sigma-delta driver is deprecated, please use driver/sdm.h The major breaking changes in concept and usage are listed as follows: Breaking Changes in Concepts - SDM channel representation has changed from ``sigmadelta_channel_t`` to :cpp:type:`sdm_channel_handle_t`, which is an opaque pointer.
18
- SDM channel configurations are stored in :cpp:type:`sdm_config_t` now, instead the previous ``sigmadelta_config_t``. - In the legacy driver, users do not have to set the clock source for SDM channel. But in the new driver, users need to set a proper one in the :cpp:member:`sdm_config_t::clk_src`. The available clock sources are listed in the :cpp:type:`soc_periph_sdm_clk_src_t`. - In the legacy driver, users need to set a ``prescale`` for the channel, which reflects the frequency in which the modulator outputs a pulse. In the new driver, users should use :cpp:member:`sdm_config_t::sample_rate_hz` to set the over sample rate. - In the legacy driver, users set ``duty`` to decide the output analog value, it is now renamed to a more appropriate name ``density``. Breaking Changes in Usage - Channel configuration was done by channel allocation, in :cpp:func:`sdm_new_channel`. In the new driver, only the ``density`` can be changed at runtime, by :cpp:func:`sdm_channel_set_pulse_density`.
18
Other parameters like ``gpio number`` and ``prescale`` are only allowed to set during channel allocation. - Before further channel operations, users should **enable** the channel in advance, by calling :cpp:func:`sdm_channel_enable`. This function helps to manage some system level services, like **Power Management**. Timer Group Driver Timer Group driver has been redesigned into :doc:`GPTimer `, which aims to unify and simplify the usage of general purpose timer. Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/timer.h``. However, by default, including ``driver/timer.h`` triggers the build warning below. The warning can be suppressed by the Kconfig option :ref:`CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN`. .. code-block:: text legacy timer group driver is deprecated, please migrate to driver/gptimer.h The major breaking changes in concept and usage are listed as follows: Breaking Changes in Concepts - ``timer_group_t`` and ``timer_idx_t`` which used to identify the hardware timer are removed from user's code.
18
In the new driver, a timer is represented by :cpp:type:`gptimer_handle_t`. - Definition of timer clock source is moved to :cpp:type:`gptimer_clock_source_t`, the previous ``timer_src_clk_t`` is not used. - Definition of timer count direction is moved to :cpp:type:`gptimer_count_direction_t`, the previous ``timer_count_dir_t`` is not used. - Only level interrupt is supported, ``timer_intr_t`` and ``timer_intr_mode_t`` are not used. - Auto-reload is enabled by set the :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` flag. ``timer_autoreload_t`` is not used. Breaking Changes in Usage - Timer initialization is done by creating a timer instance from :cpp:func:`gptimer_new_timer`. Basic configurations like clock source, resolution and direction should be set in :cpp:type:`gptimer_config_t`. Note that, specific configurations of alarm events are not needed during the installation stage of the driver. - Alarm event is configured by :cpp:func:`gptimer_set_alarm_action`, with parameters set in the :cpp:type:`gptimer_alarm_config_t`.
18
- Setting and getting count value are done by :cpp:func:`gptimer_get_raw_count` and :cpp:func:`gptimer_set_raw_count`. The driver does not help convert the raw value into UTC time-stamp. Instead, the conversion should be done from user's side as the timer resolution is also known to the user. - The driver will install the interrupt service as well if :cpp:member:`gptimer_event_callbacks_t::on_alarm` is set to a valid callback function. In the callback, users do not have to deal with the low level registers (like "clear interrupt status", "re-enable alarm event" and so on). So functions like ``timer_group_get_intr_status_in_isr`` and ``timer_group_get_auto_reload_in_isr`` are not used anymore. - To update the alarm configurations when alarm event happens, one can call :cpp:func:`gptimer_set_alarm_action` in the interrupt callback, then the alarm will be re-enabled again. - Alarm will always be re-enabled by the driver if :cpp:member:`gptimer_alarm_config_t::auto_reload_on_alarm` is set to true.
18
UART .. list-table:: :width: 700 px :header-rows: 1 - Replacement - Remarks - None - UART interrupt handling is implemented by driver itself. - None - UART interrupt handling is implemented by driver itself. - :cpp:member:`uart_config_t::source_clk` - Select the clock source. - :cpp:func:`uart_enable_pattern_det_baud_intr` - Enable pattern detection interrupt. I2C --- .. list-table:: :width: 700 px :header-rows: 1 - Replacement - Remarks - None - I2C interrupt handling is implemented by driver itself. - None - I2C interrupt handling is implemented by driver itself. - None - It is not used anywhere in ESP-IDF. SPI --- .. list-table:: :width: 700 px :header-rows: 1 - Replacement - Remarks - :cpp:func:`spi_get_actual_clock` - Get SPI real working frequency. - The internal header file ``spi_common_internal.h`` has been moved to ``esp_private/spi_common_internal.
18
h``. .. only:: SOC_SDMMC_HOST_SUPPORTED SDMMC .. list-table:: :width: 700 px :header-rows: 1 - Replacement - Remarks - set ``SDMMC_SLOT_FLAG_INTERNAL_PULLUP`` flag in :cpp:member:`sdmmc_slot_config_t::flags` - Enable internal pull up. LEDC .. list-table:: :width: 700 px :header-rows: 1 - Replacement - Remarks - :cpp:member:`ledc_timer_config_t::duty_resolution` - Set resolution of the duty cycle. .. only:: SOC_PCNT_SUPPORTED Pulse Counter Driver Pulse counter driver has been redesigned (see :doc:`PCNT `), which aims to unify and simplify the usage of PCNT peripheral. Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/pcnt.h``. However, including ``driver/pcnt.h`` triggers the build warning below by default. The warning can be suppressed by the Kconfig option :ref:`CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN`.
18
.. code-block:: text legacy pcnt driver is deprecated, please migrate to use driver/pulse_cnt.h The major breaking changes in concept and usage are listed as follows: Breaking Changes in Concepts - ``pcnt_port_t``, ``pcnt_unit_t`` and ``pcnt_channel_t`` which used to identify the hardware unit and channel are removed from user's code. In the new driver, PCNT unit is represented by :cpp:type:`pcnt_unit_handle_t`, likewise, PCNT channel is represented by :cpp:type:`pcnt_channel_handle_t`. Both of them are opaque pointers. - ``pcnt_evt_type_t`` is not used any more, they have been replaced by a universal **Watch Point Event**. In the event callback :cpp:type:`pcnt_watch_cb_t`, it is still possible to distinguish different watch points from :cpp:type:`pcnt_watch_event_data_t`. - ``pcnt_count_mode_t`` is replaced by :cpp:type:`pcnt_channel_edge_action_t`, and ``pcnt_ctrl_mode_t`` is replaced by :cpp:type:`pcnt_channel_level_action_t`. Breaking Changes in Usage - Previously, the PCNT unit configuration and channel configuration were combined into a single function: ``pcnt_unit_config``.
18
They are now split into the two factory APIs: :cpp:func:`pcnt_new_unit` and :cpp:func:`pcnt_new_channel` respectively. - Only the count range is necessary for initializing a PCNT unit. GPIO number assignment has been moved to :cpp:func:`pcnt_new_channel`. - High/Low control mode and positive/negative edge count mode are set by stand-alone functions: :cpp:func:`pcnt_channel_set_edge_action` and :cpp:func:`pcnt_channel_set_level_action`. - ``pcnt_get_counter_value`` is replaced by :cpp:func:`pcnt_unit_get_count`. - ``pcnt_counter_pause`` is replaced by :cpp:func:`pcnt_unit_stop`. - ``pcnt_counter_resume`` is replaced by :cpp:func:`pcnt_unit_start`. - ``pcnt_counter_clear`` is replaced by :cpp:func:`pcnt_unit_clear_count`. - ``pcnt_intr_enable`` and ``pcnt_intr_disable`` are removed. In the new driver, the interrupt is enabled by registering event callbacks :cpp:func:`pcnt_unit_register_event_callbacks`. - ``pcnt_event_enable`` and ``pcnt_event_disable`` are removed.
18
In the new driver, the PCNT events are enabled/disabled by adding/removing watch points :cpp:func:`pcnt_unit_add_watch_point`, :cpp:func:`pcnt_unit_remove_watch_point`. - ``pcnt_set_event_value`` is removed. In the new driver, event value is also set when adding watch point by :cpp:func:`pcnt_unit_add_watch_point`. - ``pcnt_get_event_value`` and ``pcnt_get_event_status`` are removed. In the new driver, these information are provided by event callback :cpp:type:`pcnt_watch_cb_t` in the :cpp:type:`pcnt_watch_event_data_t`. - ``pcnt_isr_register`` and ``pcnt_isr_unregister`` are removed. Register of the ISR handler from user's code is no longer permitted. Users should register event callbacks instead by calling :cpp:func:`pcnt_unit_register_event_callbacks`. - ``pcnt_set_pin`` is removed and the new driver no longer allows the switching of the GPIO at runtime. If users want to change to other GPIOs, please delete the existing PCNT channel by :cpp:func:`pcnt_del_channel` and reinstall with the new GPIO number by :cpp:func:`pcnt_new_channel`.
18
- ``pcnt_filter_enable``, ``pcnt_filter_disable`` and ``pcnt_set_filter_value`` are replaced by :cpp:func:`pcnt_unit_set_glitch_filter`. Meanwhile, ``pcnt_get_filter_value`` has been removed. - ``pcnt_set_mode`` is replaced by :cpp:func:`pcnt_channel_set_edge_action` and :cpp:func:`pcnt_channel_set_level_action`. - ``pcnt_isr_service_install``, ``pcnt_isr_service_uninstall``, ``pcnt_isr_handler_add`` and ``pcnt_isr_handler_remove`` are replaced by :cpp:func:`pcnt_unit_register_event_callbacks`. The default ISR handler is lazy installed in the new driver. .. only:: SOC_TEMP_SENSOR_SUPPORTED Temperature Sensor Driver The temperature sensor driver has been redesigned and it is recommended to use the new driver. However, the old driver is still available but cannot be used with the new driver simultaneously. The new driver can be included via ``driver/temperature_sensor.h``. The old driver is still available in the previous include path ``driver/temp_sensor.
18
h``. However, including ``driver/temp_sensor.h`` triggers the build warning below by default. The warning can be suppressed by enabling the menuconfig option :ref:`CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN`. .. code-block:: text legacy temperature sensor driver is deprecated, please migrate to driver/temperature_sensor.h Configuration contents has been changed. In the old version, users need to configure ``clk_div`` and ``dac_offset``. While in the new version, users only need to choose ``tsens_range``. The process of using temperature sensor has been changed. In the old version, users can use ``config->start->read_celsius`` to get value. In the new version, users should install the temperature sensor driver firstly, by ``temperature_sensor_install`` and uninstall it when finished. For more information, please refer to :doc:`Temperature Sensor ` . .. only:: SOC_RMT_SUPPORTED RMT Driver RMT driver has been redesigned (see :doc:`RMT transceiver `), which aims to unify and extend the usage of RMT peripheral.
18
Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/rmt.h``. However, including ``driver/rmt.h`` triggers the build warning below by default. The warning can be suppressed by the Kconfig option :ref:`CONFIG_RMT_SUPPRESS_DEPRECATE_WARN`. .. code-block:: text The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h The major breaking changes in concept and usage are listed as follows: Breaking Changes in Concepts - ``rmt_channel_t`` which used to identify the hardware channel are removed from user space. In the new driver, RMT channel is represented by :cpp:type:`rmt_channel_handle_t`. The channel is dynamically allocated by the driver, instead of designated by user. - ``rmt_item32_t`` is replaced by :cpp:type:`rmt_symbol_word_t`, which avoids a nested union inside a struct. - ``rmt_mem_t`` is removed, as we do not allow users to access RMT memory block (a.
18
k.an RMTMEM) directly. Direct access to RMTMEM does not make sense but make mistakes, especially when the RMT channel also connected with a DMA channel. - ``rmt_mem_owner_t`` is removed, as the ownership is controlled by driver, not by user anymore. - ``rmt_source_clk_t`` is replaced by :cpp:type:`rmt_clock_source_t`, and note they are not binary compatible. - ``rmt_data_mode_t`` is removed, the RMT memory access mode is configured to always use Non-FIFO and DMA mode. - ``rmt_mode_t`` is removed, as the driver has stand alone install functions for TX and RX channels. - ``rmt_idle_level_t`` is removed, setting IDLE level for TX channel is available in :cpp:member:`rmt_transmit_config_t::eot_level`. - ``rmt_carrier_level_t`` is removed, setting carrier polarity is available in :cpp:member:`rmt_carrier_config_t::polarity_active_low`. - ``rmt_channel_status_t`` and ``rmt_channel_status_result_t`` are removed, they are not used anywhere. - Transmitting by RMT channel does not expect user to prepare the RMT symbols, instead, user needs to provide an RMT Encoder to tell the driver how to convert user data into RMT symbols.
18
Breaking Changes in Usage - Channel installation has been separated for TX and RX channels into :cpp:func:`rmt_new_tx_channel` and :cpp:func:`rmt_new_rx_channel`. - ``rmt_set_clk_div`` and ``rmt_get_clk_div`` are removed. Channel clock configuration can only be done during channel installation. - ``rmt_set_rx_idle_thresh`` and ``rmt_get_rx_idle_thresh`` are removed. In the new driver, the RX channel IDLE threshold is redesigned into a new concept :cpp:member:`rmt_receive_config_t::signal_range_max_ns`. - ``rmt_set_mem_block_num`` and ``rmt_get_mem_block_num`` are removed. In the new driver, the memory block number is determined by :cpp:member:`rmt_tx_channel_config_t::mem_block_symbols` and :cpp:member:`rmt_rx_channel_config_t::mem_block_symbols`. - ``rmt_set_tx_carrier`` is removed, the new driver uses :cpp:func:`rmt_apply_carrier` to set carrier behavior. - ``rmt_set_mem_pd`` and ``rmt_get_mem_pd`` are removed. The memory power is managed by the driver automatically.
18
- ``rmt_memory_rw_rst``, ``rmt_tx_memory_reset`` and ``rmt_rx_memory_reset`` are removed. Memory reset is managed by the driver automatically. - ``rmt_tx_start`` and ``rmt_rx_start`` are merged into a single function :cpp:func:`rmt_enable`, for both TX and RX channels. - ``rmt_tx_stop`` and ``rmt_rx_stop`` are merged into a single function :cpp:func:`rmt_disable`, for both TX and RX channels. - ``rmt_set_memory_owner`` and ``rmt_get_memory_owner`` are removed. RMT memory owner guard is added automatically by the driver. - ``rmt_set_tx_loop_mode`` and ``rmt_get_tx_loop_mode`` are removed. In the new driver, the loop mode is configured in :cpp:member:`rmt_transmit_config_t::loop_count`. - ``rmt_set_source_clk`` and ``rmt_get_source_clk`` are removed. Configuring clock source is only possible during channel installation by :cpp:member:`rmt_tx_channel_config_t::clk_src` and :cpp:member:`rmt_rx_channel_config_t::clk_src`. - ``rmt_set_rx_filter`` is removed. In the new driver, the filter threshold is redesigned into a new concept :cpp:member:`rmt_receive_config_t::signal_range_min_ns`.
18
- ``rmt_set_idle_level`` and ``rmt_get_idle_level`` are removed. Setting IDLE level for TX channel is available in :cpp:member:`rmt_transmit_config_t::eot_level`. - ``rmt_set_rx_intr_en``, ``rmt_set_err_intr_en``, ``rmt_set_tx_intr_en``, ``rmt_set_tx_thr_intr_en`` and ``rmt_set_rx_thr_intr_en`` are removed. The new driver does not allow user to turn on/off interrupt from user space. Instead, it provides callback functions. - ``rmt_set_gpio`` and ``rmt_set_pin`` are removed. The new driver does not support to switch GPIO dynamically at runtime. - ``rmt_config`` is removed. In the new driver, basic configuration is done during the channel installation stage. - ``rmt_isr_register`` and ``rmt_isr_deregister`` are removed, the interrupt is allocated by the driver itself. - ``rmt_driver_install`` is replaced by :cpp:func:`rmt_new_tx_channel` and :cpp:func:`rmt_new_rx_channel`. - ``rmt_driver_uninstall`` is replaced by :cpp:func:`rmt_del_channel`. - ``rmt_fill_tx_items``, ``rmt_write_items`` and ``rmt_write_sample`` are removed.
18
In the new driver, user needs to provide an encoder to "translate" the user data into RMT symbols. - ``rmt_get_counter_clock`` is removed, as the channel clock resolution is configured by user from :cpp:member:`rmt_tx_channel_config_t::resolution_hz`. - ``rmt_wait_tx_done`` is replaced by :cpp:func:`rmt_tx_wait_all_done`. - ``rmt_translator_init``, ``rmt_translator_set_context`` and ``rmt_translator_get_context`` are removed. In the new driver, the translator has been replaced by the RMT encoder. - ``rmt_get_ringbuf_handle`` is removed. The new driver does not use Ringbuffer to save RMT symbols. Instead, the incoming data are saved to the user provided buffer directly. The user buffer can even be mounted to DMA link internally. - ``rmt_register_tx_end_callback`` is replaced by :cpp:func:`rmt_tx_register_event_callbacks`, where user can register :cpp:member:`rmt_tx_event_callbacks_t::on_trans_done` event callback. - ``rmt_set_intr_enable_mask`` and ``rmt_clr_intr_enable_mask`` are removed, as the interrupt is handled by the driver, user does not need to take care of it.
18
- ``rmt_add_channel_to_group`` and ``rmt_remove_channel_from_group`` are replaced by RMT sync manager. Please refer to :cpp:func:`rmt_new_sync_manager`. - ``rmt_set_tx_loop_count`` is removed. The loop count in the new driver is configured in :cpp:member:`rmt_transmit_config_t::loop_count`. - ``rmt_enable_tx_loop_autostop`` is removed. In the new driver, TX loop auto stop is always enabled if available, it is not configurable anymore. LCD --- - The LCD panel initialization flow is slightly changed. Now the :cpp:func:`esp_lcd_panel_init` will not turn on the display automatically. User needs to call :cpp:func:`esp_lcd_panel_disp_on_off` to manually turn on the display. Note, this is different from turning on backlight. With this breaking change, user can flash a predefined pattern to the screen before turning on the screen. This can help avoid random noise on the screen after a power on reset. - :cpp:func:`esp_lcd_panel_disp_off` is deprecated, please use :cpp:func:`esp_lcd_panel_disp_on_off` instead.
18
- ``dc_as_cmd_phase`` is removed. The SPI LCD driver currently does not support a 9-bit SPI LCD. Please always use a dedicated GPIO to control the LCD D/C line. - The way to register RGB panel event callbacks has been moved from the :cpp:type:`esp_lcd_rgb_panel_config_t` into a separate API :cpp:func:`esp_lcd_rgb_panel_register_event_callbacks`. However, the event callback signature is not changed. - Previous ``relax_on_idle`` flag in :cpp:type:`esp_lcd_rgb_panel_config_t` has been renamed into :cpp:member:`esp_lcd_rgb_panel_config_t::refresh_on_demand`, which expresses the same meaning but with a clear name. - If the RGB LCD is created with the ``refresh_on_demand`` flag enabled, the driver will not start a refresh in the :cpp:func:`esp_lcd_panel_draw_bitmap`. Now users have to call :cpp:func:`esp_lcd_rgb_panel_refresh` to refresh the screen by themselves. - :cpp:type:`esp_lcd_color_space_t` is deprecated, please use :cpp:type:`lcd_color_space_t` to describe the color space, and use :cpp:type:`lcd_rgb_element_order_t` to describe the data order of RGB color.
18
.. only:: SOC_MCPWM_SUPPORTED MCPWM MCPWM driver was redesigned (see :doc:`MCPWM `), meanwhile, the legacy driver is deprecated. The new driver's aim is to make each MCPWM submodule independent to each other, and give the freedom of resource connection back to users. Although it is recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/mcpwm.h``. However, using legacy driver triggers the build warning below by default. This warning can be suppressed by the Kconfig option :ref:`CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN`. .. code-block:: text legacy MCPWM driver is deprecated, please migrate to the new driver (include driver/mcpwm_prelude.h) The major breaking changes in concept and usage are listed as follows: Breaking Changes in Concepts The new MCPWM driver is object-oriented, where most of the MCPWM submodule has a driver object associated with it. The driver object is created by factory function like :cpp:func:`mcpwm_new_timer`.
18
IO control function always needs an object handle, in the first place. The legacy driver has an inappropriate assumption, that is the MCPWM operator should be connected to different MCPWM timer. In fact, the hardware does not have such limitation. In the new driver, a MCPWM timer can be connected to multiple operators, so that the operators can achieve the best synchronization performance. The legacy driver presets the way to generate a PWM waveform into a so called ``mcpwm_duty_type_t``. However, the duty cycle modes listed there are far from sufficient. Likewise, legacy driver has several preset ``mcpwm_deadtime_type_t``, which also does not cover all the use cases. What is more, user usually gets confused by the name of the duty cycle mode and dead-time mode. In the new driver, there are no such limitation, but user has to construct the generator behavior from scratch. In the legacy driver, the ways to synchronize the MCPWM timer by GPIO, software and other timer module are not unified.
18
It increased learning costs for users. In the new driver, the synchronization APIs are unified. The legacy driver has mixed the concepts of "Fault detector" and "Fault handler". Which make the APIs very confusing to users. In the new driver, the fault object just represents a failure source, and we introduced a new concept -- **brake** to express the concept of "Fault handler". What is more, the new driver supports software fault. The legacy drive only provides callback functions for the capture submodule. The new driver provides more useful callbacks for various MCPWM submodules, like timer stop, compare match, fault enter, brake, etc. - ``mcpwm_io_signals_t`` and ``mcpwm_pin_config_t`` are not used. GPIO configuration has been moved into submodule's configuration structure. - ``mcpwm_timer_t``, ``mcpwm_generator_t`` are not used. Timer and generator are represented by :cpp:type:`mcpwm_timer_handle_t` and :cpp:type:`mcpwm_gen_handle_t`. - ``mcpwm_fault_signal_t`` and ``mcpwm_sync_signal_t`` are not used.
18
Fault and sync source are represented by :cpp:type:`mcpwm_fault_handle_t` and :cpp:type:`mcpwm_sync_handle_t`. - ``mcpwm_capture_signal_t`` is not used. A capture channel is represented by :cpp:type:`mcpwm_cap_channel_handle_t`. Breaking Changes in Usage - ``mcpwm_gpio_init`` and ``mcpwm_set_pin``: GPIO configurations are moved to submodule's own configuration. e.g., set the PWM GPIO in :cpp:member:`mcpwm_generator_config_t::gen_gpio_num`. - ``mcpwm_init``: To get an expected PWM waveform, users need to allocated at least one MCPWM timer and MCPWM operator, then connect them by calling :cpp:func:`mcpwm_operator_connect_timer`. After that, users should set the generator's actions on various events by calling e.g., :cpp:func:`mcpwm_generator_set_actions_on_timer_event`, :cpp:func:`mcpwm_generator_set_actions_on_compare_event`. - ``mcpwm_group_set_resolution``: in the new driver, the group resolution is fixed to the maximum, usually it is 80 MHz. - ``mcpwm_timer_set_resolution``: MCPWM Timer resolution is set in :cpp:member:`mcpwm_timer_config_t::resolution_hz`.
18
- ``mcpwm_set_frequency``: PWM frequency is determined by :cpp:member:`mcpwm_timer_config_t::resolution_hz`, :cpp:member:`mcpwm_timer_config_t::count_mode` and :cpp:member:`mcpwm_timer_config_t::period_ticks`. - ``mcpwm_set_duty``: To set the PWM duty cycle, users should call :cpp:func:`mcpwm_comparator_set_compare_value` to change comparator's threshold. - ``mcpwm_set_duty_type``: There is no preset duty cycle types. The duty cycle type is configured by setting different generator actions. e.g., :cpp:func:`mcpwm_generator_set_actions_on_timer_event`. - ``mcpwm_set_signal_high`` and ``mcpwm_set_signal_low`` are replaced by :cpp:func:`mcpwm_generator_set_force_level`. In the new driver, it is implemented by setting force action for the generator, instead of changing the duty cycle to 0% or 100% at the background. - ``mcpwm_start`` and ``mcpwm_stop`` are replaced by :cpp:func:`mcpwm_timer_start_stop`. You have more modes to start and stop the MCPWM timer, see :cpp:type:`mcpwm_timer_start_stop_cmd_t`.
18
- ``mcpwm_carrier_init`` is replaced by :cpp:func:`mcpwm_operator_apply_carrier`. - ``mcpwm_carrier_enable`` and ``mcpwm_carrier_disable``: Enabling and disabling carrier submodule is done automatically by checking whether the carrier configuration structure :cpp:type:`mcpwm_carrier_config_t` is NULL. - ``mcpwm_carrier_set_period`` is replaced by :cpp:member:`mcpwm_carrier_config_t::frequency_hz`. - ``mcpwm_carrier_set_duty_cycle`` is replaced by :cpp:member:`mcpwm_carrier_config_t::duty_cycle`. - ``mcpwm_carrier_oneshot_mode_enable`` is replaced by :cpp:member:`mcpwm_carrier_config_t::first_pulse_duration_us`. - ``mcpwm_carrier_oneshot_mode_disable`` is removed. Disabling the first pulse (a.k.a the one-shot pulse) in the carrier is never supported by the hardware. - ``mcpwm_carrier_output_invert`` is replaced by :cpp:member:`mcpwm_carrier_config_t::invert_before_modulate` and :cpp:member:`mcpwm_carrier_config_t::invert_after_modulate`. - ``mcpwm_deadtime_enable`` and ``mcpwm_deadtime_disable`` are replaced by :cpp:func:`mcpwm_generator_set_dead_time`.
18
- ``mcpwm_fault_init`` is replaced by :cpp:func:`mcpwm_new_gpio_fault`. - ``mcpwm_fault_set_oneshot_mode``, ``mcpwm_fault_set_cyc_mode`` are replaced by :cpp:func:`mcpwm_operator_set_brake_on_fault` and :cpp:func:`mcpwm_generator_set_actions_on_brake_event`. - ``mcpwm_capture_enable`` is removed. It is duplicated to :cpp:func:`mcpwm_capture_enable_channel`. - ``mcpwm_capture_disable`` is removed. It is duplicated to :cpp:func:`mcpwm_capture_capture_disable_channel`. - ``mcpwm_capture_enable_channel`` and ``mcpwm_capture_disable_channel`` are replaced by :cpp:func:`mcpwm_capture_channel_enable` and :cpp:func:`mcpwm_capture_channel_disable`. - ``mcpwm_capture_signal_get_value`` and ``mcpwm_capture_signal_get_edge``: Capture timer count value and capture edge are provided in the capture event callback, via :cpp:type:`mcpwm_capture_event_data_t`. Capture data are only valuable when capture event happens. Providing single API to fetch capture data is meaningless. - ``mcpwm_sync_enable`` is removed.
18
It is duplicated to :cpp:func:`mcpwm_sync_configure`. - ``mcpwm_sync_configure`` is replaced by :cpp:func:`mcpwm_timer_set_phase_on_sync`. - ``mcpwm_sync_disable`` is equivalent to setting :cpp:member:`mcpwm_timer_sync_phase_config_t::sync_src` to ``NULL``. - ``mcpwm_set_timer_sync_output`` is replaced by :cpp:func:`mcpwm_new_timer_sync_src`. - ``mcpwm_timer_trigger_soft_sync`` is replaced by :cpp:func:`mcpwm_soft_sync_activate`. - ``mcpwm_sync_invert_gpio_synchro`` is equivalent to setting :cpp:member:`mcpwm_gpio_sync_src_config_t::active_neg`. - ``mcpwm_isr_register`` is removed. You can register various event callbacks instead. For example, to register capture event callback, users can use :cpp:func:`mcpwm_capture_channel_register_event_callbacks`. .. only:: SOC_DEDICATED_GPIO_SUPPORTED Dedicated GPIO Driver - All of the dedicated GPIO related Low Level (LL) functions in ``cpu_ll.h`` have been moved to ``dedic_gpio_cpu_ll.h`` and renamed. ..
18
only:: SOC_I2S_SUPPORTED I2S Driver The I2S driver has been redesigned (see :doc:`I2S Driver `), which aims to rectify the shortcomings of the driver that were exposed when supporting all the new features of ESP32-C3 & ESP32-S3. The new driver's APIs are available by including corresponding I2S mode's header files :component_file:`esp_driver_i2s/include/driver/i2s_std.h`, :component_file:`esp_driver_i2s/include/driver/i2s_pdm.h`, or :component_file:`esp_driver_i2s/include/driver/i2s_tdm.h`. Meanwhile, the old driver's APIs in :component_file:`driver/deprecated/driver/i2s.h` are still supported for backward compatibility. But there will be warnings if users keep using the old APIs in their projects, these warnings can be suppressed by the Kconfig option :ref:`CONFIG_I2S_SUPPRESS_DEPRECATE_WARN`. Here is the general overview of the current I2S files: .. figure:: ../../../../_static/diagrams/i2s/i2s_file_structure.png :align: center :alt: I2S File Structure Breaking changes in Concepts Independent TX/RX channels """""""""""""""""""""""""" The minimum control unit in new I2S driver are now individual TX/RX channels instead of an entire I2S controller (that consistes of multiple channels).
18
- The TX and RX channels of the same I2S controller can be controlled separately, meaning that they are configured such that they can be started or stopped separately. - The :cpp:type:`i2s_chan_handle_t` handle type is used to uniquely identify I2S channels. All the APIs require the channel handle and users need to maintain the channel handles by themselves. - On the ESP32-C3 and ESP32-S3, TX and RX channels in the same controller can be configured to different clocks or modes. - However, on the ESP32 and ESP32-S2, the TX and RX channels of the same controller still share some hardware resources. Thus, configurations may cause one channel to affect another channel in the same controller. - The channels can be registered to an available I2S controller automatically by setting :cpp:enumerator:`i2s_port_t::I2S_NUM_AUTO` as I2S port ID which causes the driver to search for the available TX/RX channels. However, the driver also supports registering channels to a specific port.
18
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
0
Edit dataset card