Migration guide to Zephyr v4.1.0 (Working Draft)
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_SCRATCH
has 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
Security
New options for stack canaries have been added, providing users with finer control over stack protection. With this change,
CONFIG_STACK_CANARIES
no 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_click
now supports both I2C and SPI interfaces. Users should select the required configuration by usingmikroe_weather_click_i2c
ormikroe_weather_click_spi
instead 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 flash
on the nRF52 and nRF53 series now always correctly honors the--erase
flag (and its absence) both when using thenrfjprog
andnrfutil
backends. Prior to this release, thenrjfprog
backend would always erase only the sectors of the external flash used by the new firmware, and thenrfutil
one would always erase the whole external flash.
Devicetree
The
microchip,cap1203
driver has changed its compatible tomicrochip,cap12xx
and 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_POLL
has been removed: If the devicetree propertyint-gpios
is present, interrupt mode is used otherwise, polling is used. TheCONFIG_INPUT_CAP1203_PERIOD
has been replaced with the devicetree propertypoll-interval-ms
. In interrupt mode, the devicetree propertyrepeat
is supported.
Raspberry Pi
CONFIG_SOC_SERIES_RP2XXX
is 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.
Modules
Mbed TLS
If a platform has a CSPRNG source available (i.e.
CONFIG_CSPRNG_ENABLED
is set), then the Kconfig optionCONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
is 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_COUNT
allows 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_PRIO
is now calledCONFIG_LV_Z_FLUSH_THREAD_PRIORITY
and its value is now interpreted as an absolute priority instead of a cooperative one.The config option
CONFIG_LV_Z_VBD_CUSTOM_SECTION
is 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.The
video_buffer_alloc()
andvideo_buffer_aligned_alloc()
functions in the video API now take an additional timeout parameter.
ADC
Renamed the
compatible
fromnxp,kinetis-adc12
tonxp,adc12
.
Counter
Renamed the devicetree property
primary_source
toprimary-source
.Renamed the devicetree property
secondary_source
tosecondary-source
.Renamed the devicetree property
filter_count
tofilter-count
.Renamed the devicetree property
filter_period
tofilter-period
.
Controller Area Network (CAN)
Display
Displays using the MIPI DBI driver which set their MIPI DBI mode via the
mipi-mode
property 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_pol
anddata_cmd-gpios
topclk-pol
anddata-cmd-gpios
.
DAC
Renamed the devicetree properties
voltage_reference
andpower_down_mode
tovoltage-reference
andpower-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
Silabs gecko ethernet changes:
Renamed the devicetree property
location-phy_mdc
tolocation-phy-mdc
.Renamed the devicetree property
location-phy_mdio
tolocation-phy-mdio
.Renamed the devicetree property
location-rmii_refclk
tolocation-phy-refclk
.Renamed the devicetree property
location-rmii_crs_dv
tolocation-phy-crs-dv
.Renamed the devicetree property
location-rmii_txd0
tolocation-phy-txd0
.Renamed the devicetree property
location-rmii_txd1
tolocation-phy-txd1
.Renamed the devicetree property
location-rmii_tx_en
tolocation-phy-tx-en
.Renamed the devicetree property
location-rmii_rxd0
tolocation-phy-rxd0
.Renamed the devicetree property
location-rmii_rxd1
tolocation-phy-rxd1
.Renamed the devicetree property
location-rmii_rx_er
tolocation-phy-rx-er
.Renamed the devicetree property
location-phy_pwr_enable
tolocation-phy-pwr-enable
.Renamed the devicetree property
location-phy_reset
tolocation-phy-reset
.Renamed the devicetree property
location-phy_interrupt
tolocation-phy-interrupt
.
GNSS
GPIO
Renamed the device tree property
pin_mask
topin-mask
.Renamed the device tree property
pinmux_mask
topinmux-mask
.Renamed the device tree property
vbatts_pins
tovbatts-pins
.Renamed the device tree property
bit_per_gpio
tobit-per-gpio
.Renamed the device tree property
off_val
tooff-val
.Renamed the device tree property
on_val
toon-val
.Renamed the
compatible
fromti,ads114s0x-gpio
toti,ads1x4s0x-gpio
.
HWSPINLOCK
Renamed the DeviceTree property
num_locks
tonum-locks
.
I2C
Renamed the
compatible
fromnxp,imx-lpi2c
tonxp,lpi2c
.Renamed the device tree property
port_sel
toport-sel`
.
I2S
Renamed the device tree property from
fifo_depth
tofifo-depth
.
Input
LED
Renamed the device tree property
max_curr_opt
tomax-curr-opt
.`
PWM
Renamed the
compatible
fromrenesas,ra8-pwm
torenesas,ra-pwm
.
Interrupt Controller
LED Strip
Misc
All the functions in the ft8xx driver take an additional
const struct *device
parameter 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_data
parameter 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_data
parameter.
MMU/MPU
Renamed the
compatible
fromnxp,kinetis-mpu
tonxp,sysmpu
and added its corresponding binding.Renamed the Kconfig option
CPU_HAS_NXP_MPU
toCPU_HAS_NXP_SYSMPU
.
Pin Control
Renamed the
compatible
fromnxp,kinetis-pinctrl
tonxp,port-pinctrl
.Renamed the
compatible
fromnxp,kinetis-pinmux
tonxp,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
compatible
fromnxp,kinetis-ftm-pwm
tonxp,ftm-pwm
.
SDHC
Renamed the device tree property from
power_delay_ms
topower-delay-ms`
Renamed the device tree property from
max_current_330
tomax-current-330
Sensors
The
we,wsen-pads
driver 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-pdus
driver 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-tids
driver 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,icp10125
driver 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
compatible
fromnxp,kinetis-lpuart
tonxp,lpuart
.Silabs Usart driver has been split for Series 2
silabs,usart-uart
and Series 0/1silabs,gecko-usart
Stepper
Renamed the
compatible
fromzephyr,gpio-steppers
tozephyr,gpio-stepper
.Renamed the
stepper_set_actual_position
function tostepper_set_reference_position()
.Renamed the
stepper_enable_constant_velocity_mode
function 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_move
function tostepper_move_by()
.Renamed the
stepper_set_target_position
function tostepper_move_to()
.Renamed the
stepper_set_max_velocity
function 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_GEN
is now deprecated and is replaced with the newSTEPPER_ADI_TMC50XX_RAMP_GEN
option.Renamed tmc5041 stepper driver to tmc50xx.
To control the velocity for
adi,tmc50xx
stepper driver, usetmc50xx_stepper_set_max_velocity()
ortmc50xx_stepper_set_ramp()
.Renamed the DeviceTree property
en_spreadcycle
toen-spreadcycle
.Renamed the DeviceTree property
i_scale_analog
toi-scale-analog
.Renamed the DeviceTree property
index_optw
toindex-otpw
.Renamed the DeviceTree property
ìndex_step
toindex-step
.Renamed the DeviceTree property
internal_rsense
tointernal-rsense
.Renamed the DeviceTree property
lock_gconf
tolock-gconf
.Renamed the DeviceTree property
mstep_reg_select
tomstep-reg-select
.Renamed the DeviceTree property
pdn_disable
topdn-disable
.Renamed the DeviceTree property
poscmp_enable
toposcmp-enable
.Renamed the DeviceTree property
test_mode
totest-mode
.
SPI
Renamed the
compatible
fromnxp,imx-lpspi
tonxp,lpspi
.Renamed the
compatible
fromnxp,kinetis-dspi
tonxp,dspi
.Renamed the
compatible
fromsilabs,gecko-spi-usart
tosilabs,usart-spi
.Renamed the
compatible
fromsilabs,gecko-spi-eusart
tosilabs,eusart-spi
.
Regulator
RTC
Renamed the
compatible
fromnxp,kinetis-rtc
tonxp,rtc
.
Timer
Renamed the
compatible
fromnxp,kinetis-ftm
tonxp,ftm
and relocate it underdts/bindings/timer
.Renamed the device tree property from
ticks_us
toticks-us
.
USB
Renamed the devicetree property names
phy_handle
tophy-handle
.
Video
The
include/zephyr/drivers/video-controls.h
got 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_GAIN
becomesVIDEO_CID_GAIN
. The newvideo-controls.h
source 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
.
Watchdog
Wi-Fi
Renamed the
compatible
fromnxp,kinetis-wdog32
tonxp,wdog32
.The config options
CONFIG_NXP_WIFI_BUILD_ONLY_MODE
andCONFIG_NRF_WIFI_BUILD_ONLY_MODE
are now unified underCONFIG_BUILD_ONLY_NO_BLOBS
making it a common entry point for any vendor to enable builds without blobs.
Bluetooth
Bluetooth HCI
The
BT_CTLR
has been deprecated. A newHAS_BT_CTLR
has 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_TINYCRYPT
was 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_TINYCRYPT
Kconfig option set on an image that was built withCONFIG_BT_MESH_USES_MBEDTLS_PSA
orCONFIG_BT_MESH_USES_TFM_PSA
without 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_STORAGE
enabled.
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_SMP
and may need to be explicitly enabled. (GitHub #84994`)
Bluetooth Classic
Bluetooth Host
CONFIG_BT_BUF_ACL_RX_COUNT
has 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_EXTRA
to add additional ones.e.g. if
CONFIG_BT_MAX_CONN
was3
andCONFIG_BT_BUF_ACL_RX_COUNT
was7
thenCONFIG_BT_BUF_ACL_RX_COUNT_EXTRA
should be set to7 - (3 + 1) = 3
.Warning
The default value of
CONFIG_BT_BUF_ACL_RX_COUNT
has 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_ONLY
manually.The prompt for
CONFIG_BT_ECC
has been removed, since it only offers an internal API, meaning internal users should explicitly select it in their respective Kconfig options.
Bluetooth Crypto
Networking
The Prometheus metric creation has changed as user does not need to have a separate struct
prometheus_metric
any more. This means that the Prometheus macrosPROMETHEUS_COUNTER_DEFINE
,PROMETHEUS_GAUGE_DEFINE
,PROMETHEUS_HISTOGRAM_DEFINE
andPROMETHEUS_SUMMARY_DEFINE
prototypes have changed. (GitHub #81712)The default subnet mask on newly added IPv4 addresses is now specified with
CONFIG_NET_IPV4_DEFAULT_NETMASK
option 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_t
has changed, the data is now passed in ahttp_request_ctx
which holds the data, data length and request header information. Request headers should be accessed via this parameter rather than directly in thehttp_client_ctx
to correctly handle concurrent requests on different HTTP/2 streams.The HTTP server public API function signature for the
http_resource_websocket_cb_t
has changed, ahttp_request_ctx
parameter 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_fallback
parameter has been added to theHTTP_SERVICE_DEFINE
andHTTPS_SERVICE_DEFINE
macros, allowing a fallback resource to be served if no other resources match the requested path. To retain the existing behaviour,NULL
can be passed as the additional parameter.The
CONFIG_NET_L2_OPENTHREAD
symbol no longer implies theCONFIG_NVS
Kconfig option. Platforms using OpenThread must explicitly enable either theCONFIG_NVS
orCONFIG_ZMS
Kconfig option.CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO
was deprecated in favour ofCONFIG_NET_TC_TX_SKIP_FOR_HIGH_PRIO
to avoid naming ambiguity.
Other Subsystems
Flash map
Filesystem
The EXT2 Kconfig symbol
CONFIG_MAX_FILES
has been renamed toCONFIG_EXT2_MAX_FILES
.
hawkBit
The Kconfig symbols
CONFIG_SMF
andCONFIG_SMF_ANCESTOR_SUPPORT
are now required to be enabled to use the hawkBit subsystem.
MCUmgr
The Kconfig
CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH
has 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.
Modem
LoRa
The function
lora_recv_async()
and callbacklora_recv_cb
now include an additionaluser_data
parameter, 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
.
Stream Flash
The function
stream_flash_init()
no longer does auto-detection of device size whensize
parameter 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_APPLICATION
has 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_COMPAT
has been switched ton
by default, and this option has been deprecated. Ensure your code does not use theCONFIG_BOARD_NATIVE_POSIX
option anymore (GitHub #81232).
x86
Kconfigs
CONFIG_DISABLE_SSBD
andCONFIG_ENABLE_EXTENDED_IBRS
have been deprecated since v3.7. These were removed. UseCONFIG_X86_DISABLE_SSBD
andCONFIG_X86_ENABLE_EXTENDED_IBRS
instead.