Migration guide to Zephyr v4.1.0
This document describes the changes required when migrating your application from Zephyr v4.0.0 to Zephyr v4.1.0.
Any other changes (not directly related to migrating applications) can be found in the release notes.
Build System
Support for the build type feature which was deprecated in Zephyr 3.6 has been removed, File Suffixes/Sysbuild file suffix support has replaced this.
Sysbuild
The Kconfig
SB_CONFIG_MCUBOOT_MODE_SWAP_WITHOUT_SCRATCHhas been deprecated and replaced withSB_CONFIG_MCUBOOT_MODE_SWAP_USING_MOVE, applications should be updated to select this new symbol if they were selecting the old symbol.
BOSSA Runner
The bossac runner has been changed to no longer do a full erase by default when flashing. To
perform a full erase, pass the --erase option when executing west flash.
Kernel
k_pipe API
The k_pipe API has been reworked and the API used in CONFIG_PIPES is now deprecated.
The k_pipe API is enabled by default when CONFIG_MULTITHREADING is set.
Function renames and modifications:
Old API |
New API |
Changes |
|---|---|---|
|
|
Removed |
|
|
Removed |
|
|
Reset the pipe, discarding all data in the pipe, non blocking. |
|
Removed |
Dynamic allocation of pipes is no longer supported |
|
Removed |
Querying the number of bytes in the pipe is no longer supported |
None |
|
Close a pipe, waking up all pending readers and writers with an error code. No further
reading or writing is allowed on the pipe. The pipe can be re-opened by calling
|
Security
New options for stack canaries have been added, providing users with finer control over stack protection. With this change,
CONFIG_STACK_CANARIESno longer enables the compiler option-fstack-protector-all. Users who wish to use this option must now enableCONFIG_STACK_CANARIES_ALL.
Boards
Shield
mikroe_weather_clicknow supports both I2C and SPI interfaces. Users should select the required configuration by usingmikroe_weather_click_i2cormikroe_weather_click_spiinstead ofmikroe_weather_click.All nRF52-based boards will now default to soft (system) reset instead of pin reset when flashing with
west flash. If you want to keep using pin reset on the nRF52 family of ICs you can usewest flash --pinreset.Erasing the external memory when programming a new firmware image with
west flashon the nRF52 and nRF53 series now always correctly honors the--eraseflag (and its absence) both when using thenrfjprogandnrfutilbackends. Prior to this release, thenrjfprogbackend would always erase only the sectors of the external flash used by the new firmware, and thenrfutilone would always erase the whole external flash.CAN1 and USART1 have been disabled on the
stm32f4_disco, because of conflicting pinctrl on I2C1, which is now used to control the audio codec connected to the audio jack output.
Devicetree
The
microchip,cap1203driver has changed its compatible tomicrochip,cap12xxand has been updated to support multiple channels. The number of available channels is derived from the length of the devicetree array propertyinput-codes. TheCONFIG_INPUT_CAP1203_POLLhas been removed: If the devicetree propertyint-gpiosis present, interrupt mode is used otherwise, polling is used. TheCONFIG_INPUT_CAP1203_PERIODhas been replaced with the devicetree propertypoll-interval-ms. In interrupt mode, the devicetree propertyrepeatis supported.
Raspberry Pi
CONFIG_SOC_SERIES_RP2XXXis renamed toCONFIG_SOC_SERIES_RP2040.
STM32
MCO clock source and prescaler are now exclusively configured by the DTS as it was introduced earlier. The Kconfig method for configuration is now removed.
ADC properties
st,adc-sequencerandst,adc-clock-sourcenow uses string values instead of integer values.
Modules
Mbed TLS
If a platform has a CSPRNG source available (i.e.
CONFIG_CSPRNG_ENABLEDis set), then the Kconfig optionCONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNGis the default choice for random number source instead ofCONFIG_MBEDTLS_PSA_CRYPTO_LEGACY_RNG. This helps in reducing ROM/RAM footprint of the Mbed TLS library.The newly-added Kconfig option
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNTallows to specify the number of key slots available in the PSA Crypto core. Previously this value was not explicitly set, so Mbed TLS’s default value of 32 was used. The new Kconfig option defaults to 16 instead in order to find a reasonable compromise between RAM consumption and most common use cases. It can be further trimmed down to reduce RAM consumption if the final application doesn’t need that many key slots simultaneously.
Trusted Firmware-M
LVGL
The config option
CONFIG_LV_Z_FLUSH_THREAD_PRIOis now calledCONFIG_LV_Z_FLUSH_THREAD_PRIORITYand its value is now interpreted as an absolute priority instead of a cooperative one.The config option
CONFIG_LV_Z_VBD_CUSTOM_SECTIONis now calledCONFIG_LV_Z_VDB_CUSTOM_SECTION.
Device Drivers and Devicetree
Device driver APIs are placed into iterable sections (GitHub #71773 and GitHub #82102) to allow for runtime checking. See Driver APIs for more details. The
DEVICE_API()macro should be used by out-of-tree driver implementations for all the upstream driver classes.
ADC
Renamed the
compatiblefromnxp,kinetis-adc12tonxp,adc12.
Clock
Renamed the devicetree property
freqs_mhztofreqs-mhz.Renamed the devicetree property
cg_regtocg-reg.Renamed the devicetree property
pll_ctrl_regtopll-ctrl-reg.
Counter
Renamed the devicetree property
primary_sourcetoprimary-source.Renamed the devicetree property
secondary_sourcetosecondary-source.Renamed the devicetree property
filter_counttofilter-count.Renamed the devicetree property
filter_periodtofilter-period.
Controller Area Network (CAN)
Renamed the
infineon,xmc4xxx-can-nodedevicetree propertyclock_div8toclock-div8(GitHub #83782).
Display
Displays using the MIPI DBI driver which set their MIPI DBI mode via the
mipi-modeproperty in devicetree should now use a string property of the same name, like so:/* Legacy display definition */ st7735r: st7735r@0 { ... mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>; ... }; /* New display definition */ st7735r: st7735r@0 { ... mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE"; ... };
Renamed the devicetree propertys
pclk_polanddata_cmd-gpiostopclk-polanddata-cmd-gpios.
DAC
Renamed the devicetree properties
voltage_referenceandpower_down_modetovoltage-referenceandpower-down-mode.
Enhanced Serial Peripheral Interface (eSPI)
Entropy
BT HCI based entropy driver now directly sends the HCI command to parse random data instead of waiting for BT connection to be ready. This is helpful on platforms where the BT controller owns the HW random generator and the application processor needs to get random data before BT is fully enabled. (GitHub #79931)
Ethernet
Deprecated eth_mcux driver was removed.
Silabs gecko ethernet changes:
Renamed the devicetree property
location-phy_mdctolocation-phy-mdc.Renamed the devicetree property
location-phy_mdiotolocation-phy-mdio.Renamed the devicetree property
location-rmii_refclktolocation-phy-refclk.Renamed the devicetree property
location-rmii_crs_dvtolocation-phy-crs-dv.Renamed the devicetree property
location-rmii_txd0tolocation-phy-txd0.Renamed the devicetree property
location-rmii_txd1tolocation-phy-txd1.Renamed the devicetree property
location-rmii_tx_entolocation-phy-tx-en.Renamed the devicetree property
location-rmii_rxd0tolocation-phy-rxd0.Renamed the devicetree property
location-rmii_rxd1tolocation-phy-rxd1.Renamed the devicetree property
location-rmii_rx_ertolocation-phy-rx-er.Renamed the devicetree property
location-phy_pwr_enabletolocation-phy-pwr-enable.Renamed the devicetree property
location-phy_resettolocation-phy-reset.Renamed the devicetree property
location-phy_interrupttolocation-phy-interrupt.
GNSS
GPIO
Renamed the device tree property
pin_masktopin-mask.Renamed the device tree property
pinmux_masktopinmux-mask.Renamed the device tree property
vbatts_pinstovbatts-pins.Renamed the device tree property
bit_per_gpiotobit-per-gpio.Renamed the device tree property
off_valtooff-val.Renamed the device tree property
on_valtoon-val.Renamed the
compatiblefromti,ads114s0x-gpiototi,ads1x4s0x-gpio.
HWSPINLOCK
Renamed the DeviceTree property
num_lockstonum-locks.
I2C
Renamed the
compatiblefromnxp,imx-lpi2ctonxp,lpi2c.Renamed the device tree property
port_seltoport-sel`.
I2S
Renamed the device tree property from
fifo_depthtofifo-depth.
Input
LED
Renamed the device tree property
max_curr_opttomax-curr-opt.`
PWM
Renamed the
compatiblefromrenesas,ra8-pwmtorenesas,ra-pwm.
Interrupt Controller
LED Strip
Misc
All the functions in the ft8xx driver take an additional
const struct *deviceparameter to allow for multiple instances of the driver.The exception to this is the functions and macros defined in the include/zephyr/drivers/misc/ft8xx/ft8xx_reference_api.h file, which translate the API to a single-instance model, compatible with the API defined in the FT8xx programming guide. These functions have not been modified.
The
ft8xx_register_int()function now takes an additionalvoid *user_dataparameter to allow user-defined data to be passed to the interrupt handler. Additionally, the signature of the ft8xx interrupt handler has changed to include thevoid *user_dataparameter.
MMU/MPU
Renamed the
compatiblefromnxp,kinetis-mputonxp,sysmpuand added its corresponding binding.Renamed the Kconfig option
CPU_HAS_NXP_MPUtoCPU_HAS_NXP_SYSMPU.
Pin Control
Renamed the
compatiblefromnxp,kinetis-pinctrltonxp,port-pinctrl.Renamed the
compatiblefromnxp,kinetis-pinmuxtonxp,port-pinmux.Silabs Series 2 devices now use a new pinctrl driver selected by
silabs,dbus-pinctrl. This driver allows the configuration of GPIO properties through device tree, rather than having them hard-coded for each supported signal. It also supports all possible digital bus signals by including a binding header such as include/zephyr/dt-bindings/pinctrl/silabs/xg24-pinctrl.h.Pinctrl should now be configured like this:
#include <dt-bindings/pinctrl/silabs/xg24-pinctrl.h> &pinctrl { i2c0_default: i2c0_default { group0 { /* Pin selection(s) using bindings included above */ pins = <I2C0_SDA_PD2>, <I2C0_SCL_PD3>; /* Shared properties for the group of pins */ drive-open-drain; bias-pull-up; }; }; };
PWM
Renamed the
compatiblefromnxp,kinetis-ftm-pwmtonxp,ftm-pwm.
SDHC
Renamed the device tree property from
power_delay_mstopower-delay-ms`Renamed the device tree property from
max_current_330tomax-current-330
Sensors
The
we,wsen-padsdriver has been renamed towe,wsen-pads-2511020213301. The Device Tree can be configured as follows:&i2c0 { pads:pads-2511020213301@5d { compatible = "we,wsen-pads-2511020213301"; reg = <0x5d>; odr = < 10 >; interrupt-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; }; };The
we,wsen-pdusdriver has been renamed towe,wsen-pdus-25131308XXXXX. The Device Tree can be configured as follows:&i2c0 { pdus:pdus-25131308XXXXX@78 { compatible = "we,wsen-pdus-25131308XXXXX"; reg = < 0x78 >; sensor-type = < 4 >; }; };The
we,wsen-tidsdriver has been renamed towe,wsen-tids-2521020222501. The Device Tree can be configured as follows:&i2c0 { tids:tids-2521020222501@3F { compatible = "we,wsen-tids-2521020222501"; reg = < 0x3F >; odr = < 25 >; interrupt-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; }; };The
invensense,icp10125driver has been renamed toinvensense,icp101xx. The Device Tree can be configured as follows:&i2c0 { icp101xx:icp101xx@63 { compatible = "invensense,icp101xx"; reg = <0x63>; }; };
Serial
Renamed the
compatiblefromnxp,kinetis-lpuarttonxp,lpuart.Silabs Usart driver has been split for Series 2
silabs,usart-uartand Series 0/1silabs,gecko-usart
Stepper
Renamed the
compatiblefromzephyr,gpio-stepperstozephyr,gpio-stepper.Renamed the
stepper_set_actual_positionfunction tostepper_set_reference_position().Renamed the
stepper_enable_constant_velocity_modefunction tostepper_run(). The function does not take a velocity parameter anymore. Set the desired speed using thestepper_set_microstep_interval()function beforehand.Renamed the
stepper_movefunction tostepper_move_by().Renamed the
stepper_set_target_positionfunction tostepper_move_to().Renamed the
stepper_set_max_velocityfunction tostepper_set_microstep_interval(). The function now takes the step interval in nanoseconds. This allows for a more precise control.Deprecating setting max velocity via
stepper_run().The
STEPPER_ADI_TMC_RAMP_GENis now deprecated and is replaced with the newSTEPPER_ADI_TMC50XX_RAMP_GENoption.Renamed tmc5041 stepper driver to tmc50xx.
To control the velocity for
adi,tmc50xxstepper driver, usetmc50xx_stepper_set_max_velocity()ortmc50xx_stepper_set_ramp().Renamed the DeviceTree property
en_spreadcycletoen-spreadcycle.Renamed the DeviceTree property
i_scale_analogtoi-scale-analog.Renamed the DeviceTree property
index_optwtoindex-otpw.Renamed the DeviceTree property
ìndex_steptoindex-step.Renamed the DeviceTree property
internal_rsensetointernal-rsense.Renamed the DeviceTree property
lock_gconftolock-gconf.Renamed the DeviceTree property
mstep_reg_selecttomstep-reg-select.Renamed the DeviceTree property
pdn_disabletopdn-disable.Renamed the DeviceTree property
poscmp_enabletoposcmp-enable.Renamed the DeviceTree property
test_modetotest-mode.
SPI
Renamed the
compatiblefromnxp,imx-lpspitonxp,lpspi.Renamed the
compatiblefromnxp,kinetis-dspitonxp,dspi.Renamed the
compatiblefromsilabs,gecko-spi-usarttosilabs,usart-spi.Renamed the
compatiblefromsilabs,gecko-spi-eusarttosilabs,eusart-spi.
Regulator
RTC
Renamed the
compatiblefromnxp,kinetis-rtctonxp,rtc.
Timer
Renamed the
compatiblefromnxp,kinetis-ftmtonxp,ftmand relocate it underdts/bindings/timer.Renamed the device tree property from
ticks_ustoticks-us.
USB
Renamed the devicetree property names
phy_handletophy-handle.
Video
The
include/zephyr/drivers/video-controls.hgot updated to have video controls IDs (CIDs) matching the definitions in the Linux kernel fileinclude/uapi/linux/v4l2-controls.h. In most cases, removing the category prefix is enough:VIDEO_CID_CAMERA_GAINbecomesVIDEO_CID_GAIN. The newvideo-controls.hsource now contains description of each control ID to help disambiguating.The
video_pix_fmt_bpp()function was returning a byte count, this got replaced byvideo_bits_per_pixel()which return a bit count. For instance, invocations such aspitch = width * video_pix_fmt_bpp(pixfmt)needs to be replaced by an equivalentpitch = width * video_bits_per_pixel(pixfmt) / BITS_PER_BYTE.The
video_buffer_alloc()andvideo_buffer_aligned_alloc()functions in the video API now take an additional timeout parameter.The
video_stream_start()andvideo_stream_stop()driver APIs are now merged into the newvideo_set_stream()driver API. The user APIs are however unchanged to keep backward compatibility with downstream applications.
Watchdog
Renamed the
compatiblefromnxp,kinetis-wdog32tonxp,wdog32.
Wi-Fi
The config options
CONFIG_NXP_WIFI_BUILD_ONLY_MODEandCONFIG_NRF_WIFI_BUILD_ONLY_MODEare now unified underCONFIG_BUILD_ONLY_NO_BLOBSmaking it a common entry point for any vendor to enable builds without blobs.
Bluetooth
Bluetooth HCI
The
BT_CTLRhas been deprecated. A newHAS_BT_CTLRhas been introduced which should be selected by the respective link layer Kconfig options (e.g. a HCI driver option, or the one for the upstream controller). It’s recommended that all HCI drivers for local link layers select the new option, since that opens up the possibility of indicating build-time support for specific features, which e.g. the host stack can take advantage of.
Bluetooth Mesh
Following the beginnig of the deprecation process for the TinyCrypt crypto library, Kconfig symbol
CONFIG_BT_MESH_USES_TINYCRYPTwas set as deprecated. Default option for platforms that do not support TF-M isCONFIG_BT_MESH_USES_MBEDTLS_PSA.Mesh key representations are not backward compatible if images are built with TinyCrypt and crypto libraries based on the PSA API. Mesh no longer stores the key values for those crypto libraries. The crypto library stores the keys in the internal trusted storage. If a provisioned device is going to update its image that was built with the
CONFIG_BT_MESH_USES_TINYCRYPTKconfig option set on an image that was built withCONFIG_BT_MESH_USES_MBEDTLS_PSAorCONFIG_BT_MESH_USES_TFM_PSAwithout erasing the persistent area, it should be unprovisioned first and reprovisioned after update again. If the image is changed over Mesh DFU, useBT_MESH_DFU_EFFECT_UNPROV.Mesh explicitly depends on the Secure Storage subsystem if storing into non-volatile memory (
CONFIG_BT_SETTINGS) is enabled and Mbed TLS library (CONFIG_BT_MESH_USES_MBEDTLS_PSA) is used. Applications should be built withCONFIG_SECURE_STORAGEenabled.
Bluetooth Audio
The following Kconfig options are not longer automatically enabled by the LE Audio Kconfig options and may need to be enabled manually (GitHub #81328):
PACS have been changed to support dynamic, runtime configuration. This means that PACS now has to be registered with
bt_pacs_register()before it can be used. In addition,bt_pacs_register()also have to be called beforebt_ascs_register()can be be called. All Kconfig options still remain. Runtime configuration cannot override a disabled Kconfig option. (GitHub #83730)Several services and service client (AICS, ASCS, CSIP, HAS, MCS, PACS, TBS, VCP and VOCS) now depend on
CONFIG_BT_SMPand may need to be explicitly enabled. (GitHub #84994`)
Bluetooth Classic
Bluetooth Host
CONFIG_BT_BUF_ACL_RX_COUNThas been deprecated. The number of ACL RX buffers is now computed internally and is equal toCONFIG_BT_MAX_CONN+ 1. If an application needs more buffers, it can use the newCONFIG_BT_BUF_ACL_RX_COUNT_EXTRAto add additional ones.e.g. if
CONFIG_BT_MAX_CONNwas3andCONFIG_BT_BUF_ACL_RX_COUNTwas7thenCONFIG_BT_BUF_ACL_RX_COUNT_EXTRAshould be set to7 - (3 + 1) = 3.Warning
The default value of
CONFIG_BT_BUF_ACL_RX_COUNThas been set to 0.LE legacy pairing is no longer enabled by default since it’s not secure. Leaving it enabled makes a device vulnerable for downgrade attacks. If an application still needs to use LE legacy pairing, it should disable
CONFIG_BT_SMP_SC_PAIR_ONLYmanually.The prompt for
CONFIG_BT_ECChas been removed, since it only offers an internal API, meaning internal users should explicitly select it in their respective Kconfig options.
Bluetooth Crypto
Bluetooth Services
The
CONFIG_BT_DIS_MODELandCONFIG_BT_DIS_MANUFhave been deprecated. Application developers should now use theCONFIG_BT_DIS_MODEL_NUMBER_STRandCONFIG_BT_DIS_MANUF_NAME_STRKconfig options to set the string values in the Model Number String and Manufacturer Name String characteristics that are part of the Device Information Service (DIS).
Networking
The Prometheus metric creation has changed as user does not need to have a separate struct
prometheus_metricany more. This means that the Prometheus macrosPROMETHEUS_COUNTER_DEFINE,PROMETHEUS_GAUGE_DEFINE,PROMETHEUS_HISTOGRAM_DEFINEandPROMETHEUS_SUMMARY_DEFINEprototypes have changed. (GitHub #81712)The default subnet mask on newly added IPv4 addresses is now specified with
CONFIG_NET_IPV4_DEFAULT_NETMASKoption instead of being left empty. Applications can still specify a custom netmask for an address withnet_if_ipv4_set_netmask_by_addr()function if needed.The HTTP server public API function signature for the
http_resource_dynamic_cb_thas changed, the data is now passed in ahttp_request_ctxwhich holds the data, data length and request header information. Request headers should be accessed via this parameter rather than directly in thehttp_client_ctxto correctly handle concurrent requests on different HTTP/2 streams.The HTTP server public API function signature for the
http_resource_websocket_cb_thas changed, ahttp_request_ctxparameter has been added. The application may use this to access the request headers of the HTTP upgrade request, which may be useful in deciding whether to accept or reject a websocket connection.An additional
_res_fallbackparameter has been added to theHTTP_SERVICE_DEFINEandHTTPS_SERVICE_DEFINEmacros, allowing a fallback resource to be served if no other resources match the requested path. To retain the existing behaviour,NULLcan be passed as the additional parameter.The
CONFIG_NET_L2_OPENTHREADsymbol no longer implies theCONFIG_NVSKconfig option. Platforms using OpenThread must explicitly enable either theCONFIG_NVSorCONFIG_ZMSKconfig option.CONFIG_NET_TC_SKIP_FOR_HIGH_PRIOwas deprecated in favour ofCONFIG_NET_TC_TX_SKIP_FOR_HIGH_PRIOto avoid naming ambiguity.
Other Subsystems
Flash map
Filesystem
The EXT2 Kconfig symbol
CONFIG_MAX_FILEShas been renamed toCONFIG_EXT2_MAX_FILES.
hawkBit
The Kconfig symbols
CONFIG_SMFandCONFIG_SMF_ANCESTOR_SUPPORTare now required to be enabled to use the hawkBit subsystem.
MCUmgr
The Kconfig
CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCHhas been deprecated and replaced withCONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_USING_MOVE, applications should be updated to select this new symbol if they were selecting the old symbol.The deprecated macro
MGMT_CB_ERROR_REThas been removed.
Modem
LoRa
The function
lora_recv_async()and callbacklora_recv_cbnow include an additionaluser_dataparameter, which is a void pointer. This parameter can be used to reference any user-defined data structure. To maintain the current behavior, set this parameter toNULL.
Secure Storage
Store backends no longer automatically enable their dependencies through
selectorimply. Users must ensure that the depencies are enabled in their applications.CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGSpreviously enabled NVS and settings, which means the NVS settings backend would get used by default if ZMS wasn’t enabled. (GitHub #86181)
Stream Flash
The function
stream_flash_init()no longer does auto-detection of device size whensizeparameter is set to 0 and will return error in such case. User is now required to explicitly provide device size. Issue GitHub #71042 provides rationale for the change.
Architectures
native/POSIX
CONFIG_NATIVE_APPLICATIONhas been deprecated. Out-of-tree boards using this option should migrate to the native_simulator runner (GitHub #81232). For an example of how this was done with a board in-tree check GitHub #61481.For the native_sim target
CONFIG_NATIVE_SIM_NATIVE_POSIX_COMPAThas been switched tonby default, and this option has been deprecated. Ensure your code does not use theCONFIG_BOARD_NATIVE_POSIXoption anymore (GitHub #81232).
x86
Kconfigs
CONFIG_DISABLE_SSBDandCONFIG_ENABLE_EXTENDED_IBRShave been deprecated since v3.7. These were removed. UseCONFIG_X86_DISABLE_SSBDandCONFIG_X86_ENABLE_EXTENDED_IBRSinstead.