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
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
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.
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.
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
.
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"; ... };
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)
GNSS
I2C
Renamed the
compatible
fromnxp,imx-lpi2c
tonxp,lpi2c
.
Input
PWM
Renamed the
compatible
fromrenesas,ra8-pwm
torenesas,ra-pwm
.
Interrupt Controller
LED Strip
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
.
Sensors
Serial
Renamed the
compatible
fromnxp,kinetis-lpuart
tonxp,lpuart
.
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()
.Renamed the
stepper_move
function tostepper_move_by()
.Renamed the
stepper_set_target_position
function tostepper_move_to()
.The
STEPPER_ADI_TMC_RAMP_GEN
is now deprecated and is replaced with the newSTEPPER_ADI_TMC5041_RAMP_GEN
option.
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
.
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.
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
.
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):
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.
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
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.
Other Subsystems
Flash map
hawkBit
MCUmgr
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
.
Architectures
Common
_current
is deprecated, usedarch_current_thread()
instead.
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.