github espressif/esp-idf v4.0.3
ESP-IDF Release v4.0.3

latest releases: v5.2.3, v5.3.1, v5.0.7...
3 years ago

Documentation for v4.0.3 is available at https://docs.espressif.com/projects/esp-idf/en/v4.0.3/

ESP-IDF v4.0.3 is a bugfix update for ESP-IDF v4.0. ESP-IDF v4.3 is the latest stable release at time of writing.

ESP-IDF v4.0.x will be supported until October 2021, according to the ESP-IDF Support Policy. Since ESP-IDF v4.1, each ESP-IDF major and minor release (V4.1, V4.2, etc) is supported for 30 months after the initial stable release date.

Obtaining v4.0.3

For full installation instructions, see the ESP-IDF Programming Guide.

The source files attached to this release will not work due to our use of git submodules. Use one of the following methods instead:

Using git

To get this release, use the following commands:

git clone -b v4.0.3 --recursive https://github.com/espressif/esp-idf.git esp-idf-v4.0.3
cd esp-idf-v4.0.3/

This is the recommended way of obtaining v4.0.3 of ESP-IDF.

Download an archive with submodules included

Attached to this release is an esp-idf-v4.0.3.zip archive. It includes .git directory and all the submodules, so can be used out of the box. This archive is provided for users who have connectivity issues preventing them from cloning from GitHub.

This archive can also be downloaded from Espressif's download server:
https://dl.espressif.com/dl/esp-idf/releases/esp-idf-v4.0.3.zip

Changelog

This is the list of changes since release v4.0.2:

Major Bug Fixes

  • Fixed arithmetic overflow issue in FreeRTOS queue API (CVE-2021-31571)

Breaking Changes

  • NVS: Usage of initialized flash after erasure changes from undefined behavior to runtime failure
  • Bootloader: The default app configuration is only compatible with bootloader and partition table generated from ESP-IDF V3.1 or newer. Apps that need to support OTA update on bootloaders and/or partition tables from older ESP-IDF must enable the new configuration option "App compatible with bootloader and partition table before ESP-IDF v3.1".

Bluetooth

Controller

  • Fixed BT controller dead if CLKN overflow
  • Reduced IRAM consumption about 300bytes
  • Fixed crash in Bluetooth caused by calling esp_restart() function
  • Fixed controller do not report disconnect event to host
  • Removed the wrong called to lld_evt_end_isr()
  • Fixed sleep cause hci timeout issue
  • Fixed the issue of modem sleep which may lead to the crash issue "assert(-218959118,0)"
  • Modified E8192 ELx200 ELx40 log level to LOGD

Bluetooth Low Energy

  • Fixed exl200 error
  • Added btdm_disable_adv_delay() function to delay ADV random delay
  • Fixed RPA address update error
  • Fixed the problem of early release of pointer(p_ccb) in function
  • Fixed ble disconnection issue in coex mode
  • Fixed the crash issue after controller disable and re-enable in bluetooth
  • Fixed assert(10, 9) when afpm occur,and changed the check order for esp_bt_controller_init()
  • Added timer to monitor controller scan event

Classic Bluetooth

  • Workaround for a hardware bug when entering sniff mode
  • Rewrite ld_acl_frm_isr to make clock read more precise and use less IRAM
  • Fixed HCI Timeout by 0x40F or 0x41C by freeing ACL RX Buffer in Exchange Memory
  • Added protection for ACL-U packet type exchange procedure
  • Added check for NULL valued combination key to prevent ‘Impersonation in the Pin Pairing Protocol’ Vulnerability (CVE-2020-26555)

Bluedroid

Classic Bluetooth

  • Separate A2DP and AVRC init procedure and set the sequence of initialization of them
  • SPP: Fixed crash caused by fixed_queue_dequeue() spp rx
  • Optimized some comments and internal functions
  • GAP: Add remove bond device complete event in GAP module
  • GAP: Fixed when calling esp_bt_gap_read_rssi_delta without ESP_BT_GAP_READ_RSSI_DELTA_EVT event.(#5660)
  • Commented out L2CAP APIs in SPP Profile to reduce the .bss.
  • SPP: Moved RFCOMM rx flow control in btc layer
  • SPP: Fixed the parameter size of API spp_vfs_write cannot exceed 1000
  • SPP: Added events if there are some internal errors when calling esp_spp_xxx API
  • A2DP: Fixed crash caused by calling a2dp_deinit directly when a2dp connected
  • SPP: Fixed SPP vfs demo crash when use dynamic memory
  • SPP: Fixed SPP vfs memory leaks when exception occurs
  • Rejected connection request if BD_ADDR of peer is same as ours (CVE-2020-26555)
  • A2DP: Added Init & Deinit Event for A2DP
  • A2DP: Fixed data stream underrun for A2DP sink
  • Added check for peer device bdaddr to be different than ours when sending conn req to prevent ‘Impersonation in the Pin Pairing Protocol’ Vulnerability
  • SPP: Added API esp_spp_stop_srv_scn to stop a specific server
  • SPP: Added parameter service_name with event ESP_SPP_DISCOVERY_COMP_EVT
  • SPP: Added parameter scn with event ESP_SPP_START_EVT
  • SPP: Added parameter scn with event ESP_SPP_SRV_STOP_EVT
  • Added change to consider Audio Major Class while showing discovery results (#6548)
  • Fixed one issue that when bta_hf_client_sco_co_out_data is called, it will crash
  • Added API to config QoS

Bluetooth Low Energy

  • Fixed a potential double free error
  • Supported BLE Authorization
  • Supported BLE Application Layer Encryption key size check
  • Supported BLE Read Attribute value by UUID
  • Supported BLE Non-Resolvable Private Address setting
  • Fixed BLE incorrect encryption flag setting
  • Fixed unexpected LMP timeout problem when rejecting remote device
  • Optimize the ble_spp_server_demo example
  • Fixed ‘Impersonation in the Passkey Entry Protocol’ Vulnerability: CVE-2020-26558
  • Added comments to avoid ‘Impersonation in the Pin Pairing Protocol' Vulnerability: (CVE-2020-26555)
  • Added comments to avoid ‘Authentication of the LE Legacy Pairing Protocol' Vulnerability
  • Added connection parameter check
  • Fixed ble connection maximum latency is 499
  • Disable bluedroid congest error log print
  • Fixed white list update failed
  • Fixed bluedroid repair faild if the two most significant bits of public address is '01'
  • Fixed congestion event parameter error
  • Fixed BLE read multiple characteristic error when the number of handles is more than 10
  • Fixed scan response report length error sometimes
  • Fixed vendor hci memory leak
  • Modified parameter description for esp_ble_gattc_open()
  • Fixed Spelling mistakes
  • Fixed multi-connection pair failure
  • Updated connection state when getting connection cancel complete
  • Fixed crash caused by enable GATTC NVS

NimBLE

  • Added check if received buffer size less than configured event buffer size
  • NimBLE NVS: Additional check to account for NVS operation failure
  • NimBLE host: Fix minor bug in ble_eddystone_set_adv_data_gen
  • NimBLE host: remove recursive call, upstream PR: apache/mynewt-nimble#857
  • Fixed host flow control in NimBLE host
  • Fixed WDT crash observed during security exchanges
  • Nimble host: Fix MITM vulnerability during public key exchange in secure connection

Blufi

  • Fixed the issue that the sequence still increases when Blufi is sending data on disconnection
  • Fixed an error caused by incorrect conn_id parameters
  • Added a macro to control the compilation of blufi code
  • Fixed the issue that sending longer customer data will cause congestion

ESP-BLE-Mesh

  • Fixed updating ccc handle with wrong value when using NimBLE host
  • Replaced ASSERT in the mesh stack with proper error handling
  • Fixed wrong description of BLE Mesh server model autorsp flag
  • Now using the latest IV Index for provisioning by Provisioner
  • Added check of mesh stack initialization before initialize vendor client
  • Updated mesh device property to v2
  • Updated Provisioner delete device function behavior
  • Synchronized a few Zephyr BLE Mesh updates
    • Use model callback for model related operations
    • Fixed RPL not checked by proxy configuration
    • Store Key Refresh Phase after the value is changed
    • Replace the Zephyr integer types with C99 types
  • Added device role check before enabling proper mesh functionality
  • Added mutex for protecting settings operations
  • Added clearing hb_pub function in settings
  • Optimized erasing NetKey and AppKey functions
  • Optimized model settings related functions
  • Fixed storing wrong next allocated net_idx and app_idx
  • Updated connection parameters used by Central device for BLE Mesh
  • Persistent storage miscellaneous fixes
  • New Kconfig options introduced to reduce code size
  • Added node local NetKey/AppKey Get/Add and bind AppKey functions
  • Always needs uuid when adding device for provisioning
  • Fixed Node ID advertising with wrong timeout value
  • Added support of receiving heartbeat messages for Provisioner
  • Support using multiple NVS namespaces to store information by Provisioner
  • Added a separate callback for BLE coexistence operations
  • Support scanning normal BLE advertising packets
  • Enable updating Lighting HSL state
  • Use different random values for each provisioning procedure
  • Fixed an issue that Proxy Client may fail to resend messages
  • Fixed deinit server models with no matching model id
  • Fixed number endianness error for Provisioner when using input/output authentication (#6862)
  • Fixed provisioning input/output count number should be at least 1 (#6863)
  • Add check the value of Provisioning Random & Confirmation sent and received by Provisioner(CVE-2020-26556 & CVE-2020-26560)
  • Recommend to use OOB mechanism to exchange Public Key (CVE-2020-26559)
  • Recommend to use randomly generated AuthValue for Static OOB (CVE-2020-26557)

Wi-Fi Coexistence

  • Changed wifi scan duration from 120ms to 100ms
  • Fixed bt controller task watchdog during Wi-Fi test

Wi-Fi

  • wpa_supplicant: Fixed linker errors depending on link order on some systems (#5641)
  • wpa_supplicant: Increased PMK lifetime to 100 days
  • wpa_supplicant: Added support of MbedTLS based EAP handshake
  • Modify LR for esp32
  • Optimized some debug logs for probe response
  • Optimized phy and soc files
  • Fixed "no event" bug for connect
  • Fixed the bug that set_channel does not work for softAP
  • Fixed softap mode event issue.
  • Added set/get inactive time api
  • Fixed STA mode problem where connection to a hidden AP does not update AP information
  • Added rf test for long/short preamble support
  • Replace internal RSA APIs by mbedtls APIs
  • Fixed "iperf example parameter opt not initialised" bug
  • Fixed links to example directories for fast_scan and scan
  • Optimized TCP timer interval
  • Added wpa_supllicant debug logging as a configurable option
  • Minor bugfix with wpa_supplicant debug logs
  • Added support for 802.1x sha256 auth key mode
  • Fixed the issue that PMF packets are not sent after mode change
  • Removed coexist warnings in WiFi MESH
  • Updated description for esp APIs
  • Fixed the issue of high PER while receiving broadcast data on ESP32-S2 station when it connects to an ESP32-S2 softAP
  • Change wifi tx buffer limits
  • Disabling Menuconfig option "Enable WPA3-Personal" now disables WPA3 code, reduces code size by around 7.7kB
  • Fixed WPA3 code cannot be disabled by disabling WPA3 flag in Menuconfig
  • Optimized WiFi debug log
  • Updated WiFi toolchain to 1.22.0-97-gc752ad5
  • Optimized WiFi TX performance
  • Fixed WPS example issues
  • Added Failure reason code for WPS event
  • Added check CSA state before CSA timer process
  • Using deport reg instead of ahb.
  • Check TID in ieee80211_recv_bar()
  • Revert to report specific reason code when receiving deauth during 4-way-handshark.
  • Fixed the bug that tx ampdu parameter is not from peer device.
  • Fixed CSA timer issue
  • Changed country code last byte to space instead of \0
  • Fixed the issue that SoftAP cannot forward A-MSDU
  • WiFi station connect improvement, avoid 100ms passive scan
  • Added FCS failed packets filter
  • Updated ESP32 phy lib to v4660
  • Fixed max tx power to 20dBm
  • Fixed the issue that the esp_wifi_sta_get_ap_info cannot get country
  • Fixed phy version log could not disable issue
  • Fixed system crash on scan failure
  • Do not check the return value of esp_wifi_connect()
  • Fixed smartconfig issue when router replies to arp late
  • Updated exception handling for iperf example's scan when no ap was found
  • Fixed CSA and BAR crash issue
  • Fixed return type of esp_wifi_deinit when Wi-Fi is not stopped
  • Fixed resource-leaks detected in static analysis
  • Fixed setting channel error after WiFi stop
  • Fixed issue of reason code change from 15 to 204 when wrong password is provided
  • Fixed set config return value error
  • Fixed ampdu age timer related memory leak
  • Add beacon timeout event
  • Fixed a bug that Wi-Fi stack may crash while receiving AMSDU length bigger then 3200
  • Fixed SoftAP not initiating 4-way handshake issue if max length passphrase is set
  • Fixed esptouch find hidden AP fail
  • Clear AP BSS when auth timeout happens
  • Fixed the bug that STA fails to connect to open AP after it failed to connect to a WPA3 AP
  • Fixed esp_wifi_80211_tx when out of memory unlock mutex issue
  • Fixed esp_wifi_80211_tx cannot be used in SoftAP mode
  • Fixed hidden AP scan issue after connecting to an AP
  • Fixed watchdog timeout issue when receiving an action frame
  • Prevent re-installation of an already in-use group key

Wi-Fi Mesh

  • Fix FIX-ROOT does not reconnect to router when disconnect reason is too many
  • Added API esp_mesh_print_scan_result
  • Modified not to reset mesh_xonseq of self and children when flush_upstream_packets
  • Fixed not arm parent monitor when a parent candidate is cleared without sending an event to mesh layer
  • Fixed the new voted root does not reconnect to router if rssi is weak
  • Add esp_mesh_send_block_time to set blocking time of esp_mesh_send
  • Fixed the issue that tx beacon interval becomes 1 minute

Ethernet

  • Fixed Ethernet RX issue, handle rx early event
  • Support PHY power on timeout (#5425)

Security

  • Fixed openssl port to correctly convert between openssl and mbedTLS verification modes
  • Flash Encryption: Fixed potential physical access TOCTOU attack to remove encrypted partition flag in partition table (CVE-2021-27926)

Peripheral Drivers

  • ADC: Fixed the issue that ADC power is affected by Wi-Fi usage
  • ADC: Fixed issue of crashing when verbose logs are enabled
  • CAN: Added support for running ISR when cache is disabled
  • CAN: Fixed a bug where log functions were called from within critical sections leading a crash
  • CAN: Fixed a bug where semaphores were taken from within a critical section
  • cxx: Fixed extern "C" declarations in touch_sensor.h and esp_adc_cal.h (#6633, #6634)
  • freemodbus: Fixed compilation issue when CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=y (#6003)
  • freemodbus: Added MB_PORT_PARITY_GET() to propagate UART parity options from mb controller to serial port layer (#6377)
  • freemodbus: Added processing of events in one poll cycle
  • freemodbus: fix event processing failure after driver destroy (#5275)
  • I2C: Fixed PM lock release in case of a timeout
  • I2S: Fixed I2S left/right channels swapped issue (#6625)
  • MCPWM: Fixed the inaccurate period
  • SPI: Turned off DMA before CPU reset to avoid memory corruption after the reset
  • SPI: Fixed duplex mode switch issue when switching multiple devices (#4641, #1080)
  • SPI: Fixed CS polarity configuration issue (#4726, #5490)
  • SPI Flash: Added config option to override inherited flash size from bootloader header
  • UART: Added config to support placing UART ISR in IRAM
  • UART: Fixed uart module reset issue (#1202)

Core System

  • Build & Config: Fixed C identified generation from embedded file in CMake (#4927)
  • Build & Config: Fixed getting component private requirements
  • Build & Config: idf_as_lib example now places sdkconfig file outside the build directory
  • Build & Config: Now always logs the sdkconfig file path from CMake
  • Added PSRAM stack check in backtrace
  • FreeRTOS: Increased minimum task stack size when stack smashing checker is enabled (#6403)?
  • pthreads: Fixed priority inheritance in pthread_mutex_destroy
  • Fixed default values for all RTC sources in the CONFIG_ESP32xx_RTC_CLK_CAL_CYCLES option (#6037)
  • Switch SPIRAM stack in esp_restart_noos() to internal stack (#5107)
  • idf.py: Now disables cmake uninitialized variable warnings by default
  • Fixed sign compare warning in soc/cpu.h (#5687)
  • Remove Core 1 disable cache in cache_utils.c
  • Fixed arithmetic overflow issue in FreeRTOS queue API (CVE-2021-31571)
  • Watchdog Timers: Task WDT now prints a backtrace when triggered
  • Disabled C++ exception FDE sorting
  • longjmp() is now context switch-safe (#5229)

Power Management

  • Fixed printing from a critical section in esp_pm_dump_locks, improve formatting (#1917)
  • Optimized deep sleep current in wifi softap mode

newlib libc

  • Fixed adjtime, returns the amount of time remaining from any previous adjustment (#5194)

LWIP

  • Enable TCP initial sequence number (ISN) randomization hook
  • Fixed missing C++ header guards in netdb.h (#5900)
  • Fixed issue for TCP recv assert
  • Fixed ICMP bug to reply correctly to pings with arbitrary length
  • Fixed assert issue when tcp sends data
  • Optimized dhcp key state transition message

mDNS

  • Fixed length calculation of mDNS text field (#6114)

Provisioning

  • wifi_provisioning_manager: Fixed issue faced while adding 2 or more endpoints in wifi_provisioning_manager

HTTP Client

  • Fixed issue with esp_http_client when disable_auto_redirect is enabled
  • Fixed issue with digest auth when opaque field is not present in response
  • Added a configuration in esp_http_client_config_t to set user agent string
  • Fixed buffer overread when esp_http_client_read is called after esp_http_client_perform
  • Fixed esp_http_client_read with OpenSSL server for file size aligned to 289 bytes

mbedTLS

  • Upgrade to release v2.16.9

Bootloader

  • Skip application binary signature checks when insecure configuration is enabled and JTAG debugger is attached (#4878, #4734)
  • Fixed bootloader_common_get_sha256_of_partition(), can handle a long image
  • Fixed anti-rollback feature memory map bug for partition size greater than 3.2MB (#5911)
  • Fixed esp_get_flash_encryption_mode() (#5747)
  • Partition Table: The partition table MD5 checksum is now checked when the partition table is loaded by the app, in addition to the existing check in the bootloader

ESP-TLS

  • Fixed memory leak in esp-tls
  • protocomm: Fixed NULL pointer check found during static analysis

TCP Transport

  • Fixed issue in SSL mode: if esp_transport_poll_read function is used, the cache data in mebdtls will block
  • Updated DNS host name resolution using getaddrinfo for tcp transports (#4510)
  • Enable TCP keep-alive function in transport level
  • Fix some memory leaks issues by coverity static analyzer

Websocket

  • Fixed possible deadlock if stop called from event handler
  • Fixed posting the disconnect event twice on read error
  • Updated the client to block timeout times when set disable_auto_connect

ESP-MQTT

  • SSL: Added config option for skipping common name check (espressif/esp-mqtt#158)
  • Websocket: Allow the query part of the uri to be a part of the path (espressif/esp-mqtt#161)
  • Config: Added check for consistency between config settings
  • Fixed esp_mqtt_client_stop deadlock (espressif/esp-mqtt#163)
  • Added dispatch error event for read errors (#5704)
  • Cleanup expired messages when offline (#5668)
  • Renamed error type MQTT_ERROR_TYPE_ESP_TLS to MQTT_ERROR_TYPE_TCP_TRANSPORT
  • Added configuration value to set network timeout
  • Used size_t for all lengths to allow for other architectures
  • mqtt_outbox: Removed unused retry_count field from outbox_item_t
  • config: Fixed typo for configuring OUTBOX_EXPIRED_TIMEOUT_MS
  • Fixed missing MQTT_API_UNLOCK in esp_mqtt_client_stop error path (espressif/esp-mqtt#173)
  • Added esp_mqtt_client_get_outbox_size API
  • Added config value to disable keepalive mechanism

Storage

  • NVS: flash erase function now de-initializes flash before
  • mmap: Fixed the issue cache not restored after mmap failure
  • NVS: add init function taking esp_partition pointer instead of partition name

Tools

  • Updates OpenOCD version to 'v0.10.0-esp32-20210401'
  • parttool.py: Added parameter out to save the output from the esptool
  • Fixed Python 3 incompatibility for building with Eclipse on Windows
  • Fixed exception when specifying baudrate argument for IDF-Monitor
  • C++: fixed non-working init_priority attribute and moved all C++ init tests to separate file (#5038)
  • Close temporary file before invoking external tools accessing it
  • Fixed path handling errors in gen_esp_err_to_name.py for Windows
  • ldgen: Added support for paths with Unicode characters in archive files parsed by ldgen (#5996)
  • ldgen: Fixed parsing of sections names on Windows
  • Added deprecation warning for Python 2 and Python 3.5 and older
  • esptool: Updated to latest release/v2
  • docker: Added libpython2.7 in order to satisfy GDB dependencies (#5817, #5284)
  • Specify UTF-8 encoding for Eclipse Make build which is not the default value under Python 2
  • Prefer python3 during install and export (#6471)
  • Simpler installation by not requiring to set up manually an alias for python on Unix systems where it doesn't exist by default
  • Reinstall virtualenv if it is broken
  • Fixed crash of idf_monitor.py in case processing input with Unicode character
  • idf_tool.py: Improved error message about tool being installed but failed to run
  • export.bat/install.bat: Human-readable error message if Git or Python is not in PATH

Build System

  • ULP: Fixed ULP assembler version detection for localized systems

Examples

  • Fixed socket examples with IPv6 scoped addresses to obtain the scope id from tcpip_adapter API
  • esp_local_ctrl_example: Fixed expired x509 certificate
  • Fixed socket examples to use sockaddr_storage for both IPv4 and IPv6 addresses
  • flash_encryption example: Fixed the partition table - The partition_example.csv should not have fixed offsets for partitions because we want to move the whole table. The fixed offsets in the table were cleared.
  • MQTT: Updated certificates used on ssl and wss
  • ESP-BLE-MESH: Fixed compile warning about portmacro already been defined (#5745)
  • ESP-BLE-MESH: Added Aligenie BLE Mesh example
  • ESP-BLE-MESH: Fixed wrong iteration of sensor data when handled by sensor client

Documentation

  • Documented solution for ImportError in idf.py
  • Added profile file name used by zsh shell
  • Fixed the setup instructions in the README.md in te root folder
  • Removed potentially confusing links to building the toolchain from scratch from from Getting Started guide
  • Updated Chinese translation for get-started/index.rst, corrected English version
  • Updated CN translation for build-system, idf-monitor, ulp and unit-tests in api-guides; corrected English versions
  • Fixed broken translation links

Don't miss a new esp-idf release

NewReleases is sending notifications on new releases.