diff --git a/.github/test-spec.yml b/.github/test-spec.yml index d638bef6667b..2c171e3841de 100644 --- a/.github/test-spec.yml +++ b/.github/test-spec.yml @@ -69,7 +69,6 @@ - "include/modem/lte_lc*.h" - "include/modem/modem_key_mgmt.h" - "include/modem/nrf_modem_lib.h" - - "include/modem/pdn.h" - "include/modem/sms.h" - "include/net/downloader.h" - "include/secure_services.h" @@ -78,7 +77,6 @@ - "lib/lte_link_control/**/*" - "lib/modem_key_mgmt/**/*" - "lib/nrf_modem_lib/**/*" - - "lib/pdn/**/*" - "lib/sms/**/*" - "samples/cellular/at_client/**/*" - "samples/cellular/at_monitor/**/*" @@ -108,8 +106,6 @@ - "subsys/net/lib/downloader/**/*" - "lib/sms/**/*" - "include/modem/sms.h" - - "lib/pdn/**/*" - - "include/modem/pdn.h" - "include/modem/modem_key_mgmt.h" - "subsys/dfu/dfu_target/**/*" @@ -428,7 +424,6 @@ - "include/modem/modem_jwt.h" - "include/modem/modem_key_mgmt.h" - "include/modem/nrf_modem_lib.h" - - "include/modem/pdn.h" - "include/modem/sms.h" - "include/net/downloader.h" - "include/net/fota_download.h" @@ -449,7 +444,6 @@ - "lib/modem_jwt/**/*" - "lib/modem_key_mgmt/**/*" - "lib/nrf_modem_lib/**/*" - - "lib/pdn/**/*" - "lib/sms/**/*" - "lib/supl/**/*" - "samples/cellular/modem_shell/**/*" diff --git a/.github/workflows/oss-history.yml b/.github/workflows/oss-history.yml index bfa40ab60192..e602d8074534 100644 --- a/.github/workflows/oss-history.yml +++ b/.github/workflows/oss-history.yml @@ -41,4 +41,4 @@ jobs: uses: nrfconnect/action-oss-history@main with: workspace: 'ncs' - args: -p zephyr -p hostap -p wfa-qt-control-app + args: -p zephyr -p wfa-qt-control-app diff --git a/CODEOWNERS b/CODEOWNERS index 85a9798c0e55..ab08880cb6f6 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -51,6 +51,7 @@ # Boards /boards/nordic/nrf54l*/ @nrfconnect/ncs-co-boards @kl-cruz /boards/nordic/nrf52* @nrfconnect/ncs-co-boards @nrfconnect/ncs-si-xcake +/boards/nordic/nrf92*/ @nrfconnect/ncs-co-boards @tervonenja /boards/nordic/thingy91*/ @nrfconnect/ncs-co-boards @nrfconnect/ncs-cia /boards/sercomm/ @nrfconnect/ncs-co-boards @tokangas @@ -148,7 +149,6 @@ /doc/nrf/libraries/modem/modem_jwt.rst @nrfconnect/ncs-iot-oulu-tampere-doc /doc/nrf/libraries/modem/modem_key_mgmt.rst @nrfconnect/ncs-modem-doc /doc/nrf/libraries/modem/ntn.rst @nrfconnect/ncs-iot-oulu-tampere-doc -/doc/nrf/libraries/modem/pdn.rst @nrfconnect/ncs-modem-doc /doc/nrf/libraries/modem/sms.rst @nrfconnect/ncs-iot-positioning-doc /doc/nrf/libraries/modem/uicc_lwm2m.rst @nrfconnect/ncs-modem-doc /doc/nrf/libraries/modem/zzhc.rst @nrfconnect/ncs-doc-leads @@ -253,7 +253,6 @@ /doc/nrf/samples/keys.rst @nrfconnect/ncs-aegir-doc /doc/nrf/samples/matter.rst @nrfconnect/ncs-matter-doc /doc/nrf/samples/matter/*.rst @nrfconnect/ncs-matter-doc -/doc/nrf/samples/mcuboot.rst @nrfconnect/ncs-eris-doc /doc/nrf/samples/mesh.rst @nrfconnect/ncs-paladin-doc /doc/nrf/samples/net.rst @nrfconnect/ncs-doc-leads /doc/nrf/samples/nfc.rst @nrfconnect/ncs-radio-sw @@ -283,6 +282,7 @@ # Drivers /drivers/bluetooth/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-dragoon +/drivers/clock_control/clock_control_nrf92* @nrfconnect/ncs-co-drivers @tervonenja /drivers/dect/ @nrfconnect/ncs-dect-nr-plus /drivers/entropy/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-aegir /drivers/flash/ @nrfconnect/ncs-co-drivers @@ -293,6 +293,7 @@ /drivers/mspi/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-ll-ursus /drivers/net/ @nrfconnect/ncs-co-drivers @doki-nordic /drivers/regulator/ @nrfconnect/ncs-co-drivers +/drivers/sdhc/ @nrfconnect/ncs-co-drivers /drivers/serial/ @nrfconnect/ncs-co-drivers @nordic-krch /drivers/sensor/bh1749/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-cia /drivers/sensor/bme68x_iaq/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-cia @@ -301,6 +302,7 @@ /drivers/sensor/sensor_sim/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-cia /drivers/sensor/sensor_stub/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-cia /drivers/wifi/nrf71/ @krish2718 @sachinthegreen +/include/drivers/wifi/nrf71/ @kapbh @krish2718 @sachinthegreen # Devicetree /dts/ @nrfconnect/ncs-co-drivers @@ -321,22 +323,16 @@ /include/bluetooth/gatt_pool.h @nrfconnect/ncs-si-muffin /include/bluetooth/mesh/ @nrfconnect/ncs-paladin /include/bluetooth/scan.h @nrfconnect/ncs-blenders @nrfconnect/ncs-si-muffin -/include/bluetooth/services/ams_client.h @nrfconnect/ncs-blenders -/include/bluetooth/services/ancs_client.h @nrfconnect/ncs-blenders -/include/bluetooth/services/bas_client.h @nrfconnect/ncs-blenders -/include/bluetooth/services/bms.h @nrfconnect/ncs-blenders -/include/bluetooth/services/cgms.h @nrfconnect/ncs-blenders -/include/bluetooth/services/ddfs.h @nrfconnect/ncs-blenders -/include/bluetooth/fast_pair/ @nrfconnect/ncs-si-bluebagel +/include/bluetooth/services/ @nrfconnect/ncs-blenders +/include/bluetooth/services/dfu_smp.h @nrfconnect/ncs-eris /include/bluetooth/services/fast_pair/ @nrfconnect/ncs-si-bluebagel /include/bluetooth/services/hids.h @nrfconnect/ncs-si-xcake -/include/bluetooth/services/hrs_client.h @nrfconnect/ncs-blenders -/include/bluetooth/services/lbs.h @nrfconnect/ncs-blenders -/include/bluetooth/services/mds.h @nrfconnect/ncs-blenders -/include/bluetooth/services/nus_client.h @nrfconnect/ncs-blenders -/include/bluetooth/services/nus.h @nrfconnect/ncs-blenders -/include/bluetooth/services/rscs.h @nrfconnect/ncs-blenders -/include/bluetooth/services/throughput.h @nrfconnect/ncs-blenders +/include/bluetooth/services/hogp.h @nrfconnect/ncs-si-xcake +/include/bluetooth/services/latency.h @nrfconnect/ncs-dragoon +/include/bluetooth/services/latency_client.h @nrfconnect/ncs-dragoon +/include/bluetooth/services/ras.h @nrfconnect/ncs-dragoon +/include/bluetooth/services/wifi_provisioning.h @wentong-li @bama-nordic +/include/bluetooth/fast_pair/ @nrfconnect/ncs-si-bluebagel /include/nrf_lcs/ @nrfconnect/ncs-eris /include/caf/ @nrfconnect/ncs-si-bluebagel @nrfconnect/ncs-si-muffin @nrfconnect/ncs-si-xcake /include/debug/ @nrfconnect/ncs-co-drivers @@ -348,6 +344,9 @@ /include/drivers/mspi/hpf_mspi.h @nrfconnect/ncs-co-drivers @nrfconnect/ncs-ll-ursus /include/drivers/sensor_sim.h @nrfconnect/ncs-co-drivers @nrfconnect/ncs-cia /include/drivers/sensor_stub.h @nrfconnect/ncs-co-drivers @nrfconnect/ncs-cia +/include/dt-bindings/misc/nordic-domain-id-nrf9220.h @tervonenja +/include/dt-bindings/misc/nordic-nrf-ficr-nrf9220.h @tervonenja +/include/dt-bindings/misc/nordic-owner-id-nrf9220.h @tervonenja /include/emds/ @nrfconnect/ncs-paladin /include/fem_al/ @nrfconnect/ncs-dragoon /include/hpf/ @nrfconnect/ncs-ll-ursus @@ -410,7 +409,6 @@ /lib/ntn/ @nrfconnect/ncs-modem-tre /lib/pcm_mix/ @nrfconnect/ncs-audio /lib/pcm_stream_channel_modifier/ @nrfconnect/ncs-audio -/lib/pdn/ @nrfconnect/ncs-co-networking @nrfconnect/ncs-modem @nrfconnect/ncs-modem-tre /lib/qos/ @nrfconnect/ncs-cia /lib/ram_pwrdn/ @MarekPorwisz /lib/sample_rate_converter/ @nrfconnect/ncs-audio @@ -449,8 +447,7 @@ /samples/bluetooth/central_nfc_pairing/ @nrfconnect/ncs-blenders /samples/bluetooth/central_smp_client/ @nrfconnect/ncs-eris /samples/bluetooth/central_uart/ @nrfconnect/ncs-blenders -/samples/bluetooth/channel_sounding/ras_initiator/ @nrfconnect/ncs-dragoon -/samples/bluetooth/channel_sounding/ras_reflector/ @nrfconnect/ncs-dragoon +/samples/bluetooth/channel_sounding/ @nrfconnect/ncs-dragoon /samples/bluetooth/conn_time_sync/ @nrfconnect/ncs-dragoon /samples/bluetooth/direction_finding_central/ @nrfconnect/ncs-dragoon /samples/bluetooth/direction_finding_connectionless_rx/ @nrfconnect/ncs-dragoon @@ -495,6 +492,7 @@ /samples/bluetooth/subrating/ @nrfconnect/ncs-dragoon /samples/bluetooth/throughput/ @nrfconnect/ncs-blenders /samples/bootloader/ @nrfconnect/ncs-eris +/samples/bootloader_deprecated_pm/ @nrfconnect/ncs-eris /samples/caf/ @nrfconnect/ncs-si-bluebagel @nrfconnect/ncs-si-muffin @nrfconnect/ncs-si-xcake /samples/caf_sensor_manager/ @nrfconnect/ncs-si-bluebagel @nrfconnect/ncs-si-muffin /samples/cellular/ @nrfconnect/ncs-co-networking @nrfconnect/ncs-modem @@ -532,6 +530,7 @@ /samples/net/ @nrfconnect/ncs-cia @nrfconnect/ncs-bifrost /samples/nfc/ @nrfconnect/ncs-radio-sw /samples/nrf5340/netboot/ @nrfconnect/ncs-eris +/samples/nrf5340/netboot_deprecated_pm/ @nrfconnect/ncs-eris /samples/nrf5340/extxip_smp_svr/ @nrfconnect/ncs-eris /samples/nrf_rpc/ @nrfconnect/ncs-blenders /samples/sensor/bh1749/ @nrfconnect/ncs-cia @@ -588,6 +587,8 @@ /samples/bluetooth/central_uart/*.rst @nrfconnect/ncs-blenders-doc /samples/bluetooth/channel_sounding/ras_initiator/*.rst @nrfconnect/ncs-dragoon-doc /samples/bluetooth/channel_sounding/ras_reflector/*.rst @nrfconnect/ncs-dragoon-doc +/samples/bluetooth/channel_sounding/ipt_initiator/*.rst @nrfconnect/ncs-dragoon-doc +/samples/bluetooth/channel_sounding/ipt_reflector/*.rst @nrfconnect/ncs-dragoon-doc /samples/bluetooth/conn_time_sync/*.rst @nrfconnect/ncs-dragoon-doc /samples/bluetooth/direction_finding_central/*.rst @nrfconnect/ncs-dragoon-doc /samples/bluetooth/direction_finding_connectionless_rx/*.rst @nrfconnect/ncs-dragoon-doc @@ -658,6 +659,7 @@ /samples/dfu/mcuboot_with_encryption/*.rst @nrfconnect/ncs-eris @nrfconnect/ncs-eris-doc /samples/dfu/single_slot/*.rst @nrfconnect/ncs-eris-doc /samples/dfu/smp_svr/*.rst @nrfconnect/ncs-eris-doc +/samples/dfu/smp_svr_mini_boot/*.rst @nrfconnect/ncs-eris-doc /samples/esb/**/*.rst @nrfconnect/ncs-si-xcake-doc /samples/edge_impulse/**/*.rst @nrfconnect/ncs-si-muffin-doc /samples/event_manager_proxy/*.rst @nrfconnect/ncs-si-bluebagel-doc @nrfconnect/ncs-si-muffin-doc @nrfconnect/ncs-si-xcake-doc @@ -700,14 +702,15 @@ /samples/zephyr/drivers/spi_bitbang/ @nrfconnect/ncs-low-level-test /samples/zephyr/drivers/spi_flash/ @nrfconnect/ncs-low-level-test /samples/zephyr/drivers/watchdog/ @nrfconnect/ncs-low-level-test +/samples/zephyr/net/ @nrfconnect/ncs-bifrost /samples/zephyr/sensor/accel_polling/ @nrfconnect/ncs-low-level-test /samples/zephyr/sensor/bme680/ @nrfconnect/ncs-low-level-test /samples/zephyr/sensor/qdec/ @nrfconnect/ncs-low-level-test -/samples/zephyr/smp_svr_mini_boot/ @nrfconnect/ncs-eris /samples/zephyr/subsys/ipc/ @nrfconnect/ncs-low-level-test @anangl /samples/zephyr/subsys/settings/ @nrfconnect/ncs-low-level-test /samples/zephyr/subsys/usb/ @nrfconnect/ncs-low-level-test /samples/zephyr/sysbuild/ @nrfconnect/ncs-low-level-test +/samples/zephyr/tfm_integration/ @nrfconnect/ncs-aegir /samples/**/*.svg @nrfconnect/ncs-doc-leads /samples/**/*.png @nrfconnect/ncs-doc-leads @@ -730,11 +733,13 @@ /scripts/tools-versions-*.txt @nrfconnect/ncs-co-build-system @nrfconnect/ncs-ci /scripts/requirements-*.txt @nrfconnect/ncs-co-build-system @nrfconnect/ncs-ci /scripts/west_commands/utils/ @gmarull -/scripts/west_commands/create_board/ @gmarull +/scripts/west_commands/create_board/ @nordicjm /scripts/west_commands/sbom/ @nrfconnect/ncs-co-scripts /scripts/west_commands/thingy91x_dfu.py @nrfconnect/ncs-cia +/scripts/west_commands/ncs_cherry_pick.py @nrfconnect/ncs-vestavind /scripts/west_commands/ncs_ironside_se_update.py @nrfconnect/ncs-aurora /scripts/west_commands/ncs_provision.py @nrfconnect/ncs-eris +/scripts/west_commands/tests/test_ncs_cherry_pick.py @nrfconnect/ncs-vestavind /scripts/bootloader/ @nrfconnect/ncs-eris /scripts/reglock.py @nrfconnect/ncs-eris /scripts/ncs-docker-version.txt @nrfconnect/ncs-ci @@ -754,6 +759,7 @@ /scripts/nrf_profiler/*.rst @nrfconnect/ncs-si-xcake-doc /scripts/nrf_provision/fast_pair/*.rst @nrfconnect/ncs-si-bluebagel-doc /scripts/partition_manager/*.rst @nrfconnect/ncs-aurora-doc +/scripts/pm_to_dts.py @nordicjm @rghaddab /scripts/generate_psa_key_attributes/*.rst @nrfconnect/ncs-aegir-doc /scripts/shell/*.rst @nrfconnect/ncs-blenders-doc /scripts/shell/ble_console/**/*.rst @nrfconnect/ncs-doc-leads @@ -809,12 +815,15 @@ /subsys/bluetooth/host_extensions/ @nrfconnect/ncs-dragoon /subsys/bluetooth/mesh/ @nrfconnect/ncs-paladin /subsys/bluetooth/rpc/ @nrfconnect/ncs-blenders @nrfconnect/ncs-protocols-serialization -/subsys/bluetooth/services/ams_client.c @nrfconnect/ncs-blenders -/subsys/bluetooth/services/ancs_client.c @nrfconnect/ncs-blenders -/subsys/bluetooth/fast_pair/ @nrfconnect/ncs-si-bluebagel +/subsys/bluetooth/services/ @nrfconnect/ncs-blenders +/subsys/bluetooth/services/dfu_smp.c @nrfconnect/ncs-eris +/subsys/bluetooth/services/hids.c @nrfconnect/ncs-si-xcake +/subsys/bluetooth/services/hogp.c @nrfconnect/ncs-si-xcake +/subsys/bluetooth/services/latency.c @nrfconnect/ncs-dragoon +/subsys/bluetooth/services/latency_client.c @nrfconnect/ncs-dragoon /subsys/bluetooth/services/ras/ @nrfconnect/ncs-dragoon /subsys/bluetooth/services/wifi_prov/ @wentong-li @bama-nordic -/subsys/bluetooth/services/hids.c @nrfconnect/ncs-si-xcake +/subsys/bluetooth/fast_pair/ @nrfconnect/ncs-si-bluebagel /subsys/bootloader/ @nrfconnect/ncs-eris /subsys/caf/ @nrfconnect/ncs-si-bluebagel @nrfconnect/ncs-si-muffin @nrfconnect/ncs-si-xcake /subsys/debug/ @nordic-krch @@ -886,6 +895,7 @@ /tests/crypto/ @magnev /tests/drivers/audio/ @nrfconnect/ncs-low-level-test /tests/drivers/can/ @nrfconnect/ncs-low-level-test +/tests/drivers/dect/dect_mdm/integration/ @nrfconnect/ncs-dect-nr-plus /tests/drivers/flash/flash_rpc/ @nrfconnect/ncs-eris /tests/drivers/flash_patch/ @nrfconnect/ncs-eris /tests/drivers/fprotect/ @nrfconnect/ncs-eris @@ -904,8 +914,7 @@ /tests/drivers/qdec/ @nrfconnect/ncs-low-level-test /tests/drivers/sensor/multicore_temp/ @nrfconnect/ncs-low-level-test /tests/drivers/spi/ @nrfconnect/ncs-low-level-test -/tests/drivers/timer/grtc_timer_lfrc/ @nrfconnect/ncs-low-level-test -/tests/drivers/timer/grtc_multiple_access/ @nrfconnect/ncs-low-level-test +/tests/drivers/timer/ @nrfconnect/ncs-low-level-test /tests/drivers/uart/ @nrfconnect/ncs-low-level-test /tests/drivers/watchdog/ @nrfconnect/ncs-low-level-test /tests/drivers/adc/ @nrfconnect/ncs-low-level-test @@ -1015,8 +1024,12 @@ /tests/zephyr/drivers/timer/ @nrfconnect/ncs-low-level-test /tests/zephyr/drivers/uart/ @nrfconnect/ncs-low-level-test /tests/zephyr/drivers/watchdog/ @nrfconnect/ncs-low-level-test +/tests/zephyr/kernel/sleep/ @nrfconnect/ncs-low-level-test /tests/zephyr/kernel/timer/timer_behavior/ @nrfconnect/ncs-low-level-test +/tests/zephyr/modules/tf-m/regression/ @nrfconnect/ncs-aegir +/tests/zephyr/subsys/sd/ @nrfconnect/ncs-low-level-test /tests/zephyr/subsys/secure_storage/ @nrfconnect/ncs-aegir +/tests/zephyr/application_development/ram_context_for_isr/ @nrfconnect/ncs-aegir /tests/zephyr/subsys/settings/performance/ @nrfconnect/ncs-eris @rghaddab /tests/zephyr/bluetooth/tester/host/ @nrfconnect/ncs-paladin diff --git a/Kconfig.nrf b/Kconfig.nrf index 4f0d3c5e9494..4c82c5625c9b 100644 --- a/Kconfig.nrf +++ b/Kconfig.nrf @@ -9,10 +9,6 @@ orsource "./cmake/toolchain/$(ZEPHYR_TOOLCHAIN_VARIANT)/Kconfig.defconfig" rsource "subsys/net/openthread/Kconfig.defconfig" rsource "subsys/net/lib/hostap_crypto/Kconfig.defconfig" -if !TFM_PROFILE_TYPE_MINIMAL -rsource "modules/trusted-firmware-m/Kconfig.mbedtls.defconfig" -endif # ! TFM_PROFILE_TYPE_MINIMAL - if TFM_PROFILE_TYPE_MINIMAL rsource "modules/trusted-firmware-m/Kconfig.mbedtls_minimal.defconfig" rsource "modules/trusted-firmware-m/Kconfig.tfm_minimal.defconfig" @@ -25,10 +21,12 @@ endif # BUILD_WITH_TFM menu "Nordic nRF Connect" # Override configuration from zephyr which sets this to 0x200 if MCUboot is -# enabled (CONFIG_BOOTLOADER_MCUBOOT), since NCS use partition_manager to -# get this offset intsead. +# enabled (CONFIG_BOOTLOADER_MCUBOOT), since NCS uses partition_manager to +# get this offset instead. config ROM_START_OFFSET default 0 if PARTITION_MANAGER_ENABLED + default 0 if BUILD_WITH_TFM + default SB_IMAGE_BOOT_OFFSET if !PARTITION_MANAGER_ENABLED && MCUBOOT && SECURE_BOOT # nRF Connect SDK default experimental warnings to on. config WARN_EXPERIMENTAL diff --git a/VERSION b/VERSION index 6869d8729dba..79499aea9e4c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.99 +3.3.99 diff --git a/applications/hpf/gpio/README.rst b/applications/hpf/gpio/README.rst index 34f3f697052f..894d057122a7 100644 --- a/applications/hpf/gpio/README.rst +++ b/applications/hpf/gpio/README.rst @@ -10,7 +10,7 @@ High-Performance Framework GPIO .. caution:: - The High-Performance Framework (HPF) support in the |NCS| is :ref:`experimental ` and is limited to the nRF54L15, nRF54LM20A, and nRF54LV10A devices. + The High-Performance Framework (HPF) support in the |NCS| is :ref:`experimental ` and is limited to the nRF54L15, nRF54LM20A, nRF54LV10A, and nRF7120 devices. This application demonstrates how to write a :ref:`High-Performance Framework (HPF) ` application implementing a simple peripheral. The application implements a subset of the Zephyr GPIO API. @@ -54,7 +54,7 @@ Building and running To build and run the application, you must include code for both the application core and FLPR core. The process involves building the :zephyr:code-sample:`blinky` sample with the appropriate sysbuild configuration. -For example, to build with icmsg backend, run the following commands: +For example, to build with icmsg backend, run the following commands (replace ```` with target board, such as ``nrf54l15dk/nrf54l15/cpuapp`` or ``nrf7120dk/nrf7120/cpuapp``): .. code-block:: console diff --git a/applications/hpf/gpio/boards/nrf7120dk_nrf7120_cpuflpr.overlay b/applications/hpf/gpio/boards/nrf7120dk_nrf7120_cpuflpr.overlay new file mode 100644 index 000000000000..a65990799e32 --- /dev/null +++ b/applications/hpf/gpio/boards/nrf7120dk_nrf7120_cpuflpr.overlay @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&cpuflpr_vevif_rx { + status = "okay"; + interrupts = <16 NRF_DEFAULT_IRQ_PRIORITY>; + nordic,tasks = <1>; + nordic,tasks-mask = <0x00010000>; +}; + +&cpuflpr_vevif_tx { + status = "okay"; +}; + +&gpio0 { + status = "disabled"; +}; + +&gpio1 { + status = "disabled"; +}; + +&gpio2 { + status = "disabled"; +}; + +&gpiote20 { + status = "disabled"; +}; + +&gpiote30 { + status = "disabled"; +}; + +&grtc { + status = "disabled"; +}; + +&uart20 { + status = "disabled"; +}; + +&uart30 { + status = "okay"; +}; + +&pwm20 { + status = "disabled"; +}; diff --git a/applications/hpf/gpio/sample.yaml b/applications/hpf/gpio/sample.yaml index 35b092b5628b..35dd919263b4 100644 --- a/applications/hpf/gpio/sample.yaml +++ b/applications/hpf/gpio/sample.yaml @@ -11,6 +11,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr + - nrf7120dk/nrf7120/cpuflpr tags: - ci_build - sysbuild @@ -25,6 +26,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr + - nrf7120dk/nrf7120/cpuflpr tags: - ci_build - sysbuild @@ -39,6 +41,7 @@ tests: platform_allow: - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr + - nrf7120dk/nrf7120/cpuflpr tags: - ci_build - sysbuild diff --git a/applications/hpf/gpio/src/hrt/hrt-nrf54l15.s b/applications/hpf/gpio/src/hrt/hrt-nrf54l15.s index 3a3d6a29e79f..e88619c864fb 100644 --- a/applications/hpf/gpio/src/hrt/hrt-nrf54l15.s +++ b/applications/hpf/gpio/src/hrt/hrt-nrf54l15.s @@ -1,6 +1,6 @@ .file "hrt.c" .option nopic - .attribute arch, "rv32e1p9_m2p0_c2p0_zicsr2p0" + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" .attribute unaligned_access, 0 .attribute stack_align, 4 .text @@ -77,3 +77,4 @@ hrt_set_masked_bits: #NO_APP ret .size hrt_set_masked_bits, .-hrt_set_masked_bits + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/gpio/src/hrt/hrt-nrf54lm20a.s b/applications/hpf/gpio/src/hrt/hrt-nrf54lm20a.s index 3a3d6a29e79f..e88619c864fb 100644 --- a/applications/hpf/gpio/src/hrt/hrt-nrf54lm20a.s +++ b/applications/hpf/gpio/src/hrt/hrt-nrf54lm20a.s @@ -1,6 +1,6 @@ .file "hrt.c" .option nopic - .attribute arch, "rv32e1p9_m2p0_c2p0_zicsr2p0" + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" .attribute unaligned_access, 0 .attribute stack_align, 4 .text @@ -77,3 +77,4 @@ hrt_set_masked_bits: #NO_APP ret .size hrt_set_masked_bits, .-hrt_set_masked_bits + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/gpio/src/hrt/hrt-nrf54lm20b.s b/applications/hpf/gpio/src/hrt/hrt-nrf54lm20b.s index 3a3d6a29e79f..e88619c864fb 100644 --- a/applications/hpf/gpio/src/hrt/hrt-nrf54lm20b.s +++ b/applications/hpf/gpio/src/hrt/hrt-nrf54lm20b.s @@ -1,6 +1,6 @@ .file "hrt.c" .option nopic - .attribute arch, "rv32e1p9_m2p0_c2p0_zicsr2p0" + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" .attribute unaligned_access, 0 .attribute stack_align, 4 .text @@ -77,3 +77,4 @@ hrt_set_masked_bits: #NO_APP ret .size hrt_set_masked_bits, .-hrt_set_masked_bits + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/gpio/src/hrt/hrt-nrf54lv10a.s b/applications/hpf/gpio/src/hrt/hrt-nrf54lv10a.s index 3a3d6a29e79f..e88619c864fb 100644 --- a/applications/hpf/gpio/src/hrt/hrt-nrf54lv10a.s +++ b/applications/hpf/gpio/src/hrt/hrt-nrf54lv10a.s @@ -1,6 +1,6 @@ .file "hrt.c" .option nopic - .attribute arch, "rv32e1p9_m2p0_c2p0_zicsr2p0" + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" .attribute unaligned_access, 0 .attribute stack_align, 4 .text @@ -77,3 +77,4 @@ hrt_set_masked_bits: #NO_APP ret .size hrt_set_masked_bits, .-hrt_set_masked_bits + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/gpio/src/hrt/hrt-nrf7120.s b/applications/hpf/gpio/src/hrt/hrt-nrf7120.s new file mode 100644 index 000000000000..e88619c864fb --- /dev/null +++ b/applications/hpf/gpio/src/hrt/hrt-nrf7120.s @@ -0,0 +1,80 @@ + .file "hrt.c" + .option nopic + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" + .attribute unaligned_access, 0 + .attribute stack_align, 4 + .text + .section .text.hrt_set_bits,"ax",@progbits + .align 1 + .globl hrt_set_bits + .type hrt_set_bits, @function +hrt_set_bits: + #APP + csrr a4, 3008 + #NO_APP + lui a5,%hi(irq_arg) + lhu a5,%lo(irq_arg)(a5) + or a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrw 3008, a5 + #NO_APP + ret + .size hrt_set_bits, .-hrt_set_bits + .section .text.hrt_clear_bits,"ax",@progbits + .align 1 + .globl hrt_clear_bits + .type hrt_clear_bits, @function +hrt_clear_bits: + #APP + csrr a4, 3008 + #NO_APP + lui a5,%hi(irq_arg) + lhu a5,%lo(irq_arg)(a5) + not a5,a5 + and a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrw 3008, a5 + #NO_APP + ret + .size hrt_clear_bits, .-hrt_clear_bits + .section .text.hrt_toggle_bits,"ax",@progbits + .align 1 + .globl hrt_toggle_bits + .type hrt_toggle_bits, @function +hrt_toggle_bits: + lui a5,%hi(irq_arg) + lhu a5,%lo(irq_arg)(a5) + #APP + csrw 3024, a5 + #NO_APP + ret + .size hrt_toggle_bits, .-hrt_toggle_bits + .section .text.hrt_set_masked_bits,"ax",@progbits + .align 1 + .globl hrt_set_masked_bits + .type hrt_set_masked_bits, @function +hrt_set_masked_bits: + #APP + csrr a2, 3008 + #NO_APP + lui a3,%hi(irq_arg) + lhu a5,%lo(irq_arg)(a3) + lui a4,%hi(irq_arg2) + lhu a4,%lo(irq_arg2)(a4) + lhu a3,%lo(irq_arg)(a3) + not a5,a5 + and a5,a5,a2 + and a4,a4,a3 + or a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrw 3008, a5 + #NO_APP + ret + .size hrt_set_masked_bits, .-hrt_set_masked_bits + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/gpio/src/main.c b/applications/hpf/gpio/src/main.c index d3fc7b8764c1..a580332833c0 100644 --- a/applications/hpf/gpio/src/main.c +++ b/applications/hpf/gpio/src/main.c @@ -60,6 +60,25 @@ static const uint8_t pin_to_vio_map[] = { #define VIO_PORT 1 #define VIO_PIN_OFFSET 15 +#elif defined(CONFIG_SOC_NRF7120) +static const uint8_t pin_to_vio_map[] = { + 6, /* Physical pin 0 */ + 7, /* Physical pin 1 */ + 8, /* Physical pin 2 */ + 9, /* Physical pin 3 */ + 10, /* Physical pin 4 */ + 11, /* Physical pin 5 */ + 0, /* Physical pin 6 */ + 1, /* Physical pin 7 */ + 2, /* Physical pin 8 */ + 3, /* Physical pin 9 */ + 4, /* Physical pin 10 */ + 5, /* Physical pin 11 */ +}; + +#define VIO_PORT 2 +#define VIO_PIN_OFFSET 0 + #else #error "Unsupported target" #endif @@ -150,32 +169,28 @@ static int gpio_hpf_pin_configure(uint8_t port, uint16_t pin, uint32_t flags) return -EINVAL; } - if (flags & GPIO_OUTPUT_INIT_HIGH) { - uint16_t outs = nrf_vpr_csr_vio_out_get(); - - nrf_vpr_csr_vio_out_set(outs | (BIT(pin_vio_index))); - } else if (flags & GPIO_OUTPUT_INIT_LOW) { - uint16_t outs = nrf_vpr_csr_vio_out_get(); - - nrf_vpr_csr_vio_out_set(outs & ~(BIT(pin_vio_index))); - } - nrf_gpio_pin_dir_t dir = (flags & GPIO_OUTPUT) ? NRF_GPIO_PIN_DIR_OUTPUT : NRF_GPIO_PIN_DIR_INPUT; nrf_gpio_pin_input_t input = (flags & GPIO_INPUT) ? NRF_GPIO_PIN_INPUT_CONNECT : NRF_GPIO_PIN_INPUT_DISCONNECT; - /* Reconfigure the GPIO pin with the specified pull-up/pull-down configuration and drive - * strength. - */ nrfy_gpio_reconfigure(abs_pin, &dir, &input, &pull, &drive, NULL); + nrfy_gpio_pin_control_select(abs_pin, NRF_GPIO_PIN_SEL_VPR); + if (dir == NRF_GPIO_PIN_DIR_OUTPUT) { nrf_vpr_csr_vio_dir_set(nrf_vpr_csr_vio_dir_get() | (BIT(pin_vio_index))); } - /* Take control of the pin */ - nrfy_gpio_pin_control_select(abs_pin, NRF_GPIO_PIN_SEL_VPR); + if (flags & GPIO_OUTPUT_INIT_HIGH) { + uint16_t outs = nrf_vpr_csr_vio_out_get(); + + nrf_vpr_csr_vio_out_set(outs | (BIT(pin_vio_index))); + } else if (flags & GPIO_OUTPUT_INIT_LOW) { + uint16_t outs = nrf_vpr_csr_vio_out_get(); + + nrf_vpr_csr_vio_out_set(outs & ~(BIT(pin_vio_index))); + } return 0; } diff --git a/applications/hpf/hpf.rst b/applications/hpf/hpf.rst index ec4b36f414f0..a5336ebf8a10 100644 --- a/applications/hpf/hpf.rst +++ b/applications/hpf/hpf.rst @@ -5,7 +5,7 @@ High-Performance Framework .. caution:: - The High-Performance Framework (HPF) support in the |NCS| is :ref:`experimental ` and is limited to the nRF54L15, nRF54LM20, and nRF54LV10A devices. + The High-Performance Framework (HPF) support in the |NCS| is :ref:`experimental ` and is limited to the nRF54L15, nRF54LM20, nRF54LV10A, and nRF7120 devices. High-Performance Framework, is a framework designed to facilitate the creation and integration of :ref:`peripheral emulations using coprocessors `. The following applications are created using HPF: diff --git a/applications/hpf/mspi/Kconfig b/applications/hpf/mspi/Kconfig index 4394abc13667..588f87311681 100644 --- a/applications/hpf/mspi/Kconfig +++ b/applications/hpf/mspi/Kconfig @@ -5,7 +5,7 @@ config HPF_MSPI_MAX_RESPONSE_SIZE config HPF_MSPI_IPC_NO_COPY bool "IPC no copy mode" default y - depends on SOC_NRF54L15 || SOC_NRF54LM20A || SOC_NRF54LM20B + depends on SOC_NRF54L15 || SOC_NRF54LM20A || SOC_NRF54LM20B || SOC_NRF54LV10A help If y Data is passed through IPC by reference, this requires both cores to be able to access each others memory spaces. diff --git a/applications/hpf/mspi/README.rst b/applications/hpf/mspi/README.rst index 38978308cd59..801ad33ac503 100644 --- a/applications/hpf/mspi/README.rst +++ b/applications/hpf/mspi/README.rst @@ -9,7 +9,7 @@ High-Performance Framework MSPI .. caution:: - The High-Performance Framework (HPF) support in the |NCS| is :ref:`experimental ` and is limited to the nRF54L15 and nRF54LM20A/B devices. + The High-Performance Framework (HPF) support in the |NCS| is :ref:`experimental ` and is limited to the nRF54L15, nRF54LM20A/B, and nRF54LV10A devices. This application demonstrates how to write a :ref:`High-Performance Framework (HPF) ` application and communicate with it. The application implements a subset of the Zephyr MSPI API. @@ -361,7 +361,7 @@ The following tests utilize the MSPI driver along with this application: * ``nrf/tests/zephyr/drivers/mspi/flash`` * ``nrf/tests/zephyr/drivers/flash/common`` -These tests report results through serial port (the USB debug port on the nRF54L15 or nRF54LM20 DK). +These tests report results over the serial port, using the USB debug port on the nRF54L15, nRF54LM20, or nRF54LV10 DK. Dependencies ************ @@ -398,3 +398,4 @@ FLPR application HRT * :file:`applications/hpf/mspi/src/hrt/hrt-nrf54l15.s` * :file:`applications/hpf/mspi/src/hrt/hrt-nrf54lm20a.s` * :file:`applications/hpf/mspi/src/hrt/hrt-nrf54lm20b.s` + * :file:`applications/hpf/mspi/src/hrt/hrt-nrf54lv10a.s` diff --git a/applications/hpf/mspi/boards/nrf54lv10dk_nrf54lv10a_cpuflpr.overlay b/applications/hpf/mspi/boards/nrf54lv10dk_nrf54lv10a_cpuflpr.overlay new file mode 100644 index 000000000000..199d156dda2e --- /dev/null +++ b/applications/hpf/mspi/boards/nrf54lv10dk_nrf54lv10a_cpuflpr.overlay @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + + sram_tx: memory@2002b000 { + reg = <0x2002b000 0x07f0>; + }; + + sram_rx: memory@2002b7f0 { + reg = <0x2002b7f0 0x07f0>; + }; + + cpuflpr_error_code: memory@2002bfe0 { + reg = <0x2002bfe0 0x0020>; /* 32 bytes */ + }; + }; + + ipc { + ipc0: ipc0 { + compatible = "zephyr,ipc-icmsg"; + tx-region = <&sram_tx>; + rx-region = <&sram_rx>; + mboxes = <&cpuflpr_vevif_rx 16>, <&cpuflpr_vevif_tx 20>; + mbox-names = "rx", "tx"; + status = "okay"; + }; + }; +}; + +&cpuflpr_rram { + reg = <0xf9400 DT_SIZE_K(15)>; + ranges = <0x0 0xf9400 DT_SIZE_K(15)>; +}; + +&cpuflpr_code_partition { + reg = <0x0 DT_SIZE_K(15)>; +}; + +&cpuflpr_sram { + reg = <0x2002c000 DT_SIZE_K(15)>; + ranges = <0x0 0x2002c000 0x3c00>; +}; + +&cpuflpr_vevif_rx { + status = "okay"; + interrupts = <16 NRF_DEFAULT_IRQ_PRIORITY>; + nordic,tasks = <1>; + nordic,tasks-mask = <0x00010000>; +}; + +&cpuflpr_vevif_tx { + status = "okay"; +}; + +&gpio0 { + status = "disabled"; +}; + +&gpio1 { + status = "disabled"; +}; + +&gpiote20 { + status = "disabled"; +}; + +&gpiote30 { + status = "disabled"; +}; + +&grtc { + status = "disabled"; +}; + +&uart20 { + status = "disabled"; +}; + +&uart30 { + status = "disabled"; +}; diff --git a/applications/hpf/mspi/sample.yaml b/applications/hpf/mspi/sample.yaml index 2ada8576bc0a..e5739c2fd5d0 100644 --- a/applications/hpf/mspi/sample.yaml +++ b/applications/hpf/mspi/sample.yaml @@ -12,6 +12,7 @@ tests: - nrf54l15dk/nrf54l15/cpuflpr - nrf54lm20dk/nrf54lm20a/cpuflpr - nrf54lm20dk/nrf54lm20b/cpuflpr + - nrf54lv10dk/nrf54lv10a/cpuflpr tags: - ci_build - sysbuild diff --git a/applications/hpf/mspi/src/hrt/hrt-nrf54l15.s b/applications/hpf/mspi/src/hrt/hrt-nrf54l15.s index 17133b339102..1784f052d37a 100644 --- a/applications/hpf/mspi/src/hrt/hrt-nrf54l15.s +++ b/applications/hpf/mspi/src/hrt/hrt-nrf54l15.s @@ -1,6 +1,6 @@ .file "hrt.c" .option nopic - .attribute arch, "rv32e1p9_m2p0_c2p0_zicsr2p0" + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" .attribute unaligned_access, 0 .attribute stack_align, 4 .text @@ -9,32 +9,33 @@ .type hrt_tx, @function hrt_tx: lw a5,4(a0) - addi sp,sp,-16 - sw s0,12(sp) - sw s1,8(sp) - sw a2,0(sp) + addi sp,sp,-20 + sw s0,16(sp) + sw s1,12(sp) + sw a2,4(sp) beq a5,zero,.L1 li a4,32 div a4,a4,a1 - lui t2,%hi(xfer_shift_ctrl) - addi a2,t2,%lo(xfer_shift_ctrl) - lbu s1,2(a2) - lbu a5,1(a2) + lui t1,%hi(xfer_shift_ctrl) + addi a2,t1,%lo(xfer_shift_ctrl) + lbu a5,2(a2) sb a1,2(a2) + li t0,3145728 + sw a5,0(sp) + lbu a5,1(a2) lbu a2,3(a2) - li t1,3145728 slli a5,a5,8 slli a2,a2,20 - and a2,a2,t1 + and a2,a2,t0 andi a5,a5,1792 or a5,a5,a2 - li t1,126976 + li t0,126976 slli a2,a1,12 - and a2,a2,t1 + and a2,a2,t0 or a5,a5,a2 addi a4,a4,-1 andi a4,a4,0xff - sb a4,%lo(xfer_shift_ctrl)(t2) + sb a4,%lo(xfer_shift_ctrl)(t1) andi a4,a4,63 or a5,a5,a4 #APP @@ -44,22 +45,21 @@ hrt_tx: slli a5,a1,16 and a5,a5,a4 ori a5,a5,4 - sw a5,4(sp) - li t1,0 - addi t0,t2,%lo(xfer_shift_ctrl) + li a2,0 + li t2,1 + sw a5,8(sp) .L3: lw a5,4(a0) - bltu t1,a5,.L14 + bltu a2,a5,.L14 .L1: - lw s0,12(sp) - lw s1,8(sp) - addi sp,sp,16 + lw s0,16(sp) + lw s1,12(sp) + addi sp,sp,20 jr ra .L14: lw a5,4(a0) - li a4,1 - sub a5,a5,t1 - beq a5,a4,.L4 + sub a5,a5,a2 + beq a5,t2,.L4 li a4,2 beq a5,a4,.L5 .L6: @@ -67,59 +67,59 @@ hrt_tx: li a5,0 beq a4,zero,.L7 lw a5,0(a0) - slli a4,t1,2 + slli a4,a2,2 add a5,a5,a4 lw a5,0(a5) j .L7 .L4: - lbu a2,1(t0) - lbu a5,2(t0) - li s0,126976 - slli a2,a2,8 - slli a5,a5,12 - and a5,a5,s0 - andi a2,a2,1792 - or a2,a2,a5 - lbu a4,8(a0) - lbu a5,3(t0) + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,8(a0) + lbu t0,3(s0) li s0,3145728 - addi a4,a4,-1 - slli a5,a5,20 - andi a4,a4,0xff - and a5,a5,s0 - sb a4,%lo(xfer_shift_ctrl)(t2) - or a5,a2,a5 - andi a4,a4,63 - or a5,a5,a4 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 #APP - csrw 3019, a5 + csrw 3019, t0 #NO_APP lw a5,12(a0) .L7: - beq a1,s1,.L8 + lw a4,0(sp) + beq a1,a4,.L8 .L9: #APP csrr a4, 3022 #NO_APP andi a4,a4,0xff bne a4,zero,.L9 - lw a4,4(sp) + lw a4,8(sp) #APP csrw 3043, a4 #NO_APP - mv s1,a1 .L8: lbu a4,16(a0) - andi a2,a4,0xff + andi t0,a4,0xff beq a4,zero,.L10 - li a4,1 - bne a2,a4,.L11 + bne t0,t2,.L11 #APP csrw 3017, a5 #NO_APP .L11: - bne t1,zero,.L12 - lw a5,0(sp) + bne a2,zero,.L12 + lw a5,4(sp) lbu a5,0(a5) bne a5,zero,.L12 mv a5,a3 @@ -131,34 +131,35 @@ hrt_tx: #APP csrw 2005, a3 #NO_APP - lw a5,0(sp) - li a4,1 - sb a4,0(a5) + lw a5,4(sp) + sb t2,0(a5) .L12: - addi t1,t1,1 + addi a2,a2,1 + sw a1,0(sp) j .L3 .L5: - lbu a2,1(t0) - lbu a5,2(t0) - li s0,126976 - slli a2,a2,8 - slli a5,a5,12 - and a5,a5,s0 - andi a2,a2,1792 - or a2,a2,a5 - lbu a4,9(a0) - lbu a5,3(t0) + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,9(a0) + lbu t0,3(s0) li s0,3145728 - addi a4,a4,-1 - slli a5,a5,20 - andi a4,a4,0xff - and a5,a5,s0 - sb a4,%lo(xfer_shift_ctrl)(t2) - or a5,a2,a5 - andi a4,a4,63 - or a5,a5,a4 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 #APP - csrw 3019, a5 + csrw 3019, t0 #NO_APP j .L6 .L10: @@ -194,18 +195,22 @@ hrt_write: bne a5,a3,.L21 li a5,3 .L22: - li a4,1 - beq a5,a4,.L23 - li a4,3 - beq a5,a4,.L24 - li a3,0 - bne a5,zero,.L25 - lbu a3,80(s0) -.L43: - andi a3,a3,0xff -.L25: - lui a4,%hi(xfer_shift_ctrl+2) - sb a3,%lo(xfer_shift_ctrl+2)(a4) + lbu a4,83(s0) + j .L42 +.L20: + andi a4,a5,0xff + li a3,1 + beq a4,a3,.L23 + li a3,3 + beq a4,a3,.L22 + bne a4,zero,.L36 + lbu a4,80(s0) +.L42: + andi a4,a4,0xff + mv a3,a4 +.L24: + lui a2,%hi(xfer_shift_ctrl+2) + sb a4,%lo(xfer_shift_ctrl+2)(a2) #APP csrw 2000, 2 #NO_APP @@ -234,38 +239,36 @@ hrt_write: li a2,1 add a5,s0,a5 lw a4,4(a5) - beq a4,a2,.L26 + beq a4,a2,.L25 li a2,2 - beq a4,a2,.L27 + beq a4,a2,.L26 li a5,32 div a5,a5,a3 - j .L44 -.L20: - andi a5,a5,0xff - j .L22 -.L23: - lbu a3,81(s0) j .L43 -.L24: - lbu a3,83(s0) - j .L43 -.L26: +.L23: + lbu a4,81(s0) + j .L42 +.L36: + li a4,0 + li a3,0 + j .L24 +.L25: lbu a5,8(a5) -.L44: +.L43: #APP csrw 3022, a5 #NO_APP - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L30 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L29 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP -.L31: +.L30: #APP csrr s1, 3008 #NO_APP @@ -290,30 +293,30 @@ hrt_write: addi a0,s0,60 call hrt_tx lbu a5,92(s0) - bne a5,zero,.L32 + bne a5,zero,.L31 li a5,4096 addi a5,a5,1 #APP csrw 3019, a5 #NO_APP - li a4,131072 - slli a5,s1,1 - addi a4,a4,-2 - and a5,a5,a4 + li a5,131072 + addi a5,a5,-2 + slli s1,s1,1 + and s1,s1,a5 #APP - csrw 3012, a5 + csrw 3012, s1 csrw 2000, 0 #NO_APP -.L33: +.L32: #APP csrw 2005, 0 #NO_APP lbu a5,87(s0) bne a5,zero,.L19 - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L36 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L35 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 @@ -326,24 +329,24 @@ hrt_write: lw s1,4(sp) addi sp,sp,16 jr ra -.L27: +.L26: lbu a5,9(a5) - j .L44 -.L30: - li a5,1 + j .L43 +.L29: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP - j .L31 -.L32: + j .L30 +.L31: #APP csrr a5, 3022 #NO_APP andi a5,a5,0xff - bne a5,zero,.L32 + bne a5,zero,.L31 #APP csrw 2000, 0 #NO_APP @@ -354,21 +357,21 @@ hrt_write: #NO_APP lbu a4,92(s0) li a5,1 - bne a4,a5,.L34 + bne a4,a5,.L33 #APP - csrc 3008, 1 + csrc 3008, a5 #NO_APP - j .L33 -.L34: + j .L32 +.L33: lbu a4,92(s0) li a5,3 - bne a4,a5,.L33 + bne a4,a5,.L32 #APP csrs 3008, 1 #NO_APP - j .L33 -.L36: - li a5,1 + j .L32 +.L35: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 @@ -402,34 +405,34 @@ hrt_read: andi t1,t1,0xff addi s1,s1,-1 andi s1,s1,0xff - bne a0,a2,.L46 + bne a0,a2,.L45 lbu a2,68(s0) addi a2,a2,-1 andi a2,a2,0xff sb a2,68(s0) -.L46: - lbu a2,88(s0) - lbu a0,86(s0) - bne a2,zero,.L47 +.L45: + lbu a0,88(s0) li a2,1 + bne a0,zero,.L46 + lbu a0,86(s0) sll a2,a2,a0 slli a2,a2,16 srli a2,a2,16 #APP csrc 3008, a2 #NO_APP -.L48: +.L47: #APP csrr a2, 3008 #NO_APP lw a0,4(s0) sw a2,0(sp) - bne a0,zero,.L49 + bne a0,zero,.L48 lw a0,24(s0) - bne a0,zero,.L49 + bne a0,zero,.L48 lw a0,44(s0) - beq a0,zero,.L50 -.L49: + beq a0,zero,.L49 +.L48: sw zero,64(s0) li a0,1 sb a0,87(s0) @@ -445,17 +448,17 @@ hrt_read: lw a4,12(sp) lw a3,8(sp) lw a5,4(sp) -.L50: +.L49: sw a4,64(s0) sb t1,87(s0) lbu t0,83(s0) li t1,1 li a0,4 - bleu t0,t1,.L51 + bleu t0,t1,.L50 lbu t1,83(s0) - beq t1,a0,.L79 + beq t1,a0,.L80 li a0,6 -.L51: +.L50: #APP csrr t1, 3009 #NO_APP @@ -516,18 +519,18 @@ hrt_read: csrw 3019, a0 csrw 3017, 0 #NO_APP - li a0,1 - bne a4,a0,.L52 - lbu t0,68(s0) + li t1,1 li a0,2 - bne t0,a0,.L53 + bne a4,t1,.L51 + lbu t1,68(s0) + bne t1,a0,.L52 lhu a4,84(s0) li a1,65536 or a4,a4,a1 #APP csrw 2002, a4 #NO_APP -.L54: +.L53: #APP csrr a1, 2005 csrr a4, 2005 @@ -536,7 +539,7 @@ hrt_read: slli a4,a4,16 srli a1,a1,16 srli a4,a4,16 - bne a1,a4,.L54 + bne a1,a4,.L53 lw a4,0(sp) slli a2,a4,24 #APP @@ -546,9 +549,9 @@ hrt_read: #NO_APP lbu a2,83(s0) li a3,8 - bne a2,a3,.L55 + bne a2,a3,.L54 srli a4,a4,16 -.L92: +.L95: sw a4,72(s0) #APP csrw 2000, 0 @@ -560,51 +563,72 @@ hrt_read: csrw 3019, s1 #NO_APP lbu a5,87(s0) - bne a5,zero,.L45 - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L77 + bne a5,zero,.L44 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L78 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP -.L45: +.L44: lw ra,32(sp) lw s0,28(sp) lw s1,24(sp) addi sp,sp,36 jr ra -.L47: - li a2,1 +.L46: + lbu a0,86(s0) sll a2,a2,a0 slli a2,a2,16 srli a2,a2,16 #APP csrs 3008, a2 #NO_APP - j .L48 -.L79: + j .L47 +.L80: li a0,30 - j .L51 -.L55: + j .L50 +.L54: srli a4,a4,24 + j .L95 +.L51: + bne a4,a0,.L88 + lbu a0,69(s0) j .L92 .L52: - li a0,2 - bne a4,a0,.L87 - lbu a0,69(s0) - addi a0,a0,-3 + lbu a0,68(s0) +.L92: + addi a0,a0,-1 + addi a0,a0,-2 andi a0,a0,63 + li t1,2097152 or a0,a0,a5 + addi t1,t1,1024 or a0,a0,t1 #APP csrw 3019, a0 #NO_APP + li t1,1 + addi a0,a4,-1 + beq a0,t1,.L60 + li t1,2 + beq a0,t1,.L61 + lbu a0,83(s0) + li s1,32 + div s1,s1,a0 + j .L93 +.L88: + lbu t1,83(s0) + li a0,32 + div a0,a0,t1 + j .L92 +.L60: lbu s1,68(s0) -.L90: +.L93: lhu a0,84(s0) li t1,65536 addi s1,s1,-1 @@ -626,9 +650,9 @@ hrt_read: addi a4,a4,-2 li t0,2 li t2,32 -.L63: - bne a4,a2,.L68 -.L69: +.L64: + bne a4,a2,.L69 +.L70: #APP csrr a1, 2005 csrr a4, 2005 @@ -637,7 +661,7 @@ hrt_read: slli a4,a4,16 srli a1,a1,16 srli a4,a4,16 - bne a1,a4,.L69 + bne a1,a4,.L70 lw a4,0(sp) slli a2,a4,24 #APP @@ -646,7 +670,7 @@ hrt_read: #NO_APP lbu a3,92(s0) li a4,3 - bne a3,a4,.L70 + bne a3,a4,.L71 #APP fence iorw,iorw csrr a3, 3018 @@ -654,7 +678,7 @@ hrt_read: #NO_APP lhu a2,84(s0) li a4,35 - bleu a2,a4,.L71 + bleu a2,a4,.L72 #APP csrw 2000, 0 #NO_APP @@ -665,23 +689,23 @@ hrt_read: #APP csrw 2005, a4 #NO_APP -.L71: +.L72: li a4,65536 addi a4,a4,-1 -.L72: +.L73: #APP csrr a2, 3010 #NO_APP slli a2,a2,16 srli a2,a2,16 - beq a2,a4,.L72 + beq a2,a4,.L73 lhu a2,84(s0) li a4,35 - bleu a2,a4,.L73 + bleu a2,a4,.L74 #APP csrw 2010, 0 #NO_APP -.L73: +.L74: #APP csrr a2, 3010 #NO_APP @@ -690,28 +714,29 @@ hrt_read: #APP csrs 3008, 1 #NO_APP - lbu a1,83(s0) - li a4,4 - beq a1,a4,.L80 - li t1,2 - li t0,4 -.L74: - slli a1,a3,24 + lbu a4,83(s0) + li a1,4 + li t0,2 + bne a4,a1,.L75 + li t0,1 + li a1,30 +.L75: + slli a0,a3,24 srli a4,a3,24 - or a4,a4,a1 - li a1,65536 - srli a0,a3,8 - addi a1,a1,-256 - and a0,a0,a1 - lbu t2,83(s0) or a4,a4,a0 + li a0,65536 + srli t1,a3,8 + addi a0,a0,-256 + and t1,t1,a0 + lbu t2,83(s0) + or a4,a4,t1 slli a3,a3,8 - li a0,16711680 - and a3,a3,a0 + li t1,16711680 + and a3,a3,t1 or a4,a4,a3 - and a2,a2,t0 + and a2,a2,a1 lbu a3,68(s0) - sra a2,a2,t1 + sra a2,a2,t0 sll a4,a4,t2 or a4,a4,a2 lbu a2,83(s0) @@ -724,55 +749,25 @@ hrt_read: srli a3,a4,24 or a3,a3,a2 srli a2,a4,8 - and a2,a2,a1 + and a2,a2,a0 slli a4,a4,8 or a3,a3,a2 - and a4,a4,a0 + and a4,a4,t1 or a4,a3,a4 - j .L92 -.L53: - lbu a0,68(s0) - addi a0,a0,-3 - andi a0,a0,63 - or a0,a0,a5 - or a0,a0,t1 - #APP - csrw 3019, a0 - #NO_APP - li a0,0 -.L60: - li t1,2 - bne a0,t1,.L62 + j .L95 +.L61: lbu s1,69(s0) - j .L90 -.L87: - lbu t0,83(s0) - li a0,32 - div a0,a0,t0 - addi a0,a0,-3 - andi a0,a0,63 - or a0,a0,a5 - or a0,a0,t1 - #APP - csrw 3019, a0 - #NO_APP - addi a0,a4,-1 - j .L60 -.L62: - lbu a0,83(s0) - li s1,32 - div s1,s1,a0 - j .L90 -.L68: + j .L93 +.L69: li a0,1 - beq a4,a0,.L64 - beq a4,t0,.L65 + beq a4,a0,.L65 + beq a4,t0,.L66 lbu s1,83(s0) div s1,t2,s1 - j .L91 -.L64: + j .L94 +.L65: lbu s1,68(s0) -.L91: +.L94: addi s1,s1,-1 andi s1,s1,0xff #APP @@ -787,15 +782,11 @@ hrt_read: #NO_APP addi a1,a1,4 addi a4,a4,-1 - j .L63 -.L65: + j .L64 +.L66: lbu s1,69(s0) - j .L91 -.L80: - li t1,1 - li t0,30 - j .L74 -.L70: + j .L94 +.L71: #APP csrr a4, 3018 #NO_APP @@ -805,16 +796,16 @@ hrt_read: li a3,32 sub a3,a3,a2 srl a4,a4,a3 - j .L92 -.L77: - li a5,1 + j .L95 +.L78: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP - j .L45 + j .L44 .size hrt_read, .-hrt_read .section .sdata.xfer_shift_ctrl,"aw" .align 2 @@ -825,3 +816,4 @@ xfer_shift_ctrl: .byte 4 .byte 1 .byte 0 + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/mspi/src/hrt/hrt-nrf54lm20a.s b/applications/hpf/mspi/src/hrt/hrt-nrf54lm20a.s index cf09170e3dcf..343ec3162a4d 100644 --- a/applications/hpf/mspi/src/hrt/hrt-nrf54lm20a.s +++ b/applications/hpf/mspi/src/hrt/hrt-nrf54lm20a.s @@ -1,6 +1,6 @@ .file "hrt.c" .option nopic - .attribute arch, "rv32e1p9_m2p0_c2p0_zicsr2p0" + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" .attribute unaligned_access, 0 .attribute stack_align, 4 .text @@ -9,32 +9,33 @@ .type hrt_tx, @function hrt_tx: lw a5,4(a0) - addi sp,sp,-16 - sw s0,12(sp) - sw s1,8(sp) - sw a2,0(sp) + addi sp,sp,-20 + sw s0,16(sp) + sw s1,12(sp) + sw a2,4(sp) beq a5,zero,.L1 li a4,32 div a4,a4,a1 - lui t2,%hi(xfer_shift_ctrl) - addi a2,t2,%lo(xfer_shift_ctrl) - lbu s1,2(a2) - lbu a5,1(a2) + lui t1,%hi(xfer_shift_ctrl) + addi a2,t1,%lo(xfer_shift_ctrl) + lbu a5,2(a2) sb a1,2(a2) + li t0,3145728 + sw a5,0(sp) + lbu a5,1(a2) lbu a2,3(a2) - li t1,3145728 slli a5,a5,8 slli a2,a2,20 - and a2,a2,t1 + and a2,a2,t0 andi a5,a5,1792 or a5,a5,a2 - li t1,126976 + li t0,126976 slli a2,a1,12 - and a2,a2,t1 + and a2,a2,t0 or a5,a5,a2 addi a4,a4,-1 andi a4,a4,0xff - sb a4,%lo(xfer_shift_ctrl)(t2) + sb a4,%lo(xfer_shift_ctrl)(t1) andi a4,a4,63 or a5,a5,a4 #APP @@ -44,22 +45,21 @@ hrt_tx: slli a5,a1,16 and a5,a5,a4 ori a5,a5,4 - sw a5,4(sp) - li t1,0 - addi t0,t2,%lo(xfer_shift_ctrl) + li a2,0 + li t2,1 + sw a5,8(sp) .L3: lw a5,4(a0) - bltu t1,a5,.L14 + bltu a2,a5,.L14 .L1: - lw s0,12(sp) - lw s1,8(sp) - addi sp,sp,16 + lw s0,16(sp) + lw s1,12(sp) + addi sp,sp,20 jr ra .L14: lw a5,4(a0) - li a4,1 - sub a5,a5,t1 - beq a5,a4,.L4 + sub a5,a5,a2 + beq a5,t2,.L4 li a4,2 beq a5,a4,.L5 .L6: @@ -67,59 +67,59 @@ hrt_tx: li a5,0 beq a4,zero,.L7 lw a5,0(a0) - slli a4,t1,2 + slli a4,a2,2 add a5,a5,a4 lw a5,0(a5) j .L7 .L4: - lbu a2,1(t0) - lbu a5,2(t0) - li s0,126976 - slli a2,a2,8 - slli a5,a5,12 - and a5,a5,s0 - andi a2,a2,1792 - or a2,a2,a5 - lbu a4,8(a0) - lbu a5,3(t0) + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,8(a0) + lbu t0,3(s0) li s0,3145728 - addi a4,a4,-1 - slli a5,a5,20 - andi a4,a4,0xff - and a5,a5,s0 - sb a4,%lo(xfer_shift_ctrl)(t2) - or a5,a2,a5 - andi a4,a4,63 - or a5,a5,a4 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 #APP - csrw 3019, a5 + csrw 3019, t0 #NO_APP lw a5,12(a0) .L7: - beq a1,s1,.L8 + lw a4,0(sp) + beq a1,a4,.L8 .L9: #APP csrr a4, 3022 #NO_APP andi a4,a4,0xff bne a4,zero,.L9 - lw a4,4(sp) + lw a4,8(sp) #APP csrw 3043, a4 #NO_APP - mv s1,a1 .L8: lbu a4,16(a0) - andi a2,a4,0xff + andi t0,a4,0xff beq a4,zero,.L10 - li a4,1 - bne a2,a4,.L11 + bne t0,t2,.L11 #APP csrw 3017, a5 #NO_APP .L11: - bne t1,zero,.L12 - lw a5,0(sp) + bne a2,zero,.L12 + lw a5,4(sp) lbu a5,0(a5) bne a5,zero,.L12 mv a5,a3 @@ -131,34 +131,35 @@ hrt_tx: #APP csrw 2005, a3 #NO_APP - lw a5,0(sp) - li a4,1 - sb a4,0(a5) + lw a5,4(sp) + sb t2,0(a5) .L12: - addi t1,t1,1 + addi a2,a2,1 + sw a1,0(sp) j .L3 .L5: - lbu a2,1(t0) - lbu a5,2(t0) - li s0,126976 - slli a2,a2,8 - slli a5,a5,12 - and a5,a5,s0 - andi a2,a2,1792 - or a2,a2,a5 - lbu a4,9(a0) - lbu a5,3(t0) + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,9(a0) + lbu t0,3(s0) li s0,3145728 - addi a4,a4,-1 - slli a5,a5,20 - andi a4,a4,0xff - and a5,a5,s0 - sb a4,%lo(xfer_shift_ctrl)(t2) - or a5,a2,a5 - andi a4,a4,63 - or a5,a5,a4 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 #APP - csrw 3019, a5 + csrw 3019, t0 #NO_APP j .L6 .L10: @@ -194,18 +195,22 @@ hrt_write: bne a5,a3,.L21 li a5,3 .L22: - li a4,1 - beq a5,a4,.L23 - li a4,3 - beq a5,a4,.L24 - li a3,0 - bne a5,zero,.L25 - lbu a3,80(s0) -.L43: - andi a3,a3,0xff -.L25: - lui a4,%hi(xfer_shift_ctrl+2) - sb a3,%lo(xfer_shift_ctrl+2)(a4) + lbu a4,83(s0) + j .L42 +.L20: + andi a4,a5,0xff + li a3,1 + beq a4,a3,.L23 + li a3,3 + beq a4,a3,.L22 + bne a4,zero,.L36 + lbu a4,80(s0) +.L42: + andi a4,a4,0xff + mv a3,a4 +.L24: + lui a2,%hi(xfer_shift_ctrl+2) + sb a4,%lo(xfer_shift_ctrl+2)(a2) #APP csrw 2000, 2 #NO_APP @@ -234,38 +239,36 @@ hrt_write: li a2,1 add a5,s0,a5 lw a4,4(a5) - beq a4,a2,.L26 + beq a4,a2,.L25 li a2,2 - beq a4,a2,.L27 + beq a4,a2,.L26 li a5,32 div a5,a5,a3 - j .L44 -.L20: - andi a5,a5,0xff - j .L22 -.L23: - lbu a3,81(s0) - j .L43 -.L24: - lbu a3,83(s0) j .L43 -.L26: +.L23: + lbu a4,81(s0) + j .L42 +.L36: + li a4,0 + li a3,0 + j .L24 +.L25: lbu a5,8(a5) -.L44: +.L43: #APP csrw 3022, a5 #NO_APP - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L30 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L29 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP -.L31: +.L30: #APP csrr s1, 3008 #NO_APP @@ -290,30 +293,30 @@ hrt_write: addi a0,s0,60 call hrt_tx lbu a5,92(s0) - bne a5,zero,.L32 + bne a5,zero,.L31 li a5,4096 addi a5,a5,1 #APP csrw 3019, a5 #NO_APP - li a4,131072 - slli a5,s1,1 - addi a4,a4,-2 - and a5,a5,a4 + li a5,131072 + addi a5,a5,-2 + slli s1,s1,1 + and s1,s1,a5 #APP - csrw 3012, a5 + csrw 3012, s1 csrw 2000, 0 #NO_APP -.L33: +.L32: #APP csrw 2005, 0 #NO_APP lbu a5,87(s0) bne a5,zero,.L19 - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L36 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L35 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 @@ -326,24 +329,24 @@ hrt_write: lw s1,4(sp) addi sp,sp,16 jr ra -.L27: +.L26: lbu a5,9(a5) - j .L44 -.L30: - li a5,1 + j .L43 +.L29: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP - j .L31 -.L32: + j .L30 +.L31: #APP csrr a5, 3022 #NO_APP andi a5,a5,0xff - bne a5,zero,.L32 + bne a5,zero,.L31 #APP csrw 2000, 0 #NO_APP @@ -354,21 +357,21 @@ hrt_write: #NO_APP lbu a4,92(s0) li a5,1 - bne a4,a5,.L34 + bne a4,a5,.L33 #APP - csrc 3008, 1 + csrc 3008, a5 #NO_APP - j .L33 -.L34: + j .L32 +.L33: lbu a4,92(s0) li a5,3 - bne a4,a5,.L33 + bne a4,a5,.L32 #APP csrs 3008, 1 #NO_APP - j .L33 -.L36: - li a5,1 + j .L32 +.L35: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 @@ -392,30 +395,30 @@ hrt_read: lw s1,64(a0) lbu a3,87(a0) lw a2,60(a0) - lbu a5,88(a0) - lbu a1,86(a0) + lbu a1,88(a0) mv s0,a0 andi a4,a4,0xff andi a3,a3,0xff - bne a5,zero,.L46 li a5,1 + bne a1,zero,.L45 + lbu a1,86(a0) sll a5,a5,a1 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP -.L47: +.L46: #APP csrr a5, 3008 #NO_APP lw a5,4(s0) - bne a5,zero,.L48 + bne a5,zero,.L47 lw a5,24(s0) - bne a5,zero,.L48 + bne a5,zero,.L47 lw a5,44(s0) - beq a5,zero,.L49 -.L48: + beq a5,zero,.L48 +.L47: sw zero,64(s0) li a5,1 sb a5,87(s0) @@ -427,7 +430,7 @@ hrt_read: lw a2,8(sp) lw a3,4(sp) lw a4,0(sp) -.L49: +.L48: sw s1,64(s0) sb a3,87(s0) #APP @@ -437,11 +440,11 @@ hrt_read: lbu a1,83(s0) li a3,1 li a5,4 - bleu a1,a3,.L50 + bleu a1,a3,.L49 lbu a3,83(s0) - beq a3,a5,.L70 + beq a3,a5,.L69 li a5,6 -.L50: +.L49: #APP csrr a3, 3009 #NO_APP @@ -464,28 +467,28 @@ hrt_read: csrw 3043, a5 #NO_APP li a5,1 - beq s1,a5,.L51 + beq s1,a5,.L50 li a5,2 - beq s1,a5,.L52 + beq s1,a5,.L51 lbu a3,83(s0) li a5,32 div a5,a5,a3 - j .L81 -.L46: - li a5,1 + j .L80 +.L45: + lbu a1,86(a0) sll a5,a5,a1 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP - j .L47 -.L70: + j .L46 +.L69: li a5,30 - j .L50 -.L51: + j .L49 +.L50: lbu a5,68(s0) -.L81: +.L80: addi a5,a5,-1 andi a5,a5,255 #APP @@ -535,45 +538,45 @@ hrt_read: addi a3,s1,-1 li a0,2 li t1,32 -.L55: - bne a3,zero,.L60 +.L54: + bne a3,zero,.L59 #APP csrw 3023, 0 #NO_APP -.L61: +.L60: #APP csrr a5, 3021 #NO_APP andi a5,a5,0xff - bne a5,zero,.L61 + bne a5,zero,.L60 #APP csrw 2010, 0 #NO_APP lbu a5,92(s0) - beq a5,zero,.L62 + beq a5,zero,.L61 lbu a3,92(s0) li a5,2 - bne a3,a5,.L63 -.L62: + bne a3,a5,.L62 +.L61: #APP csrw 2010, 0 #NO_APP -.L63: +.L62: #APP csrw 2000, 0 csrw 2001, 0 csrr a5, 3018 #NO_APP li a3,1 - bne s1,a3,.L64 + bne s1,a3,.L63 lbu a2,68(s0) li a3,2 - bne a2,a3,.L64 + bne a2,a3,.L63 lbu a2,83(s0) li a3,8 - bne a2,a3,.L65 + bne a2,a3,.L64 srli a5,a5,16 -.L83: +.L82: sw a5,72(s0) #APP csrw 2010, 0 @@ -582,35 +585,35 @@ hrt_read: csrw 3011, 0 #NO_APP lbu a5,87(s0) - bne a5,zero,.L45 - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L68 + bne a5,zero,.L44 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L67 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP -.L45: +.L44: lw ra,20(sp) lw s0,16(sp) lw s1,12(sp) addi sp,sp,24 jr ra -.L52: +.L51: lbu a5,69(s0) - j .L81 -.L60: - beq a3,a1,.L56 - beq a3,a0,.L57 + j .L80 +.L59: + beq a3,a1,.L55 + beq a3,a0,.L56 lbu a5,83(s0) div a5,t1,a5 - j .L82 -.L56: + j .L81 +.L55: lbu a5,68(s0) -.L82: +.L81: addi a5,a5,-1 andi a5,a5,255 #APP @@ -620,30 +623,30 @@ hrt_read: sw a5,0(a2) addi a3,a3,-1 addi a2,a2,4 - j .L55 -.L57: + j .L54 +.L56: lbu a5,69(s0) - j .L82 -.L65: - srli a5,a5,24 - j .L83 + j .L81 .L64: + srli a5,a5,24 + j .L82 +.L63: lbu a2,68(s0) lbu a3,83(s0) mul a2,a2,a3 li a3,32 sub a3,a3,a2 srl a5,a5,a3 - j .L83 -.L68: - li a5,1 + j .L82 +.L67: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP - j .L45 + j .L44 .size hrt_read, .-hrt_read .section .sdata.xfer_shift_ctrl,"aw" .align 2 @@ -654,3 +657,4 @@ xfer_shift_ctrl: .byte 4 .byte 1 .byte 0 + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/mspi/src/hrt/hrt-nrf54lm20b.s b/applications/hpf/mspi/src/hrt/hrt-nrf54lm20b.s index cf09170e3dcf..343ec3162a4d 100644 --- a/applications/hpf/mspi/src/hrt/hrt-nrf54lm20b.s +++ b/applications/hpf/mspi/src/hrt/hrt-nrf54lm20b.s @@ -1,6 +1,6 @@ .file "hrt.c" .option nopic - .attribute arch, "rv32e1p9_m2p0_c2p0_zicsr2p0" + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" .attribute unaligned_access, 0 .attribute stack_align, 4 .text @@ -9,32 +9,33 @@ .type hrt_tx, @function hrt_tx: lw a5,4(a0) - addi sp,sp,-16 - sw s0,12(sp) - sw s1,8(sp) - sw a2,0(sp) + addi sp,sp,-20 + sw s0,16(sp) + sw s1,12(sp) + sw a2,4(sp) beq a5,zero,.L1 li a4,32 div a4,a4,a1 - lui t2,%hi(xfer_shift_ctrl) - addi a2,t2,%lo(xfer_shift_ctrl) - lbu s1,2(a2) - lbu a5,1(a2) + lui t1,%hi(xfer_shift_ctrl) + addi a2,t1,%lo(xfer_shift_ctrl) + lbu a5,2(a2) sb a1,2(a2) + li t0,3145728 + sw a5,0(sp) + lbu a5,1(a2) lbu a2,3(a2) - li t1,3145728 slli a5,a5,8 slli a2,a2,20 - and a2,a2,t1 + and a2,a2,t0 andi a5,a5,1792 or a5,a5,a2 - li t1,126976 + li t0,126976 slli a2,a1,12 - and a2,a2,t1 + and a2,a2,t0 or a5,a5,a2 addi a4,a4,-1 andi a4,a4,0xff - sb a4,%lo(xfer_shift_ctrl)(t2) + sb a4,%lo(xfer_shift_ctrl)(t1) andi a4,a4,63 or a5,a5,a4 #APP @@ -44,22 +45,21 @@ hrt_tx: slli a5,a1,16 and a5,a5,a4 ori a5,a5,4 - sw a5,4(sp) - li t1,0 - addi t0,t2,%lo(xfer_shift_ctrl) + li a2,0 + li t2,1 + sw a5,8(sp) .L3: lw a5,4(a0) - bltu t1,a5,.L14 + bltu a2,a5,.L14 .L1: - lw s0,12(sp) - lw s1,8(sp) - addi sp,sp,16 + lw s0,16(sp) + lw s1,12(sp) + addi sp,sp,20 jr ra .L14: lw a5,4(a0) - li a4,1 - sub a5,a5,t1 - beq a5,a4,.L4 + sub a5,a5,a2 + beq a5,t2,.L4 li a4,2 beq a5,a4,.L5 .L6: @@ -67,59 +67,59 @@ hrt_tx: li a5,0 beq a4,zero,.L7 lw a5,0(a0) - slli a4,t1,2 + slli a4,a2,2 add a5,a5,a4 lw a5,0(a5) j .L7 .L4: - lbu a2,1(t0) - lbu a5,2(t0) - li s0,126976 - slli a2,a2,8 - slli a5,a5,12 - and a5,a5,s0 - andi a2,a2,1792 - or a2,a2,a5 - lbu a4,8(a0) - lbu a5,3(t0) + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,8(a0) + lbu t0,3(s0) li s0,3145728 - addi a4,a4,-1 - slli a5,a5,20 - andi a4,a4,0xff - and a5,a5,s0 - sb a4,%lo(xfer_shift_ctrl)(t2) - or a5,a2,a5 - andi a4,a4,63 - or a5,a5,a4 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 #APP - csrw 3019, a5 + csrw 3019, t0 #NO_APP lw a5,12(a0) .L7: - beq a1,s1,.L8 + lw a4,0(sp) + beq a1,a4,.L8 .L9: #APP csrr a4, 3022 #NO_APP andi a4,a4,0xff bne a4,zero,.L9 - lw a4,4(sp) + lw a4,8(sp) #APP csrw 3043, a4 #NO_APP - mv s1,a1 .L8: lbu a4,16(a0) - andi a2,a4,0xff + andi t0,a4,0xff beq a4,zero,.L10 - li a4,1 - bne a2,a4,.L11 + bne t0,t2,.L11 #APP csrw 3017, a5 #NO_APP .L11: - bne t1,zero,.L12 - lw a5,0(sp) + bne a2,zero,.L12 + lw a5,4(sp) lbu a5,0(a5) bne a5,zero,.L12 mv a5,a3 @@ -131,34 +131,35 @@ hrt_tx: #APP csrw 2005, a3 #NO_APP - lw a5,0(sp) - li a4,1 - sb a4,0(a5) + lw a5,4(sp) + sb t2,0(a5) .L12: - addi t1,t1,1 + addi a2,a2,1 + sw a1,0(sp) j .L3 .L5: - lbu a2,1(t0) - lbu a5,2(t0) - li s0,126976 - slli a2,a2,8 - slli a5,a5,12 - and a5,a5,s0 - andi a2,a2,1792 - or a2,a2,a5 - lbu a4,9(a0) - lbu a5,3(t0) + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,9(a0) + lbu t0,3(s0) li s0,3145728 - addi a4,a4,-1 - slli a5,a5,20 - andi a4,a4,0xff - and a5,a5,s0 - sb a4,%lo(xfer_shift_ctrl)(t2) - or a5,a2,a5 - andi a4,a4,63 - or a5,a5,a4 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 #APP - csrw 3019, a5 + csrw 3019, t0 #NO_APP j .L6 .L10: @@ -194,18 +195,22 @@ hrt_write: bne a5,a3,.L21 li a5,3 .L22: - li a4,1 - beq a5,a4,.L23 - li a4,3 - beq a5,a4,.L24 - li a3,0 - bne a5,zero,.L25 - lbu a3,80(s0) -.L43: - andi a3,a3,0xff -.L25: - lui a4,%hi(xfer_shift_ctrl+2) - sb a3,%lo(xfer_shift_ctrl+2)(a4) + lbu a4,83(s0) + j .L42 +.L20: + andi a4,a5,0xff + li a3,1 + beq a4,a3,.L23 + li a3,3 + beq a4,a3,.L22 + bne a4,zero,.L36 + lbu a4,80(s0) +.L42: + andi a4,a4,0xff + mv a3,a4 +.L24: + lui a2,%hi(xfer_shift_ctrl+2) + sb a4,%lo(xfer_shift_ctrl+2)(a2) #APP csrw 2000, 2 #NO_APP @@ -234,38 +239,36 @@ hrt_write: li a2,1 add a5,s0,a5 lw a4,4(a5) - beq a4,a2,.L26 + beq a4,a2,.L25 li a2,2 - beq a4,a2,.L27 + beq a4,a2,.L26 li a5,32 div a5,a5,a3 - j .L44 -.L20: - andi a5,a5,0xff - j .L22 -.L23: - lbu a3,81(s0) - j .L43 -.L24: - lbu a3,83(s0) j .L43 -.L26: +.L23: + lbu a4,81(s0) + j .L42 +.L36: + li a4,0 + li a3,0 + j .L24 +.L25: lbu a5,8(a5) -.L44: +.L43: #APP csrw 3022, a5 #NO_APP - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L30 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L29 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP -.L31: +.L30: #APP csrr s1, 3008 #NO_APP @@ -290,30 +293,30 @@ hrt_write: addi a0,s0,60 call hrt_tx lbu a5,92(s0) - bne a5,zero,.L32 + bne a5,zero,.L31 li a5,4096 addi a5,a5,1 #APP csrw 3019, a5 #NO_APP - li a4,131072 - slli a5,s1,1 - addi a4,a4,-2 - and a5,a5,a4 + li a5,131072 + addi a5,a5,-2 + slli s1,s1,1 + and s1,s1,a5 #APP - csrw 3012, a5 + csrw 3012, s1 csrw 2000, 0 #NO_APP -.L33: +.L32: #APP csrw 2005, 0 #NO_APP lbu a5,87(s0) bne a5,zero,.L19 - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L36 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L35 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 @@ -326,24 +329,24 @@ hrt_write: lw s1,4(sp) addi sp,sp,16 jr ra -.L27: +.L26: lbu a5,9(a5) - j .L44 -.L30: - li a5,1 + j .L43 +.L29: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP - j .L31 -.L32: + j .L30 +.L31: #APP csrr a5, 3022 #NO_APP andi a5,a5,0xff - bne a5,zero,.L32 + bne a5,zero,.L31 #APP csrw 2000, 0 #NO_APP @@ -354,21 +357,21 @@ hrt_write: #NO_APP lbu a4,92(s0) li a5,1 - bne a4,a5,.L34 + bne a4,a5,.L33 #APP - csrc 3008, 1 + csrc 3008, a5 #NO_APP - j .L33 -.L34: + j .L32 +.L33: lbu a4,92(s0) li a5,3 - bne a4,a5,.L33 + bne a4,a5,.L32 #APP csrs 3008, 1 #NO_APP - j .L33 -.L36: - li a5,1 + j .L32 +.L35: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 @@ -392,30 +395,30 @@ hrt_read: lw s1,64(a0) lbu a3,87(a0) lw a2,60(a0) - lbu a5,88(a0) - lbu a1,86(a0) + lbu a1,88(a0) mv s0,a0 andi a4,a4,0xff andi a3,a3,0xff - bne a5,zero,.L46 li a5,1 + bne a1,zero,.L45 + lbu a1,86(a0) sll a5,a5,a1 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP -.L47: +.L46: #APP csrr a5, 3008 #NO_APP lw a5,4(s0) - bne a5,zero,.L48 + bne a5,zero,.L47 lw a5,24(s0) - bne a5,zero,.L48 + bne a5,zero,.L47 lw a5,44(s0) - beq a5,zero,.L49 -.L48: + beq a5,zero,.L48 +.L47: sw zero,64(s0) li a5,1 sb a5,87(s0) @@ -427,7 +430,7 @@ hrt_read: lw a2,8(sp) lw a3,4(sp) lw a4,0(sp) -.L49: +.L48: sw s1,64(s0) sb a3,87(s0) #APP @@ -437,11 +440,11 @@ hrt_read: lbu a1,83(s0) li a3,1 li a5,4 - bleu a1,a3,.L50 + bleu a1,a3,.L49 lbu a3,83(s0) - beq a3,a5,.L70 + beq a3,a5,.L69 li a5,6 -.L50: +.L49: #APP csrr a3, 3009 #NO_APP @@ -464,28 +467,28 @@ hrt_read: csrw 3043, a5 #NO_APP li a5,1 - beq s1,a5,.L51 + beq s1,a5,.L50 li a5,2 - beq s1,a5,.L52 + beq s1,a5,.L51 lbu a3,83(s0) li a5,32 div a5,a5,a3 - j .L81 -.L46: - li a5,1 + j .L80 +.L45: + lbu a1,86(a0) sll a5,a5,a1 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP - j .L47 -.L70: + j .L46 +.L69: li a5,30 - j .L50 -.L51: + j .L49 +.L50: lbu a5,68(s0) -.L81: +.L80: addi a5,a5,-1 andi a5,a5,255 #APP @@ -535,45 +538,45 @@ hrt_read: addi a3,s1,-1 li a0,2 li t1,32 -.L55: - bne a3,zero,.L60 +.L54: + bne a3,zero,.L59 #APP csrw 3023, 0 #NO_APP -.L61: +.L60: #APP csrr a5, 3021 #NO_APP andi a5,a5,0xff - bne a5,zero,.L61 + bne a5,zero,.L60 #APP csrw 2010, 0 #NO_APP lbu a5,92(s0) - beq a5,zero,.L62 + beq a5,zero,.L61 lbu a3,92(s0) li a5,2 - bne a3,a5,.L63 -.L62: + bne a3,a5,.L62 +.L61: #APP csrw 2010, 0 #NO_APP -.L63: +.L62: #APP csrw 2000, 0 csrw 2001, 0 csrr a5, 3018 #NO_APP li a3,1 - bne s1,a3,.L64 + bne s1,a3,.L63 lbu a2,68(s0) li a3,2 - bne a2,a3,.L64 + bne a2,a3,.L63 lbu a2,83(s0) li a3,8 - bne a2,a3,.L65 + bne a2,a3,.L64 srli a5,a5,16 -.L83: +.L82: sw a5,72(s0) #APP csrw 2010, 0 @@ -582,35 +585,35 @@ hrt_read: csrw 3011, 0 #NO_APP lbu a5,87(s0) - bne a5,zero,.L45 - lbu a5,88(s0) - lbu a4,86(s0) - bne a5,zero,.L68 + bne a5,zero,.L44 + lbu a4,88(s0) li a5,1 + bne a4,zero,.L67 + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrs 3008, a5 #NO_APP -.L45: +.L44: lw ra,20(sp) lw s0,16(sp) lw s1,12(sp) addi sp,sp,24 jr ra -.L52: +.L51: lbu a5,69(s0) - j .L81 -.L60: - beq a3,a1,.L56 - beq a3,a0,.L57 + j .L80 +.L59: + beq a3,a1,.L55 + beq a3,a0,.L56 lbu a5,83(s0) div a5,t1,a5 - j .L82 -.L56: + j .L81 +.L55: lbu a5,68(s0) -.L82: +.L81: addi a5,a5,-1 andi a5,a5,255 #APP @@ -620,30 +623,30 @@ hrt_read: sw a5,0(a2) addi a3,a3,-1 addi a2,a2,4 - j .L55 -.L57: + j .L54 +.L56: lbu a5,69(s0) - j .L82 -.L65: - srli a5,a5,24 - j .L83 + j .L81 .L64: + srli a5,a5,24 + j .L82 +.L63: lbu a2,68(s0) lbu a3,83(s0) mul a2,a2,a3 li a3,32 sub a3,a3,a2 srl a5,a5,a3 - j .L83 -.L68: - li a5,1 + j .L82 +.L67: + lbu a4,86(s0) sll a5,a5,a4 slli a5,a5,16 srli a5,a5,16 #APP csrc 3008, a5 #NO_APP - j .L45 + j .L44 .size hrt_read, .-hrt_read .section .sdata.xfer_shift_ctrl,"aw" .align 2 @@ -654,3 +657,4 @@ xfer_shift_ctrl: .byte 4 .byte 1 .byte 0 + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/mspi/src/hrt/hrt-nrf54lv10a.s b/applications/hpf/mspi/src/hrt/hrt-nrf54lv10a.s new file mode 100644 index 000000000000..343ec3162a4d --- /dev/null +++ b/applications/hpf/mspi/src/hrt/hrt-nrf54lv10a.s @@ -0,0 +1,660 @@ + .file "hrt.c" + .option nopic + .attribute arch, "rv32e2p0_m2p0_c2p0_zicsr2p0" + .attribute unaligned_access, 0 + .attribute stack_align, 4 + .text + .section .text.hrt_tx,"ax",@progbits + .align 1 + .type hrt_tx, @function +hrt_tx: + lw a5,4(a0) + addi sp,sp,-20 + sw s0,16(sp) + sw s1,12(sp) + sw a2,4(sp) + beq a5,zero,.L1 + li a4,32 + div a4,a4,a1 + lui t1,%hi(xfer_shift_ctrl) + addi a2,t1,%lo(xfer_shift_ctrl) + lbu a5,2(a2) + sb a1,2(a2) + li t0,3145728 + sw a5,0(sp) + lbu a5,1(a2) + lbu a2,3(a2) + slli a5,a5,8 + slli a2,a2,20 + and a2,a2,t0 + andi a5,a5,1792 + or a5,a5,a2 + li t0,126976 + slli a2,a1,12 + and a2,a2,t0 + or a5,a5,a2 + addi a4,a4,-1 + andi a4,a4,0xff + sb a4,%lo(xfer_shift_ctrl)(t1) + andi a4,a4,63 + or a5,a5,a4 + #APP + csrw 3019, a5 + #NO_APP + li a4,2031616 + slli a5,a1,16 + and a5,a5,a4 + ori a5,a5,4 + li a2,0 + li t2,1 + sw a5,8(sp) +.L3: + lw a5,4(a0) + bltu a2,a5,.L14 +.L1: + lw s0,16(sp) + lw s1,12(sp) + addi sp,sp,20 + jr ra +.L14: + lw a5,4(a0) + sub a5,a5,a2 + beq a5,t2,.L4 + li a4,2 + beq a5,a4,.L5 +.L6: + lw a4,0(a0) + li a5,0 + beq a4,zero,.L7 + lw a5,0(a0) + slli a4,a2,2 + add a5,a5,a4 + lw a5,0(a5) + j .L7 +.L4: + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,8(a0) + lbu t0,3(s0) + li s0,3145728 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 + #APP + csrw 3019, t0 + #NO_APP + lw a5,12(a0) +.L7: + lw a4,0(sp) + beq a1,a4,.L8 +.L9: + #APP + csrr a4, 3022 + #NO_APP + andi a4,a4,0xff + bne a4,zero,.L9 + lw a4,8(sp) + #APP + csrw 3043, a4 + #NO_APP +.L8: + lbu a4,16(a0) + andi t0,a4,0xff + beq a4,zero,.L10 + bne t0,t2,.L11 + #APP + csrw 3017, a5 + #NO_APP +.L11: + bne a2,zero,.L12 + lw a5,4(sp) + lbu a5,0(a5) + bne a5,zero,.L12 + mv a5,a3 + bne a3,zero,.L13 + li a5,1 +.L13: + slli a3,a5,16 + srli a3,a3,16 + #APP + csrw 2005, a3 + #NO_APP + lw a5,4(sp) + sb t2,0(a5) +.L12: + addi a2,a2,1 + sw a1,0(sp) + j .L3 +.L5: + addi s0,t1,%lo(xfer_shift_ctrl) + lbu t0,1(s0) + lbu a4,2(s0) + li s1,126976 + slli t0,t0,8 + slli a4,a4,12 + andi t0,t0,1792 + and a4,a4,s1 + or a4,t0,a4 + lbu a5,9(a0) + lbu t0,3(s0) + li s0,3145728 + addi a5,a5,-1 + slli t0,t0,20 + andi a5,a5,0xff + and t0,t0,s0 + sb a5,%lo(xfer_shift_ctrl)(t1) + or t0,a4,t0 + andi a5,a5,63 + or t0,t0,a5 + #APP + csrw 3019, t0 + #NO_APP + j .L6 +.L10: + #APP + csrw 3016, a5 + #NO_APP + j .L11 + .size hrt_tx, .-hrt_tx + .section .text.hrt_write,"ax",@progbits + .align 1 + .globl hrt_write + .type hrt_write, @function +hrt_write: + addi sp,sp,-16 + sw s0,8(sp) + sw ra,12(sp) + sw s1,4(sp) + mv s0,a0 + sb zero,3(sp) + lhu a5,90(a0) + #APP + csrw 3009, a5 + #NO_APP + li a5,0 + li a2,20 + li a3,4 +.L21: + mul a4,a5,a2 + add a4,s0,a4 + lw a4,4(a4) + bne a4,zero,.L20 + addi a5,a5,1 + bne a5,a3,.L21 + li a5,3 +.L22: + lbu a4,83(s0) + j .L42 +.L20: + andi a4,a5,0xff + li a3,1 + beq a4,a3,.L23 + li a3,3 + beq a4,a3,.L22 + bne a4,zero,.L36 + lbu a4,80(s0) +.L42: + andi a4,a4,0xff + mv a3,a4 +.L24: + lui a2,%hi(xfer_shift_ctrl+2) + sb a4,%lo(xfer_shift_ctrl+2)(a2) + #APP + csrw 2000, 2 + #NO_APP + lhu a4,84(s0) + slli a4,a4,16 + srli a4,a4,16 + #APP + csrr a2, 2003 + #NO_APP + li a1,-65536 + and a2,a2,a1 + or a4,a4,a2 + #APP + csrw 2003, a4 + csrw 3011, 0 + #NO_APP + li a2,2031616 + slli a4,a3,16 + and a4,a4,a2 + ori a4,a4,4 + #APP + csrw 3043, a4 + #NO_APP + li a4,20 + mul a5,a5,a4 + li a2,1 + add a5,s0,a5 + lw a4,4(a5) + beq a4,a2,.L25 + li a2,2 + beq a4,a2,.L26 + li a5,32 + div a5,a5,a3 + j .L43 +.L23: + lbu a4,81(s0) + j .L42 +.L36: + li a4,0 + li a3,0 + j .L24 +.L25: + lbu a5,8(a5) +.L43: + #APP + csrw 3022, a5 + #NO_APP + lbu a4,88(s0) + li a5,1 + bne a4,zero,.L29 + lbu a4,86(s0) + sll a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrc 3008, a5 + #NO_APP +.L30: + #APP + csrr s1, 3008 + #NO_APP + lbu a1,80(s0) + lhu a3,84(s0) + addi a2,sp,3 + mv a0,s0 + call hrt_tx + lbu a1,81(s0) + lhu a3,84(s0) + addi a2,sp,3 + addi a0,s0,20 + call hrt_tx + lbu a1,82(s0) + lhu a3,84(s0) + addi a2,sp,3 + addi a0,s0,40 + call hrt_tx + lbu a1,83(s0) + lhu a3,84(s0) + addi a2,sp,3 + addi a0,s0,60 + call hrt_tx + lbu a5,92(s0) + bne a5,zero,.L31 + li a5,4096 + addi a5,a5,1 + #APP + csrw 3019, a5 + #NO_APP + li a5,131072 + addi a5,a5,-2 + slli s1,s1,1 + and s1,s1,a5 + #APP + csrw 3012, s1 + csrw 2000, 0 + #NO_APP +.L32: + #APP + csrw 2005, 0 + #NO_APP + lbu a5,87(s0) + bne a5,zero,.L19 + lbu a4,88(s0) + li a5,1 + bne a4,zero,.L35 + lbu a4,86(s0) + sll a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrs 3008, a5 + #NO_APP +.L19: + lw ra,12(sp) + lw s0,8(sp) + lw s1,4(sp) + addi sp,sp,16 + jr ra +.L26: + lbu a5,9(a5) + j .L43 +.L29: + lbu a4,86(s0) + sll a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrs 3008, a5 + #NO_APP + j .L30 +.L31: + #APP + csrr a5, 3022 + #NO_APP + andi a5,a5,0xff + bne a5,zero,.L31 + #APP + csrw 2000, 0 + #NO_APP + li a5,4096 + addi a5,a5,1 + #APP + csrw 3019, a5 + #NO_APP + lbu a4,92(s0) + li a5,1 + bne a4,a5,.L33 + #APP + csrc 3008, a5 + #NO_APP + j .L32 +.L33: + lbu a4,92(s0) + li a5,3 + bne a4,a5,.L32 + #APP + csrs 3008, 1 + #NO_APP + j .L32 +.L35: + lbu a4,86(s0) + sll a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrc 3008, a5 + #NO_APP + j .L19 + .size hrt_write, .-hrt_write + .section .text.hrt_read,"ax",@progbits + .align 1 + .globl hrt_read + .type hrt_read, @function +hrt_read: + addi sp,sp,-24 + sw s0,16(sp) + sw ra,20(sp) + sw s1,12(sp) + lbu a5,83(a0) + lbu a5,83(a0) + lbu a4,83(a0) + lw s1,64(a0) + lbu a3,87(a0) + lw a2,60(a0) + lbu a1,88(a0) + mv s0,a0 + andi a4,a4,0xff + andi a3,a3,0xff + li a5,1 + bne a1,zero,.L45 + lbu a1,86(a0) + sll a5,a5,a1 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrc 3008, a5 + #NO_APP +.L46: + #APP + csrr a5, 3008 + #NO_APP + lw a5,4(s0) + bne a5,zero,.L47 + lw a5,24(s0) + bne a5,zero,.L47 + lw a5,44(s0) + beq a5,zero,.L48 +.L47: + sw zero,64(s0) + li a5,1 + sb a5,87(s0) + mv a0,s0 + sw a2,8(sp) + sw a3,4(sp) + sw a4,0(sp) + call hrt_write + lw a2,8(sp) + lw a3,4(sp) + lw a4,0(sp) +.L48: + sw s1,64(s0) + sb a3,87(s0) + #APP + csrw 3022, 0 + csrw 2010, 0 + #NO_APP + lbu a1,83(s0) + li a3,1 + li a5,4 + bleu a1,a3,.L49 + lbu a3,83(s0) + beq a3,a5,.L69 + li a5,6 +.L49: + #APP + csrr a3, 3009 + #NO_APP + not a5,a5 + and a5,a5,a3 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrw 3009, a5 + #NO_APP + li a5,-1 + #APP + csrw 2002, a5 + #NO_APP + li a5,2031616 + slli a4,a4,16 + and a4,a4,a5 + ori a5,a4,4 + #APP + csrw 3043, a5 + #NO_APP + li a5,1 + beq s1,a5,.L50 + li a5,2 + beq s1,a5,.L51 + lbu a3,83(s0) + li a5,32 + div a5,a5,a3 + j .L80 +.L45: + lbu a1,86(a0) + sll a5,a5,a1 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrs 3008, a5 + #NO_APP + j .L46 +.L69: + li a5,30 + j .L49 +.L50: + lbu a5,68(s0) +.L80: + addi a5,a5,-1 + andi a5,a5,255 + #APP + csrw 3023, a5 + csrw 3022, 0 + csrw 3021, 0 + csrw 3011, 2 + csrw 2000, 2 + csrw 2001, 2 + #NO_APP + lhu a5,84(s0) + slli a5,a5,16 + srli a5,a5,16 + #APP + csrr a3, 2003 + #NO_APP + li a1,-65536 + and a3,a3,a1 + or a5,a5,a3 + #APP + csrw 2003, a5 + #NO_APP + lhu a5,84(s0) + slli a5,a5,16 + srli a5,a5,16 + #APP + csrr a3, 2003 + #NO_APP + slli a5,a5,1 + slli a3,a3,16 + addi a5,a5,1 + srli a3,a3,16 + slli a5,a5,16 + or a5,a5,a3 + #APP + csrw 2003, a5 + #NO_APP + lhu a5,84(s0) + li a3,65536 + or a5,a5,a3 + #APP + csrw 2002, a5 + csrw 2010, 0 + csrr a5, 3018 + #NO_APP + li a1,1 + addi a3,s1,-1 + li a0,2 + li t1,32 +.L54: + bne a3,zero,.L59 + #APP + csrw 3023, 0 + #NO_APP +.L60: + #APP + csrr a5, 3021 + #NO_APP + andi a5,a5,0xff + bne a5,zero,.L60 + #APP + csrw 2010, 0 + #NO_APP + lbu a5,92(s0) + beq a5,zero,.L61 + lbu a3,92(s0) + li a5,2 + bne a3,a5,.L62 +.L61: + #APP + csrw 2010, 0 + #NO_APP +.L62: + #APP + csrw 2000, 0 + csrw 2001, 0 + csrr a5, 3018 + #NO_APP + li a3,1 + bne s1,a3,.L63 + lbu a2,68(s0) + li a3,2 + bne a2,a3,.L63 + lbu a2,83(s0) + li a3,8 + bne a2,a3,.L64 + srli a5,a5,16 +.L82: + sw a5,72(s0) + #APP + csrw 2010, 0 + csrw 3022, 0 + csrw 3043, a4 + csrw 3011, 0 + #NO_APP + lbu a5,87(s0) + bne a5,zero,.L44 + lbu a4,88(s0) + li a5,1 + bne a4,zero,.L67 + lbu a4,86(s0) + sll a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrs 3008, a5 + #NO_APP +.L44: + lw ra,20(sp) + lw s0,16(sp) + lw s1,12(sp) + addi sp,sp,24 + jr ra +.L51: + lbu a5,69(s0) + j .L80 +.L59: + beq a3,a1,.L55 + beq a3,a0,.L56 + lbu a5,83(s0) + div a5,t1,a5 + j .L81 +.L55: + lbu a5,68(s0) +.L81: + addi a5,a5,-1 + andi a5,a5,255 + #APP + csrw 3023, a5 + csrr a5, 3018 + #NO_APP + sw a5,0(a2) + addi a3,a3,-1 + addi a2,a2,4 + j .L54 +.L56: + lbu a5,69(s0) + j .L81 +.L64: + srli a5,a5,24 + j .L82 +.L63: + lbu a2,68(s0) + lbu a3,83(s0) + mul a2,a2,a3 + li a3,32 + sub a3,a3,a2 + srl a5,a5,a3 + j .L82 +.L67: + lbu a4,86(s0) + sll a5,a5,a4 + slli a5,a5,16 + srli a5,a5,16 + #APP + csrc 3008, a5 + #NO_APP + j .L44 + .size hrt_read, .-hrt_read + .section .sdata.xfer_shift_ctrl,"aw" + .align 2 + .type xfer_shift_ctrl, @object + .size xfer_shift_ctrl, 4 +xfer_shift_ctrl: + .byte 31 + .byte 4 + .byte 1 + .byte 0 + .section .note.GNU-stack,"",@progbits diff --git a/applications/hpf/mspi/src/hrt/hrt.c b/applications/hpf/mspi/src/hrt/hrt.c index 0254f3b20762..6f4a176694ee 100644 --- a/applications/hpf/mspi/src/hrt/hrt.c +++ b/applications/hpf/mspi/src/hrt/hrt.c @@ -324,7 +324,8 @@ void hrt_write(volatile hrt_xfer_t *hrt_xfer_params) } } -#if defined(CONFIG_SOC_NRF54LM20A) || defined(CONFIG_SOC_NRF54LM20B) +#if defined(CONFIG_SOC_NRF54LM20A) || defined(CONFIG_SOC_NRF54LM20B) || \ + defined(CONFIG_SOC_NRF54LV10A) void hrt_read(volatile hrt_xfer_t *hrt_xfer_params) { nrf_vpr_csr_vio_shift_ctrl_t rx_shift_ctrl = { diff --git a/applications/hpf/mspi/src/main.c b/applications/hpf/mspi/src/main.c index ccc0d286c68c..4dabf181ea08 100644 --- a/applications/hpf/mspi/src/main.c +++ b/applications/hpf/mspi/src/main.c @@ -37,6 +37,7 @@ #define MAX_SHIFT_COUNT 63 +#define INVALID_VIO UINT8_MAX #define DATA_PIN_UNUSED UINT8_MAX #define CE_PIN_UNUSED UINT8_MAX @@ -47,18 +48,10 @@ #define VEVIF_IRQN(vevif) VEVIF_IRQN_1(vevif) #define VEVIF_IRQN_1(vevif) VPRCLIC_##vevif##_IRQn -#if !defined(CONFIG_SOC_NRF54L15) && !defined(CONFIG_SOC_NRF54LM20A) && \ - !defined(CONFIG_SOC_NRF54LM20B) -#error "Unsupported SoC for HPF MSPI" -#endif - -#define DATA_LINE_INDEX(pinctr_fun) (pinctr_fun - NRF_FUN_HPF_MSPI_DQ0) +#if defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54LM20A) || \ + defined(CONFIG_SOC_NRF54LM20B) -#ifndef CONFIG_HPF_MSPI_IPC_NO_COPY -BUILD_ASSERT(CONFIG_HPF_MSPI_MAX_RESPONSE_SIZE > 0, "Response max size should be greater that 0"); -#endif - -static const uint8_t pin_to_vio_map[HPF_MSPI_PINS_MAX] = { +static const uint8_t pin_to_vio_map[HPF_MSPI_PIN_COUNT] = { 4, /* Physical pin 0 */ 0, /* Physical pin 1 */ 1, /* Physical pin 2 */ @@ -71,6 +64,41 @@ static const uint8_t pin_to_vio_map[HPF_MSPI_PINS_MAX] = { 9, /* Physical pin 9 */ 10, /* Physical pin 10 */ }; +#define VIO_PIN_OFFSET 0 + +#elif defined(CONFIG_SOC_NRF54LV10A) +static const uint8_t pin_to_vio_map[HPF_MSPI_PIN_COUNT] = { + 4, /* Physical pin 15 */ + 0, /* Physical pin 16 */ + 1, /* Physical pin 17 */ + 3, /* Physical pin 18 */ + 2, /* Physical pin 19 */ + 5, /* Physical pin 20 */ + 6, /* Physical pin 21 */ + 7, /* Physical pin 22 */ + 8, /* Physical pin 23 */ + 9, /* Physical pin 24 */ +}; +#define VIO_PIN_OFFSET 15 + +#else +#error "Unsupported SoC for HPF MSPI" +#endif + +#define DATA_LINE_INDEX(pinctr_fun) (pinctr_fun - NRF_FUN_HPF_MSPI_DQ0) + +#ifndef CONFIG_HPF_MSPI_IPC_NO_COPY +BUILD_ASSERT(CONFIG_HPF_MSPI_MAX_RESPONSE_SIZE > 0, "Response max size should be greater that 0"); +#endif + +static uint8_t gpio_pin_to_vio_index(uint16_t pin) +{ + /* Check if the pin and the port can be accessed by VIO. */ + if ((pin >= VIO_PIN_OFFSET) && (pin < (VIO_PIN_OFFSET + HPF_MSPI_PIN_COUNT))) { + return pin_to_vio_map[pin - VIO_PIN_OFFSET]; + } + return INVALID_VIO; +} static const hrt_xfer_bus_widths_t io_modes[SUPPORTED_IO_MODES_COUNT] = { {1, 1, 1, 1}, /* MSPI_IO_MODE_SINGLE */ @@ -195,7 +223,8 @@ static void configure_clock(enum mspi_cpp_mode cpp_mode) { nrf_vpr_csr_vio_config_t vio_config = { .input_sel = false, -#if defined(CONFIG_SOC_NRF54LM20A) || defined(CONFIG_SOC_NRF54LM20B) +#if defined(CONFIG_SOC_NRF54LM20A) || defined(CONFIG_SOC_NRF54LM20B) || \ + defined(CONFIG_SOC_NRF54LV10A) .stop_cnt = false, #else .stop_cnt = true, @@ -372,12 +401,13 @@ static void config_pins(hpf_mspi_pinctrl_soc_pin_msg_t *pins_cfg) } uint8_t pin_number = NRF_PIN_NUMBER_TO_PIN(psel); + uint8_t vio_pin = gpio_pin_to_vio_index(pin_number); - NRFX_ASSERT(pin_number < HPF_MSPI_PINS_MAX); + NRFX_ASSERT(vio_pin != INVALID_VIO); if ((fun >= NRF_FUN_HPF_MSPI_CS0) && (fun <= NRF_FUN_HPF_MSPI_CS4)) { - ce_vios[ce_vios_count] = pin_to_vio_map[pin_number]; + ce_vios[ce_vios_count] = vio_pin; WRITE_BIT(xfer_params.used_pins_mask, ce_vios[ce_vios_count], VPRCSR_NORDIC_PIN_USED); ce_vios_count++; @@ -387,13 +417,12 @@ static void config_pins(hpf_mspi_pinctrl_soc_pin_msg_t *pins_cfg) NRFX_ASSERT(DATA_LINE_INDEX(fun) < DATA_PINS_MAX); NRFX_ASSERT(data_vios[DATA_LINE_INDEX(fun)] == DATA_PIN_UNUSED); - data_vios[DATA_LINE_INDEX(fun)] = pin_to_vio_map[pin_number]; + data_vios[DATA_LINE_INDEX(fun)] = vio_pin; WRITE_BIT(xfer_params.used_pins_mask, data_vios[DATA_LINE_INDEX(fun)], VPRCSR_NORDIC_PIN_USED); data_vios_count++; } else if (fun == NRF_FUN_HPF_MSPI_SCK) { - clk_vio = pin_to_vio_map[pin_number]; - WRITE_BIT(xfer_params.used_pins_mask, clk_vio, VPRCSR_NORDIC_PIN_USED); + WRITE_BIT(xfer_params.used_pins_mask, vio_pin, VPRCSR_NORDIC_PIN_USED); } } @@ -466,7 +495,8 @@ static void ep_recv(const void *data, size_t len, void *priv) } /* Set unshifted parts of OUT to high state */ -#if defined(CONFIG_SOC_NRF54LM20A) || defined(CONFIG_SOC_NRF54LM20B) +#if defined(CONFIG_SOC_NRF54LM20A) || defined(CONFIG_SOC_NRF54LM20B) || \ + defined(CONFIG_SOC_NRF54LV10A) nrf_csr_write(VPRCSR_NORDIC_OUTUB, BIT(data_vios[DATA_LINE_INDEX(NRF_FUN_HPF_MSPI_DQ1)]) | BIT(data_vios[DATA_LINE_INDEX(NRF_FUN_HPF_MSPI_DQ2)]) | @@ -508,12 +538,13 @@ static void ep_recv(const void *data, size_t len, void *priv) #endif configure_clock(hpf_mspi_devices[hpf_mspi_xfer_config_ptr->device_index].cpp); +#if defined(NRF_GPIOHSPADCTRL) /* Tune up pad bias for frequencies above 32MHz */ if (hpf_mspi_devices[hpf_mspi_xfer_config_ptr->device_index].cnt0_value <= STD_PAD_BIAS_CNT0_THRESHOLD) { NRF_GPIOHSPADCTRL->BIAS = PAD_BIAS_VALUE; } - +#endif break; } case HPF_MSPI_TX: @@ -548,7 +579,6 @@ static void ep_recv(const void *data, size_t len, void *priv) #else ); #endif - #if defined(CONFIG_HPF_MSPI_FAULT_TIMER) if (fault_timer != NULL) { nrf_timer_task_trigger(fault_timer, NRF_TIMER_TASK_CLEAR); diff --git a/applications/image_flasher/CMakeLists.txt b/applications/image_flasher/CMakeLists.txt index 5aa8218bf14e..03fbc51f8250 100644 --- a/applications/image_flasher/CMakeLists.txt +++ b/applications/image_flasher/CMakeLists.txt @@ -18,12 +18,11 @@ add_custom_target(runners_yaml_props_target) # Fetch hex file to flash from sysbuild zephyr_get(hex_file_to_flash SYSBUILD LOCAL VAR HEX_FILE) -zephyr_get(default_image SYSBUILD GLOBAL VAR IMAGE_FLASHER_DEFAULT_IMAGE) +zephyr_get(base_image SYSBUILD LOCAL VAR IMAGE_FLASHER_SPECIFIC_IMAGE) -# Set hex_file property to point to the hex file -set_target_properties(runners_yaml_props_target PROPERTIES - hex_file "${hex_file_to_flash}" -) +if(NOT base_image) + zephyr_get(base_image SYSBUILD GLOBAL VAR IMAGE_FLASHER_DEFAULT_IMAGE) +endif() # Override the runners.yaml path to use CMAKE_CURRENT_BINARY_DIR/zephyr instead of # PROJECT_BINARY_DIR, this ensures runners.yaml is generated at /softdevice/zephyr where @@ -31,20 +30,25 @@ set_target_properties(runners_yaml_props_target PROPERTIES set(PROJECT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/zephyr) # Copy over Kconfig and dts files from the main image -set(default_image_binary_dir ${PROJECT_BINARY_DIR}/../../${default_image}/zephyr) -zephyr_file_copy(${default_image_binary_dir}/.config ${PROJECT_BINARY_DIR}/.config +set(base_image_binary_dir ${PROJECT_BINARY_DIR}/../../${base_image}/zephyr) +zephyr_file_copy(${base_image_binary_dir}/.config ${PROJECT_BINARY_DIR}/.config ONLY_IF_DIFFERENT ) -zephyr_file_copy(${default_image_binary_dir}/edt.pickle ${PROJECT_BINARY_DIR}/edt.pickle +zephyr_file_copy(${base_image_binary_dir}/edt.pickle ${PROJECT_BINARY_DIR}/edt.pickle ONLY_IF_DIFFERENT ) -import_kconfig(CONFIG_ ${default_image_binary_dir}/.config) +import_kconfig(CONFIG_ ${base_image_binary_dir}/.config) # Manually include board configuration to enable automatic runners.yaml generation foreach(dir ${BOARD_DIRECTORIES}) include(${dir}/board.cmake OPTIONAL) endforeach() +# Set hex_file property to point to the hex file +set_target_properties(runners_yaml_props_target PROPERTIES + hex_file "${hex_file_to_flash}" +) + # Include flash support to automatically generate runners.yaml include(${ZEPHYR_BASE}/cmake/flash/CMakeLists.txt) diff --git a/applications/installer/src/main.c b/applications/installer/src/main.c index e00ead7131c0..79a8ff21cb20 100644 --- a/applications/installer/src/main.c +++ b/applications/installer/src/main.c @@ -28,12 +28,12 @@ LOG_MODULE_REGISTER(installer, CONFIG_INSTALLER_LOG_LEVEL); extern uintptr_t _flash_used; #define INSTALLER_SLOT DT_NODELABEL(slot0_partition) -#define INSTALLER_SLOT_ADDRESS FIXED_PARTITION_NODE_ADDRESS(INSTALLER_SLOT) -#define INSTALLER_SLOT_SIZE FIXED_PARTITION_NODE_SIZE(INSTALLER_SLOT) -#define INSTALLER_SLOT_ID DT_FIXED_PARTITION_ID(INSTALLER_SLOT) +#define INSTALLER_SLOT_ADDRESS PARTITION_NODE_ADDRESS(INSTALLER_SLOT) +#define INSTALLER_SLOT_SIZE PARTITION_NODE_SIZE(INSTALLER_SLOT) +#define INSTALLER_SLOT_ID DT_PARTITION_ID(INSTALLER_SLOT) #define INSTALLER_CODE_PARTITION DT_CHOSEN(zephyr_code_partition) -#define INSTALLER_CODE_PARTITION_ADDRESS FIXED_PARTITION_NODE_ADDRESS(INSTALLER_CODE_PARTITION) +#define INSTALLER_CODE_PARTITION_ADDRESS PARTITION_NODE_ADDRESS(INSTALLER_CODE_PARTITION) /** * Offset from the start of the slot the installer resides to the actual image flash start. @@ -46,8 +46,8 @@ extern uintptr_t _flash_used; #define INSTALLER_FLASH_USED_OFFSET (INSTALLER_CODE_PARTITION_ADDRESS - INSTALLER_SLOT_ADDRESS) #define FW_LOADER_SLOT DT_NODELABEL(slot1_partition) -#define FW_LOADER_SLOT_ID DT_FIXED_PARTITION_ID(FW_LOADER_SLOT) -#define FW_LOADER_SLOT_SIZE FIXED_PARTITION_NODE_SIZE(FW_LOADER_SLOT) +#define FW_LOADER_SLOT_ID DT_PARTITION_ID(FW_LOADER_SLOT) +#define FW_LOADER_SLOT_SIZE PARTITION_NODE_SIZE(FW_LOADER_SLOT) #define BUFFER_SIZE 4096 #define ERASE_BLOCK_SIZE DT_PROP(DT_CHOSEN(zephyr_flash), erase_block_size) diff --git a/applications/machine_learning/VERSION b/applications/machine_learning/VERSION index e34904f561cd..16a47594f510 100644 --- a/applications/machine_learning/VERSION +++ b/applications/machine_learning/VERSION @@ -1,5 +1,5 @@ VERSION_MAJOR = 3 -VERSION_MINOR = 2 +VERSION_MINOR = 3 PATCHLEVEL = 99 VERSION_TWEAK = 0 EXTRAVERSION = diff --git a/applications/machine_learning/configuration/nrf54h20dk_nrf54h20_cpuapp/app.overlay b/applications/machine_learning/configuration/nrf54h20dk_nrf54h20_cpuapp/app.overlay index 4e3d4803b588..f52586036dbc 100644 --- a/applications/machine_learning/configuration/nrf54h20dk_nrf54h20_cpuapp/app.overlay +++ b/applications/machine_learning/configuration/nrf54h20dk_nrf54h20_cpuapp/app.overlay @@ -67,10 +67,12 @@ ipc1: &cpuapp_cpuppr_ipc { &mram1x { partitions { slot0_partition: cpuapp_slot0_partition: partition@30000 { + compatible = "zephyr,mapped-partition"; reg = <0x30000 0x82000>; }; cpurad_slot0_partition: partition@b2000 { + compatible = "zephyr,mapped-partition"; reg = <0xb2000 0x32000>; }; }; diff --git a/applications/machine_learning/remote/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/applications/machine_learning/remote/boards/nrf54h20dk_nrf54h20_cpuppr.overlay index ed1b1e20686e..33331951e6cb 100644 --- a/applications/machine_learning/remote/boards/nrf54h20dk_nrf54h20_cpuppr.overlay +++ b/applications/machine_learning/remote/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -32,11 +32,15 @@ /* This duplicates the Application core configuration to build PPR image under valid address. */ &mram1x { partitions { + ranges; + cpuapp_slot0_partition: slot0_partition: partition@30000 { + compatible = "zephyr,mapped-partition"; reg = <0x30000 0x82000>; }; cpurad_slot0_partition: partition@b2000 { + compatible = "zephyr,mapped-partition"; reg = <0xb2000 0x32000>; }; }; diff --git a/applications/machine_learning/sysbuild/ipc_radio/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/applications/machine_learning/sysbuild/ipc_radio/boards/nrf54h20dk_nrf54h20_cpurad.overlay index 92b4aa2cc0f5..727498233a10 100644 --- a/applications/machine_learning/sysbuild/ipc_radio/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ b/applications/machine_learning/sysbuild/ipc_radio/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -16,11 +16,15 @@ &mram1x { partitions { + ranges; + cpuapp_slot0_partition: partition@30000 { + compatible = "zephyr,mapped-partition"; reg = <0x30000 0x82000>; }; slot0_partition: cpurad_slot0_partition: partition@b2000 { + compatible = "zephyr,mapped-partition"; reg = <0xb2000 0x32000>; }; }; diff --git a/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf b/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf index 5f5df34719ce..3c40b44ef045 100644 --- a/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf +++ b/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf @@ -10,7 +10,7 @@ CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_PM=n CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_MAX_IMG_SECTORS=2048 CONFIG_BOOT_SIGNATURE_TYPE_RSA=y diff --git a/applications/machine_learning/sysbuild/mcuboot/prj.conf b/applications/machine_learning/sysbuild/mcuboot/prj.conf index aac044a100c7..58e53c959d1d 100644 --- a/applications/machine_learning/sysbuild/mcuboot/prj.conf +++ b/applications/machine_learning/sysbuild/mcuboot/prj.conf @@ -7,7 +7,7 @@ CONFIG_PM=n CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_SWAP_SAVE_ENCTLV=n CONFIG_BOOT_ENCRYPT_IMAGE=n diff --git a/applications/matter_bridge/Kconfig b/applications/matter_bridge/Kconfig index a019320d5599..905d2f63370e 100644 --- a/applications/matter_bridge/Kconfig +++ b/applications/matter_bridge/Kconfig @@ -176,8 +176,7 @@ endchoice endif # OPENTHREAD config CHIP_WIFI - default y if BOARD_NRF7002DK_NRF5340_CPUAPP || SHIELD_NRF7002EK || SHIELD_NRF7002EB2 - select DEPRECATED if SOC_SERIES_NRF53 + default y if SHIELD_NRF7002EB2 # Dummy Kconfig just to select experimental for some of the configurations. config BRIDGE_EXPERIMENTAL diff --git a/applications/matter_bridge/Kconfig.sysbuild b/applications/matter_bridge/Kconfig.sysbuild index acff0989f97e..309852ae7c4a 100644 --- a/applications/matter_bridge/Kconfig.sysbuild +++ b/applications/matter_bridge/Kconfig.sysbuild @@ -4,10 +4,6 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -# This config has to be enabled manually for variants with shields, because sysbuild does not support it. -config WIFI_NRF70 - default y if BOARD_NRF7002DK - #### Radio core config NRF_DEFAULT_IPC_RADIO default y @@ -70,19 +66,6 @@ endif # BOARD_NRF54LM20DK endif # BOOTLOADER_MCUBOOT -# Store the Wi-Fi firmware patch on external flash by default for nRF5340 with nRF7002 -if WIFI_NRF70 && SOC_NRF5340_CPUAPP - -choice WIFI_PATCHES_EXT_FLASH_SUPPORT - default WIFI_PATCHES_EXT_FLASH_STORE - -endchoice - -config DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH - default y - -endif # WIFI_NRF70 - #### Enable generating factory data config MATTER_FACTORY_DATA_GENERATE default y diff --git a/applications/matter_bridge/VERSION b/applications/matter_bridge/VERSION index e34904f561cd..16a47594f510 100644 --- a/applications/matter_bridge/VERSION +++ b/applications/matter_bridge/VERSION @@ -1,5 +1,5 @@ VERSION_MAJOR = 3 -VERSION_MINOR = 2 +VERSION_MINOR = 3 PATCHLEVEL = 99 VERSION_TWEAK = 0 EXTRAVERSION = diff --git a/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay b/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay index d3ac716ba910..cb936ca47bff 100644 --- a/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -4,17 +4,22 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include #include +/* Set IPC thread priority to the highest value to not collide with other threads. */ +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; +}; + / { chosen { nordic,pm-ext-flash = &mx25r64; }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; +&mx25r64 { + status = "okay"; }; /* Disable unused peripherals to reduce power consumption */ diff --git a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index edcffc5fb26c..880354d8056e 100644 --- a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -4,21 +4,16 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; +#include +/ { aliases { /* Use watchdog wdt31 as the application watchdog */ watchdog0 = &wdt31; }; -}; -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; + chosen { + nordic,pm-ext-flash = &mx25r64; }; }; diff --git a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay index 2e8fcd150a85..329518c701a7 100644 --- a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay +++ b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include + / { aliases { /* Use watchdog wdt31 as the application watchdog */ @@ -11,17 +13,6 @@ }; }; -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; - }; -}; - -&mx25r64 { - status = "disabled"; -}; - &wdt31 { status = "okay"; }; diff --git a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay index 22ef54a62f2d..150b01d6180b 100644 --- a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay +++ b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay @@ -4,21 +4,16 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; +#include +/ { aliases { /* Use watchdog wdt31 as the application watchdog */ watchdog0 = &wdt31; }; -}; -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; + chosen { + nordic,pm-ext-flash = &mx25r64; }; }; diff --git a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay index f45c210fe2ab..ec5ce34565a6 100644 --- a/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay +++ b/applications/matter_bridge/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include + / { aliases { /* Use watchdog wdt31 as the application watchdog */ @@ -11,17 +13,6 @@ }; }; -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; - }; -}; - -&mx25r64 { - status = "disabled"; -}; - &wdt31 { status = "okay"; }; diff --git a/applications/matter_bridge/boards/nrf7002dk_nrf5340_cpuapp.conf b/applications/matter_bridge/boards/nrf7002dk_nrf5340_cpuapp.conf deleted file mode 100644 index 83fe484e08ee..000000000000 --- a/applications/matter_bridge/boards/nrf7002dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) 2025 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -# Enable LTO to decrease the flash usage. -CONFIG_LTO=y -CONFIG_ISR_TABLES_LOCAL_DECLARATION=y diff --git a/applications/matter_bridge/boards/nrf7002dk_nrf5340_cpuapp.overlay b/applications/matter_bridge/boards/nrf7002dk_nrf5340_cpuapp.overlay deleted file mode 100644 index 5b9f48b498dc..000000000000 --- a/applications/matter_bridge/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - }; - - aliases { - watchdog0 = &wdt0; - }; -}; - -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; diff --git a/applications/matter_bridge/doc/matter_bridge_description.rst b/applications/matter_bridge/doc/matter_bridge_description.rst index b30899250e3b..e388ad36e866 100644 --- a/applications/matter_bridge/doc/matter_bridge_description.rst +++ b/applications/matter_bridge/doc/matter_bridge_description.rst @@ -472,28 +472,6 @@ Configuring the number of Bluetooth LE bridged devices .. tabs:: - .. group-tab:: Matter bridge over Wi-Fi - - You can increase the number of Bluetooth LE connections if you decrease the size of the Bluetooth LE TX/RX buffers used by the Bluetooth controller, but this will decrease the communication throughput. - The default number of Bluetooth LE connections that you can select using the default configuration is ``10`` for Matter, which effectively means 9 bridged devices. - - To enable up to 20 Bluetooth LE connections (19 bridged devices) using reduced buffer sizes: - - .. tabs:: - - .. group-tab:: |nRFVSC| - - Add ``-Dmatter_bridge_SHIELD=nrf7002ek -DSB_CONFIG_WIFI_NRF70=y -DCONFIG_BRIDGED_DEVICE_BT=y -DEXTRA_CONF_FILE="bt_max_connections_app.conf" -Dipc_radio_EXTRA_CONF_FILE="bt_max_connections_net.conf" -DFILE_SUFFIX=nrf70ek`` to :guilabel:`Extra CMake arguments` in your build configuration. - - .. group-tab:: Command line - - Run the following command in the project directory: - - .. parsed-literal:: - :class: highlight - - west build -b nrf5340dk/nrf5340/cpuapp -p -- -Dmatter_bridge_SHIELD=nrf7002ek -DSB_CONFIG_WIFI_NRF70=y -DCONFIG_BRIDGED_DEVICE_BT=y -DEXTRA_CONF_FILE="bt_max_connections_app.conf" -Dipc_radio_EXTRA_CONF_FILE="bt_max_connections_net.conf" -DFILE_SUFFIX=nrf70ek - .. group-tab:: Matter bridge over Thread You cannot increase the default number of Bluetooth LE connections in this configuration using overlays. @@ -501,33 +479,6 @@ Configuring the number of Bluetooth LE bridged devices You can still increase the number of connections by modifying the board files and decreasing the buffer sizes. The default number of connections is ``8``, which effectively means 7 bridged devices. - .. group-tab:: nRF70 DKs - - The nRF70 Series supports the Matter bridge over Wi-Fi configuration. - - .. tabs:: - - .. group-tab:: Matter bridge over Wi-Fi - - You can increase the number of Bluetooth LE connections if you decrease the size of the Bluetooth LE TX/RX buffers used by the Bluetooth controller, but this will decrease the communication throughput. - - To enable up to 20 Bluetooth LE connections (19 bridged devices) using reduced buffer sizes: - - .. tabs:: - - .. group-tab:: |nRFVSC| - - Add ``-DCONFIG_BRIDGED_DEVICE_BT=y -DEXTRA_CONF_FILE="bt_max_connections_app.conf" -Dipc_radio_EXTRA_CONF_FILE="bt_max_connections_net.conf"`` to :guilabel:`Extra CMake arguments` in your build configuration. - - .. group-tab:: Command line - - Run the following command in the project directory: - - .. parsed-literal:: - :class: highlight - - west build -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_BRIDGED_DEVICE_BT=y -DEXTRA_CONF_FILE="bt_max_connections_app.conf" -Dipc_radio_EXTRA_CONF_FILE="bt_max_connections_net.conf" - .. group-tab:: nRF54LM20 DKs The nRF54LM20 supports the Matter bridge over Wi-Fi and Matter bridge over Thread configurations. diff --git a/applications/matter_bridge/pm_static_nrf5340dk_nrf5340_cpuapp.yml b/applications/matter_bridge/pm_static_nrf5340dk_nrf5340_cpuapp.yml deleted file mode 100644 index 3b0873d5ab3c..000000000000 --- a/applications/matter_bridge/pm_static_nrf5340dk_nrf5340_cpuapp.yml +++ /dev/null @@ -1,56 +0,0 @@ -mcuboot: - address: 0x0 - size: 0x8000 - region: flash_primary -mcuboot_pad: - address: 0x8000 - size: 0x200 -app: - address: 0x8200 - size: 0xeee00 -mcuboot_primary: - orig_span: &id001 - - mcuboot_pad - - app - span: *id001 - address: 0x8000 - size: 0xef000 - region: flash_primary -mcuboot_primary_app: - orig_span: &id002 - - app - span: *id002 - address: 0x8200 - size: 0xeee00 -factory_data: - address: 0xf7000 - size: 0x1000 - region: flash_primary -settings_storage: - address: 0xf8000 - size: 0x8000 - region: flash_primary -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x0 - size: 0xef000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xef000 - size: 0x40000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x12f000 - size: 0x6D1000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary diff --git a/applications/matter_bridge/pm_static_nrf5340dk_nrf5340_cpuapp_nrf70ek.yml b/applications/matter_bridge/pm_static_nrf5340dk_nrf5340_cpuapp_nrf70ek.yml deleted file mode 100644 index 995593ad0eea..000000000000 --- a/applications/matter_bridge/pm_static_nrf5340dk_nrf5340_cpuapp_nrf70ek.yml +++ /dev/null @@ -1,80 +0,0 @@ -mcuboot: - address: 0x0 - size: 0x8000 - region: flash_primary -mcuboot_pad: - address: 0x8000 - size: 0x200 -app: - address: 0x8200 - size: 0xeee00 -mcuboot_primary: - orig_span: &id001 - - mcuboot_pad - - app - span: *id001 - address: 0x8000 - size: 0xef000 - region: flash_primary -mcuboot_primary_app: - orig_span: &id002 - - app - span: *id002 - address: 0x8200 - size: 0xeee00 -factory_data: - address: 0xf7000 - size: 0x1000 - region: flash_primary -settings_storage: - address: 0xf8000 - size: 0x8000 - region: flash_primary -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x0 - size: 0xef000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xef000 - size: 0x40000 - device: MX25R64 - region: external_flash -nrf70_wifi_fw_mcuboot_pad: - address: 0x12F000 - size: 0x200 - device: MX25R64 - region: external_flash -nrf70_wifi_fw: - address: 0x12F200 - size: 0x20000 - device: MX25R64 - region: external_flash -mcuboot_primary_2: - orig_span: &id003 - - nrf70_wifi_fw_mcuboot_pad - - nrf70_wifi_fw - span: *id003 - address: 0x12F000 - size: 0x21000 - device: MX25R64 - region: external_flash -mcuboot_secondary_2: - address: 0x150000 - size: 0x21000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x171000 - size: 0x68F000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary diff --git a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20a_cpuapp.yml b/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20a_cpuapp.yml deleted file mode 100644 index 3e9051d5b84d..000000000000 --- a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20a_cpuapp.yml +++ /dev/null @@ -1,56 +0,0 @@ -mcuboot: - address: 0x0 - region: flash_primary - size: 0xD000 -mcuboot_pad: - address: 0xD000 - region: flash_primary - size: 0x800 -app: - address: 0xD800 - region: flash_primary - size: 0x1E2800 -mcuboot_primary: - address: 0xD000 - orig_span: &id001 - - app - - mcuboot_pad - region: flash_primary - size: 0x1E3000 - span: *id001 -mcuboot_primary_app: - address: 0xD800 - orig_span: &id002 - - app - region: flash_primary - size: 0x1E2800 - span: *id002 -factory_data: - address: 0x1F0000 - region: flash_primary - size: 0x1000 -settings_storage: - address: 0x1F1000 - region: flash_primary - size: 0xC000 -mcuboot_secondary: - address: 0x0 - orig_span: &id003 - - mcuboot_secondary_pad - - mcuboot_secondary_app - region: external_flash - size: 0x1E3000 - span: *id003 -mcuboot_secondary_pad: - region: external_flash - address: 0x0 - size: 0x800 -mcuboot_secondary_app: - region: external_flash - address: 0x800 - size: 0x1E2800 -external_flash: - address: 0x1E3000 - size: 0x5DB000 - device: MX25R64 - region: external_flash diff --git a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20a_cpuapp_internal.yml b/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20a_cpuapp_internal.yml deleted file mode 100644 index 028bb179c50e..000000000000 --- a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20a_cpuapp_internal.yml +++ /dev/null @@ -1,52 +0,0 @@ -mcuboot: - address: 0x0 - region: flash_primary - size: 0xA000 -mcuboot_pad: - address: 0xA000 - region: flash_primary - size: 0x800 -app: - address: 0xA800 - region: flash_primary - size: 0x125800 -mcuboot_primary: - address: 0xA000 - orig_span: &id001 - - app - - mcuboot_pad - region: flash_primary - size: 0x126000 - span: *id001 -mcuboot_primary_app: - address: 0xA800 - orig_span: &id002 - - app - region: flash_primary - size: 0x125800 - span: *id002 -mcuboot_secondary: - address: 0x130000 - orig_span: &id003 - - mcuboot_secondary_pad - - mcuboot_secondary_app - region: flash_primary - size: 0xC0000 - span: *id003 -mcuboot_secondary_pad: - region: flash_primary - address: 0x130000 - size: 0x800 -# Compression rate 34.75% -mcuboot_secondary_app: - region: flash_primary - address: 0x130800 - size: 0xBF800 -factory_data: - address: 0x1F0000 - region: flash_primary - size: 0x1000 -settings_storage: - address: 0x1F1000 - region: flash_primary - size: 0xC000 diff --git a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20b_cpuapp.yml b/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20b_cpuapp.yml deleted file mode 100644 index 3e9051d5b84d..000000000000 --- a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20b_cpuapp.yml +++ /dev/null @@ -1,56 +0,0 @@ -mcuboot: - address: 0x0 - region: flash_primary - size: 0xD000 -mcuboot_pad: - address: 0xD000 - region: flash_primary - size: 0x800 -app: - address: 0xD800 - region: flash_primary - size: 0x1E2800 -mcuboot_primary: - address: 0xD000 - orig_span: &id001 - - app - - mcuboot_pad - region: flash_primary - size: 0x1E3000 - span: *id001 -mcuboot_primary_app: - address: 0xD800 - orig_span: &id002 - - app - region: flash_primary - size: 0x1E2800 - span: *id002 -factory_data: - address: 0x1F0000 - region: flash_primary - size: 0x1000 -settings_storage: - address: 0x1F1000 - region: flash_primary - size: 0xC000 -mcuboot_secondary: - address: 0x0 - orig_span: &id003 - - mcuboot_secondary_pad - - mcuboot_secondary_app - region: external_flash - size: 0x1E3000 - span: *id003 -mcuboot_secondary_pad: - region: external_flash - address: 0x0 - size: 0x800 -mcuboot_secondary_app: - region: external_flash - address: 0x800 - size: 0x1E2800 -external_flash: - address: 0x1E3000 - size: 0x5DB000 - device: MX25R64 - region: external_flash diff --git a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20b_cpuapp_internal.yml b/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20b_cpuapp_internal.yml deleted file mode 100644 index 028bb179c50e..000000000000 --- a/applications/matter_bridge/pm_static_nrf54lm20dk_nrf54lm20b_cpuapp_internal.yml +++ /dev/null @@ -1,52 +0,0 @@ -mcuboot: - address: 0x0 - region: flash_primary - size: 0xA000 -mcuboot_pad: - address: 0xA000 - region: flash_primary - size: 0x800 -app: - address: 0xA800 - region: flash_primary - size: 0x125800 -mcuboot_primary: - address: 0xA000 - orig_span: &id001 - - app - - mcuboot_pad - region: flash_primary - size: 0x126000 - span: *id001 -mcuboot_primary_app: - address: 0xA800 - orig_span: &id002 - - app - region: flash_primary - size: 0x125800 - span: *id002 -mcuboot_secondary: - address: 0x130000 - orig_span: &id003 - - mcuboot_secondary_pad - - mcuboot_secondary_app - region: flash_primary - size: 0xC0000 - span: *id003 -mcuboot_secondary_pad: - region: flash_primary - address: 0x130000 - size: 0x800 -# Compression rate 34.75% -mcuboot_secondary_app: - region: flash_primary - address: 0x130800 - size: 0xBF800 -factory_data: - address: 0x1F0000 - region: flash_primary - size: 0x1000 -settings_storage: - address: 0x1F1000 - region: flash_primary - size: 0xC000 diff --git a/applications/matter_bridge/pm_static_nrf7002dk_nrf5340_cpuapp.yml b/applications/matter_bridge/pm_static_nrf7002dk_nrf5340_cpuapp.yml deleted file mode 100644 index 3f4cbba2e822..000000000000 --- a/applications/matter_bridge/pm_static_nrf7002dk_nrf5340_cpuapp.yml +++ /dev/null @@ -1,80 +0,0 @@ -mcuboot: - address: 0x0 - size: 0xC000 - region: flash_primary -mcuboot_pad: - address: 0xC000 - size: 0x200 -app: - address: 0xC200 - size: 0xeae00 -mcuboot_primary: - orig_span: &id001 - - mcuboot_pad - - app - span: *id001 - address: 0xC000 - size: 0xeb000 - region: flash_primary -mcuboot_primary_app: - orig_span: &id002 - - app - span: *id002 - address: 0xC200 - size: 0xeae00 -factory_data: - address: 0xf7000 - size: 0x1000 - region: flash_primary -settings_storage: - address: 0xf8000 - size: 0x8000 - region: flash_primary -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x0 - size: 0xeb000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xeb000 - size: 0x40000 - device: MX25R64 - region: external_flash -nrf70_wifi_fw_mcuboot_pad: - address: 0x12B000 - size: 0x200 - device: MX25R64 - region: external_flash -nrf70_wifi_fw: - address: 0x12B200 - size: 0x20000 - device: MX25R64 - region: external_flash -mcuboot_primary_2: - orig_span: &id003 - - nrf70_wifi_fw_mcuboot_pad - - nrf70_wifi_fw - span: *id003 - address: 0x12B000 - size: 0x21000 - device: MX25R64 - region: external_flash -mcuboot_secondary_2: - address: 0x14C000 - size: 0x21000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x16D000 - size: 0x693000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary diff --git a/applications/matter_bridge/sample.yaml b/applications/matter_bridge/sample.yaml index b616a26f3969..4cb4c7afa7e8 100644 --- a/applications/matter_bridge/sample.yaml +++ b/applications/matter_bridge/sample.yaml @@ -14,12 +14,10 @@ tests: - CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n - CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y integration_platforms: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp platform_allow: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -45,12 +43,10 @@ tests: - CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n - CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y integration_platforms: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp platform_allow: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -76,12 +72,10 @@ tests: - CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n - CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y integration_platforms: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp platform_allow: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -109,12 +103,10 @@ tests: - CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n - CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y integration_platforms: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp platform_allow: - - nrf7002dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp @@ -143,11 +135,9 @@ tests: - CONFIG_BRIDGE_GENERIC_SWITCH_BRIDGED_DEVICE=n - CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y integration_platforms: - - nrf7002dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp platform_allow: - - nrf7002dk/nrf5340/cpuapp - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp applications.matter_bridge.nrf7002eb2.br_ble.smp_dfu: @@ -166,20 +156,6 @@ tests: platform_allow: - nrf54lm20dk/nrf54lm20b/cpuapp - nrf54lm20dk/nrf54lm20a/cpuapp - applications.matter_bridge.nrf5340.wifi: - sysbuild: true - build_only: true - extra_args: - - matter_bridge_SHIELD=nrf7002ek - - SB_CONFIG_WIFI_PATCHES_EXT_FLASH_STORE=y - - mcuboot_CONFIG_UPDATEABLE_IMAGE_NUMBER=3 - - SB_CONFIG_WIFI_NRF70=y - - SB_CONFIG_DFU_MULTI_IMAGE_PACKAGE_WIFI_FW_PATCH=y - - CONFIG_CHIP_DFU_OVER_BT_SMP=y - - FILE_SUFFIX=nrf70ek - integration_platforms: - - nrf5340dk/nrf5340/cpuapp - platform_allow: nrf5340dk/nrf5340/cpuapp applications.matter_bridge.br_ble.memory_profiling: sysbuild: true build_only: true @@ -205,9 +181,11 @@ tests: - CONFIG_BRIDGE_ONOFF_LIGHT_SWITCH_BRIDGED_DEVICE=y - CONFIG_CHIP_MEMORY_PROFILING=y integration_platforms: - - nrf7002dk/nrf5340/cpuapp + - nrf54lm20dk/nrf54lm20b/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp platform_allow: - - nrf7002dk/nrf5340/cpuapp + - nrf54lm20dk/nrf54lm20b/cpuapp + - nrf54lm20dk/nrf54lm20a/cpuapp applications.matter_bridge.smart_plug: sysbuild: true build_only: true diff --git a/applications/matter_bridge/sysbuild.conf b/applications/matter_bridge/sysbuild.conf index 08394759913c..23369f0c2e89 100644 --- a/applications/matter_bridge/sysbuild.conf +++ b/applications/matter_bridge/sysbuild.conf @@ -5,3 +5,4 @@ # SB_CONFIG_MATTER=y +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/matter_bridge/sysbuild/b0n/boards/nrf5340dk_nrf5340_cpunet.overlay b/applications/matter_bridge/sysbuild/b0n/boards/nrf5340dk_nrf5340_cpunet.overlay new file mode 100644 index 000000000000..632c0e6795f3 --- /dev/null +++ b/applications/matter_bridge/sysbuild/b0n/boards/nrf5340dk_nrf5340_cpunet.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include + +/ { + chosen { + zephyr,code-partition = &b0n_partition; + }; +}; diff --git a/applications/matter_bridge/sysbuild/b0n/prj.conf b/applications/matter_bridge/sysbuild/b0n/prj.conf new file mode 100644 index 000000000000..c6efcbd07bc0 --- /dev/null +++ b/applications/matter_bridge/sysbuild/b0n/prj.conf @@ -0,0 +1,37 @@ +# +# Copyright (c) 2026 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_NCS_SAMPLES_DEFAULTS=n + +CONFIG_IS_SECURE_BOOTLOADER=y +CONFIG_MULTITHREADING=n +CONFIG_GPIO=n +CONFIG_ARM_MPU=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_ERRNO=n +CONFIG_SYS_CLOCK_EXISTS=y +CONFIG_FPROTECT=y +CONFIG_FW_INFO=y +CONFIG_SECURE_BOOT_CRYPTO=y +CONFIG_SECURE_BOOT_VALIDATION=y +CONFIG_SECURE_BOOT_STORAGE=y +CONFIG_PCD_NET=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_LOG=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_PRINTK=n +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_ASSERT=n +CONFIG_NRF_RTC_TIMER=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n +CONFIG_SYS_CLOCK_EXISTS=n +CONFIG_TIMEOUT_64BIT=n diff --git a/applications/matter_bridge/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf b/applications/matter_bridge/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf index 346ccc745956..c3fc7b02051a 100644 --- a/applications/matter_bridge/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf +++ b/applications/matter_bridge/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.conf @@ -4,17 +4,44 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -# Set 8 BLE connections, as it is an upper limit supported caused by RAM usage due to using Thread and BLE at same time. -CONFIG_BT_MAX_CONN=8 - -# Decrease stack and buffer sizes to free some RAM and support 8 BLE connections -CONFIG_MAIN_STACK_SIZE=512 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_BT_BUF_ACL_RX_SIZE=69 -CONFIG_BT_BUF_ACL_TX_SIZE=69 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=69 -# 15.4 RX buffers were decreased to save RAM -CONFIG_NRF_802154_RX_BUFFERS=14 +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 + +# It is set based on BT_BUF_ACL_RX_COUNT_EXTRA = 6 - (BT_MAX_CONN + 1) +CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=4 + +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y # NRF_802154_ENCRYPTION is not enabled by default in the `overlay-802154.conf` file # that is pulled in by NETCORE_IPC_RADIO_IEEE802154 in application's Kconfig.sysbuild. diff --git a/applications/matter_bridge/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.overlay b/applications/matter_bridge/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.overlay new file mode 100644 index 000000000000..bbfdde5ab0d6 --- /dev/null +++ b/applications/matter_bridge/sysbuild/ipc_radio/boards/nrf5340dk_nrf5340_cpunet.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include diff --git a/applications/matter_bridge/sysbuild/ipc_radio/prj.conf b/applications/matter_bridge/sysbuild/ipc_radio/prj.conf index f73b695a909a..b61304be4296 100644 --- a/applications/matter_bridge/sysbuild/ipc_radio/prj.conf +++ b/applications/matter_bridge/sysbuild/ipc_radio/prj.conf @@ -4,41 +4,11 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -# Disable serial and UART interface. CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_LOG=n -# RAM usage configuration -CONFIG_HEAP_MEM_POOL_SIZE=8192 -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 - -# BT configuration -CONFIG_BT=y -CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=10 -CONFIG_BT_CTLR_ASSERT_HANDLER=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=y -CONFIG_BT_EXT_ADV=y -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 -CONFIG_BT_CTLR_PHY_2M=n - -# Debug and assert configuration -CONFIG_ASSERT=y CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_REBOOT=n - -# IPC -CONFIG_MBOX=y -CONFIG_IPC_SERVICE=y - -# ipc_radio -CONFIG_IPC_RADIO_BT=y -CONFIG_IPC_RADIO_BT_HCI_IPC=y # Workaround for the spinlock assertion issue. CONFIG_TIMESLICE_SIZE=0 diff --git a/applications/matter_bridge/sysbuild/ipc_radio/prj_release.conf b/applications/matter_bridge/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 000000000000..4aac746c80bf --- /dev/null +++ b/applications/matter_bridge/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,14 @@ +# +# Copyright (c) 2026 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y + +# Workaround for the spinlock assertion issue. +CONFIG_TIMESLICE_SIZE=0 diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf index 888af8dceec1..52d5b30dac31 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -7,3 +7,8 @@ CONFIG_NORDIC_QSPI_NOR=y CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_MCUBOOT_VERIFY_IMG_ADDRESS=n +CONFIG_NRF53_MULTI_IMAGE_UPDATE=y +CONFIG_FLASH_SIMULATOR_STATS=n +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay index 4e44b37666b6..4708f19e082b 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -4,13 +4,19 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include + / { chosen { - nordic,pm-ext-flash = &mx25r64; zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; }; }; +&mx25r64 { + status = "okay"; +}; + /* Disable GPIO forwarder for nRF7002 EK compatibility */ &gpio_fwd { status = "disabled"; diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf index 53effdf0d883..d1441e73d412 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.conf @@ -14,12 +14,9 @@ CONFIG_SPI_NOR=y CONFIG_SPI_NOR_SFDP_DEVICETREE=y CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -# Increase the maximum number of sectors to 512 to fit the large image size (> 1024 kB). -CONFIG_BOOT_MAX_IMG_SECTORS=512 - # Currently, without tickless kernel, the SYSCOUNTER value after the software # reset is not set properly and due to that the first system interrupt is not called # in the proper time - the SYSCOUNTER value is set to the value from before # reset + 1. Hence, the reboot time increases more and more. -# To avoid it enable tickless kernel for MCUboot. +# To avoid it enable tickles kernel for mcuboot. CONFIG_TICKLESS_KERNEL=y diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay index 51079fe073f4..475cfc215e40 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay @@ -4,19 +4,15 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include + / { chosen { + zephyr,code-partition = &boot_partition; nordic,pm-ext-flash = &mx25r64; }; }; -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; - }; -}; - &mx25r64 { status = "okay"; }; diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.conf b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.conf index b953f7d795e6..209466d403e8 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.conf +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.conf @@ -19,12 +19,9 @@ CONFIG_PRINTK=n CONFIG_SPI_NOR=n CONFIG_SPI=n -# Increase the maximum number of sectors to 512 to fit the large image size (> 1024 kB). -CONFIG_BOOT_MAX_IMG_SECTORS=512 - # Currently, without tickless kernel, the SYSCOUNTER value after the software # reset is not set properly and due to that the first system interrupt is not called # in the proper time - the SYSCOUNTER value is set to the value from before # reset + 1. Hence, the reboot time increases more and more. -# To avoid it enable tickless kernel for MCUboot. +# To avoid it enable tickles kernel for mcuboot. CONFIG_TICKLESS_KERNEL=y diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay index 50b7c9f32914..8abe06ae316a 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20a_cpuapp_internal.overlay @@ -4,17 +4,10 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; - }; -}; +#include -/* Disable the external flash, as it is not needed - * for the configuration with secondary slot residing - * in the internal RRAM. - */ -&mx25r64 { - status = "disabled"; +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.conf b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.conf index 831907cd4b32..7e71780323ff 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.conf +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.conf @@ -14,12 +14,9 @@ CONFIG_SPI_NOR=y CONFIG_SPI_NOR_SFDP_DEVICETREE=y CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -# Increase the maximum number of sectors to 512 to fit the large image size (> 1024 kB). -CONFIG_BOOT_MAX_IMG_SECTORS=512 - # Currently, without tickless kernel, the SYSCOUNTER value after the software # reset is not set properly and due to that the first system interrupt is not called # in the proper time - the SYSCOUNTER value is set to the value from before # reset + 1. Hence, the reboot time increases more and more. -# To avoid it enable tickless kernel for MCUboot. +# To avoid it enable tickles kernel for mcuboot. CONFIG_TICKLESS_KERNEL=y diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay index 107cc4e13d34..c8a28063f3f7 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp.overlay @@ -4,19 +4,15 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include + / { chosen { + zephyr,code-partition = &boot_partition; nordic,pm-ext-flash = &mx25r64; }; }; -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; - }; -}; - &mx25r64 { status = "okay"; }; diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.conf b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.conf index 0cae7a8ad7ef..6e63fe52c685 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.conf +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.conf @@ -19,12 +19,9 @@ CONFIG_PRINTK=n CONFIG_SPI_NOR=n CONFIG_SPI=n -# Increase the maximum number of sectors to 512 to fit the large image size (> 1024 kB). -CONFIG_BOOT_MAX_IMG_SECTORS=512 - # Currently, without tickless kernel, the SYSCOUNTER value after the software # reset is not set properly and due to that the first system interrupt is not called # in the proper time - the SYSCOUNTER value is set to the value from before # reset + 1. Hence, the reboot time increases more and more. -# To avoid it enable tickless kernel for MCUboot. +# To avoid it enable tickles kernel for mcuboot. CONFIG_TICKLESS_KERNEL=y diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay index b31ae28c620f..cb39b0ecd589 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay +++ b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf54lm20dk_nrf54lm20b_cpuapp_internal.overlay @@ -4,17 +4,10 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -&rram_controller { - cpuapp_rram: rram@0 { - reg = <0x0 DT_SIZE_K(2036)>; - ranges = <0x0 0x0 DT_SIZE_K(2036)>; - }; -}; +#include -/* Disable the external flash, as it is not needed - * for the configuration with secondary slot residing - * in the internal RRAM. - */ -&mx25r64 { - status = "disabled"; +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf deleted file mode 100644 index b480468aa6ab..000000000000 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -# nRF7002DK uses SPI NOR external flash -CONFIG_GPIO=y -CONFIG_SPI=y -CONFIG_SPI_NOR=y -CONFIG_SPI_NOR_SFDP_DEVICETREE=y -CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 - -# The following configurations are required to support simultaneous multi-image update -CONFIG_PCD_APP=y - -# The network core cannot access external flash directly. The flash simulator must be used to -# provide a memory region that is used to forward the new firmware to the network core. -CONFIG_FLASH_SIMULATOR=y -CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y -CONFIG_FLASH_SIMULATOR_STATS=n - -CONFIG_ZCBOR=y diff --git a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay b/applications/matter_bridge/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay deleted file mode 100644 index 46485bd08db6..000000000000 --- a/applications/matter_bridge/sysbuild/mcuboot/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/ { - chosen { - nordic,pm-ext-flash = &mx25r64; - zephyr,code-partition = &boot_partition; - }; -}; diff --git a/applications/matter_bridge/sysbuild/mcuboot/prj.conf b/applications/matter_bridge/sysbuild/mcuboot/prj.conf index 0324b23239f0..00a8ca231df3 100644 --- a/applications/matter_bridge/sysbuild/mcuboot/prj.conf +++ b/applications/matter_bridge/sysbuild/mcuboot/prj.conf @@ -13,7 +13,7 @@ CONFIG_PM=n CONFIG_FLASH=y CONFIG_FPROTECT=y -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" # Bootloader size optimization CONFIG_CBPRINTF_NANO=y @@ -24,7 +24,7 @@ CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=n CONFIG_GPIO=n -CONFIG_BOOT_MAX_IMG_SECTORS=256 +CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=y CONFIG_LOG=n CONFIG_CONSOLE_HANDLER=n @@ -36,6 +36,7 @@ CONFIG_MULTITHREADING=n CONFIG_TICKLESS_KERNEL=n CONFIG_TIMEOUT_64BIT=n CONFIG_NRF_ENABLE_ICACHE=n +CONFIG_SIZE_OPTIMIZATIONS=y # Activate LTO CONFIG_LTO=y diff --git a/applications/matter_weather_station/Kconfig b/applications/matter_weather_station/Kconfig index e5d7c4cecc19..105cb4e96ef4 100644 --- a/applications/matter_weather_station/Kconfig +++ b/applications/matter_weather_station/Kconfig @@ -47,17 +47,6 @@ config CHIP_ENABLE_ICD_SUPPORT endif # OPENTHREAD -if SHIELD_NRF7002EB - -config CHIP_WIFI - default y - select DEPRECATED if SOC_SERIES_NRF53 - -config NRF_WIFI_LOW_POWER - default y - -endif # SHIELD_NRF7002EB - source "$(ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR)/config/nrfconnect/chip-module/Kconfig.features" source "$(ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR)/config/nrfconnect/chip-module/Kconfig.defaults" source "$(ZEPHYR_NRF_MODULE_DIR)/samples/matter/common/src/Kconfig" diff --git a/applications/matter_weather_station/VERSION b/applications/matter_weather_station/VERSION index e34904f561cd..16a47594f510 100644 --- a/applications/matter_weather_station/VERSION +++ b/applications/matter_weather_station/VERSION @@ -1,5 +1,5 @@ VERSION_MAJOR = 3 -VERSION_MINOR = 2 +VERSION_MINOR = 3 PATCHLEVEL = 99 VERSION_TWEAK = 0 EXTRAVERSION = diff --git a/applications/matter_weather_station/boards/nrf54l15tag_nrf54l15_cpuapp.overlay b/applications/matter_weather_station/boards/nrf54l15tag_nrf54l15_cpuapp.overlay index 574c906cdc19..19822f9d12a1 100644 --- a/applications/matter_weather_station/boards/nrf54l15tag_nrf54l15_cpuapp.overlay +++ b/applications/matter_weather_station/boards/nrf54l15tag_nrf54l15_cpuapp.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include + / { aliases { /* Use watchdog wdt31 as the application watchdog */ @@ -11,23 +13,6 @@ }; }; -/* BME688 (temperature pressure and humidity sensor) */ -&i2c21 { - bme688@76 { - status = "okay"; - }; -}; - -/* restore full RRAM and SRAM space - by default some parts are dedicated to FLRP */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1524)>; -}; - -&cpuapp_sram { - reg = <0x20000000 DT_SIZE_K(256)>; - ranges = <0x0 0x20000000 0x40000>; -}; - &wdt31 { status = "okay"; }; diff --git a/applications/matter_weather_station/boards/thingy53_nrf5340_cpuapp.overlay b/applications/matter_weather_station/boards/thingy53_nrf5340_cpuapp.overlay index ae941608e411..17598f034cb9 100644 --- a/applications/matter_weather_station/boards/thingy53_nrf5340_cpuapp.overlay +++ b/applications/matter_weather_station/boards/thingy53_nrf5340_cpuapp.overlay @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Nordic Semiconductor ASA + * Copyright (c) 2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ @@ -72,6 +72,59 @@ zephyr,priority = <0 PRIO_COOP>; }; +/delete-node/ &boot_partition; +/delete-node/ &slot0_partition; +/delete-node/ &slot1_partition; +/delete-node/ &storage_partition; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(32)>; + }; + + slot0_partition: partition@8000 { + label = "image-0"; + reg = <0x00008000 DT_SIZE_K(956)>; + }; + + factory_data_partition: partition@f7000 { + label = "factory-data"; + reg = <0x000f7000 DT_SIZE_K(4)>; + }; + + storage_partition: partition@f8000 { + label = "storage"; + reg = <0x000f8000 DT_SIZE_K(32)>; + }; + }; +}; + +&mx25r64 { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@0 { + label = "image-1"; + reg = <0x00000000 DT_SIZE_K(956)>; + }; + + slot3_partition: partition@ef000 { + label = "image-3"; + reg = <0x000ef000 DT_SIZE_K(224)>; + }; + }; +}; + &i2c1 { bme688@76 { compatible = "bosch,bme680"; diff --git a/applications/matter_weather_station/pm_static_nrf54l15tag_nrf54l15_cpuapp.yml b/applications/matter_weather_station/pm_static_nrf54l15tag_nrf54l15_cpuapp.yml deleted file mode 100644 index a8bcbce256bf..000000000000 --- a/applications/matter_weather_station/pm_static_nrf54l15tag_nrf54l15_cpuapp.yml +++ /dev/null @@ -1,52 +0,0 @@ -mcuboot: - address: 0x0 - region: flash_primary - size: 0xD000 -mcuboot_pad: - address: 0xD000 - region: flash_primary - size: 0x800 -app: - address: 0xD800 - region: flash_primary - size: 0xD7800 -mcuboot_primary: - address: 0xD000 - orig_span: &id001 - - app - - mcuboot_pad - region: flash_primary - size: 0xD8000 - span: *id001 -mcuboot_primary_app: - address: 0xD800 - orig_span: &id002 - - app - region: flash_primary - size: 0xD7800 - span: *id002 -mcuboot_secondary: - address: 0xE5000 - orig_span: &id003 - - mcuboot_secondary_pad - - mcuboot_secondary_app - region: flash_primary - size: 0x8D000 - span: *id003 -mcuboot_secondary_pad: - region: flash_primary - address: 0xE5000 - size: 0x800 -# Compression rate 34.80% -mcuboot_secondary_app: - region: flash_primary - address: 0xE5800 - size: 0x8C800 -factory_data: - address: 0x172000 - region: flash_primary - size: 0x1000 -settings_storage: - address: 0x173000 - region: flash_primary - size: 0xA000 diff --git a/applications/matter_weather_station/pm_static_thingy53_nrf5340_cpuapp_factory_data.yml b/applications/matter_weather_station/pm_static_thingy53_nrf5340_cpuapp_factory_data.yml deleted file mode 100644 index 7e7d75eedb98..000000000000 --- a/applications/matter_weather_station/pm_static_thingy53_nrf5340_cpuapp_factory_data.yml +++ /dev/null @@ -1,59 +0,0 @@ -app: - address: 0x10200 - region: flash_primary - size: 0xdfe00 -mcuboot: - address: 0x0 - region: flash_primary - size: 0x10000 -mcuboot_pad: - address: 0x10000 - region: flash_primary - size: 0x200 -mcuboot_primary: - address: 0x10000 - orig_span: &id001 - - mcuboot_pad - - app - region: flash_primary - size: 0xe0000 - span: *id001 -mcuboot_primary_app: - address: 0x10200 - orig_span: &id002 - - app - region: flash_primary - size: 0xdfe00 - span: *id002 -factory_data: - address: 0xf0000 - region: flash_primary - size: 0x4000 -settings_storage: - address: 0xf4000 - region: flash_primary - size: 0xc000 -mcuboot_primary_1: - address: 0x0 - size: 0x40000 - device: flash_ctrl - region: ram_flash -mcuboot_secondary: - address: 0x00000 - size: 0xe0000 - device: MX25R64 - region: external_flash -mcuboot_secondary_1: - address: 0xe0000 - size: 0x40000 - device: MX25R64 - region: external_flash -external_flash: - address: 0x120000 - size: 0x6e0000 - device: MX25R64 - region: external_flash -pcd_sram: - address: 0x20000000 - size: 0x2000 - region: sram_primary diff --git a/applications/matter_weather_station/sample.yaml b/applications/matter_weather_station/sample.yaml index df293fd09137..0057e37bd666 100644 --- a/applications/matter_weather_station/sample.yaml +++ b/applications/matter_weather_station/sample.yaml @@ -49,15 +49,3 @@ tests: integration_platforms: - thingy53/nrf5340/cpuapp - nrf54l15tag/nrf54l15/cpuapp - applications.matter_weather_station.nrf7002eb: - sysbuild: true - build_only: true - extra_args: - - matter_weather_station_SHIELD=nrf7002eb - - FILE_SUFFIX=release - - SB_CONFIG_WIFI_NRF70=y - - CONFIG_CHIP_WIFI=y - platform_allow: thingy53/nrf5340/cpuapp - platform_exclude: thingy53/nrf5340/cpuapp/ns - integration_platforms: - - thingy53/nrf5340/cpuapp diff --git a/applications/matter_weather_station/sysbuild.conf b/applications/matter_weather_station/sysbuild.conf index 08394759913c..23369f0c2e89 100644 --- a/applications/matter_weather_station/sysbuild.conf +++ b/applications/matter_weather_station/sysbuild.conf @@ -5,3 +5,4 @@ # SB_CONFIG_MATTER=y +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/matter_weather_station/sysbuild/b0n/boards/thingy53_nrf5340_cpunet.overlay b/applications/matter_weather_station/sysbuild/b0n/boards/thingy53_nrf5340_cpunet.overlay new file mode 100644 index 000000000000..632c0e6795f3 --- /dev/null +++ b/applications/matter_weather_station/sysbuild/b0n/boards/thingy53_nrf5340_cpunet.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include + +/ { + chosen { + zephyr,code-partition = &b0n_partition; + }; +}; diff --git a/applications/matter_weather_station/sysbuild/b0n/prj.conf b/applications/matter_weather_station/sysbuild/b0n/prj.conf new file mode 100644 index 000000000000..c6efcbd07bc0 --- /dev/null +++ b/applications/matter_weather_station/sysbuild/b0n/prj.conf @@ -0,0 +1,37 @@ +# +# Copyright (c) 2026 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_NCS_SAMPLES_DEFAULTS=n + +CONFIG_IS_SECURE_BOOTLOADER=y +CONFIG_MULTITHREADING=n +CONFIG_GPIO=n +CONFIG_ARM_MPU=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_ERRNO=n +CONFIG_SYS_CLOCK_EXISTS=y +CONFIG_FPROTECT=y +CONFIG_FW_INFO=y +CONFIG_SECURE_BOOT_CRYPTO=y +CONFIG_SECURE_BOOT_VALIDATION=y +CONFIG_SECURE_BOOT_STORAGE=y +CONFIG_PCD_NET=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_LOG=n +CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n +CONFIG_PRINTK=n +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_ASSERT=n +CONFIG_NRF_RTC_TIMER=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n +CONFIG_SYS_CLOCK_EXISTS=n +CONFIG_TIMEOUT_64BIT=n diff --git a/applications/matter_weather_station/sysbuild/ipc_radio/boards/thingy53_nrf5340_cpunet.conf b/applications/matter_weather_station/sysbuild/ipc_radio/boards/thingy53_nrf5340_cpunet.conf new file mode 100644 index 000000000000..1ef215cc427b --- /dev/null +++ b/applications/matter_weather_station/sysbuild/ipc_radio/boards/thingy53_nrf5340_cpunet.conf @@ -0,0 +1,49 @@ +# +# Copyright (c) 2026 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Disable serial and UART interface. +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +# RAM usage configuration +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# BT configuration +CONFIG_BT=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_MAX_CONN=1 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=n +CONFIG_BT_BUF_ACL_RX_SIZE=502 +CONFIG_BT_BUF_ACL_TX_SIZE=251 + +# It is set based on BT_BUF_ACL_RX_COUNT_EXTRA = 6 - (BT_MAX_CONN + 1) +CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=4 + +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +CONFIG_BT_CTLR_PHY_2M=n + +# Debug and assert configuration +CONFIG_ASSERT=y +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_REBOOT=n + +# IPC +CONFIG_MBOX=y +CONFIG_IPC_SERVICE=y + +# ipc_radio +CONFIG_IPC_RADIO_BT=y +CONFIG_IPC_RADIO_BT_HCI_IPC=y + +# NRF_802154_ENCRYPTION is not enabled by default in the `overlay-802154.conf` file +# that is pulled in by NETCORE_IPC_RADIO_IEEE802154 in application's Kconfig.sysbuild. +# For Wi-Fi builds, this option will not get applied anyway. +CONFIG_NRF_802154_ENCRYPTION=y diff --git a/applications/matter_weather_station/sysbuild/ipc_radio/boards/thingy53_nrf5340_cpunet.overlay b/applications/matter_weather_station/sysbuild/ipc_radio/boards/thingy53_nrf5340_cpunet.overlay new file mode 100644 index 000000000000..bbfdde5ab0d6 --- /dev/null +++ b/applications/matter_weather_station/sysbuild/ipc_radio/boards/thingy53_nrf5340_cpunet.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include diff --git a/applications/matter_weather_station/sysbuild/ipc_radio/prj.conf b/applications/matter_weather_station/sysbuild/ipc_radio/prj.conf index 92716ca1df9e..e5d81fa2108d 100644 --- a/applications/matter_weather_station/sysbuild/ipc_radio/prj.conf +++ b/applications/matter_weather_station/sysbuild/ipc_radio/prj.conf @@ -4,52 +4,11 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -# Disable serial and UART interface. CONFIG_SERIAL=n CONFIG_UART_CONSOLE=n CONFIG_LOG=n -# Workaround FEM issue seen on some Thingy:53 revisions -CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=10 - -# RAM usage configuration -CONFIG_HEAP_MEM_POOL_SIZE=8192 -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 - -# BT configuration -CONFIG_BT=y -CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=1 -CONFIG_BT_CTLR_ASSERT_HANDLER=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=n -CONFIG_BT_BUF_ACL_RX_SIZE=502 -CONFIG_BT_BUF_ACL_TX_SIZE=251 - -# It is set based on BT_BUF_ACL_RX_COUNT_EXTRA = 6 - (BT_MAX_CONN + 1) -CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=4 - -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 -CONFIG_BT_CTLR_PHY_2M=n - -# Debug and assert configuration -CONFIG_ASSERT=y CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_REBOOT=n - -# IPC -CONFIG_MBOX=y -CONFIG_IPC_SERVICE=y - -# ipc_radio -CONFIG_IPC_RADIO_BT=y -CONFIG_IPC_RADIO_BT_HCI_IPC=y - -# NRF_802154_ENCRYPTION is not enabled by default in the `overlay-802154.conf` file -# that is pulled in by NETCORE_IPC_RADIO_IEEE802154 in application's Kconfig.sysbuild. -# For Wi-Fi builds, this option will not get applied anyway. -CONFIG_NRF_802154_ENCRYPTION=y # Workaround for the spinlock assertion issue. CONFIG_TIMESLICE_SIZE=0 diff --git a/applications/matter_weather_station/sysbuild/ipc_radio/prj_release.conf b/applications/matter_weather_station/sysbuild/ipc_radio/prj_release.conf new file mode 100644 index 000000000000..4aac746c80bf --- /dev/null +++ b/applications/matter_weather_station/sysbuild/ipc_radio/prj_release.conf @@ -0,0 +1,14 @@ +# +# Copyright (c) 2026 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_LOG=n + +CONFIG_RESET_ON_FATAL_ERROR=y + +# Workaround for the spinlock assertion issue. +CONFIG_TIMESLICE_SIZE=0 diff --git a/applications/matter_weather_station/sysbuild/mcuboot/app.overlay b/applications/matter_weather_station/sysbuild/mcuboot/app.overlay index e888755e9855..74d3dfbfd22f 100644 --- a/applications/matter_weather_station/sysbuild/mcuboot/app.overlay +++ b/applications/matter_weather_station/sysbuild/mcuboot/app.overlay @@ -1,9 +1,3 @@ -/* - * Copyright (c) 2026 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - / { chosen { zephyr,code-partition = &boot_partition; diff --git a/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.conf b/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.conf index 28efe7087476..32375aa6e065 100644 --- a/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.conf +++ b/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.conf @@ -9,9 +9,6 @@ CONFIG_HW_STACK_PROTECTION=n CONFIG_BOOT_WATCHDOG_FEED=n -CONFIG_BOOT_SWAP_SAVE_ENCTLV=n -CONFIG_BOOT_BOOTSTRAP=n - # Disable all debug features CONFIG_ASSERT_VERBOSE=n CONFIG_ASSERT_NO_FILE_INFO=y @@ -22,12 +19,7 @@ CONFIG_PRINTK=n # the secondary slot resides in the internal RRAM, so features # needed to handle the external flash are not needed. CONFIG_SPI_NOR=n -CONFIG_SERIAL=n -CONFIG_GPIO=n -CONFIG_MULTITHREADING=n -CONFIG_TICKLESS_KERNEL=n -CONFIG_TIMEOUT_64BIT=n -CONFIG_NRF_ENABLE_ICACHE=n +CONFIG_SPI=n # Currently, without tickless kernel, the SYSCOUNTER value after the software # reset is not set properly and due to that the first system interrupt is not called diff --git a/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.overlay b/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.overlay index 498bb6b245ec..28632679ec75 100644 --- a/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.overlay +++ b/applications/matter_weather_station/sysbuild/mcuboot/boards/nrf54l15tag_nrf54l15_cpuapp.overlay @@ -4,12 +4,10 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* restore full RRAM and SRAM space - by default some parts are dedicated to FLRP */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1524)>; -}; +#include -&cpuapp_sram { - reg = <0x20000000 DT_SIZE_K(256)>; - ranges = <0x0 0x20000000 0x40000>; +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/matter_weather_station/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf b/applications/matter_weather_station/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf index c51210387c19..8fd98233672c 100644 --- a/applications/matter_weather_station/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf +++ b/applications/matter_weather_station/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf @@ -17,9 +17,8 @@ CONFIG_NCS_APPLICATION_BOOT_BANNER_STRING="MCUboot" CONFIG_SYSTEM_CLOCK_NO_WAIT=y -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" -CONFIG_BOOT_MAX_IMG_SECTORS=2048 CONFIG_BOOT_SIGNATURE_TYPE_RSA=y # Flash @@ -63,6 +62,8 @@ CONFIG_UART_NRFX=n CONFIG_PCD_APP=y CONFIG_UPDATEABLE_IMAGE_NUMBER=2 CONFIG_BOOT_UPGRADE_ONLY=y +CONFIG_MCUBOOT_VERIFY_IMG_ADDRESS=n +CONFIG_NRF53_MULTI_IMAGE_UPDATE=y # The network core cannot access external flash directly. The flash simulator must be used to # provide a memory region that is used to forward the new firmware to the network core. CONFIG_FLASH_SIMULATOR=y diff --git a/applications/matter_weather_station/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay b/applications/matter_weather_station/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..ee8326855b1c --- /dev/null +++ b/applications/matter_weather_station/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2021 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include + +/ { + zephyr,user { + battery-charge-gpios = <&gpio1 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + }; + + pwmbuzzer { + compatible = "pwm-leds"; + status = "okay"; + + buzzer: buzzer_pwm { + pwms = <&pwm1 0 PWM_HZ(100) PWM_POLARITY_NORMAL>; + label = "PWM_1"; + }; + }; + + aliases { + buzzer-pwm = &buzzer; + }; + + sram@2007e340 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2007e340 0x1cc0>; + zephyr,memory-region = "DiagnosticLogMem"; + status = "okay"; + + retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + + /* Reserve 192 B for the crash logs. */ + crash_retention: retention@0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0x0 0xc0>; + prefix = [08 04]; + checksum = <2>; + }; + + /* Reserve 6 kB for the network logs. */ + network_logs_retention: retention@c0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0xc0 0x1800>; + prefix = [06 03]; + checksum = <2>; + }; + + /* Reserve 1 kB for the end user logs. */ + end_user_logs_retention: retention@18c0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0x18c0 0x400>; + prefix = [05 02]; + checksum = <2>; + }; + }; + }; +}; + +/* Set IPC thread priority to the highest value to not collide with other threads. */ +&ipc0 { + zephyr,priority = <0 PRIO_COOP>; +}; + +/delete-node/ &boot_partition; +/delete-node/ &slot0_partition; +/delete-node/ &slot1_partition; +/delete-node/ &storage_partition; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(32)>; + }; + + slot0_partition: partition@8000 { + label = "image-0"; + reg = <0x00008000 DT_SIZE_K(956)>; + }; + + factory_data_partition: partition@f7000 { + label = "factory-data"; + reg = <0x000f7000 DT_SIZE_K(4)>; + }; + + storage_partition: partition@f8000 { + label = "storage"; + reg = <0x000f8000 DT_SIZE_K(32)>; + }; + }; +}; + +&mx25r64 { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@0 { + label = "image-1"; + reg = <0x00000000 DT_SIZE_K(956)>; + }; + + slot3_partition: partition@ef000 { + label = "image-3"; + reg = <0x000ef000 DT_SIZE_K(224)>; + }; + }; +}; + +&i2c1 { + bme688@76 { + compatible = "bosch,bme680"; + reg = <0x76>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <12>; + zephyr,oversampling = <4>; + }; +}; + +/* Disable unused peripherals to reduce power consumption */ +&pwm0 { + status = "disabled"; +}; + +&pwm2 { + status = "disabled"; +}; + +/* Reduce SRAM0 usage by 7360 B to account for non-init area */ +&sram0 { + reg = <0x20000000 0x7e340>; +}; diff --git a/applications/matter_weather_station/sysbuild/mcuboot/prj.conf b/applications/matter_weather_station/sysbuild/mcuboot/prj.conf index 9190de8246d9..aec8ccdcf910 100644 --- a/applications/matter_weather_station/sysbuild/mcuboot/prj.conf +++ b/applications/matter_weather_station/sysbuild/mcuboot/prj.conf @@ -19,7 +19,7 @@ CONFIG_SPI=n CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=n -CONFIG_BOOT_MAX_IMG_SECTORS=256 +CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=y CONFIG_LOG=n CONFIG_CONSOLE_HANDLER=n diff --git a/applications/nrf5340_audio/Kconfig.defaults b/applications/nrf5340_audio/Kconfig.defaults index 680dd4fedf6f..c9797f8e2c8c 100644 --- a/applications/nrf5340_audio/Kconfig.defaults +++ b/applications/nrf5340_audio/Kconfig.defaults @@ -11,8 +11,8 @@ config MAIN_THREAD_PRIORITY default 10 config MAIN_STACK_SIZE - default 1800 if SD_CARD_PLAYBACK - default 1600 + default 2500 if SD_CARD_PLAYBACK + default 2000 config SYSTEM_WORKQUEUE_STACK_SIZE default 2000 diff --git a/applications/nrf5340_audio/broadcast_sink/main.c b/applications/nrf5340_audio/broadcast_sink/main.c index 7095c780bf79..3152533aa544 100644 --- a/applications/nrf5340_audio/broadcast_sink/main.c +++ b/applications/nrf5340_audio/broadcast_sink/main.c @@ -144,6 +144,14 @@ static void button_msg_sub_thread(void) break; } + if (IS_ENABLED(CONFIG_BT_AUDIO_SCAN_DELEGATOR)) { + /* If this device is a scan delegator, we depend on a broadcast + * assistant to transfer the broadcast source info. + * It should not scan by itself. + */ + break; + } + ret = broadcast_sink_disable(); if (ret) { LOG_ERR("Failed to disable the broadcast sink: %d", ret); @@ -339,6 +347,11 @@ static void bt_mgmt_msg_sub_thread(void) LOG_DBG("Security changed"); break; + case BT_MGMT_PAIRING_COMPLETE: + /* If this device is a scan delegator */ + LOG_DBG("Pairing complete"); + break; + case BT_MGMT_PA_SYNCED: LOG_DBG("PA synced"); diff --git a/applications/nrf5340_audio/doc/building.rst b/applications/nrf5340_audio/doc/building.rst index ba3247a06ca6..c99fc3090203 100644 --- a/applications/nrf5340_audio/doc/building.rst +++ b/applications/nrf5340_audio/doc/building.rst @@ -68,6 +68,9 @@ When preparing the JSON file, update the following fields: * ``location`` - This field is valid only for headsets. It sets the location on which the headset is meant to work, especially when using the :ref:`default CIS transport mode configuration `. For more information, see :ref:`nrf53_audio_app_configuration_headset_location`. +* ``sirk`` - This field sets the SIRK for the device set, which is used in the unicast applications. + The SIRK must be 16 characters long and cannot be the default SIRK defined in the Kconfig file (``NRF5340_TWS_DEMO``). + If the default SIRK is used, the script will raise an error and stop building. .. _nrf53_audio_app_building_script_running: diff --git a/applications/nrf5340_audio/prj.conf b/applications/nrf5340_audio/prj.conf index 5bffd8fce3ff..0b67e6246cff 100644 --- a/applications/nrf5340_audio/prj.conf +++ b/applications/nrf5340_audio/prj.conf @@ -19,6 +19,7 @@ CONFIG_INIT_STACKS=y CONFIG_BT=y CONFIG_NET_BUF_POOL_USAGE=y CONFIG_BT_RX_STACK_SIZE=2500 +CONFIG_POLL=y # Uart driver CONFIG_SERIAL=y @@ -29,6 +30,7 @@ CONFIG_LOG_TAG_MAX_LEN=2 CONFIG_LOG_TAG_DEFAULT="--" CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BUFFER_SIZE=4096 +CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=4 CONFIG_BT_SECURITY_ERR_TO_STR=y # Use this for debugging thread usage @@ -88,3 +90,7 @@ CONFIG_LOG_PRINTK=n CONFIG_CPU_LOAD_LOG_PERIODICALLY=5000 CONFIG_CPU_LOAD_LOG_LEVEL_WRN=y CONFIG_SPEED_OPTIMIZATIONS=y + +# Enable link-time-optimizations to improve performance and reduce size +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y diff --git a/applications/nrf5340_audio/prj_release.conf b/applications/nrf5340_audio/prj_release.conf index f20bc08712f8..f8655c77f93e 100644 --- a/applications/nrf5340_audio/prj_release.conf +++ b/applications/nrf5340_audio/prj_release.conf @@ -22,16 +22,15 @@ CONFIG_UART_CONSOLE=n CONFIG_BOOT_BANNER=n CONFIG_NET_BUF_POOL_USAGE=y CONFIG_BT_RX_STACK_SIZE=2500 +CONFIG_POLL=y # BT related configs CONFIG_BT_ISO_TX_BUF_COUNT=3 CONFIG_BT_BUF_ACL_TX_COUNT=3 CONFIG_BT_ATT_TX_COUNT=12 -# Bluetooth -# Default value from src/bluetooth/Kconfig.defaults. -# BT_PRIVACY is default turned off to ease the development. -# Should be turned on before production. -# CONFIG_BT_PRIVACY=y - CONFIG_SPEED_OPTIMIZATIONS=y + +# Enable link-time-optimizations to improve performance and reduce size +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y diff --git a/applications/nrf5340_audio/src/audio/Kconfig b/applications/nrf5340_audio/src/audio/Kconfig index 049ceeb5910c..70ac0fc5dd17 100644 --- a/applications/nrf5340_audio/src/audio/Kconfig +++ b/applications/nrf5340_audio/src/audio/Kconfig @@ -403,7 +403,7 @@ config BT_MGMT_MSG_SUB_STACK_SIZE config CONTENT_CONTROL_MSG_SUB_STACK_SIZE int "Stack size for content control subscriber" - default 1024 + default 1200 endmenu # Stack sizes diff --git a/applications/nrf5340_audio/src/audio/audio_datapath.c b/applications/nrf5340_audio/src/audio/audio_datapath.c index 9b4582b00b9d..b4e68c872de5 100644 --- a/applications/nrf5340_audio/src/audio/audio_datapath.c +++ b/applications/nrf5340_audio/src/audio/audio_datapath.c @@ -38,7 +38,7 @@ LOG_MODULE_REGISTER(audio_datapath, CONFIG_AUDIO_DATAPATH_LOG_LEVEL); * - frame: encoded audio packet exchanged with connectivity */ -#define BLK_PERIOD_US 1000 +#define BLK_PERIOD_US 500 /* Total sample FIFO period in microseconds */ #define FIFO_CHANNELS_MAX MAX(CONFIG_AUDIO_INPUT_CHANNELS, CONFIG_AUDIO_OUTPUT_CHANNELS) @@ -51,7 +51,7 @@ LOG_MODULE_REGISTER(audio_datapath, CONFIG_AUDIO_DATAPATH_LOG_LEVEL); #define NUM_BLKS(d) ((d) / BLK_PERIOD_US) /* Single audio block size in number of samples */ /* clang-format off */ -#define BLK_SIZE_SAMPLES(r) (((r)*BLK_PERIOD_US) / 1000000) +#define BLK_SIZE_SAMPLES(r) (((r)*BLK_PERIOD_US) / USEC_PER_SEC) /* clang-format on */ /* Increment sample FIFO index by one block */ #define NEXT_IDX(i) (((i) < (FIFO_NUM_BLKS - 1)) ? ((i) + 1) : 0) @@ -61,6 +61,7 @@ LOG_MODULE_REGISTER(audio_datapath, CONFIG_AUDIO_DATAPATH_LOG_LEVEL); #define NUM_BLKS_IN_FRAME NUM_BLKS(CONFIG_AUDIO_FRAME_DURATION_US) #define BLK_MONO_NUM_SAMPS BLK_SIZE_SAMPLES(CONFIG_AUDIO_SAMPLE_RATE_HZ) #define BLK_MULTI_CHAN_NUM_SAMPS (BLK_MONO_NUM_SAMPS * CONFIG_AUDIO_OUTPUT_CHANNELS) + /* Number of octets in a single audio block */ #define BLK_MONO_SIZE_OCTETS (BLK_MONO_NUM_SAMPS * CONFIG_AUDIO_BIT_DEPTH_OCTETS) #define BLK_MULTI_CHAN_SIZE_OCTETS (BLK_MULTI_CHAN_NUM_SAMPS * CONFIG_AUDIO_BIT_DEPTH_OCTETS) @@ -83,16 +84,12 @@ LOG_MODULE_REGISTER(audio_datapath, CONFIG_AUDIO_DATAPATH_LOG_LEVEL); #define APLL_FREQ_ADJ(t) (-((t)*1000) / 331) /* clang-format on */ -#define DRIFT_MEAS_PERIOD_US 100000 +#define DRIFT_MEAS_PERIOD_US 150000 #define DRIFT_ERR_THRESH_LOCK 16 #define DRIFT_ERR_THRESH_UNLOCK 32 /* To get smaller corrections */ #define DRIFT_REGULATOR_DIV_FACTOR 2 -/* To allow BLE transmission and (host -> HCI -> controller) */ -#define JUST_IN_TIME_TARGET_DLY_US 3000 -#define JUST_IN_TIME_BOUND_US 2500 - /* How often to print under-run warning */ #define LOG_INTERVAL_BLKS 5000 @@ -190,7 +187,7 @@ static int filled_blocks_get(void) } static struct audio_metadata i2s_meta = {.data_coding = PCM, - .data_len_us = 1000, + .data_len_us = BLK_PERIOD_US, .sample_rate_hz = CONFIG_AUDIO_SAMPLE_RATE_HZ, .bits_per_sample = CONFIG_AUDIO_BIT_DEPTH_BITS, .carried_bits_per_sample = CONFIG_AUDIO_BIT_DEPTH_BITS, @@ -738,7 +735,7 @@ static void audio_datapath_i2s_blk_complete(uint32_t frame_start_ts_us, uint32_t static uint32_t num_overruns; static uint32_t num_overruns_last_printed; - if (IS_ENABLED(CONFIG_STREAM_BIDIRECTIONAL) || (CONFIG_AUDIO_DEV == GATEWAY)) { + if (audio_system_encoder_is_started()) { if (unlikely(rx_buf_released == NULL)) { ERR_CHK_MSG(-ENOMEM, "No RX data available"); } @@ -776,7 +773,7 @@ static void audio_datapath_i2s_blk_complete(uint32_t frame_start_ts_us, uint32_t /* Update metadata */ struct audio_metadata *meta = net_buf_user_data(i2s_current_frame); - meta->data_len_us += i2s_meta.data_len_us; /* Each block is 1ms */ + meta->data_len_us += i2s_meta.data_len_us; meta->bytes_per_location += i2s_meta.bytes_per_location; i2s_blocks_in_current_frame++; @@ -792,7 +789,7 @@ static void audio_datapath_i2s_blk_complete(uint32_t frame_start_ts_us, uint32_t * queue is ready */ net_buf_remove_mem(i2s_current_frame, BLK_MULTI_CHAN_SIZE_OCTETS); - meta->data_len_us -= i2s_meta.data_len_us; /* Each block is 1ms */ + meta->data_len_us -= i2s_meta.data_len_us; meta->bytes_per_location -= i2s_meta.bytes_per_location; i2s_blocks_in_current_frame--; @@ -895,13 +892,23 @@ static void audio_datapath_just_in_time_check_and_adjust(uint32_t tx_sync_ts_us, } if (print_count % 100 == 0) { - LOG_DBG("JIT diff: %lld us. Target: %u +/- %u", diff, JUST_IN_TIME_TARGET_DLY_US, - JUST_IN_TIME_BOUND_US); + LOG_DBG("JIT diff: %lld us. Target: %d +/- %d", diff, + CONFIG_NRF_AUDIO_TX_TGT_LEAD_TIME_US, + CONFIG_NRF_AUDIO_TX_LEAD_TIME_DEVIATION_US); } print_count++; - if ((diff < (JUST_IN_TIME_TARGET_DLY_US - JUST_IN_TIME_BOUND_US)) || - (diff > (JUST_IN_TIME_TARGET_DLY_US + JUST_IN_TIME_BOUND_US))) { + /* If the data is sent too late/too slow, we don't copy in data. Instead, + * blocks are dropped, which in turn will cause the controller to starve and + * send a NULL PDU on air "gaining" an ISO interval of time. This means + * we are again too fast, and drop blocks to come back to sync. + */ + + if (!IN_RANGE(diff, + CONFIG_NRF_AUDIO_TX_TGT_LEAD_TIME_US - + CONFIG_NRF_AUDIO_TX_LEAD_TIME_DEVIATION_US, + CONFIG_NRF_AUDIO_TX_TGT_LEAD_TIME_US + + CONFIG_NRF_AUDIO_TX_LEAD_TIME_DEVIATION_US)) { /* Drop next block to help with just-in-time */ atomic_set(&drop_next_block, true); LOG_DBG("Dropped block to align with connection interval"); @@ -934,7 +941,7 @@ static void audio_datapath_sdu_ref_update(const struct zbus_channel *chan) if (ctrl_blk.stream_started) { ctrl_blk.prev_drift_sdu_ref_us = tx_sync_ts_us; - if (adjust && tx_sync_ts_us != 0) { + if (adjust) { audio_datapath_just_in_time_check_and_adjust(tx_sync_ts_us, curr_ts_us); } diff --git a/applications/nrf5340_audio/src/audio/audio_system.c b/applications/nrf5340_audio/src/audio/audio_system.c index 1f25ace23957..38b8771df3ee 100644 --- a/applications/nrf5340_audio/src/audio/audio_system.c +++ b/applications/nrf5340_audio/src/audio/audio_system.c @@ -152,7 +152,7 @@ static void encoder_thread(void *arg1, void *arg2, void *arg3) ret = k_msgq_get(&audio_q_rx, (void *)&audio_frame_in, K_FOREVER); ERR_CHK_MSG(ret, "Failed to get complete audio frame from RX queue"); - if (likely(sw_codec_cfg.encoder.enabled)) { + if (likely(sw_codec_cfg.initialized && sw_codec_cfg.encoder.enabled)) { audio_frame_out = net_buf_alloc(&audio_q_enc_pool, K_NO_WAIT); if (unlikely(audio_frame_out == NULL)) { @@ -200,6 +200,8 @@ static void encoder_thread(void *arg1, void *arg2, void *arg3) ret = sw_codec_encode(audio_frame_in, audio_frame_out); ERR_CHK_MSG(ret, "Encode failed"); + } else { + LOG_INF_RATELIMIT("Encoder not initialized or enabled, data dropped"); } net_buf_unref(audio_frame_in); @@ -231,6 +233,15 @@ void audio_system_encoder_stop(void) k_poll_signal_reset(&encoder_sig); } +bool audio_system_encoder_is_started(void) +{ + int set, res; + + k_poll_signal_check(&encoder_sig, &set, &res); + + return (set == 0 ? false : true); +} + int audio_system_encode_test_tone_set(uint32_t freq) { int ret; diff --git a/applications/nrf5340_audio/src/audio/audio_system.h b/applications/nrf5340_audio/src/audio/audio_system.h index 217ca737880d..25b2a0d151be 100644 --- a/applications/nrf5340_audio/src/audio/audio_system.h +++ b/applications/nrf5340_audio/src/audio/audio_system.h @@ -38,6 +38,13 @@ void audio_system_encoder_start(void); */ void audio_system_encoder_stop(void); +/** + * @brief Check if the encoder thread is currently enabled to execute. + * + * @return true if encoder thread is enabled, false otherwise. + */ +bool audio_system_encoder_is_started(void); + /** * @brief Toggle a test tone on and off. * diff --git a/applications/nrf5340_audio/src/audio/le_audio_rx.c b/applications/nrf5340_audio/src/audio/le_audio_rx.c index d034967aa6d3..ae8dc66f4165 100644 --- a/applications/nrf5340_audio/src/audio/le_audio_rx.c +++ b/applications/nrf5340_audio/src/audio/le_audio_rx.c @@ -23,7 +23,9 @@ LOG_MODULE_REGISTER(le_audio_rx, CONFIG_LE_AUDIO_RX_LOG_LEVEL); struct rx_stats { uint32_t recv_cnt; + uint32_t good_frame_cnt; uint32_t bad_frame_cnt; + bool prev_bad_data; }; static bool initialized; @@ -115,6 +117,8 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad if (meta->bad_data) { rx_stats[location_index].bad_frame_cnt++; + } else { + rx_stats[location_index].good_frame_cnt++; } if ((rx_stats[location_index].recv_cnt % 100) == 0 && rx_stats[location_index].recv_cnt) { @@ -123,6 +127,16 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad rx_stats[location_index].recv_cnt, rx_stats[location_index].bad_frame_cnt); } + if (meta->bad_data && !rx_stats[location_index].prev_bad_data) { + LOG_INF_RATELIMIT_RATE(1000, + "Bad or 0 SDU: Loc: %u Total: %u Bad: %u. (Prints " + "good->bad transition)", + location_index, rx_stats[location_index].recv_cnt, + rx_stats[location_index].bad_frame_cnt); + } + + rx_stats[location_index].prev_bad_data = meta->bad_data; + if (stream_state_get() != STATE_STREAMING) { /* Throw away data */ num_thrown++; @@ -215,7 +229,7 @@ void le_audio_rx_data_handler(struct net_buf *audio_frame_rx, struct audio_metad audio_frame = net_buf_alloc(&ble_rx_pool, K_NO_WAIT); if (audio_frame == NULL) { - LOG_WRN("Out of RX buffers"); + LOG_WRN_RATELIMIT_RATE(1000, "Out of RX buffers"); return; } diff --git a/applications/nrf5340_audio/src/audio/sw_codec_select.c b/applications/nrf5340_audio/src/audio/sw_codec_select.c index 8a78107c22f2..f6218d0c228d 100644 --- a/applications/nrf5340_audio/src/audio/sw_codec_select.c +++ b/applications/nrf5340_audio/src/audio/sw_codec_select.c @@ -395,6 +395,7 @@ int sw_codec_uninit(struct sw_codec_config sw_codec_cfg) LOG_ERR("Trying to uninit a codec that is not first initialized"); return -ENODEV; } + switch (m_config.sw_codec) { case SW_CODEC_LC3: #if (CONFIG_SW_CODEC_LC3) @@ -404,10 +405,12 @@ int sw_codec_uninit(struct sw_codec_config sw_codec_cfg) "initialized"); return -EALREADY; } + ret = sw_codec_lc3_enc_uninit_all(); if (ret) { return ret; } + m_config.encoder.enabled = false; } @@ -422,8 +425,14 @@ int sw_codec_uninit(struct sw_codec_config sw_codec_cfg) if (ret) { return ret; } + m_config.decoder.enabled = false; } + + ret = sw_codec_lc3_uninit(); + if (ret) { + return ret; + } #endif /* (CONFIG_SW_CODEC_LC3) */ break; default: @@ -443,9 +452,23 @@ int sw_codec_init(struct sw_codec_config sw_codec_cfg) switch (sw_codec_cfg.sw_codec) { case SW_CODEC_LC3: { #if (CONFIG_SW_CODEC_LC3) - if (m_config.sw_codec != SW_CODEC_LC3) { + if (!m_config.initialized) { /* Check if LC3 is already initialized */ - ret = sw_codec_lc3_init(NULL, NULL, CONFIG_AUDIO_FRAME_DURATION_US); + uint16_t encoder_sample_rate = 0; + uint16_t decoder_sample_rate = 0; + + if (sw_codec_cfg.encoder.enabled) { + encoder_sample_rate = sw_codec_cfg.encoder.sample_rate_hz; + } + + if (sw_codec_cfg.decoder.enabled) { + decoder_sample_rate = sw_codec_cfg.decoder.sample_rate_hz; + } + + ret = sw_codec_lc3_single_rate_init(encoder_sample_rate, + decoder_sample_rate, + NULL, NULL, + CONFIG_AUDIO_FRAME_DURATION_US); if (ret) { return ret; } @@ -456,6 +479,7 @@ int sw_codec_init(struct sw_codec_config sw_codec_cfg) LOG_WRN("The LC3 encoder is already initialized"); return -EALREADY; } + uint16_t pcm_bytes_req_enc; LOG_DBG("Encode: %dHz %dbits %dus %dbps %d channel(s)", diff --git a/applications/nrf5340_audio/src/audio/sw_codec_select.h b/applications/nrf5340_audio/src/audio/sw_codec_select.h index eb854d1b421b..eba13d11dea1 100644 --- a/applications/nrf5340_audio/src/audio/sw_codec_select.h +++ b/applications/nrf5340_audio/src/audio/sw_codec_select.h @@ -25,10 +25,12 @@ #include "device_location.h" #if (CONFIG_SW_CODEC_LC3) -#define LC3_MAX_FRAME_SIZE_MS 10 -#define LC3_ENC_MONO_FRAME_SIZE (CONFIG_LC3_BITRATE_MAX * LC3_MAX_FRAME_SIZE_MS / (8 * 1000)) +#define LC3_MAX_FRAME_SIZE_US 10000 +#define LC3_ENC_MONO_FRAME_SIZE \ + (CONFIG_LC3_BITRATE_MAX * LC3_MAX_FRAME_SIZE_US / (8 * USEC_PER_SEC)) #define LC3_PCM_NUM_BYTES_MONO \ - (CONFIG_AUDIO_SAMPLE_RATE_HZ * CONFIG_AUDIO_BIT_DEPTH_OCTETS * LC3_MAX_FRAME_SIZE_MS / 1000) + (CONFIG_AUDIO_SAMPLE_RATE_HZ * CONFIG_AUDIO_BIT_DEPTH_OCTETS * LC3_MAX_FRAME_SIZE_US / \ + USEC_PER_SEC) #define LC3_ENC_TIME_US 3000 #define LC3_DEC_TIME_US 1500 #else diff --git a/applications/nrf5340_audio/src/bluetooth/Kconfig b/applications/nrf5340_audio/src/bluetooth/Kconfig index fb1cd8391b0c..d3cb91461743 100644 --- a/applications/nrf5340_audio/src/bluetooth/Kconfig +++ b/applications/nrf5340_audio/src/bluetooth/Kconfig @@ -21,6 +21,8 @@ if TRANSPORT_CIS rsource "bt_stream/unicast/Kconfig" endif # TRANSPORT_CIS +rsource "bt_stream/bt_le_audio_tx/Kconfig" + config BT_AUDIO_PACKING_INTERLEAVED bool "Interleaved packing" default n diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/Kconfig b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/Kconfig index 4e90063b53d9..3de28c8b3108 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/Kconfig +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/Kconfig @@ -265,6 +265,11 @@ config BT_AUDIO_BROADCAST_ZBUS_EVT_STREAM_SENT be prepared. As this event will trigger once for each frame it will cause significant overhead, even if the event is not used. +config BT_AUDIO_BROADCAST_BASE_PRINT + bool "Print BASE information" + help + Print the contents of the BASE when received. This is useful for debugging purposes. + #----------------------------------------------------------------------------# menu "Log levels" diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_sink.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_sink.c index 8065e3e789d3..dca8ee369d41 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_sink.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_sink.c @@ -47,6 +47,12 @@ struct audio_codec_info { uint32_t pd; }; +struct stream_info { + struct bt_bap_base_codec_id codec_id; + uint8_t subgroup_index; + uint8_t bis_index; +}; + static struct bt_bap_broadcast_sink *broadcast_sink; static struct bt_bap_stream audio_streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; static struct bt_bap_stream *audio_streams_p[ARRAY_SIZE(audio_streams)]; @@ -71,6 +77,7 @@ static struct bt_pacs_cap capabilities = { }; #define AVAILABLE_SINK_CONTEXT (BT_AUDIO_CONTEXT_TYPE_ANY) +#define PROGRAM_INFO_MAX_LEN 256 static le_audio_receive_cb receive_cb; @@ -126,66 +133,6 @@ struct bt_csip_set_member_register_param csip_param = { .cb = &csip_callbacks, }; -int broadcast_sink_uuid_populate(struct net_buf_simple *uuid_buf) -{ - if (net_buf_simple_tailroom(uuid_buf) >= (BT_UUID_SIZE_16 * 3)) { - net_buf_simple_add_le16(uuid_buf, BT_UUID_BASS_VAL); - net_buf_simple_add_le16(uuid_buf, BT_UUID_PACS_VAL); - } else { - LOG_ERR("Not enough space for UUIDS"); - return -ENOMEM; - } - - return 0; -} - -int broadcast_sink_adv_populate(struct bt_data *adv_buf, uint8_t adv_buf_vacant) -{ - int ret; - uint32_t adv_buf_cnt = 0; - - if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER)) { - ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, - sizeof(csip_rsi_adv_data), BT_DATA_CSIS_RSI, - (void *)csip_rsi_adv_data); - if (ret) { - return ret; - } - } - - /* - * AD format required for broadcast sink with scan delegator. - * Details can be found in Basic Audio Profile Section 3.9.2. - */ - sys_put_le16(BT_UUID_BASS_VAL, &bass_service_uuid[0]); - - ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, - sizeof(bass_service_uuid), BT_DATA_SVC_DATA16, - (void *)bass_service_uuid); - if (ret) { - return ret; - } - - sys_put_le16(CONFIG_BT_DEVICE_APPEARANCE, &gap_appear_adv_data[0]); - - ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, - sizeof(gap_appear_adv_data), BT_DATA_GAP_APPEARANCE, - (void *)gap_appear_adv_data); - if (ret) { - return ret; - } - - flags_adv_data = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR; - - ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, sizeof(uint8_t), - BT_DATA_FLAGS, (void *)&flags_adv_data); - if (ret) { - return ret; - } - - return adv_buf_cnt; -} - static int broadcast_sink_cleanup(void) { int ret; @@ -437,6 +384,7 @@ static bool base_subgroup_cb(const struct bt_bap_base_subgroup *subgroup, void * LOG_DBG("Subgroup %p has %d BISes", (void *)subgroup, bis_num); if (bis_num > 0) { *suitable_stream_found = true; + for (int i = 0; i < bis_num; i++) { get_codec_info(&codec_cfg, &audio_codec_info[i]); audio_codec_info[i].id = codec_id.id; @@ -448,12 +396,211 @@ static bool base_subgroup_cb(const struct bt_bap_base_subgroup *subgroup, void * if (ret < 0) { LOG_WRN("Could not get BIS for subgroup %p: %d", (void *)subgroup, ret); } + return false; } return true; } +static bool base_print_subgroup_per_bis_cb(const struct bt_bap_base_subgroup_bis *bis, + void *user_data) +{ + int ret; + struct stream_info *info = user_data; + enum bt_audio_location chan_allocation; + + struct bt_audio_codec_cfg codec_cfg = { + .id = info->codec_id.id, + .cid = info->codec_id.cid, + .vid = info->codec_id.vid, + }; + + ret = bt_bap_base_subgroup_bis_codec_to_codec_cfg(bis, &codec_cfg); + if (ret < 0) { + LOG_WRN("Failed to convert codec to codec_cfg: %d", ret); + return false; + } + + ret = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &chan_allocation, false); + if (ret < 0) { + LOG_WRN("Failed to get channel allocation: %d", ret); + return false; + } + + if (chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO) { + LOG_INF("\t\t\tBIS %d: Mono", info->bis_index); + } else { + for (size_t i = 0; i < 32; i++) { + uint32_t bit_val = BIT(i); + + if (chan_allocation & bit_val) { + LOG_INF("\t\t\tBIS %d: %s", info->bis_index, + bt_audio_location_bit_to_str(bit_val)); + } + } + } + + info->bis_index += 1; + + return true; +} + +static bool base_print_per_subgroup_cb(const struct bt_bap_base_subgroup *subgroup, void *user_data) +{ + int ret; + struct bt_bap_base_codec_id codec_id; + struct bt_audio_codec_cfg codec_cfg; + uint8_t *subgroup_index = user_data; + + LOG_INF("Subgroup: %d", *subgroup_index); + + ret = bt_bap_base_get_subgroup_codec_id(subgroup, &codec_id); + if (ret < 0) { + return false; + } + + struct stream_info info = { + .codec_id = codec_id, + .subgroup_index = *subgroup_index, + .bis_index = 0, + }; + + ret = bt_bap_base_subgroup_codec_to_codec_cfg(subgroup, &codec_cfg); + if (ret != 0) { + LOG_WRN("Failed to convert codec to codec_cfg: %d", ret); + return false; + } + + LOG_INF("\tCodec specific configuration:"); + + if (codec_cfg.data_len == 0U) { + LOG_INF("\t\tNone"); + } else if (codec_cfg.id == BT_HCI_CODING_FORMAT_LC3) { + int ret; + + ret = bt_audio_codec_cfg_get_freq(&codec_cfg); + if (ret >= 0) { + LOG_INF("\t\tSampling rate: %u Hz", + bt_audio_codec_cfg_freq_to_freq_hz(ret)); + } else { + LOG_WRN("Failed to get frequency: %d", ret); + } + + ret = bt_audio_codec_cfg_get_frame_dur(&codec_cfg); + if (ret >= 0) { + LOG_INF("\t\tFrame duration: %u us", + bt_audio_codec_cfg_frame_dur_to_frame_dur_us(ret)); + } else { + LOG_WRN("Failed to get frame duration: %d", ret); + } + + ret = bt_audio_codec_cfg_get_octets_per_frame(&codec_cfg); + if (ret >= 0) { + LOG_INF("\t\tOctets per frame: %u", (uint16_t)ret); + } else { + LOG_WRN("Failed to get octets per frame: %d", ret); + } + + ret = bt_bap_base_get_subgroup_bis_count(subgroup); + if (ret >= 0) { + LOG_INF("\t\tNumber of BISes: %u", (uint8_t)ret); + } else { + LOG_WRN("Failed to get number of BISes: %d", ret); + } + + LOG_INF("\t\tLocation:"); + ret = bt_bap_base_subgroup_foreach_bis(subgroup, base_print_subgroup_per_bis_cb, + &info); + if (ret < 0) { + return false; + } + + } else { + LOG_INF("\t\tUnsupported codec"); + } + + LOG_INF("\tCodec specific metadata:"); + + if (codec_cfg.meta_len == 0U) { + LOG_INF("\tNone"); + } else { + const uint8_t *data; + + ret = bt_audio_codec_cfg_meta_get_stream_context(&codec_cfg); + if (ret >= 0) { + /* Iterate through the context bits */ + for (size_t i = 0U; i < 16; i++) { + uint16_t bit_val = BIT(i); + + if (ret & bit_val) { + LOG_INF("\t\tContext: %s", + bt_audio_context_bit_to_str(bit_val)); + } + } + } + + ret = bt_audio_codec_cfg_meta_get_program_info(&codec_cfg, &data); + if (ret >= 0) { + char program_info[PROGRAM_INFO_MAX_LEN] = {'\0'}; + int meta_len = ret; + + if (meta_len > PROGRAM_INFO_MAX_LEN) { + meta_len = PROGRAM_INFO_MAX_LEN - 1; + LOG_WRN("Program info length %d exceeds max, truncating. Note that " + "this is non-spec compliant behavior: %d. Program info can " + "be up to 255 bytes long according to the spec, but only " + "%d bytes will be printed", + ret, meta_len, PROGRAM_INFO_MAX_LEN - 1); + } + + memcpy(program_info, data, meta_len); + LOG_INF("\t\tProgram info: %s", program_info); + } + + const uint8_t *lang; + + ret = bt_audio_codec_cfg_meta_get_lang(&codec_cfg, &lang); + if (ret == 0) { + LOG_INF("\t\tLanguage: %c%c%c", (char)lang[0], (char)lang[1], + (char)lang[2]); + } + + ret = bt_audio_codec_cfg_meta_get_parental_rating(&codec_cfg); + if (ret >= 0) { + LOG_INF("\t\tParental rating: %s", bt_audio_parental_rating_to_str(ret)); + } + + ret = bt_audio_codec_cfg_meta_get_audio_active_state(&codec_cfg); + if (ret >= 0) { + LOG_INF("\t\tAudio active state: %s", + ret == BT_AUDIO_ACTIVE_STATE_ENABLED ? "enabled" : "disabled"); + } + + ret = bt_audio_codec_cfg_meta_get_bcast_audio_immediate_rend_flag(&codec_cfg); + if (ret >= 0) { + LOG_INF("\t\tImmediate rendering flag: %s", + ret == 0 ? "enabled" : "disabled"); + } + } + + *subgroup_index += 1; + + return true; +} + +static void base_print(struct bt_bap_broadcast_sink *sink, const struct bt_bap_base *base) +{ + int ret; + + uint8_t subgroup_index = 0; + + ret = bt_bap_base_foreach_subgroup(base, base_print_per_subgroup_cb, &subgroup_index); + if (ret < 0) { + LOG_DBG("Invalid BASE: %d", ret); + } +} + static void base_recv_cb(struct bt_bap_broadcast_sink *sink, const struct bt_bap_base *base, size_t base_size) { @@ -489,6 +636,10 @@ static void base_recv_cb(struct bt_bap_broadcast_sink *sink, const struct bt_bap } le_audio_event_publish(LE_AUDIO_EVT_CONFIG_RECEIVED); + if (IS_ENABLED(CONFIG_BT_AUDIO_BROADCAST_BASE_PRINT)) { + base_print(sink, base); + } + LOG_DBG("Waiting for syncable"); } else { LOG_DBG("Found no suitable stream"); @@ -513,6 +664,12 @@ static void syncable_cb(struct bt_bap_broadcast_sink *sink, const struct bt_iso_ return; } + if (biginfo->encryption == true) { + LOG_INF("BIG is encrypted"); + } else { + LOG_INF("BIG is not encrypted"); + } + /* NOTE: The string below is used by the Nordic CI system */ LOG_INF("Syncing to broadcast stream index 0x%04x (bitfield)", bis_index_bitfield); @@ -564,6 +721,66 @@ static struct bt_bap_broadcast_sink_cb broadcast_sink_cbs = { .syncable = syncable_cb, }; +int broadcast_sink_uuid_populate(struct net_buf_simple *uuid_buf) +{ + if (net_buf_simple_tailroom(uuid_buf) >= (BT_UUID_SIZE_16 * 3)) { + net_buf_simple_add_le16(uuid_buf, BT_UUID_BASS_VAL); + net_buf_simple_add_le16(uuid_buf, BT_UUID_PACS_VAL); + } else { + LOG_ERR("Not enough space for UUIDS"); + return -ENOMEM; + } + + return 0; +} + +int broadcast_sink_adv_populate(struct bt_data *adv_buf, uint8_t adv_buf_vacant) +{ + int ret; + uint32_t adv_buf_cnt = 0; + + if (IS_ENABLED(CONFIG_BT_CSIP_SET_MEMBER)) { + ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, + sizeof(csip_rsi_adv_data), BT_DATA_CSIS_RSI, + (void *)csip_rsi_adv_data); + if (ret) { + return ret; + } + } + + /* + * AD format required for broadcast sink with scan delegator. + * Details can be found in Basic Audio Profile Section 3.9.2. + */ + sys_put_le16(BT_UUID_BASS_VAL, &bass_service_uuid[0]); + + ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, + sizeof(bass_service_uuid), BT_DATA_SVC_DATA16, + (void *)bass_service_uuid); + if (ret) { + return ret; + } + + sys_put_le16(CONFIG_BT_DEVICE_APPEARANCE, &gap_appear_adv_data[0]); + + ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, + sizeof(gap_appear_adv_data), BT_DATA_GAP_APPEARANCE, + (void *)gap_appear_adv_data); + if (ret) { + return ret; + } + + flags_adv_data = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR; + + ret = bt_mgmt_adv_buffer_put(adv_buf, &adv_buf_cnt, adv_buf_vacant, sizeof(uint8_t), + BT_DATA_FLAGS, (void *)&flags_adv_data); + if (ret) { + return ret; + } + + return adv_buf_cnt; +} + int le_audio_concurrent_sync_num_get(uint8_t *num_streams, enum bt_audio_location *locations) { if (num_streams == NULL || locations == NULL) { diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c index 608d6d3da34c..fd26ecca6ce0 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c @@ -53,6 +53,8 @@ static bool initialized; static bool delete_broadcast_src[CONFIG_BT_ISO_MAX_BIG]; static uint32_t stored_broadcast_id; +BT_LE_AUDIO_TX_DEFINE(bt_le_audio_tx); + static int metadata_u8_add(uint8_t buffer[], uint8_t *index, uint8_t type, uint8_t value) { if (buffer == NULL || index == NULL) { @@ -113,7 +115,7 @@ static void stream_sent_cb(struct bt_bap_stream *stream) le_audio_event_publish(LE_AUDIO_EVT_STREAM_SENT, &idx); } - ERR_CHK(bt_le_audio_tx_stream_sent(idx)); + ERR_CHK(bt_le_audio_tx_stream_sent(bt_le_audio_tx, idx)); } static void stream_started_cb(struct bt_bap_stream *stream) @@ -126,7 +128,7 @@ static void stream_started_cb(struct bt_bap_stream *stream) return; } - ERR_CHK(bt_le_audio_tx_stream_started(idx)); + ERR_CHK(bt_le_audio_tx_stream_started(bt_le_audio_tx, idx)); le_audio_event_publish(LE_AUDIO_EVT_STREAMING, &idx); @@ -664,9 +666,13 @@ int broadcast_source_send(struct net_buf const *const audio_frame, uint8_t big_i return -ECANCELED; } - ret = bt_le_audio_tx_send(audio_frame, tx, num_active_streams); + ret = bt_le_audio_tx_send(bt_le_audio_tx, audio_frame, tx, num_active_streams); if (ret) { - return ret; + if (ret == -ECANCELED || ret == -ETIMEDOUT) { + LOG_DBG("Adjusted audio TX: %d", ret); + } else { + return ret; + } } return 0; @@ -818,7 +824,12 @@ int broadcast_source_enable(struct broadcast_source_big const *const broadcast_p } if (!initialized) { - bt_le_audio_tx_init(); + /* A broadcast source is the Bluetooth central device */ + ret = bt_le_audio_tx_init(bt_le_audio_tx, true); + if (ret != 0) { + LOG_ERR("Failed to initialize LE Audio TX: %d", ret); + return ret; + } } ret = bt_cap_initiator_register_cb(&cap_cbs); diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/Kconfig b/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/Kconfig new file mode 100644 index 000000000000..a96e63494c0a --- /dev/null +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/Kconfig @@ -0,0 +1,25 @@ +menu "BT LE Audio TX" + +config NRF_AUDIO_TX_TGT_LEAD_TIME_US + int + default 3000 + help + Do not change this value unless you know what you are doing. + Target lead time to send data to controller before it sends the next SDU on air. + Used to make sure that the data is sent to controller just in time for the next SDU, + which can help with reducing the overall latency and power consumption. + Setting this too low may lead to flushed data, and too high will increase latency. + +config NRF_AUDIO_TX_LEAD_TIME_DEVIATION_US + int + range 500 NRF_AUDIO_TX_TGT_LEAD_TIME_US + default 2500 + help + Do not change this value unless you know what you are doing. + Max allowed deviation in microseconds from NRF_AUDIO_TX_TGT_LEAD_TIME_US + This deviation may take into account audio processing jitter, + which is caused by e.g. variable LC3 encoding time. + Modules may use this value in different ways. + + +endmenu # BT LE Audio TX diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.c index c99b01093735..06eec1e65089 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.c @@ -24,65 +24,48 @@ ZBUS_CHAN_DEFINE(sdu_ref_chan, struct sdu_ref_msg, NULL, NULL, ZBUS_OBSERVERS_EM #define HANDLE_INVALID 0xFFFF -#define HCI_ISO_BUF_PER_CHAN 2 - -#if defined(CONFIG_BT_ISO_MAX_CIG) && defined(CONFIG_BT_ISO_MAX_BIG) -#define GROUP_MAX (CONFIG_BT_ISO_MAX_BIG + CONFIG_BT_ISO_MAX_CIG) -#elif defined(CONFIG_BT_ISO_MAX_CIG) -#define GROUP_MAX CONFIG_BT_ISO_MAX_CIG -#elif defined(CONFIG_BT_ISO_MAX_BIG) -#define GROUP_MAX CONFIG_BT_ISO_MAX_BIG -#else -#error Neither CIG nor BIG defined -#endif - -#if (defined(CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT) && defined(CONFIG_BT_BAP_UNICAST)) -/* 1 since CIGs doesn't have the concept of subgroups */ -#define SUBGROUP_MAX (1 + CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT) - -#elif (defined(CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT) && !defined(CONFIG_BT_BAP_UNICAST)) -#define SUBGROUP_MAX CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT - -#else -/* 1 since CIGs doesn't have the concept of subgroups */ -#define SUBGROUP_MAX 1 -#endif - -/* Since we can't assume that the number of streams are equally distributed on the subgroups ,we - * need to allocate the max number per subgroup +/* Maximum allowed time deviation for calling tx_send. + * E.g. 0.2 = 20 % deviation from the common interval + * So, if the common interval is 10 ms, the function can be called with an interval between 8 ms and + * 12 ms without considering it a gap and resyncing with the controller. */ -#define STREAMS_MAX (CONFIG_BT_ISO_MAX_CHAN) - -#define NET_BUF_POOL_MAX ((GROUP_MAX) * (SUBGROUP_MAX) * (STREAMS_MAX) * (HCI_ISO_BUF_PER_CHAN)) - -NET_BUF_POOL_FIXED_DEFINE(iso_tx_pool, NET_BUF_POOL_MAX, BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), - CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); - -struct tx_inf { - uint16_t iso_conn_handle; - struct bt_iso_tx_info iso_tx; - struct bt_iso_tx_info iso_tx_readback; - atomic_t iso_tx_pool_alloc; - bool hci_wrn_printed; -}; +#define INVOKE_TIME_LIMIT_DEVIATION_WINDOW 0.25f +#define INVOKE_TIME_LIM_MAX (1.0f + INVOKE_TIME_LIMIT_DEVIATION_WINDOW) +#define INVOKE_TIME_LIM_MIN (1.0f - INVOKE_TIME_LIMIT_DEVIATION_WINDOW) + +/* Time between performing a timestamp re-sync with the Bluetooth controller. + * For gateway/central (unicast client/broadcast source) where this device is the master + * Bluetooth LE clocking device, the wall clock and BLE clock should be in sync. + * Hence, there is no strict need for regular re-sync after the first timestamp is obtained. + * For simplicity and risk mitigation, a periodic re-sync is still performed. + * However, for the headset/peripheral (unicast server/broadcast sink) + * regular re-sync is needed to compensate for clock drift. + */ +#define TX_TS_RESYNC_US 1000000U -static bool initialized; -static struct tx_inf tx_info_arr[GROUP_MAX][SUBGROUP_MAX][STREAMS_MAX]; +/* When starting a stream, I2S or USB feeding the TX function with data, will usually need some time + * to stabilize and potentially drop data to meet just-in-time requirements. + */ +#define SUBSEQUENT_RAPID_CORRECTIONS_LIMIT 20U /** * @brief Sends audio data over a single BAP stream. * * @param data Audio data to send. * @param size Size of data. - * @param bap_stream Pointer to BAP stream to use. + * @param cap_stream Pointer to CAP stream to use. + * @param ctx Pointer to TX context. * @param tx_info Pointer to tx_info struct. * @param ts_tx Timestamp to send. Note that for some controllers, BT_ISO_TIMESTAMP_NONE * is used. This timestamp is used to ensure that SDUs are sent in the same * connection interval. + * @param send_ts_tx Whether to send the ts_tx timestamp or not. + * * @return 0 if successful, error otherwise. */ static int iso_stream_send(uint8_t const *const data, size_t size, struct bt_cap_stream *cap_stream, - struct tx_inf *tx_info, uint32_t ts_tx) + struct bt_le_audio_tx_ctx *ctx, struct tx_inf *tx_info, uint32_t ts_tx, + bool send_ts_tx) { int ret; struct net_buf *buf; @@ -110,7 +93,7 @@ static int iso_stream_send(uint8_t const *const data, size_t size, struct bt_cap tx_info->hci_wrn_printed = false; - buf = net_buf_alloc(&iso_tx_pool, K_NO_WAIT); + buf = net_buf_alloc(ctx->iso_tx_pool, K_NO_WAIT); if (buf == NULL) { /* This should never occur because of the iso_tx_pool_alloc check above */ LOG_WRN("Out of TX buffers"); @@ -122,10 +105,10 @@ static int iso_stream_send(uint8_t const *const data, size_t size, struct bt_cap atomic_inc(&tx_info->iso_tx_pool_alloc); - if (ts_tx == 0) { - ret = bt_cap_stream_send(cap_stream, buf, tx_info->iso_tx.seq_num); + if (send_ts_tx) { + ret = bt_cap_stream_send_ts(cap_stream, buf, 0U, ts_tx); } else { - ret = bt_cap_stream_send_ts(cap_stream, buf, tx_info->iso_tx.seq_num, ts_tx); + ret = bt_cap_stream_send(cap_stream, buf, 0U); } if (ret < 0) { @@ -134,10 +117,8 @@ static int iso_stream_send(uint8_t const *const data, size_t size, struct bt_cap (void *)&cap_stream->bap_stream); } net_buf_unref(buf); - atomic_dec(&tx_info->iso_tx_pool_alloc); + (void)atomic_dec(&tx_info->iso_tx_pool_alloc); return ret; - } else { - tx_info->iso_tx.seq_num++; } return 0; @@ -146,24 +127,24 @@ static int iso_stream_send(uint8_t const *const data, size_t size, struct bt_cap static int get_tx_sync_sdc(uint16_t iso_conn_handle, struct bt_iso_tx_info *info) { int ret; - sdc_hci_cmd_vs_iso_read_tx_timestamp_t cmd_read_tx_timestamp; + sdc_hci_cmd_vs_iso_read_tx_timestamp_t cmd_read_tx_ts; sdc_hci_cmd_vs_iso_read_tx_timestamp_return_t rsp_params; - cmd_read_tx_timestamp.conn_handle = iso_conn_handle; + cmd_read_tx_ts.conn_handle = iso_conn_handle; - ret = hci_vs_sdc_iso_read_tx_timestamp(&cmd_read_tx_timestamp, &rsp_params); - if (ret) { + ret = hci_vs_sdc_iso_read_tx_timestamp(&cmd_read_tx_ts, &rsp_params); + if (ret != 0) { return ret; } info->ts = rsp_params.tx_time_stamp; info->seq_num = rsp_params.packet_sequence_number; - info->offset = 0; + info->offset = 0U; return 0; } -static int iso_conn_handle_set(struct bt_bap_stream *bap_stream, uint16_t *iso_conn_handle) +static int iso_conn_handle_set(const struct bt_bap_stream *bap_stream, uint16_t *iso_conn_handle) { int ret; @@ -171,13 +152,13 @@ static int iso_conn_handle_set(struct bt_bap_stream *bap_stream, uint16_t *iso_c struct bt_bap_ep_info ep_info; ret = bt_bap_ep_get_info(bap_stream->ep, &ep_info); - if (ret) { + if (ret != 0) { LOG_WRN("Unable to get info for ep"); return -EACCES; } ret = bt_hci_get_conn_handle(ep_info.iso_chan->iso, iso_conn_handle); - if (ret) { + if (ret != 0) { LOG_ERR("Failed obtaining conn_handle (ret:%d)", ret); return ret; } @@ -188,200 +169,525 @@ static int iso_conn_handle_set(struct bt_bap_stream *bap_stream, uint16_t *iso_c return 0; } -int bt_le_audio_tx_send(struct net_buf const *const audio_frame, struct le_audio_tx_info *tx, - uint8_t num_tx) +static int verify_stream_idx(struct stream_index idx) { - int ret; - size_t data_size_pr_stream = 0; - - if (!initialized) { - return -EACCES; + if (idx.lvl1 >= GROUP_MAX || idx.lvl2 >= SUBGROUP_MAX || idx.lvl3 >= TX_STREAMS_MAX) { + return -ESPIPE; } - if (tx == NULL) { - return -EINVAL; - } + return 0; +} - /* Get number of locations in the audio frame */ - struct audio_metadata *meta = net_buf_user_data(audio_frame); - uint8_t num_loc = audio_metadata_num_loc_get(meta); +static int tx_entries_validate(struct le_audio_tx_info const *const tx, uint8_t num_tx) +{ + for (int i = 0; i < num_tx; i++) { + int ret = verify_stream_idx(tx[i].idx); - if (num_loc == 0 || (audio_frame->len % num_loc != 0)) { - LOG_ERR("Invalid number (%d) of locations in audio frame (%d)", num_loc, - audio_frame->len); - return -EINVAL; - } + if (ret != 0) { + LOG_ERR("Invalid stream index for tx[%d]", i); + return -EINVAL; + } - data_size_pr_stream = audio_frame->len / num_loc; + if (tx[i].cap_stream == NULL || tx[i].cap_stream->bap_stream.ep == NULL || + tx[i].cap_stream->bap_stream.qos == NULL || + tx[i].cap_stream->bap_stream.codec_cfg == NULL) { + LOG_ERR("Invalid tx stream configuration for tx[%d]", i); + return -EINVAL; + } + } - /* When sending ISO data, we always send ts = 0 to the first active transmitting channel. - * The controller will populate with a ts which is fetched using bt_iso_chan_get_tx_sync. - * This timestamp will be submitted to all the other channels in order to place data on all - * channels in the same ISO interval. - */ + return 0; +} - uint32_t common_tx_sync_ts_us = 0; - uint32_t curr_ts_us = 0; - bool ts_common_acquired = false; - uint32_t common_interval = 0; +/** + * @brief Validate all TX streams before sending audio data. + * + * Iterates over all streams in @p tx and, for each stream in the STREAMING state: + * - Increments @p num_streaming_state. + * - Verifies that @p data_size_pr_stream matches the SDU size derived from the + * stream's codec configuration (bitrate and frame duration). + * - Verifies that the streams share the same ISO interval, and + * writes the common interval to @p common_interval_us. + * + * Streams not in the STREAMING state are silently skipped. + */ +static int tx_precheck(struct le_audio_tx_info const *const tx, uint8_t num_tx, + size_t data_size_pr_stream, uint32_t *common_interval_us, + uint8_t *num_streaming_state) +{ + int ret; for (int i = 0; i < num_tx; i++) { - struct tx_inf *tx_info = - &tx_info_arr[tx[i].idx.lvl1][tx[i].idx.lvl2][tx[i].idx.lvl3]; - - if (tx_info->iso_tx.seq_num == 0) { - /* Temporary fix until /zephyr/pull/68745/ is available - */ -#if defined(CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM) - tx[i].cap_stream->bap_stream._prev_seq_num = 0; -#endif /* CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM */ - } + const struct bt_bap_stream *bap_stream = &tx[i].cap_stream->bap_stream; - if (!le_audio_ep_state_check(tx[i].cap_stream->bap_stream.ep, - BT_BAP_EP_STATE_STREAMING)) { - /* This bap_stream is not streaming*/ + if (unlikely(!le_audio_ep_state_check(bap_stream->ep, BT_BAP_EP_STATE_STREAMING))) { + /* This bap_stream is not streaming */ continue; } - if (tx[i].audio_location > num_loc) { - LOG_WRN("Unsupported audio_location: %d", tx[i].audio_location); - continue; - } + (*num_streaming_state)++; uint32_t bitrate; int dur_us; - ret = le_audio_bitrate_get(tx[i].cap_stream->bap_stream.codec_cfg, &bitrate); - if (ret) { + ret = le_audio_bitrate_get(bap_stream->codec_cfg, &bitrate); + if (ret != 0) { LOG_ERR("Failed to calculate bitrate: %d", ret); return ret; } - ret = le_audio_duration_us_get(tx[i].cap_stream->bap_stream.codec_cfg, &dur_us); - if (ret) { + ret = le_audio_duration_us_get(bap_stream->codec_cfg, &dur_us); + if (ret != 0) { LOG_ERR("Error retrieving frame duration: %d", ret); return ret; } - if (data_size_pr_stream != LE_AUDIO_SDU_SIZE_OCTETS(bitrate, dur_us)) { + if (unlikely(data_size_pr_stream != LE_AUDIO_SDU_SIZE_OCTETS(bitrate, dur_us))) { LOG_ERR("The encoded data size (%zu) does not match the SDU size (%d)", data_size_pr_stream, LE_AUDIO_SDU_SIZE_OCTETS(bitrate, dur_us)); return -EINVAL; } - if (common_interval != 0 && - (common_interval != tx[i].cap_stream->bap_stream.qos->interval)) { + if (unlikely(*common_interval_us != 0U && + (*common_interval_us != bap_stream->qos->interval))) { LOG_ERR("Not all channels have the same ISO interval"); return -EINVAL; } - common_interval = tx[i].cap_stream->bap_stream.qos->interval; + *common_interval_us = bap_stream->qos->interval; + } + + return 0; +} + +static int controller_ts_tx_get(const struct bt_bap_stream *bap_stream, uint32_t *ts_tx_us, + struct tx_inf *tx_info) +{ + int ret; + + ret = iso_conn_handle_set(bap_stream, &tx_info->iso_conn_handle); + if (ret != 0) { + LOG_ERR("Failed to set iso_conn_handle: %d", ret); + *ts_tx_us = 0U; + return ret; + } + + ret = get_tx_sync_sdc(tx_info->iso_conn_handle, &tx_info->iso_tx_readback); + if (ret != 0) { + LOG_ERR("Unable to get tx sync. ret: %d", ret); + *ts_tx_us = 0U; + return ret; + } + + *ts_tx_us = tx_info->iso_tx_readback.ts; + return 0; +} + +static int num_loc_get(struct net_buf const *const audio_frame, uint8_t *const num_loc) +{ + struct audio_metadata *meta = net_buf_user_data(audio_frame); + + if (meta == NULL) { + LOG_ERR("Audio metadata is missing"); + return -EINVAL; + } + + *num_loc = audio_metadata_num_loc_get(meta); + + if (*num_loc == 0U || (audio_frame->len % *num_loc != 0U)) { + LOG_ERR("Invalid number (%u) of locations in audio frame (%u)", *num_loc, + audio_frame->len); + return -EINVAL; + } + + return 0; +} + +static void tx_call_interval_check(struct bt_le_audio_tx_ctx *ctx, uint32_t ts_now_us, + uint32_t common_interval_us) +{ + uint32_t time_since_last_call_us = ts_now_us - ctx->ts_last_us; + uint32_t upper_lim_us = (uint32_t)(common_interval_us * INVOKE_TIME_LIM_MAX); + uint32_t lower_lim_us = (uint32_t)(common_interval_us * INVOKE_TIME_LIM_MIN); + const uint32_t PRINT_WRN_LIMIT_US = 200000U; + + if (!IN_RANGE(time_since_last_call_us, lower_lim_us, upper_lim_us) && + ctx->ts_last_us_valid) { + /* This will happen if a stream is paused/restarted */ + ctx->ts_ctlr_esti_us_valid = false; + + if (time_since_last_call_us > PRINT_WRN_LIMIT_US) { + /* Likely a result of a stream being paused/restarted */ + LOG_INF("Audio tx called with interval of %u us, (min %u us, max %u us) " + "expected " + "around %u us. Resync with controller", + time_since_last_call_us, lower_lim_us, upper_lim_us, + common_interval_us); + } else { + LOG_WRN("Audio tx called with interval of %u us, (min %u us, max %u us) " + "expected " + "around %u us. Resync with controller", + time_since_last_call_us, lower_lim_us, upper_lim_us, + common_interval_us); + } + } +} + +static uint8_t tx_streams_send(struct bt_le_audio_tx_ctx *ctx, + struct net_buf const *const audio_frame, struct le_audio_tx_info *tx, + uint8_t num_tx, uint8_t num_loc, size_t data_size_pr_stream, + const struct bt_bap_stream **last_successful_bap_stream, + struct tx_inf **last_successful_tx_info) +{ + int ret; + uint8_t sent_streams = 0U; + + for (int i = 0; i < num_tx; i++) { + const struct bt_bap_stream *bap_stream = &tx[i].cap_stream->bap_stream; + struct tx_inf *tx_info = + &ctx->tx_info_arr[tx[i].idx.lvl1][tx[i].idx.lvl2][tx[i].idx.lvl3]; /* Check if same audio is sent to all locations */ - if (num_loc == 1) { + if (num_loc == 1U) { ret = iso_stream_send(audio_frame->data, data_size_pr_stream, - tx[i].cap_stream, tx_info, common_tx_sync_ts_us); + tx[i].cap_stream, ctx, tx_info, ctx->ts_ctlr_esti_us, + ctx->ts_ctlr_esti_us_valid); } else { + if (unlikely(tx[i].audio_location >= num_loc)) { + LOG_ERR("audio_location (%u) out of bounds (num_loc: %u) for " + "stream " + "%d", + tx[i].audio_location, num_loc, i); + continue; + } + ret = iso_stream_send(audio_frame->data + (tx[i].audio_location * data_size_pr_stream), - data_size_pr_stream, tx[i].cap_stream, tx_info, - common_tx_sync_ts_us); + data_size_pr_stream, tx[i].cap_stream, ctx, tx_info, + ctx->ts_ctlr_esti_us, ctx->ts_ctlr_esti_us_valid); } - if (ret) { - /* DBG used here as prints are handled within iso_stream_send */ - LOG_DBG("Failed to send to idx: %d stream: %p, ret: %d ", i, - (void *)&tx[i].cap_stream->bap_stream, ret); - continue; + if (ret != 0) { + /* May happen if we try to send to a device which has disconnected */ + LOG_INF_RATELIMIT_RATE(1000, + "Failed to send to idx: %d stream: %p, ret: %d ", i, + (void *)&tx[i].cap_stream->bap_stream, ret); + } else { + *last_successful_bap_stream = bap_stream; + *last_successful_tx_info = tx_info; + sent_streams++; } + } - ret = iso_conn_handle_set(&tx[i].cap_stream->bap_stream, &tx_info->iso_conn_handle); - if (ret) { - continue; + return sent_streams; +} + +static int tx_ts_prepare(struct bt_le_audio_tx_ctx *ctx, uint32_t common_interval_us) +{ + /* Increment the tx timestamp with the interval. + * Designed for overflow. + * If this TX function is called too fast or slow, the estimate will deteriorate more + * quickly. + */ + ctx->ts_ctlr_esti_us += common_interval_us; + if (ctx->flush_next) { + LOG_DBG("Flushed %u us of audio data to maintain timestamp sync with controller", + common_interval_us); + ctx->flush_next = false; + ctx->ts_ctlr_esti_us_valid = false; + return -ECANCELED; + } + + return 0; +} + +static int tx_controller_sync_and_correct(struct bt_le_audio_tx_ctx *ctx, + const struct bt_bap_stream *last_successful_bap_stream, + uint32_t common_interval_us, uint32_t ts_now_us, + struct tx_inf *tx_info, int *status) +{ + int ret; + uint32_t ts_ctlr_real_us = 0U; + + ctx->corr_diff_us = 0U; + + /* If the timestamp is not valid or it has been more than TX_TS_RESYNC_US since the last + * timestamp, we re-acquire a timestamp from the controller. + */ + if (!ctx->ts_ctlr_esti_us_valid || + ((uint32_t)(ctx->ts_ctlr_esti_us - ctx->ts_ctlr_real_us_last) >= TX_TS_RESYNC_US) || + ((uint32_t)(ts_now_us - ctx->ts_last_us) >= TX_TS_RESYNC_US)) { + + ret = controller_ts_tx_get(last_successful_bap_stream, &ts_ctlr_real_us, tx_info); + if (ret != 0) { + LOG_ERR("Failed to get timestamp after sending: %d", ret); + return ret; + } + + ctx->corr_diff_us = (int64_t)ts_ctlr_real_us - (int64_t)ctx->ts_ctlr_esti_us; + LOG_DBG_RATELIMIT_RATE(1000U, "TX clock correction: %lld us real %u esti %u", + ctx->corr_diff_us, ts_ctlr_real_us, ctx->ts_ctlr_esti_us); + + if ((uint32_t)(ts_now_us - ctx->ts_last_correction) < TX_TS_RESYNC_US) { + ctx->subsequent_rapid_corrections++; + } else { + ctx->subsequent_rapid_corrections = 0U; } - /* Strictly, it is only required to call get_tx_sync_sdc on the first streaming - * location to get the timestamp which is sent to all other locations. - * However, to be able to detect errors, this is called on each TX. + if (ctx->subsequent_rapid_corrections > SUBSEQUENT_RAPID_CORRECTIONS_LIMIT) { + LOG_ERR_RATELIMIT_RATE(1000U, "%d subsequent time corrections", + ctx->subsequent_rapid_corrections); + } + + /* There are several options which can occur at this point: + * + * - corr_diff_us == 0: The estimate is correct, no correction needed. + * + * - corr_diff_us >> 0: Data was given to this module too slow/late. + * Hence, the controller schedules sending for the next ISO + * interval. An empty packet will be sent on air. + * + * - corr_diff_us << 0: Data was given to this module too fast/early. + * + * - corr_diff_us > or < 0: This means that the estimate has gotten a small + * correction. As a central/gateway/unicast client/broadcast source, the + * clocks shall be running in lockstep and this should never happen. As a + * peripheral/headset/unicast server/broadcast sink, this will occur to + * correct for drift. */ - ret = get_tx_sync_sdc(tx_info->iso_conn_handle, &tx_info->iso_tx_readback); - if (ret) { - if (ret != -ENOTCONN) { - LOG_WRN("Unable to get tx sync. ret: %d stream: %p", ret, - (void *)&tx[i].cap_stream->bap_stream); + + const int64_t half_common_interval_us = (int64_t)common_interval_us / 2; + + if (ctx->corr_diff_us == 0) { + /* No correction needed, the estimate is correct. */ + LOG_DBG("TX clock no adjustment needed (%lld us)", ctx->corr_diff_us); + ctx->ts_ctlr_esti_us_valid = true; + } else if (ctx->corr_diff_us > half_common_interval_us) { + LOG_DBG("TX clock corrected by (%lld us). Late: Empty packet(s) on air", + ctx->corr_diff_us); + ctx->ts_ctlr_esti_us_valid = false; + *status = -ETIMEDOUT; + } else if (ctx->corr_diff_us < -half_common_interval_us) { + LOG_DBG("TX clock corrected by (%lld us). Early", ctx->corr_diff_us); + ctx->ts_ctlr_esti_us_valid = false; + } else { + if (ctx->is_ble_clock_master) { + /* The gateway is the Bluetooth central. This shall not happen */ + LOG_ERR("TX clock has been drift adjusted by (%lld us)", + ctx->corr_diff_us); + ctx->ts_ctlr_esti_us_valid = false; + } else { + LOG_DBG("TX clock has been drift adjusted by (%lld us)", + ctx->corr_diff_us); + ctx->ts_ctlr_esti_us_valid = true; } - continue; } - if (!ts_common_acquired) { - curr_ts_us = audio_sync_timer_capture(); - common_tx_sync_ts_us = tx_info->iso_tx_readback.ts; - ts_common_acquired = true; - } + ctx->ts_ctlr_real_us_last = ts_ctlr_real_us; + /* Update the estimate to the real (most current) value */ + ctx->ts_ctlr_esti_us = ts_ctlr_real_us; + ctx->ts_last_correction = ts_now_us; } - if (ts_common_acquired) { - struct sdu_ref_msg msg; + return 0; +} + +static void tx_publish_sdu_ref_and_finalize(struct bt_le_audio_tx_ctx *ctx, uint32_t ts_now_us) +{ + int ret; + struct sdu_ref_msg msg; - msg.tx_sync_ts_us = common_tx_sync_ts_us; - msg.curr_ts_us = curr_ts_us; - msg.adjust = true; + msg.tx_sync_ts_us = ctx->ts_ctlr_esti_us; + msg.curr_ts_us = ts_now_us; + msg.adjust = true; - ret = zbus_chan_pub(&sdu_ref_chan, &msg, K_NO_WAIT); - if (ret) { - LOG_WRN("Failed to publish timestamp: %d", ret); + ret = zbus_chan_pub(&sdu_ref_chan, &msg, K_NO_WAIT); + if (ret != 0) { + LOG_WRN("Failed to publish timestamp: %d", ret); + } + + ctx->ts_last_us = ts_now_us; + ctx->ts_last_us_valid = true; +} + +int bt_le_audio_tx_send(struct bt_le_audio_tx_ctx *ctx, struct net_buf const *const audio_frame, + struct le_audio_tx_info *tx, uint8_t num_tx) +{ + int ret; + int status = 0; + size_t data_size_pr_stream = 0U; + + if (unlikely(ctx == NULL || tx == NULL || num_tx == 0U || audio_frame == NULL)) { + return -EINVAL; + } + + ret = tx_entries_validate(tx, num_tx); + if (ret != 0) { + return ret; + } + + uint8_t num_loc; + + ret = num_loc_get(audio_frame, &num_loc); + if (ret != 0) { + return ret; + } + + if (num_loc > num_tx) { + /* May happen if we are trying to send N streams, but N-X locations are available */ + LOG_DBG("Number of locations (%u) more than number of streams (%u)", num_loc, + num_tx); + } else if (num_loc < num_tx) { + if (num_loc != 1U) { + LOG_ERR("If number of locations (%u) is less than number of streams (%u) " + "it must be 1. Single loc. sent to all streams.", + num_loc, num_tx); + return -EINVAL; + } + + if (!IS_ENABLED(CONFIG_MONO_TO_ALL_RECEIVERS)) { + LOG_ERR("Num locations (%u) sent to all streams (%u)." + "CONFIG_MONO_TO_ALL_RECEIVERS must be enabled", + num_loc, num_tx); + return -EINVAL; } } - return 0; + uint32_t common_interval_us = 0U; + uint8_t num_streaming_state = 0U; + + data_size_pr_stream = audio_frame->len / num_loc; + if (unlikely(data_size_pr_stream == 0U)) { + LOG_ERR("Data size per stream is 0"); + return -EINVAL; + } + + ret = tx_precheck(tx, num_tx, data_size_pr_stream, &common_interval_us, + &num_streaming_state); + if (ret != 0) { + return ret; + } + + if (num_streaming_state == 0U) { + LOG_DBG("No streams are in streaming state"); + return 0; + } + + uint8_t sent_streams = 0U; + const struct bt_bap_stream *last_successful_bap_stream = NULL; + struct tx_inf *tx_info = NULL; + + if (common_interval_us == 0U) { + LOG_ERR("common_interval is zero"); + return -EINVAL; + } + + ret = tx_ts_prepare(ctx, common_interval_us); + if (ret != 0) { + return ret; + } + + LOG_DBG_RATELIMIT_RATE(1000, "tx %d valid %d", num_tx, ctx->ts_ctlr_esti_us_valid); + + uint32_t ts_now_us = audio_sync_timer_capture(); + + tx_call_interval_check(ctx, ts_now_us, common_interval_us); + + sent_streams = tx_streams_send(ctx, audio_frame, tx, num_tx, num_loc, data_size_pr_stream, + &last_successful_bap_stream, &tx_info); + + if (sent_streams == 0U) { + /* If nothing was sent, do not continue with timestamp handling + * Info is printed in tx_streams_send(). + */ + LOG_DBG("No streams were sent"); + return -EIO; + } + + if (last_successful_bap_stream == NULL || tx_info == NULL) { + LOG_ERR("No successful stream available for timestamp query"); + return -EIO; + } + + /* Get the current (wall clock) time */ + ts_now_us = audio_sync_timer_capture(); + + ret = tx_controller_sync_and_correct(ctx, last_successful_bap_stream, common_interval_us, + ts_now_us, tx_info, &status); + if (ret != 0) { + return ret; + } + + if ((int32_t)(ts_now_us - ctx->ts_ctlr_esti_us) > 0) { + LOG_WRN("Curr time ahead of ctlr time. Flush %u us of data. " + "Now: %u us, ctlr: %u us", + common_interval_us, ts_now_us, ctx->ts_ctlr_esti_us); + ctx->flush_next = true; + ctx->ts_ctlr_esti_us_valid = false; + } + + tx_publish_sdu_ref_and_finalize(ctx, ts_now_us); + return status; } -int bt_le_audio_tx_stream_started(struct stream_index idx) +int bt_le_audio_tx_stream_started(struct bt_le_audio_tx_ctx *ctx, struct stream_index idx) { - if (!initialized) { - return -EACCES; + int ret; + + if (ctx == NULL) { + return -EINVAL; + } + + ret = verify_stream_idx(idx); + if (ret != 0) { + return ret; } - atomic_clear(&tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].iso_tx_pool_alloc); + (void)atomic_clear(&ctx->tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].iso_tx_pool_alloc); - tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].hci_wrn_printed = false; - tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].iso_conn_handle = HANDLE_INVALID; - tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].iso_tx.seq_num = 0; - tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].iso_tx_readback.seq_num = 0; + ctx->tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].hci_wrn_printed = false; + ctx->tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].iso_conn_handle = HANDLE_INVALID; + ctx->tx_info_arr[idx.lvl1][idx.lvl2][idx.lvl3].iso_tx_readback.seq_num = 0U; return 0; } -int bt_le_audio_tx_stream_sent(struct stream_index stream_idx) +int bt_le_audio_tx_stream_sent(struct bt_le_audio_tx_ctx *ctx, struct stream_index stream_idx) { - if (!initialized) { - return -EACCES; + int ret; + + if (ctx == NULL) { + return -EINVAL; + } + + ret = verify_stream_idx(stream_idx); + if (ret != 0) { + return ret; } - atomic_dec( - &tx_info_arr[stream_idx.lvl1][stream_idx.lvl2][stream_idx.lvl3].iso_tx_pool_alloc); + (void)atomic_dec(&ctx->tx_info_arr[stream_idx.lvl1][stream_idx.lvl2][stream_idx.lvl3] + .iso_tx_pool_alloc); return 0; } -void bt_le_audio_tx_init(void) +int bt_le_audio_tx_init(struct bt_le_audio_tx_ctx *ctx, bool is_clock_master) { - if (initialized) { - /* If TX is disabled and enabled again this should be called to reset the state */ - LOG_DBG("Already initialized"); + if (ctx == NULL || ctx->iso_tx_pool == NULL) { + return -EINVAL; } + struct net_buf_pool *tmp = ctx->iso_tx_pool; + + (void)memset(ctx, 0, sizeof(*ctx)); + + ctx->iso_tx_pool = tmp; + ctx->is_ble_clock_master = is_clock_master; + for (int i = 0; i < GROUP_MAX; i++) { for (int j = 0; j < SUBGROUP_MAX; j++) { - for (int k = 0; k < STREAMS_MAX; k++) { - tx_info_arr[i][j][k].hci_wrn_printed = false; - tx_info_arr[i][j][k].iso_conn_handle = HANDLE_INVALID; - tx_info_arr[i][j][k].iso_tx.ts = 0; - tx_info_arr[i][j][k].iso_tx.offset = 0; - tx_info_arr[i][j][k].iso_tx.seq_num = 0; - tx_info_arr[i][j][k].iso_tx_readback.ts = 0; - tx_info_arr[i][j][k].iso_tx_readback.offset = 0; - tx_info_arr[i][j][k].iso_tx_readback.seq_num = 0; + for (int k = 0; k < TX_STREAMS_MAX; k++) { + ctx->tx_info_arr[i][j][k].iso_conn_handle = HANDLE_INVALID; } } } - initialized = true; + return 0; } diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.h b/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.h index 73f3f0b86c3f..af573d89e827 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.h +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/bt_le_audio_tx/bt_le_audio_tx.h @@ -15,6 +15,8 @@ #ifndef _LE_AUDIO_TX_H_ #define _LE_AUDIO_TX_H_ +#include +#include #include #include #include @@ -27,45 +29,131 @@ struct le_audio_tx_info { uint8_t audio_location; }; +struct bt_le_audio_tx_ctx; + +#define HCI_ISO_BUF_PER_CHAN 2 + +#if defined(CONFIG_BT_ISO_MAX_CIG) && defined(CONFIG_BT_ISO_MAX_BIG) +#define GROUP_MAX (CONFIG_BT_ISO_MAX_BIG + CONFIG_BT_ISO_MAX_CIG) +#elif defined(CONFIG_BT_ISO_MAX_CIG) +#define GROUP_MAX CONFIG_BT_ISO_MAX_CIG +#elif defined(CONFIG_BT_ISO_MAX_BIG) +#define GROUP_MAX CONFIG_BT_ISO_MAX_BIG +#else +#error Neither CIG nor BIG defined +#endif + +#if (defined(CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT) && defined(CONFIG_BT_BAP_UNICAST)) +#define SUBGROUP_MAX (1 + CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT) +#elif (defined(CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT) && !defined(CONFIG_BT_BAP_UNICAST)) +#define SUBGROUP_MAX CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT +#else +#define SUBGROUP_MAX 1 +#endif + +#define TX_STREAMS_MAX CONFIG_BT_ISO_MAX_CHAN + +#define TX_BUF_NUM (GROUP_MAX * SUBGROUP_MAX * TX_STREAMS_MAX * HCI_ISO_BUF_PER_CHAN) + +struct tx_inf { + uint16_t iso_conn_handle; + struct bt_iso_tx_info iso_tx; + struct bt_iso_tx_info iso_tx_readback; + atomic_t iso_tx_pool_alloc; + bool hci_wrn_printed; +}; + +struct bt_le_audio_tx_ctx { + struct net_buf_pool *iso_tx_pool; + struct tx_inf tx_info_arr[GROUP_MAX][SUBGROUP_MAX][TX_STREAMS_MAX]; + /* Estimated timestamp from the controller and validity */ + uint32_t ts_ctlr_esti_us; + bool ts_ctlr_esti_us_valid; + /* Real timestamp from the controller */ + uint32_t ts_ctlr_real_us_last; + /* Timestamp - when the last correction was applied */ + uint32_t ts_last_correction; + /* Counter to track subsequent rapid corrections. Indicates an error state */ + uint32_t subsequent_rapid_corrections; + /* Correction between estimated and real timestamps */ + int64_t corr_diff_us; + /* The previous "now" timestamp and validity */ + uint32_t ts_last_us; + bool ts_last_us_valid; + /* Should the data in the next function call be flushed */ + bool flush_next; + /* This device is Bluetooth clock master (central/unicast client or broadcast source) */ + bool is_ble_clock_master; +}; + +#define BT_LE_AUDIO_TX_DEFINE(name) \ + NET_BUF_POOL_FIXED_DEFINE(name##_cfg_buf, TX_BUF_NUM, \ + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), \ + CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); \ + static struct bt_le_audio_tx_ctx name##_ctx = { \ + .iso_tx_pool = &name##_cfg_buf, \ + }; \ + static struct bt_le_audio_tx_ctx *name = &name##_ctx + /** * @brief Allocates buffers and sends data to the controller. * * @note Send all available channels in a single call. * Do not call this for each channel. * + * @param[in] ctx Pointer to TX context. * @param[in] audio_frame Pointer to the encoded audio data. * @param[in] tx Pointer to an array of le_audio_tx_info elements. * @param[in] num_tx Number of elements in @p tx. * - * @return 0 if successful, error otherwise. + * @retval 0 Success. + * @retval -EINVAL Invalid arguments or invalid audio/frame/stream configuration. + * @retval -ECANCELED Current call is intentionally flushed due to previous late timing. + * @retval -ETIMEDOUT Controller timestamp indicates late delivery (empty packet(s) on + * air). + * @retval -EIO No stream was sent successfully. + * + * @return Other negative error codes may be propagated from timestamp/HCI operations. */ -int bt_le_audio_tx_send(struct net_buf const *const audio_frame, struct le_audio_tx_info *tx, - uint8_t num_tx); +int bt_le_audio_tx_send(struct bt_le_audio_tx_ctx *ctx, struct net_buf const *const audio_frame, + struct le_audio_tx_info *tx, uint8_t num_tx); /** * @brief Initializes a stream. Must be called when a TX stream is started. * + * @param[in] ctx Pointer to TX context. * @param[in] stream_idx Stream index. * - * @retval -EACCES The module has not been initialized. + * @retval -EINVAL ctx is NULL or the module has not been initialized. + * @retval -ESPIPE stream_idx is out of bounds. * @retval 0 Success. */ -int bt_le_audio_tx_stream_started(struct stream_index stream_idx); +int bt_le_audio_tx_stream_started(struct bt_le_audio_tx_ctx *ctx, struct stream_index stream_idx); /** * @brief Frees a TX buffer. Must be called when a TX stream has been sent. * + * @param[in] ctx Pointer to TX context. * @param[in] stream_idx Stream index. * - * @retval -EACCES The module has not been initialized. + * @retval -EINVAL ctx is NULL or the module has not been initialized. + * @retval -ESPIPE stream_idx is out of bounds. * @retval 0 Success. */ -int bt_le_audio_tx_stream_sent(struct stream_index stream_idx); +int bt_le_audio_tx_stream_sent(struct bt_le_audio_tx_ctx *ctx, struct stream_index stream_idx); /** * @brief Initializes the TX path for ISO transmission. + * + * @param[in] ctx Pointer to TX context. + * @param[in] is_clock_master Set to true if this device is a Bluetooth central, + * (Unicast client) or Broadcast source, + * false = peripheral (unicast server) or Broadcast sink. + * + * @retval -EINVAL @p ctx is NULL or required configuration is missing. + * @retval 0 Success. */ -void bt_le_audio_tx_init(void); +int bt_le_audio_tx_init(struct bt_le_audio_tx_ctx *ctx, bool is_clock_master); /** * @} diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.c index 91150e5aa4d1..71ebffea9fbb 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.c @@ -206,7 +206,7 @@ int le_audio_bitrate_get(const struct bt_audio_codec_cfg *const codec, uint32_t return ret; } - int frames_per_sec = 1000000 / dur_us; + float frames_per_sec = (float)USEC_PER_SEC / dur_us; uint32_t octets_per_sdu; ret = le_audio_octets_per_frame_get(codec, &octets_per_sdu); diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h b/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h index 7cb2513b1089..3ddbdff84322 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h @@ -22,7 +22,7 @@ #include #define LE_AUDIO_ZBUS_EVENT_WAIT_TIME K_MSEC(5) -#define LE_AUDIO_SDU_SIZE_OCTETS(bitrate, dur_us) (bitrate / (1000000 / dur_us) / 8) +#define LE_AUDIO_SDU_SIZE_OCTETS(bitrate, dur_us) (bitrate / (USEC_PER_SEC / dur_us) / 8) #if CONFIG_SAMPLE_RATE_CONVERTER && CONFIG_AUDIO_SAMPLE_RATE_48000_HZ #define BT_AUDIO_CODEC_CAPABILIY_FREQ \ diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/server_store.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/server_store.c index 226f1e471bd5..23ffa5dc9521 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/server_store.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/server_store.c @@ -37,7 +37,6 @@ static int owner_line; static void valid_entry_check(char const *const str) { - LOG_DBG("Stored: %p current: %p", atomic_ptr_get(&lock_owner), k_current_get()); __ASSERT(k_sem_count_get(&sem) == 0, "%s: Semaphore not taken", str); __ASSERT(atomic_ptr_get(&lock_owner) == k_current_get(), "%s: Thread mismatch", str); } @@ -562,13 +561,13 @@ static bool stream_check_pd(struct bt_cap_stream *existing_stream, void *user_da /* The existing stream is not in the same group as the incoming stream */ LOG_ERR("Existing stream not in same group as incoming stream"); ctx->ret = -EINVAL; - return true; + return false; } if (pres_dly_stream_ignore(&(existing_stream->bap_stream), ctx->incoming_stream)) { /* Do not consider this stream. Continue parsing */ LOG_DBG("Ignoring existing stream"); - return false; + return true; } /* All already running streams in the same direction and in the @@ -582,13 +581,13 @@ static bool stream_check_pd(struct bt_cap_stream *existing_stream, void *user_da LOG_ERR("Illegal value. Pres delays do not match: %u != %u", *ctx->existing_pres_dly_us_check, *ctx->existing_pres_dly_us); ctx->ret = -EINVAL; - return true; + return false; } if (*ctx->existing_pres_dly_us == 0) { LOG_ERR("Existing presentation delay is zero"); ctx->ret = -EINVAL; - return true; + return false; } if (IN_RANGE(*ctx->existing_pres_dly_us, ctx->incoming_qos->pd_min, @@ -596,7 +595,7 @@ static bool stream_check_pd(struct bt_cap_stream *existing_stream, void *user_da *ctx->computed_pres_dly_us = *ctx->existing_pres_dly_us; LOG_INF("Existing pres delay is within the incoming stream QoS range"); ctx->existing_pres_dly_already_in_range = true; - return true; + return false; } *ctx->group_reconfig_needed = true; @@ -604,11 +603,12 @@ static bool stream_check_pd(struct bt_cap_stream *existing_stream, void *user_da ctx->ret = pres_delay_compute(ctx->common_qos, &existing_stream->bap_stream.ep->qos_pref); if (ctx->ret) { - return true; + LOG_ERR("Failed to compute common presentation delay: %d", ctx->ret); + return false; } /* Continue iteration */ - return false; + return true; } /* Find the presentation delay. Needs to be the same within a CIG for a given direction */ @@ -1500,8 +1500,6 @@ void srv_store_unlock(void) { valid_entry_check(__func__); - LOG_DBG("Unlocking srv_store"); - atomic_ptr_set(&lock_owner, NULL); #if CONFIG_DEBUG owner_line = -1; diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c index db05e8d4bc15..d733afc23d9d 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c @@ -59,6 +59,8 @@ BUILD_ASSERT(CONFIG_BT_ISO_MAX_CIG == 1, "Only one CIG is supported"); static le_audio_receive_cb receive_cb; +BT_LE_AUDIO_TX_DEFINE(bt_le_audio_tx); + static struct bt_cap_unicast_group *unicast_group; static bool unicast_group_created; @@ -354,10 +356,10 @@ static bool stream_in_group_check(struct bt_cap_stream *stream, void *user_data) if (stream == server_stream) { /* Found the stream in the group, stop iterating */ - return true; + return false; } - return false; + return true; } /** @@ -458,23 +460,21 @@ static void cap_start_worker(struct k_work *work) /* Check if each of the connected servers in srv_store are in the unicast_group */ ret = srv_store_foreach_server(server_stream_in_unicast_group_check, NULL); + srv_store_unlock(); + if (ret == -ECANCELED) { /* A new group will be created after the released_cb has been called */ ret = unicast_client_stop(0); if (ret == -EAGAIN) { - srv_store_unlock(); unicast_group_create(); goto start_streams; } unicast_group_created = false; - srv_store_unlock(); return; } - srv_store_unlock(); - start_streams: ret = unicast_client_start(0); @@ -923,7 +923,7 @@ static void stream_sent_cb(struct bt_bap_stream *stream) LOG_ERR("%s: Failed to get stream index: %d", __func__, ret); return; } - ERR_CHK(bt_le_audio_tx_stream_sent(idx)); + ERR_CHK(bt_le_audio_tx_stream_sent(bt_le_audio_tx, idx)); } else { LOG_WRN("Not in streaming state: %d", state); } @@ -936,7 +936,7 @@ static bool new_pres_dly_us_set(struct bt_cap_stream *stream, void *user_data) stream->bap_stream.qos->pd = *new_pres_dly_us; - return false; + return true; } static void stream_configured_cb(struct bt_bap_stream *stream, @@ -1042,7 +1042,7 @@ static void stream_started_cb(struct bt_bap_stream *stream) } if (IS_ENABLED(CONFIG_BT_AUDIO_TX)) { - ERR_CHK(bt_le_audio_tx_stream_started(idx)); + ERR_CHK(bt_le_audio_tx_stream_started(bt_le_audio_tx, idx)); } /* NOTE: The string below is used by the Nordic CI system */ @@ -1110,10 +1110,10 @@ static bool all_streams_released_check(struct bt_cap_stream *stream, void *user_ if (stream->bap_stream.ep != NULL) { LOG_DBG("stream %p is not released", stream); /* Found a stream that is not released, will stop iterating */ - return true; + return false; } - return false; + return true; } static void stream_released_cb(struct bt_bap_stream *stream) @@ -1218,10 +1218,14 @@ static void unicast_discovery_complete_cb(struct bt_conn *conn, int err, return; } - if (err || csis_inst == NULL) { + if (err) { LOG_WRN("Got err: %d from conn: %p", err, (void *)conn); msg.set_size = 0; msg.sirk = NULL; + } else if (csis_inst == NULL) { + LOG_WRN("csis_inst is NULL from conn: %p", (void *)conn); + msg.set_size = 0; + msg.sirk = NULL; } else { LOG_DBG("\tErr: %d, set_size: %d", err, csis_inst->info.set_size); LOG_HEXDUMP_DBG(csis_inst->info.sirk, BT_CSIP_SIRK_SIZE, "\tSIRK:"); @@ -1296,7 +1300,7 @@ static bool first_source_location_get(struct bt_cap_stream *stream, void *user_d if (stream == NULL || user_data == NULL) { LOG_ERR("Invalid parameters"); - return false; + return true; } enum bt_audio_location *locations = (enum bt_audio_location *)user_data; @@ -1311,7 +1315,7 @@ static bool first_source_location_get(struct bt_cap_stream *stream, void *user_d if ((dir != BT_AUDIO_DIR_SOURCE) || (idx.lvl1 != 0) || (idx.lvl2 != 0) || (idx.lvl3 != 0)) { /* Not the first source stream, continue searching */ - return false; + return true; } ret = bt_audio_codec_cfg_get_chan_allocation(stream->bap_stream.codec_cfg, locations, @@ -1322,7 +1326,7 @@ static bool first_source_location_get(struct bt_cap_stream *stream, void *user_d } /* Found the first source stream, stop iterating */ - return true; + return false; } int le_audio_concurrent_sync_num_get(uint8_t *num_streams, enum bt_audio_location *locations) @@ -1677,12 +1681,12 @@ static bool add_to_stop_params(struct bt_cap_stream *stream, void *user_data) if (stream->bap_stream.ep == NULL) { /* Stream already released */ - return false; + return true; } param->streams[param->count++] = stream; - return false; + return true; } static bool server_connected_check(struct bt_cap_stream *stream, void *user_data) @@ -1694,16 +1698,16 @@ static bool server_connected_check(struct bt_cap_stream *stream, void *user_data ret = srv_store_from_stream_get(&stream->bap_stream, &server); if (ret) { LOG_ERR("Failed to get server from stream: %d", ret); - return false; + return true; } if (server && is_connected(server->conn)) { *connected_server_found = true; /* Found a connected server, will stop iterating */ - return true; + return false; } - return false; + return true; } int unicast_client_stop(uint8_t cig_index) @@ -1762,13 +1766,27 @@ int unicast_client_stop(uint8_t cig_index) /* No streams found. Check if devices are connected, if no, delete the group */ bool connected_server_found = false; + ret = srv_store_lock(CAP_PROCED_SEM_WAIT_TIME_MS); + if (ret < 0) { + LOG_ERR("%s: Failed to lock server store: %d", __func__, ret); + return ret; + } + ret = bt_cap_unicast_group_foreach_stream(unicast_group, server_connected_check, &connected_server_found); - if (ret) { + + if (ret == -ECANCELED) { + /* If cancelled a connected server has been found */ + srv_store_unlock(); + return ret; + } else if (ret) { LOG_ERR("Failed to check if servers are connected: %d", ret); + srv_store_unlock(); return ret; } + srv_store_unlock(); + if (!connected_server_found) { LOG_DBG("No connected servers found, deleting unicast group"); ret = bt_cap_unicast_group_delete(unicast_group); @@ -1883,8 +1901,10 @@ int unicast_client_send(struct net_buf const *const audio_frame, uint8_t cig_ind return -ECANCELED; } - ret = bt_le_audio_tx_send(audio_frame, info.tx, info.num_active_streams); - if (ret) { + ret = bt_le_audio_tx_send(bt_le_audio_tx, audio_frame, info.tx, info.num_active_streams); + if (ret == -ECANCELED || ret == -ETIMEDOUT) { + LOG_DBG("Adjusted audio TX: %d", ret); + } else if (ret) { srv_store_unlock(); return ret; } @@ -1947,7 +1967,13 @@ int unicast_client_enable(uint8_t cig_index, le_audio_receive_cb recv_cb) } if (IS_ENABLED(CONFIG_BT_AUDIO_TX)) { - bt_le_audio_tx_init(); + /* A unicast client is the Bluetooth central device */ + ret = bt_le_audio_tx_init(bt_le_audio_tx, true); + if (ret) { + LOG_ERR("Failed to initialize LE Audio TX: %d", ret); + srv_store_unlock(); + return ret; + } } initialized = true; diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c index 35a206d8ca85..2e3f98fdb123 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c @@ -25,6 +25,8 @@ #include LOG_MODULE_REGISTER(unicast_server, CONFIG_UNICAST_SERVER_LOG_LEVEL); +BT_LE_AUDIO_TX_DEFINE(bt_le_audio_tx); + ZBUS_CHAN_DEFINE(le_audio_chan, struct le_audio_msg, NULL, NULL, ZBUS_OBSERVERS_EMPTY, ZBUS_MSG_INIT(0)); @@ -366,7 +368,7 @@ static void stream_sent_cb(struct bt_bap_stream *stream) .lvl2 = 0, .lvl3 = 0, }; - ERR_CHK(bt_le_audio_tx_stream_sent(idx)); + ERR_CHK(bt_le_audio_tx_stream_sent(bt_le_audio_tx, idx)); } #endif /* (CONFIG_BT_AUDIO_TX) */ @@ -420,7 +422,7 @@ static void stream_started_cb(struct bt_bap_stream *stream) .lvl2 = 0, .lvl3 = 0, }; - ERR_CHK(bt_le_audio_tx_stream_started(idx)); + ERR_CHK(bt_le_audio_tx_stream_started(bt_le_audio_tx, idx)); } le_audio_event_publish(LE_AUDIO_EVT_STREAMING, stream->conn, dir); @@ -692,8 +694,10 @@ int unicast_server_send(struct net_buf const *const audio_frame) num_active_streams++; } - ret = bt_le_audio_tx_send(audio_frame, tx, num_active_streams); - if (ret) { + ret = bt_le_audio_tx_send(bt_le_audio_tx, audio_frame, tx, num_active_streams); + if (ret == -ECANCELED || ret == -ETIMEDOUT) { + LOG_DBG("Adjusted audio TX: %d", ret); + } else if (ret) { return ret; } @@ -813,7 +817,12 @@ int unicast_server_enable(le_audio_receive_cb recv_cb, enum bt_audio_location lo } if (IS_ENABLED(CONFIG_BT_AUDIO_TX)) { - bt_le_audio_tx_init(); + /* A unicast server is the Bluetooth peripheral device */ + ret = bt_le_audio_tx_init(bt_le_audio_tx, false); + if (ret) { + LOG_ERR("Failed to initialize LE Audio TX: %d", ret); + return ret; + } ret = bt_pacs_set_location(BT_AUDIO_DIR_SOURCE, location); if (ret) { diff --git a/applications/nrf5340_audio/src/modules/audio_i2s.c b/applications/nrf5340_audio/src/modules/audio_i2s.c index 5693964faba1..47bb4cd28649 100644 --- a/applications/nrf5340_audio/src/modules/audio_i2s.c +++ b/applications/nrf5340_audio/src/modules/audio_i2s.c @@ -72,7 +72,8 @@ static void i2s_comp_handler(nrfx_i2s_buffers_t const *released_bufs, uint32_t s } } -void audio_i2s_set_next_buf(const uint8_t *tx_buf, uint32_t *rx_buf) +/* Prevent function from being inlined when LTO is enabled */ +void __noinline audio_i2s_set_next_buf(const uint8_t *tx_buf, uint32_t *rx_buf) { __ASSERT_NO_MSG(state == AUDIO_I2S_STATE_STARTED); if (IS_ENABLED(CONFIG_STREAM_BIDIRECTIONAL) || (CONFIG_AUDIO_DEV == GATEWAY)) { @@ -93,7 +94,8 @@ void audio_i2s_set_next_buf(const uint8_t *tx_buf, uint32_t *rx_buf) __ASSERT_NO_MSG(ret == 0); } -void audio_i2s_start(const uint8_t *tx_buf, uint32_t *rx_buf) +/* Prevent function from being inlined when LTO is enabled */ +void __noinline audio_i2s_start(const uint8_t *tx_buf, uint32_t *rx_buf) { __ASSERT_NO_MSG(state == AUDIO_I2S_STATE_IDLE); if (IS_ENABLED(CONFIG_STREAM_BIDIRECTIONAL) || (CONFIG_AUDIO_DEV == GATEWAY)) { diff --git a/applications/nrf5340_audio/src/modules/audio_usb.c b/applications/nrf5340_audio/src/modules/audio_usb.c index f3a4b93aa0b3..cc79ebb5ada1 100644 --- a/applications/nrf5340_audio/src/modules/audio_usb.c +++ b/applications/nrf5340_audio/src/modules/audio_usb.c @@ -38,8 +38,11 @@ K_MEM_SLAB_DEFINE_STATIC(usb_rx_slab, ROUND_UP(USB_BLOCK_SIZE_MULTI_CHAN, UDC_BU static struct k_msgq *audio_q_tx; static struct k_msgq *audio_q_rx; +/* USB blocks are 1 ms each, but we split them into 0.5 ms blocks for processing, + * hence the dividing by two + */ NET_BUF_POOL_FIXED_DEFINE(pool_in, USB_BLOCKS, - (USB_BLOCK_SIZE_MULTI_CHAN * CONFIG_FIFO_FRAME_SPLIT_NUM), + (USB_BLOCK_SIZE_MULTI_CHAN * CONFIG_FIFO_FRAME_SPLIT_NUM / 2), sizeof(struct audio_metadata), NULL); static uint32_t rx_num_overruns; @@ -50,6 +53,7 @@ static bool terminal_headset_in_enabled; static bool playing_state; static bool local_host_in; static bool local_host_out; +static bool usb_sof_synchronized; /* The meta data for the USB and that required for the following audio system. */ struct audio_metadata usb_in_meta = {.data_coding = PCM, @@ -167,6 +171,21 @@ static void *get_recv_buf_cb(const struct device *dev, uint8_t terminal, uint16_ return buf; } +static void half_buf_add(struct net_buf *frame, void *data, uint16_t size, + uint32_t *blocks_in_frame) +{ + const uint32_t half_data_len_us = usb_in_meta.data_len_us / 2; + const uint32_t half_bytes_per_location = usb_in_meta.bytes_per_location / 2; + + net_buf_add_mem(frame, data, size); + + struct audio_metadata *meta = net_buf_user_data(frame); + + meta->data_len_us += half_data_len_us; + meta->bytes_per_location += half_bytes_per_location; + (*blocks_in_frame)++; +} + static void data_recv_cb(const struct device *dev, uint8_t terminal, void *buf, uint16_t size, void *user_data) { @@ -175,9 +194,11 @@ static void data_recv_cb(const struct device *dev, uint8_t terminal, void *buf, ARG_UNUSED(user_data); int ret; - /* Frame accumulation for 10ms frames */ - static struct net_buf *current_frame; - static uint32_t blocks_in_current_frame; + /* Frame accumulation */ + static struct net_buf *frame_current; + static struct net_buf *frame_spillover; + static uint32_t blocks_in_frame_current; + static uint32_t blocks_in_frame_spillover; if (unlikely(buf == NULL)) { LOG_ERR("Received NULL buffer"); @@ -185,13 +206,8 @@ static void data_recv_cb(const struct device *dev, uint8_t terminal, void *buf, } /* Fast exit conditions */ - if (unlikely(size == 0 || !playing_state)) { - k_mem_slab_free(&usb_rx_slab, buf); - return; - } - - /* Terminal check */ - if (unlikely(!(terminal_headset_out_enabled || terminal_headphones_out_enabled))) { + if (unlikely(size == 0 || !playing_state) || + !(terminal_headset_out_enabled || terminal_headphones_out_enabled)) { k_mem_slab_free(&usb_rx_slab, buf); return; } @@ -204,52 +220,96 @@ static void data_recv_cb(const struct device *dev, uint8_t terminal, void *buf, } /* Allocate new frame if we don't have one */ - if (current_frame == NULL) { - /* Check space availability */ - if (unlikely(k_msgq_num_free_get(audio_q_rx) == 0 || pool_in.avail_count == 0)) { - goto overrun_cleanup; + if (frame_current == NULL) { + if (frame_spillover != NULL) { + frame_current = frame_spillover; + blocks_in_frame_current = blocks_in_frame_spillover; + frame_spillover = NULL; + blocks_in_frame_spillover = 0; + } else { + /* Check space availability */ + if (unlikely(k_msgq_num_free_get(audio_q_rx) == 0 || + pool_in.avail_count == 0)) { + goto overrun_cleanup; + } + + frame_current = net_buf_alloc(&pool_in, K_NO_WAIT); + if (unlikely(frame_current == NULL)) { + LOG_WRN("Out of RX buffers for frame"); + goto overrun_cleanup; + } + + /* Initialize metadata for the first block */ + struct audio_metadata *meta = net_buf_user_data(frame_current); + + *meta = usb_in_meta; + meta->data_len_us = 0; + meta->bytes_per_location = 0; + blocks_in_frame_current = 0; + } + } + + /* Check if we are about to spill over, if so: allocate spill_over frame */ + if ((blocks_in_frame_current + 2) > CONFIG_FIFO_FRAME_SPLIT_NUM) { + const size_t half_size = size / 2; + + /* Add half the buffer to current frame */ + half_buf_add(frame_current, buf, half_size, &blocks_in_frame_current); + + if (frame_spillover != NULL) { + LOG_WRN("Previous spillover frame not consumed, dropping it"); + net_buf_unref(frame_spillover); + blocks_in_frame_spillover = 0; } - current_frame = net_buf_alloc(&pool_in, K_NO_WAIT); - if (unlikely(current_frame == NULL)) { - LOG_WRN("Out of RX buffers for frame"); + /* Allocate new frame for spill over data since current frame is full. If allocation + * fails, drop the spill over data to prevent blocking the USB endpoint, but keep + * the current frame to allow it to be sent to the audio system. + */ + frame_spillover = net_buf_alloc(&pool_in, K_NO_WAIT); + if (unlikely(frame_spillover == NULL)) { + LOG_WRN("Out of RX buffers for spill over frame"); goto overrun_cleanup; } /* Initialize metadata for the first block */ - struct audio_metadata *meta = net_buf_user_data(current_frame); - *meta = usb_in_meta; - meta->data_len_us = 0; - meta->bytes_per_location = 0; - blocks_in_current_frame = 0; - } - - /* Add block data directly to current frame */ - net_buf_add_mem(current_frame, buf, size); + struct audio_metadata *meta_spill_over = net_buf_user_data(frame_spillover); - /* Update metadata */ - struct audio_metadata *meta = net_buf_user_data(current_frame); + *meta_spill_over = usb_in_meta; + meta_spill_over->data_len_us = 0; + meta_spill_over->bytes_per_location = 0; + blocks_in_frame_spillover = 0; - /* Accumulate per-block duration (typically 1 ms) */ - meta->data_len_us += usb_in_meta.data_len_us; - meta->bytes_per_location += usb_in_meta.bytes_per_location; - blocks_in_current_frame++; + /* Add half the buffer to spill over frame */ + half_buf_add(frame_spillover, (char *)buf + half_size, half_size, + &blocks_in_frame_spillover); + } else { + /* Add block data directly to current frame */ + net_buf_add_mem(frame_current, buf, size); + /* Update metadata */ + struct audio_metadata *meta = net_buf_user_data(frame_current); + + /* Accumulate one full 1 ms USB buffer, which counts as two 0.5 ms blocks. */ + meta->data_len_us += usb_in_meta.data_len_us; + meta->bytes_per_location += usb_in_meta.bytes_per_location; + blocks_in_frame_current += 2; + } /* Release USB buffer */ k_mem_slab_free(&usb_rx_slab, buf); /* Check if we have a complete frame */ - if (blocks_in_current_frame >= CONFIG_FIFO_FRAME_SPLIT_NUM) { + if (blocks_in_frame_current >= CONFIG_FIFO_FRAME_SPLIT_NUM) { /* Put complete frame into RX queue */ - ret = k_msgq_put(audio_q_rx, (void *)¤t_frame, K_NO_WAIT); + ret = k_msgq_put(audio_q_rx, (void *)&frame_current, K_NO_WAIT); if (ret) { LOG_ERR("Failed to store complete frame"); - net_buf_unref(current_frame); + net_buf_unref(frame_current); } /* Reset for next frame */ - current_frame = NULL; - blocks_in_current_frame = 0; + frame_current = NULL; + blocks_in_frame_current = 0; } return; @@ -331,9 +391,11 @@ int audio_usb_init(bool host_in, bool host_out) if (host_in && host_out) { dev = DEVICE_DT_GET(DT_NODELABEL(uac2_headset)); + usb_sof_synchronized = DT_PROP(DT_NODELABEL(uac_aclk), sof_synchronized); LOG_INF("USB initialized as bidirectional (headset)."); } else if (host_out) { dev = DEVICE_DT_GET(DT_NODELABEL(uac2_headphones)); + usb_sof_synchronized = DT_PROP(DT_NODELABEL(hp_uac_aclk), sof_synchronized); LOG_INF("USB initialized as unidirectional (headphones only)."); } else { LOG_ERR("USB currently only supports output (host out) or bidirectional (host in " @@ -359,7 +421,8 @@ int audio_usb_init(bool host_in, bool host_out) return ret; } - LOG_INF("Ready for USB host to send/receive."); + LOG_INF("Ready for USB host to send/receive: %s", + usb_sof_synchronized ? "No Sync (multi-clock) " : "Async (host-adjustable)"); return 0; } diff --git a/applications/nrf5340_audio/src/utils/Kconfig b/applications/nrf5340_audio/src/utils/Kconfig index 7bf2dbcd3c52..737f04c30cdd 100644 --- a/applications/nrf5340_audio/src/utils/Kconfig +++ b/applications/nrf5340_audio/src/utils/Kconfig @@ -12,14 +12,14 @@ menu "FIFO" config FIFO_FRAME_SPLIT_NUM int "Number of blocks to make up one frame of audio data" - default 10 + default 20 help Easy DMA in I2S requires two buffers to be filled before I2S transmission will begin. In order to reduce latency, an audio frame can be split into multiple blocks with this parameter. USB sends data in 1 ms blocks, so we need the split to match that. - Since we set frame size to 10 ms for USB, 10 is selected as - FRAME_SPLIT_NUM + If we set frame size to 10 ms for USB, 20 is selected as + FIFO_FRAME_SPLIT_NUM config FIFO_TX_FRAME_COUNT int "Max number of audio frames in TX slab" diff --git a/applications/nrf5340_audio/tools/buildprog/buildprog.py b/applications/nrf5340_audio/tools/buildprog/buildprog.py index e2158c51f60d..5acbf2d3ac16 100644 --- a/applications/nrf5340_audio/tools/buildprog/buildprog.py +++ b/applications/nrf5340_audio/tools/buildprog/buildprog.py @@ -53,6 +53,8 @@ TARGET_RELEASE_FOLDER = "build_release" TARGET_DEBUG_FOLDER = "build_debug" +DEFAULT_SIRK = "NRF5340_TWS_DEMO" + MAX_USER_NAME_LEN = 248 - len('\0') @@ -99,7 +101,7 @@ def __print_dev_conf(device_list): def __build_cmd_get(core: Core, device: AudioDevice, build: BuildType, - pristine, options): + pristine, options, sirk=""): build_cmd = (f"west build {TARGET_AUDIO_FOLDER} " f"-b {TARGET_BOARD_NRF5340_AUDIO_DK_APP_NAME} " @@ -143,6 +145,14 @@ def __build_cmd_get(core: Core, device: AudioDevice, build: BuildType, else: if device == AudioDevice.headset: overlay_flag = f" -DEXTRA_CONF_FILE={UNICAST_SERVER_OVERLAY}" + + if sirk == DEFAULT_SIRK: + raise ValueError("Default SIRK is not allowed. Please set a custom SIRK in the JSON file.") + + if len(sirk) != 16: + raise ValueError("SIRK must be 16 characters long") + + device_flag += " -DCONFIG_BT_SET_IDENTITY_RESOLVING_KEY=\\\"" + sirk + "\\\"" else: overlay_flag = f" -DEXTRA_CONF_FILE={UNICAST_CLIENT_OVERLAY}" @@ -156,13 +166,14 @@ def __build_cmd_get(core: Core, device: AudioDevice, build: BuildType, return build_cmd, dest_folder, device_flag, release_flag, overlay_flag -def __build_module(build_config, options): +def __build_module(build_config, options, sirk=""): build_cmd, dest_folder, device_flag, release_flag, overlay_flag = __build_cmd_get( build_config.core, build_config.device, build_config.build, build_config.pristine, options, + sirk, ) west_str = f"{build_cmd} -d {dest_folder} " @@ -196,10 +207,10 @@ def __find_snr(): def __populate_hex_paths(dev, options): """Poplulate hex paths where relevant""" - _, temp_dest_folder, _, _, _ = __build_cmd_get(Core.app, dev.nrf5340_audio_dk_dev, options.build, options.pristine, options) + _, temp_dest_folder, _, _, _ = __build_cmd_get(Core.app, dev.nrf5340_audio_dk_dev, options.build, options.pristine, options, dev.sirk) dev.hex_path_app = temp_dest_folder / "nrf5340_audio/zephyr/zephyr.hex" - _, temp_dest_folder, _, _, _ = __build_cmd_get(Core.net, dev.nrf5340_audio_dk_dev, options.build, options.pristine, options) + _, temp_dest_folder, _, _, _ = __build_cmd_get(Core.net, dev.nrf5340_audio_dk_dev, options.build, options.pristine, options, dev.sirk) dev.hex_path_net = temp_dest_folder / "ipc_radio/zephyr/zephyr.hex" @@ -350,7 +361,17 @@ def __main(): # Then run git update-index --skip-worktree FILENAME to avoid changes # being pushed with AUDIO_KIT_SERIAL_NUMBERS_JSON.open() as f: - dev_arr = json.load(f) + json_data = json.load(f) + + # Extract SIRK and devices from the new JSON structure + if "devices" in json_data: + dev_arr = json_data["devices"] + sirk = json_data.get("sirk", "") + else: + # Fallback for old format (array at root level) + dev_arr = json_data + sirk = DEFAULT_SIRK + device_list = [] for dev in dev_arr: if AudioDevice[dev["nrf5340_audio_dk_dev"]] == AudioDevice.headset: @@ -387,6 +408,7 @@ def __main(): snr_connected=(dev["nrf5340_audio_dk_snr"] in boards_snr_connected), recover_on_fail=options.recover_on_fail, nrf5340_audio_dk_dev=AudioDevice[dev["nrf5340_audio_dk_dev"]], + sirk=sirk, cores=cores, devices=devices, _only_reboot=options.only_reboot, @@ -431,7 +453,7 @@ def __main(): ) for build_cfg in build_configs: - __build_module(build_cfg, options) + __build_module(build_cfg, options, sirk) # Build step finished # Program step start diff --git a/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.json b/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.json index 1b37a8ad2606..37fb2f485a11 100644 --- a/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.json +++ b/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.json @@ -1,17 +1,26 @@ -[ - { - "nrf5340_audio_dk_snr": 1000, - "nrf5340_audio_dk_dev": "headset", - "location": ["FRONT_LEFT"] - }, - { - "nrf5340_audio_dk_snr": 1000, - "nrf5340_audio_dk_dev": "gateway", - "location": ["NA"] - }, - { - "nrf5340_audio_dk_snr": 1000, - "nrf5340_audio_dk_dev": "headset", - "location": ["FRONT_RIGHT"] - } -] +{ + "sirk": "NRF5340_TWS_DEMO", + "devices": [ + { + "nrf5340_audio_dk_snr": 1000, + "nrf5340_audio_dk_dev": "headset", + "location": [ + "FRONT_LEFT" + ] + }, + { + "nrf5340_audio_dk_snr": 1000, + "nrf5340_audio_dk_dev": "gateway", + "location": [ + "NA" + ] + }, + { + "nrf5340_audio_dk_snr": 1000, + "nrf5340_audio_dk_dev": "headset", + "location": [ + "FRONT_RIGHT" + ] + } + ] +} diff --git a/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py b/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py index e4cf7687de65..cbee14d98d63 100644 --- a/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py +++ b/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py @@ -105,6 +105,8 @@ class DeviceConf: cores: InitVar[list[Core]] devices: InitVar[list[AudioDevice]] _only_reboot: InitVar[SelectFlags] + sirk: str = "" # SIRK for the device set + # Post init variables only_reboot: SelectFlags = field(init=False, default=SelectFlags.NOT) hex_path_app: Path = field(init=False, default=None) diff --git a/applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf b/applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf index 191504048fce..5f1a1e84f872 100644 --- a/applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf +++ b/applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf @@ -26,7 +26,7 @@ CONFIG_BT_DEVICE_APPEARANCE=2176 CONFIG_BT_ISO_MAX_CHAN=4 CONFIG_BT_VCP_VOL_CTLR=y CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT=4 -CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=2 +CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=4 CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT=2 CONFIG_UTF8=y CONFIG_BT_CONTENT_CTRL_MEDIA=y diff --git a/applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf b/applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf index fcac90ff22c7..e4f9f60ff636 100644 --- a/applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf +++ b/applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf @@ -49,3 +49,7 @@ CONFIG_MBEDTLS_HEAP_SIZE=2048 CONFIG_BT_AUDIO_CONCURRENT_RX_STREAMS_MAX=2 CONFIG_AUDIO_DECODE_CHANNELS_MAX=2 CONFIG_AUDIO_SOURCE_I2S=y + +# Always enable bidirectional stream support on the server. +# The client may not support it, but the server should be able to handle it if the client does. +CONFIG_STREAM_BIDIRECTIONAL=y diff --git a/applications/nrf_desktop/CMakeLists.txt b/applications/nrf_desktop/CMakeLists.txt index fd1f4913c5f5..5d16993ec8af 100644 --- a/applications/nrf_desktop/CMakeLists.txt +++ b/applications/nrf_desktop/CMakeLists.txt @@ -61,12 +61,6 @@ if(CONFIG_BOOTLOADER_MCUBOOT) endif() if(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) - message(WARNING " - ----------------------------------------------------------------------------- - --- WARNING: The RAM load mode of the MCUboot bootloader is experimental. --- - ----------------------------------------------------------------------------- - ") - # Enforce the specific RAM layout in DTS when MCUboot uses the RAM load mode. dt_nodelabel(app_rxm_region_node NODELABEL cpuapp_sram_app_rxm_region) if(NOT app_rxm_region_node) diff --git a/applications/nrf_desktop/VERSION b/applications/nrf_desktop/VERSION index e34904f561cd..16a47594f510 100644 --- a/applications/nrf_desktop/VERSION +++ b/applications/nrf_desktop/VERSION @@ -1,5 +1,5 @@ VERSION_MAJOR = 3 -VERSION_MINOR = 2 +VERSION_MINOR = 3 PATCHLEVEL = 99 VERSION_TWEAK = 0 EXTRAVERSION = diff --git a/applications/nrf_desktop/board_configuration.rst b/applications/nrf_desktop/board_configuration.rst index 6db2db91ea34..e2508a809ba8 100644 --- a/applications/nrf_desktop/board_configuration.rst +++ b/applications/nrf_desktop/board_configuration.rst @@ -220,5 +220,7 @@ Sample mouse or dongle (``nrf54h20dk/nrf54h20/cpuapp``) All configurations enable hardware cryptography for the MCUboot bootloader. The MCUboot bootloader uses the :ref:`ug_crypto_architecture_implementation_standards_ironside` for hardware cryptography. The application image is verified using a pure ED25519 signature. + The public key that MCUboot uses for validating the application image is securely stored in the Internal Trusted Storage (ITS). + For more details about secure storage on the nRF54H20, see :ref:`ug_nrf54h20_ironside_secure_storage`. In all configurations, the MCUboot bootloader uses a merged image slot that combines both application and radio core images. For more details on nRF54H Series DFU, see :ref:`ug_nrf54h20_mcuboot_dfu`. diff --git a/applications/nrf_desktop/bootloader_dfu.rst b/applications/nrf_desktop/bootloader_dfu.rst index 7f6853e63865..e7476ecca58e 100644 --- a/applications/nrf_desktop/bootloader_dfu.rst +++ b/applications/nrf_desktop/bootloader_dfu.rst @@ -129,7 +129,7 @@ These options allow the :ref:`nrf_desktop_dfu`, :ref:`nrf_desktop_ble_smp`, and .. note:: When the MCUboot bootloader is in the swap mode, it can use a secondary image slot located on the external non-volatile memory. - For details on using external non-volatile memory for the secondary image slot, see the :ref:`nrf_desktop_pm_external_flash` section. + For details on using external non-volatile memory for the secondary image slot, see the :ref:`nrf_desktop_external_flash` section. Direct-xip mode ~~~~~~~~~~~~~~~ @@ -201,9 +201,7 @@ However, instead of booting the image from the NVM slot, the bootloader in the R The application image is always built for the RAM address space in only one variant. .. caution:: - The RAM load mode of the MCUboot bootloader is not officially supported in |NCS|. - However, the mode is available in the |NCS| as the support for this feature has been developed as part of the Zephyr RTOS project. - This feature is only used in a limited context for the nRF54LM20 DK to improve performance. + Currently, this feature is only used in a limited context for the nRF54LM20 DK to improve performance. You can use the RAM load mode of the MCUboot bootloader to speed up the code execution for the application image, as code execution from the RAM is generally faster than from the NVM. This can improve the device performance during the activities that require high CPU usage. @@ -287,9 +285,22 @@ See the :ref:`ug_kmu_provisioning_overview` documentation for details. This option enables generating a default :file:`keyfile.json` file during the build process based on the input file provided by the :kconfig:option:`SB_CONFIG_BOOT_SIGNATURE_KEY_FILE` sysbuild Kconfig option. The automatic provisioning is only performed if the west flash command is executed with the ``--erase`` or ``--recover`` flag. +.. _nrf_desktop_mcuboot_bootloader_features_nrf54h: + MCUboot bootloader features specific to nRF54H series ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The nRF54H Series devices support the use of the Internal Trusted Storage (ITS) to store keys for signature verification instead of compiling key data into the MCUboot bootloader image. +To use ITS in the MCUboot bootloader, enable the :kconfig:option:`SB_CONFIG_MCUBOOT_SIGNATURE_USING_ITS` sysbuild Kconfig option. +For more details about secure storage on the nRF54H20, see :ref:`ug_nrf54h20_ironside_secure_storage`. +You must also make sure to provision the public key to your target device before running the firmware. +See the :ref:`ug_nrf54h20_keys` documentation for details. + +.. note:: + To use automatic provisioning, enable the :kconfig:option:`SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE` sysbuild Kconfig option. + This option enables generating a default :file:`keyfile.json` file during the build process based on the input file provided by the :kconfig:option:`SB_CONFIG_BOOT_SIGNATURE_KEY_FILE` sysbuild Kconfig option. + The automatic provisioning is only performed if the west flash command is executed with the ``--erase`` or ``--recover`` flag. + On the nRF54H devices, the MCUboot direct-xip mode uses by default a merged image slot that combines both application and radio core images. The merged binary size is the sum of the application image, the radio core image, and the padding between them. The merged image slot configuration is indicated by the :kconfig:option:`SB_CONFIG_MCUBOOT_SIGN_MERGED_BINARY` sysbuild Kconfig option. diff --git a/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/images/mcuboot/prj_release.conf index 766f2f59bfcc..a3e065bf592c 100644 --- a/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/images/mcuboot/prj_release.conf @@ -9,7 +9,7 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=4096 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/images/mcuboot/prj_release.conf index 839b75f299a8..24db4a582e07 100644 --- a/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/images/mcuboot/prj_release.conf @@ -9,7 +9,7 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=4096 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj.conf b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj.conf index 80758a0b95da..c690be0d21f6 100644 --- a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj.conf +++ b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj.conf @@ -11,7 +11,7 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_dongle_small.conf b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_dongle_small.conf index f5297b7d6917..8c64e51cf0a1 100644 --- a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_dongle_small.conf +++ b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_dongle_small.conf @@ -11,7 +11,7 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_release.conf index e3ce5ea3f74b..6e3b45bb9a9a 100644 --- a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/images/mcuboot/prj_release.conf @@ -11,7 +11,7 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj.conf b/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj.conf index 80758a0b95da..c690be0d21f6 100644 --- a/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj.conf +++ b/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj.conf @@ -11,7 +11,7 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj_release.conf index aa2f4f9daf87..9856c4cd20c0 100644 --- a/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/images/mcuboot/prj_release.conf @@ -11,7 +11,7 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/app_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/app_fast_pair.overlay new file mode 100644 index 000000000000..e6a4b9757b8f --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/app_fast_pair.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "memory_map_fast_pair.dtsi" +#include "app_common.dtsi" + +secondary_app_partition: &slot1_partition {}; + +/ { + /* Configure DTS nodes used for USB next HID support. */ + hid_dev_0: hid_dev_0 { + compatible = "zephyr,hid-device"; + label = "HID0"; + protocol-code = "mouse"; + in-polling-period-us = <1000>; + in-report-size = <64>; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/app_mcuboot_qspi.overlay b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/app_mcuboot_qspi.overlay index 66d1430f1124..52640a080410 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/app_mcuboot_qspi.overlay +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/app_mcuboot_qspi.overlay @@ -1,13 +1,17 @@ /* - * Copyright (c) 2024 Nordic Semiconductor ASA + * Copyright (c) 2024-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map_mcuboot_qspi.dtsi" #include "app_common.dtsi" / { chosen { + /* Used by the Partition Manager (when enabled through sysbuild). + * Unused when the DTS-based memory map is used. + */ nordic,pm-ext-flash = &mx25r64; }; @@ -20,7 +24,3 @@ in-report-size = <64>; }; }; - -&qspi { - status = "okay"; -}; diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/app_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/app_fast_pair.overlay new file mode 100644 index 000000000000..96aff1aa6b68 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/app_fast_pair.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map_fast_pair.dtsi" + +/* The nRF52840 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/app_mcuboot_qspi.overlay b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/app_mcuboot_qspi.overlay new file mode 100644 index 000000000000..99c8dbee4739 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/app_mcuboot_qspi.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map_mcuboot_qspi.dtsi" + +/* The nRF52840 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_fast_pair.conf index 3c815a5466cb..6175fdadc736 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Nordic Semiconductor ASA +# Copyright (c) 2023, 2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -10,9 +10,8 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_qspi.conf b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_qspi.conf index 809237547262..8ae9fced0f67 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_qspi.conf +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_qspi.conf @@ -10,7 +10,7 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n @@ -19,7 +19,6 @@ CONFIG_FPROTECT=y CONFIG_NORDIC_QSPI_NOR=y CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_BOOT_MAX_IMG_SECTORS=2048 # Logger CONFIG_LOG=y diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_smp.conf b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_smp.conf index 85cae1bb7b80..3500353267bd 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_smp.conf +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/images/mcuboot/prj_mcuboot_smp.conf @@ -10,7 +10,7 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/memory_map_fast_pair.dtsi b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/memory_map_fast_pair.dtsi new file mode 100644 index 000000000000..8d012f4491ce --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/memory_map_fast_pair.dtsi @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&flash0 { + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(32)>; + }; + + slot0_partition: partition@8000 { + label = "image-0"; + reg = <0x8000 DT_SIZE_K(488)>; + }; + + slot1_partition: partition@82000 { + label = "image-1"; + reg = <0x82000 DT_SIZE_K(488)>; + }; + + bt_fast_pair_partition: partition@fc000 { + label = "fast_pair"; + reg = <0xfc000 DT_SIZE_K(4)>; + }; + + storage_partition: partition@fd000 { + label = "storage"; + reg = <0xfd000 DT_SIZE_K(12)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/memory_map_mcuboot_qspi.dtsi b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/memory_map_mcuboot_qspi.dtsi new file mode 100644 index 000000000000..0a2d740add2d --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/memory_map_mcuboot_qspi.dtsi @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&flash0 { + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(48)>; + }; + + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0xc000 DT_SIZE_K(960)>; + }; + + storage_partition: partition@fc000 { + label = "storage"; + reg = <0xfc000 DT_SIZE_K(16)>; + }; + }; +}; + +/* The mx25r64 external flash is a child of the QSPI peripheral (see the board + * definition), so the QSPI node must be enabled in order to use it. + */ +&qspi { + status = "okay"; +}; + +&mx25r64 { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@0 { + label = "image-1"; + reg = <0x0 DT_SIZE_K(960)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_fast_pair.conf index b4a1b1c9b6ec..7087ed54d963 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2024-2025 Nordic Semiconductor ASA +# Copyright (c) 2024-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -14,3 +14,5 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private_fast_pair.pem" + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_mcuboot_qspi.conf b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_mcuboot_qspi.conf index 9fbe6a9d844d..c2a8fba95621 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_mcuboot_qspi.conf +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/sysbuild_mcuboot_qspi.conf @@ -1,11 +1,17 @@ # -# Copyright (c) 2024 Nordic Semiconductor ASA +# Copyright (c) 2024-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # ################################################################################ SB_CONFIG_BOOTLOADER_MCUBOOT=y -SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" + +# The configuration uses the DTS-based memory map. +SB_CONFIG_PARTITION_MANAGER=n +# Uncomment the option below if you re-enable the Partition Manager +# (SB_CONFIG_PARTITION_MANAGER=y) to place the MCUboot secondary slot +# in the external flash. +# SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app.overlay b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app.overlay index b8fc24f574d6..56ad087432ba 100644 --- a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app.overlay +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app.overlay @@ -1,83 +1 @@ -/ { - chosen { - /* - * In some default configurations within the nRF Connect SDK, - * e.g. on nRF52840 and nRF9160, the chosen zephyr,entropy node - * is &cryptocell. This devicetree overlay ensures that default - * is overridden wherever it is set, as this application uses - * the RNG node for entropy exclusively. - */ - zephyr,entropy = &rng; - }; - - /* Configure DTS nodes used for USB next HID support. */ - hid_dev_0: hid_dev_0 { - compatible = "zephyr,hid-device"; - label = "HID0"; - protocol-code = "mouse"; - in-polling-period-us = <1000>; - in-report-size = <64>; - }; - - pwmleds0 { - compatible = "pwm-leds"; - status = "okay"; - - led0_r: led_pwm_0 { - pwms = <&pwm0 0 PWM_MSEC(1) PWM_POLARITY_NORMAL>; - label = "LED0 Red"; - }; - - led0_g: led_pwm_1 { - pwms = <&pwm0 1 PWM_MSEC(1) PWM_POLARITY_NORMAL>; - label = "LED0 Green"; - }; - - led0_b: led_pwm_2 { - pwms = <&pwm0 2 PWM_MSEC(1) PWM_POLARITY_NORMAL>; - label = "LED0 Blue"; - }; - }; - - pwmleds1 { - compatible = "pwm-leds"; - status = "okay"; - - led1_r: led_pwm_3 { - pwms = <&pwm1 0 PWM_MSEC(1) PWM_POLARITY_NORMAL>; - label = "LED1 Red"; - }; - - led1_g: led_pwm_4 { - pwms = <&pwm1 1 PWM_MSEC(1) PWM_POLARITY_NORMAL>; - label = "LED1 Green"; - }; - - led1_b: led_pwm_5 { - pwms = <&pwm1 2 PWM_MSEC(1) PWM_POLARITY_NORMAL>; - label = "LED1 Blue"; - }; - }; - - battery_charger: battery_charger { - compatible = "battery-charger"; - cso-gpios = <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; - cso-switching-freq = <1>; - enable-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; - }; -}; - -&usbd { - compatible = "nordic,nrf-usbd"; - status = "okay"; - num-bidir-endpoints = <0>; - num-in-endpoints = <2>; - num-out-endpoints = <2>; - num-isoin-endpoints = <0>; - num-isoout-endpoints = <0>; -}; - -&spi1 { - compatible = "nordic,nrf-spim"; - status = "okay"; -}; +#include "app_common.dtsi" diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_common.dtsi b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_common.dtsi new file mode 100644 index 000000000000..b8fc24f574d6 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_common.dtsi @@ -0,0 +1,83 @@ +/ { + chosen { + /* + * In some default configurations within the nRF Connect SDK, + * e.g. on nRF52840 and nRF9160, the chosen zephyr,entropy node + * is &cryptocell. This devicetree overlay ensures that default + * is overridden wherever it is set, as this application uses + * the RNG node for entropy exclusively. + */ + zephyr,entropy = &rng; + }; + + /* Configure DTS nodes used for USB next HID support. */ + hid_dev_0: hid_dev_0 { + compatible = "zephyr,hid-device"; + label = "HID0"; + protocol-code = "mouse"; + in-polling-period-us = <1000>; + in-report-size = <64>; + }; + + pwmleds0 { + compatible = "pwm-leds"; + status = "okay"; + + led0_r: led_pwm_0 { + pwms = <&pwm0 0 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + label = "LED0 Red"; + }; + + led0_g: led_pwm_1 { + pwms = <&pwm0 1 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + label = "LED0 Green"; + }; + + led0_b: led_pwm_2 { + pwms = <&pwm0 2 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + label = "LED0 Blue"; + }; + }; + + pwmleds1 { + compatible = "pwm-leds"; + status = "okay"; + + led1_r: led_pwm_3 { + pwms = <&pwm1 0 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + label = "LED1 Red"; + }; + + led1_g: led_pwm_4 { + pwms = <&pwm1 1 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + label = "LED1 Green"; + }; + + led1_b: led_pwm_5 { + pwms = <&pwm1 2 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + label = "LED1 Blue"; + }; + }; + + battery_charger: battery_charger { + compatible = "battery-charger"; + cso-gpios = <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + cso-switching-freq = <1>; + enable-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + }; +}; + +&usbd { + compatible = "nordic,nrf-usbd"; + status = "okay"; + num-bidir-endpoints = <0>; + num-in-endpoints = <2>; + num-out-endpoints = <2>; + num-isoin-endpoints = <0>; + num-isoout-endpoints = <0>; +}; + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_fast_pair.overlay new file mode 100644 index 000000000000..09bc446b0b37 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_fast_pair.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "memory_map_fast_pair.dtsi" +#include "app_common.dtsi" + +secondary_app_partition: &slot1_partition {}; diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_release_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_release_fast_pair.overlay new file mode 100644 index 000000000000..09bc446b0b37 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/app_release_fast_pair.overlay @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "memory_map_fast_pair.dtsi" +#include "app_common.dtsi" + +secondary_app_partition: &slot1_partition {}; diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/app_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/app_fast_pair.overlay new file mode 100644 index 000000000000..d26d6fca82f6 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/app_fast_pair.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map_fast_pair.dtsi" + +/* The nRF52840 Gaming Mouse defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/app_release_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/app_release_fast_pair.overlay new file mode 100644 index 000000000000..d26d6fca82f6 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/app_release_fast_pair.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map_fast_pair.dtsi" + +/* The nRF52840 Gaming Mouse defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_fast_pair.conf index 4b57aa793207..81fb594a1aff 100644 --- a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Nordic Semiconductor ASA +# Copyright (c) 2023, 2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -10,9 +10,8 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_release_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_release_fast_pair.conf index f9bb589093e7..7cea17de75ae 100644 --- a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_release_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/images/mcuboot/prj_release_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Nordic Semiconductor ASA +# Copyright (c) 2023, 2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -10,9 +10,8 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/memory_map_fast_pair.dtsi b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/memory_map_fast_pair.dtsi new file mode 100644 index 000000000000..8d012f4491ce --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/memory_map_fast_pair.dtsi @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&flash0 { + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(32)>; + }; + + slot0_partition: partition@8000 { + label = "image-0"; + reg = <0x8000 DT_SIZE_K(488)>; + }; + + slot1_partition: partition@82000 { + label = "image-1"; + reg = <0x82000 DT_SIZE_K(488)>; + }; + + bt_fast_pair_partition: partition@fc000 { + label = "fast_pair"; + reg = <0xfc000 DT_SIZE_K(4)>; + }; + + storage_partition: partition@fd000 { + label = "storage"; + reg = <0xfd000 DT_SIZE_K(12)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_fast_pair.conf index b4a1b1c9b6ec..7087ed54d963 100644 --- a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2024-2025 Nordic Semiconductor ASA +# Copyright (c) 2024-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -14,3 +14,5 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private_fast_pair.pem" + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_release_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_release_fast_pair.conf index b4a1b1c9b6ec..7087ed54d963 100644 --- a/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_release_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52840gmouse_nrf52840/sysbuild_release_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2024-2025 Nordic Semiconductor ASA +# Copyright (c) 2024-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -14,3 +14,5 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private_fast_pair.pem" + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/app_release_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/app_release_fast_pair.overlay new file mode 100644 index 000000000000..e00f6812706a --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/app_release_fast_pair.overlay @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "memory_map_release_fast_pair.dtsi" + +secondary_app_partition: &slot1_partition {}; + +/ { + pwmleds0 { + compatible = "pwm-leds"; + status = "okay"; + + pwm_led0: led_pwm_0 { + status = "okay"; + pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + label = "LED Conn State"; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/images/mcuboot/app_release_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/images/mcuboot/app_release_fast_pair.overlay new file mode 100644 index 000000000000..94acaaaac715 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/images/mcuboot/app_release_fast_pair.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map_release_fast_pair.dtsi" + +/* The nRF52 Keyboard defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/images/mcuboot/prj_release_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/images/mcuboot/prj_release_fast_pair.conf index 1297fd5a8cf3..54d2ac1e2d3e 100644 --- a/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/images/mcuboot/prj_release_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/images/mcuboot/prj_release_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Nordic Semiconductor ASA +# Copyright (c) 2023, 2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -10,9 +10,8 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" +CONFIG_MBEDTLS_CONFIG_FILE="mcuboot-mbedtls-cfg.h" -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/memory_map_release_fast_pair.dtsi b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/memory_map_release_fast_pair.dtsi new file mode 100644 index 000000000000..ada7fb32b9c6 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/memory_map_release_fast_pair.dtsi @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&flash0 { + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(24)>; + }; + + slot0_partition: partition@6000 { + label = "image-0"; + reg = <0x6000 DT_SIZE_K(236)>; + }; + + slot1_partition: partition@41000 { + label = "image-1"; + reg = <0x41000 DT_SIZE_K(236)>; + }; + + bt_fast_pair_partition: partition@7c000 { + label = "fast_pair"; + reg = <0x7c000 DT_SIZE_K(4)>; + }; + + storage_partition: partition@7d000 { + label = "storage"; + reg = <0x7d000 DT_SIZE_K(12)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/sysbuild_release_fast_pair.conf b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/sysbuild_release_fast_pair.conf index 7e6e93d263e9..468a865e5293 100644 --- a/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/sysbuild_release_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf52kbd_nrf52832/sysbuild_release_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2024-2025 Nordic Semiconductor ASA +# Copyright (c) 2024-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -14,3 +14,5 @@ SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private_fast_pair.pem" + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/memory_map.dtsi b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/memory_map.dtsi index f70cde3d42c7..4efdb6350d8c 100644 --- a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/memory_map.dtsi +++ b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/memory_map.dtsi @@ -9,7 +9,6 @@ /* Redefine the "partitions" DTS node. */ partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; ranges; @@ -19,6 +18,7 @@ */ cpuapp_boot_partition: partition@30000 { + compatible = "zephyr,mapped-partition"; reg = <0x30000 DT_SIZE_K(32)>; }; @@ -26,17 +26,19 @@ * images and points to the "merged" partition. */ slot0_partition: partition@38000 { - compatible = "fixed-subpartitions"; + compatible = "zephyr,mapped-partition"; reg = <0x38000 DT_SIZE_K(800)>; ranges = <0x0 0x38000 DT_SIZE_K(800)>; #address-cells = <1>; #size-cells = <1>; cpuapp_slot0_partition: partition@800 { + compatible = "zephyr,mapped-partition"; reg = <0x800 DT_SIZE_K(330)>; }; cpurad_slot0_partition: partition@53000 { + compatible = "zephyr,mapped-partition"; reg = <0x53000 DT_SIZE_K(220)>; }; @@ -50,17 +52,19 @@ /* Partitions belonging to the MRAM_11 memory block. */ slot1_partition: partition@100000 { - compatible = "fixed-subpartitions"; + compatible = "zephyr,mapped-partition"; reg = <0x100000 DT_SIZE_K(800)>; ranges = <0x0 0x100000 DT_SIZE_K(800)>; #address-cells = <1>; #size-cells = <1>; cpuapp_slot1_partition: partition@800 { + compatible = "zephyr,mapped-partition"; reg = <0x800 DT_SIZE_K(330)>; }; cpurad_slot1_partition: partition@53000 { + compatible = "zephyr,mapped-partition"; reg = <0x53000 DT_SIZE_K(220)>; }; @@ -72,10 +76,12 @@ }; storage_partition: partition@1c8000 { + compatible = "zephyr,mapped-partition"; reg = <0x1c8000 DT_SIZE_K(40)>; }; periphconf_partition: partition@1d2000 { + compatible = "zephyr,mapped-partition"; reg = <0x1d2000 DT_SIZE_K(8)>; }; @@ -85,25 +91,29 @@ * there is no more space after secure_storage_partition. */ secure_storage_partition: partition@1fd000 { - compatible = "fixed-subpartitions"; + compatible = "zephyr,mapped-partition"; reg = <0x1fd000 DT_SIZE_K(12)>; ranges = <0x0 0x1fd000 DT_SIZE_K(12)>; #address-cells = <1>; #size-cells = <1>; cpuapp_crypto_partition: partition@0 { + compatible = "zephyr,mapped-partition"; reg = <0x0 DT_SIZE_K(4)>; }; cpurad_crypto_partition: partition@1000 { + compatible = "zephyr,mapped-partition"; reg = <0x1000 DT_SIZE_K(4)>; }; cpuapp_its_partition: partition@2000 { + compatible = "zephyr,mapped-partition"; reg = <0x2000 DT_SIZE_K(2)>; }; cpurad_its_partition: partition@2800 { + compatible = "zephyr,mapped-partition"; reg = <0x2800 DT_SIZE_K(2)>; }; }; diff --git a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild.conf b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild.conf index 6b76c56e2704..c91016229c84 100644 --- a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild.conf +++ b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild.conf @@ -13,5 +13,7 @@ SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519=y SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" +SB_CONFIG_MCUBOOT_SIGNATURE_USING_ITS=y +SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y # Reserve space for MCUboot trailer only in the radio slots. SB_CONFIG_MCUBOOT_IMAGES_ROM_END_OFFSET_AUTO="ipc_radio;ipc_radio_secondary_app" diff --git a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_dongle.conf b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_dongle.conf index 5aee7487d61e..9ca6be06e20c 100644 --- a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_dongle.conf +++ b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_dongle.conf @@ -13,5 +13,7 @@ SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519=y SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" +SB_CONFIG_MCUBOOT_SIGNATURE_USING_ITS=y +SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y # Reserve space for MCUboot trailer only in the radio slots. SB_CONFIG_MCUBOOT_IMAGES_ROM_END_OFFSET_AUTO="ipc_radio;ipc_radio_secondary_app" diff --git a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release.conf b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release.conf index 6b76c56e2704..c91016229c84 100644 --- a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release.conf +++ b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release.conf @@ -13,5 +13,7 @@ SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519=y SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" +SB_CONFIG_MCUBOOT_SIGNATURE_USING_ITS=y +SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y # Reserve space for MCUboot trailer only in the radio slots. SB_CONFIG_MCUBOOT_IMAGES_ROM_END_OFFSET_AUTO="ipc_radio;ipc_radio_secondary_app" diff --git a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release_dongle.conf b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release_dongle.conf index 5aee7487d61e..9ca6be06e20c 100644 --- a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release_dongle.conf +++ b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/sysbuild_release_dongle.conf @@ -13,5 +13,7 @@ SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP=y SB_CONFIG_BOOT_SIGNATURE_TYPE_ED25519=y SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" +SB_CONFIG_MCUBOOT_SIGNATURE_USING_ITS=y +SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y # Reserve space for MCUboot trailer only in the radio slots. SB_CONFIG_MCUBOOT_IMAGES_ROM_END_OFFSET_AUTO="ipc_radio;ipc_radio_secondary_app" diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app.overlay index 51eda84e94e0..0c1677e71191 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app.overlay +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app.overlay @@ -1,7 +1,8 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map.dtsi" #include "app_common.dtsi" diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_common.dtsi b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_common.dtsi index db2fa5c67971..6890a98d4653 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_common.dtsi +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_common.dtsi @@ -1,13 +1,10 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1012)>; -}; +secondary_app_partition: &slot1_partition {}; / { /* Disable pwmleds and redefine them to align configuration with CAF LEDs requirements. diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_fast_pair.overlay new file mode 100644 index 000000000000..c32c3e913eff --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_fast_pair.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "memory_map_fast_pair.dtsi" +#include "app_common.dtsi" diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_keyboard.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_keyboard.overlay new file mode 100644 index 000000000000..06d14fc4e7f6 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_keyboard.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "memory_map.dtsi" +#include "app_common.dtsi" diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_release.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_release.overlay index 3faa341ff1ce..356975a44fa9 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_release.overlay +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/app_release.overlay @@ -1,9 +1,10 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map.dtsi" #include "app_common.dtsi" /* For nRF54L, watchdog status is disabled by default. Needs to be enabled in DTS overlay. */ diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app.overlay index 0469ddcc977f..82207d9f7028 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app.overlay +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app.overlay @@ -1,10 +1,16 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(1012)>; +#include "../../memory_map.dtsi" + +/* The nRF54L15 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_fast_pair.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_fast_pair.overlay new file mode 100644 index 000000000000..3a83b62f588d --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_fast_pair.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map_fast_pair.dtsi" + +/* The nRF54L15 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_keyboard.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_keyboard.overlay new file mode 100644 index 000000000000..61ee7264052d --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_keyboard.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map.dtsi" + +/* The nRF54L15 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_release.overlay b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_release.overlay new file mode 100644 index 000000000000..61ee7264052d --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/app_release.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "../../memory_map.dtsi" + +/* The nRF54L15 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj.conf index 4130ac28c3e4..66f26509110a 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -8,7 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_fast_pair.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_fast_pair.conf index f3c2b63a5b22..66f26509110a 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -8,8 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_keyboard.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_keyboard.conf index f3c2b63a5b22..66f26509110a 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_keyboard.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_keyboard.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -8,8 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_release.conf index aea39579a2b4..79991b41a4f4 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/images/mcuboot/prj_release.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -8,8 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/memory_map.dtsi b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/memory_map.dtsi new file mode 100644 index 000000000000..57bc14bd2e4c --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/memory_map.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&cpuapp_rram { + /* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ + reg = <0x0 DT_SIZE_K(1012)>; + + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(28)>; + }; + + slot0_partition: partition@7000 { + label = "image-0"; + reg = <0x7000 DT_SIZE_K(484)>; + }; + + slot1_partition: partition@80000 { + label = "image-1"; + reg = <0x80000 DT_SIZE_K(484)>; + }; + + storage_partition: partition@f9000 { + label = "storage"; + reg = <0xf9000 DT_SIZE_K(16)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/memory_map_fast_pair.dtsi b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/memory_map_fast_pair.dtsi new file mode 100644 index 000000000000..77cb6f59948e --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/memory_map_fast_pair.dtsi @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&cpuapp_rram { + /* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ + reg = <0x0 DT_SIZE_K(1012)>; + + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(28)>; + }; + + slot0_partition: partition@7000 { + label = "image-0"; + reg = <0x7000 DT_SIZE_K(480)>; + }; + + slot1_partition: partition@7f000 { + label = "image-1"; + reg = <0x7f000 DT_SIZE_K(480)>; + }; + + bt_fast_pair_partition: partition@f7000 { + label = "fast_pair"; + reg = <0xf7000 DT_SIZE_K(4)>; + }; + + storage_partition: partition@f8000 { + label = "storage"; + reg = <0xf8000 DT_SIZE_K(20)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild.conf index d94acdc01b9c..925b36c4cb31 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_fast_pair.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_fast_pair.conf index 763a1779ec82..def4d35b650a 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_fast_pair.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -17,3 +17,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private_fast_pair.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_keyboard.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_keyboard.conf index d94acdc01b9c..925b36c4cb31 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_keyboard.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_keyboard.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_release.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_release.conf index d94acdc01b9c..925b36c4cb31 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_release.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l10_cpuapp/sysbuild_release.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app.overlay index 660ce0ce2a6b..6e7b1a2739a1 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app.overlay @@ -1,16 +1,12 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map.dtsi" #include "app_common.dtsi" -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; -}; - / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_common.dtsi b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_common.dtsi index e8d11cb081cf..8f32a13f757c 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_common.dtsi +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_common.dtsi @@ -1,9 +1,11 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +secondary_app_partition: &slot1_partition {}; + / { /* Disable pwmleds and redefine them to align configuration with CAF LEDs requirements. */ /delete-node/ pwmleds; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_llvm.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_llvm.overlay index 660ce0ce2a6b..078435057539 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_llvm.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_llvm.overlay @@ -1,16 +1,12 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map_llvm.dtsi" #include "app_common.dtsi" -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; -}; - / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_release.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_release.overlay index 63ddd54f20ad..01965b1e335a 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_release.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/app_release.overlay @@ -1,16 +1,12 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map.dtsi" #include "app_common.dtsi" -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; -}; - / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app.overlay index 0531e1f2bb53..4229ccd7cd0a 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app.overlay @@ -1,10 +1,16 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; +#include "../../memory_map.dtsi" + +/* The nRF54LM20 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_llvm.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_llvm.overlay index 0531e1f2bb53..50288706342f 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_llvm.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_llvm.overlay @@ -1,10 +1,16 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; +#include "../../memory_map_llvm.dtsi" + +/* The nRF54LM20 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_release.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_release.overlay index 0531e1f2bb53..4229ccd7cd0a 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_release.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/app_release.overlay @@ -1,10 +1,16 @@ /* - * Copyright (c) 2025 Nordic Semiconductor ASA + * Copyright (c) 2025-2026 Nordic Semiconductor ASA * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; +#include "../../memory_map.dtsi" + +/* The nRF54LM20 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj.conf index 34804ac38838..db44dfa9c761 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -8,7 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_llvm.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_llvm.conf index 102914720590..054c481de931 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_llvm.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_llvm.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -8,7 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS_AGGRESSIVE=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_release.conf index 90b009e38669..5f854f875649 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/images/mcuboot/prj_release.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -8,8 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map.dtsi b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map.dtsi new file mode 100644 index 000000000000..99d80c16b2ce --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&cpuapp_rram { + /* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ + reg = <0x0 DT_SIZE_K(2036)>; + + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(20)>; + }; + + slot0_partition: partition@5000 { + label = "image-0"; + reg = <0x5000 DT_SIZE_K(1000)>; + }; + + slot1_partition: partition@ff000 { + label = "image-1"; + reg = <0xff000 DT_SIZE_K(1000)>; + }; + + storage_partition: partition@1f9000 { + label = "storage"; + reg = <0x1f9000 DT_SIZE_K(16)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map_llvm.dtsi b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map_llvm.dtsi new file mode 100644 index 000000000000..1af3d3e82014 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/memory_map_llvm.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&cpuapp_rram { + /* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ + reg = <0x0 DT_SIZE_K(2036)>; + + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(28)>; + }; + + slot0_partition: partition@7000 { + label = "image-0"; + reg = <0x7000 DT_SIZE_K(996)>; + }; + + slot1_partition: partition@100000 { + label = "image-1"; + reg = <0x100000 DT_SIZE_K(996)>; + }; + + storage_partition: partition@1f9000 { + label = "storage"; + reg = <0x1f9000 DT_SIZE_K(16)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj.conf index 728f775dfb89..b12d03ef9823 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -115,6 +115,9 @@ CONFIG_SPI_NOR=n # timeouts in flash_sync_mpsl. CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=8 +# Enable code partitioning with DTS +CONFIG_USE_DT_CODE_PARTITION=y + ################################################################################ CONFIG_ASSERT=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_llvm.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_llvm.conf index 95be5253eeef..d9a81b6c2d16 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_llvm.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_llvm.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -119,6 +119,9 @@ CONFIG_SPI_NOR=n # timeouts in flash_sync_mpsl. CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=8 +# Enable code partitioning with DTS +CONFIG_USE_DT_CODE_PARTITION=y + ################################################################################ CONFIG_ASSERT=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_release.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_release.conf index e2555b16962c..9273e892f971 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/prj_release.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -111,6 +111,9 @@ CONFIG_SPI_NOR=n # timeouts in flash_sync_mpsl. CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=8 +# Enable code partitioning with DTS +CONFIG_USE_DT_CODE_PARTITION=y + ################################################################################ # Disable unused features diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild.conf index d94acdc01b9c..925b36c4cb31 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_llvm.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_llvm.conf index d94acdc01b9c..925b36c4cb31 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_llvm.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_llvm.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_release.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_release.conf index d94acdc01b9c..925b36c4cb31 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_release.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20a_cpuapp/sysbuild_release.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Nordic Semiconductor ASA +# Copyright (c) 2025-2026 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app.overlay index 553404b6b806..3390d2575f02 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app.overlay @@ -4,13 +4,9 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map.dtsi" #include "app_common.dtsi" -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; -}; - / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_common.dtsi b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_common.dtsi index e0eba71fa60d..8524a20d78f3 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_common.dtsi +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_common.dtsi @@ -4,6 +4,8 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +secondary_app_partition: &slot1_partition {}; + / { /* Disable pwmleds and redefine them to align configuration with CAF LEDs requirements. */ /delete-node/ pwmleds; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_llvm.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_llvm.overlay index 553404b6b806..2c4759c8b625 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_llvm.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_llvm.overlay @@ -4,13 +4,9 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map_llvm.dtsi" #include "app_common.dtsi" -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; -}; - / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_release.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_release.overlay index 9f6fc1118ed3..b29aae957adb 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_release.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/app_release.overlay @@ -4,13 +4,9 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +#include "memory_map.dtsi" #include "app_common.dtsi" -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; -}; - / { hid_dev_0: hid_dev_0 { compatible = "zephyr,hid-device"; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app.overlay index 3aff1157999e..ef7032d1de3c 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app.overlay @@ -4,7 +4,13 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; +#include "../../memory_map.dtsi" + +/* The nRF54LM20 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_llvm.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_llvm.overlay index 3aff1157999e..e002dd4f72b6 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_llvm.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_llvm.overlay @@ -4,7 +4,13 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; +#include "../../memory_map_llvm.dtsi" + +/* The nRF54LM20 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_release.overlay b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_release.overlay index 3aff1157999e..ef7032d1de3c 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_release.overlay +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/app_release.overlay @@ -4,7 +4,13 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ -&cpuapp_rram { - reg = <0x0 DT_SIZE_K(2036)>; +#include "../../memory_map.dtsi" + +/* The nRF54LM20 DK defines memory map using DTS. + * Assign the bootloader partition to MCUboot image. + */ +/ { + chosen { + zephyr,code-partition = &boot_partition; + }; }; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj.conf index 3054a1d1f430..294fe20715b8 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj.conf @@ -8,7 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_llvm.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_llvm.conf index 479858665d47..aef4279038a2 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_llvm.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_llvm.conf @@ -8,7 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS_AGGRESSIVE=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_release.conf index 6b6a95c01fd6..46a2d2ba2124 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/images/mcuboot/prj_release.conf @@ -8,8 +8,6 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_MAIN_STACK_SIZE=10240 - -CONFIG_BOOT_MAX_IMG_SECTORS=256 CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/memory_map.dtsi b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/memory_map.dtsi new file mode 100644 index 000000000000..99d80c16b2ce --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/memory_map.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&cpuapp_rram { + /* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ + reg = <0x0 DT_SIZE_K(2036)>; + + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(20)>; + }; + + slot0_partition: partition@5000 { + label = "image-0"; + reg = <0x5000 DT_SIZE_K(1000)>; + }; + + slot1_partition: partition@ff000 { + label = "image-1"; + reg = <0xff000 DT_SIZE_K(1000)>; + }; + + storage_partition: partition@1f9000 { + label = "storage"; + reg = <0x1f9000 DT_SIZE_K(16)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/memory_map_llvm.dtsi b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/memory_map_llvm.dtsi new file mode 100644 index 000000000000..1af3d3e82014 --- /dev/null +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/memory_map_llvm.dtsi @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&cpuapp_rram { + /* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */ + reg = <0x0 DT_SIZE_K(2036)>; + + /delete-node/ partitions; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(28)>; + }; + + slot0_partition: partition@7000 { + label = "image-0"; + reg = <0x7000 DT_SIZE_K(996)>; + }; + + slot1_partition: partition@100000 { + label = "image-1"; + reg = <0x100000 DT_SIZE_K(996)>; + }; + + storage_partition: partition@1f9000 { + label = "storage"; + reg = <0x1f9000 DT_SIZE_K(16)>; + }; + }; +}; diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj.conf index d429bd98caae..95e4fbe8272c 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj.conf @@ -115,6 +115,9 @@ CONFIG_SPI_NOR=n # timeouts in flash_sync_mpsl. CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=8 +# Enable code partitioning with DTS +CONFIG_USE_DT_CODE_PARTITION=y + ################################################################################ CONFIG_ASSERT=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_llvm.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_llvm.conf index ef421d0114ad..f3d07eb7ea0d 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_llvm.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_llvm.conf @@ -119,6 +119,9 @@ CONFIG_SPI_NOR=n # timeouts in flash_sync_mpsl. CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=8 +# Enable code partitioning with DTS +CONFIG_USE_DT_CODE_PARTITION=y + ################################################################################ CONFIG_ASSERT=y diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_release.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_release.conf index 961154231dbc..563082bfb747 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/prj_release.conf @@ -111,6 +111,9 @@ CONFIG_SPI_NOR=n # timeouts in flash_sync_mpsl. CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=8 +# Enable code partitioning with DTS +CONFIG_USE_DT_CODE_PARTITION=y + ################################################################################ # Disable unused features diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild.conf index d0af5f689280..f27dc95231ac 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild.conf @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_llvm.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_llvm.conf index d0af5f689280..f27dc95231ac 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_llvm.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_llvm.conf @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_release.conf b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_release.conf index d0af5f689280..f27dc95231ac 100644 --- a/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_release.conf +++ b/applications/nrf_desktop/configuration/nrf54lm20dk_nrf54lm20b_cpuapp/sysbuild_release.conf @@ -12,3 +12,5 @@ SB_CONFIG_BOOT_SIGNATURE_TYPE_PURE=y SB_CONFIG_BOOT_SIGNATURE_KEY_FILE="\${APPLICATION_CONFIG_DIR}/images/mcuboot/mcuboot_private.pem" SB_CONFIG_MCUBOOT_SIGNATURE_USING_KMU=y SB_CONFIG_MCUBOOT_GENERATE_DEFAULT_KEY_FILE=y + +SB_CONFIG_PARTITION_MANAGER=n diff --git a/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release.conf index 03bdb744bde3..0f3fc275b53c 100644 --- a/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release.conf @@ -14,7 +14,7 @@ CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y CONFIG_FLASH=y -CONFIG_FPROTECT=y +CONFIG_FPROTECT=n CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release_keyboard.conf b/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release_keyboard.conf index 03bdb744bde3..0f3fc275b53c 100644 --- a/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release_keyboard.conf +++ b/applications/nrf_desktop/configuration/nrf54ls05dk_nrf54ls05b_cpuapp/images/mcuboot/prj_release_keyboard.conf @@ -14,7 +14,7 @@ CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_VERSION_CMP_USE_BUILD_NUMBER=y CONFIG_FLASH=y -CONFIG_FPROTECT=y +CONFIG_FPROTECT=n CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/applications/nrf_desktop/doc/dfu.rst b/applications/nrf_desktop/doc/dfu.rst index 4a3fd5aca55f..7665573a7dc1 100644 --- a/applications/nrf_desktop/doc/dfu.rst +++ b/applications/nrf_desktop/doc/dfu.rst @@ -77,10 +77,7 @@ RAM load mode ------------- If this bootloader mode is selected, the DFU module does not mark the newly uploaded image as pending and does not confirm it after a successful boot. - -.. note:: - Support for the RAM load mode in this module is experimental. - For more details about the support of the MCUboot RAM load mode in the nRF Desktop application, see the MCUboot :ref:`nrf_desktop_configuring_mcuboot_bootloader_ram_load` section in the nRF Desktop documentation. +For more details about the support of the MCUboot RAM load mode in the nRF Desktop application, see the MCUboot :ref:`nrf_desktop_configuring_mcuboot_bootloader_ram_load` section in the nRF Desktop documentation. .. note:: DTS is the only supported partitioning method when you use the MCUboot bootloader in the RAM load mode. diff --git a/applications/nrf_desktop/memory_layout.rst b/applications/nrf_desktop/memory_layout.rst index 1c0f6ee97529..66cf6a6ed897 100644 --- a/applications/nrf_desktop/memory_layout.rst +++ b/applications/nrf_desktop/memory_layout.rst @@ -30,6 +30,11 @@ If enabled, the :ref:`partition_manager` defines a new memory layout that is use You can use the :kconfig:option:`CONFIG_PARTITION_MANAGER_ENABLED` Kconfig option value to check whether the Partition Manager is enabled in the current build. The option is automatically enabled when using Zephyr's :ref:`zephyr:sysbuild` (unless your board uses nRF54H SoC Series). +.. note:: + The nRF Desktop application configurations are being migrated from Partition Manager to DTS memory layout because of Partition Manager deprecation. + Some of the configurations already explicitly disable the Partition Manager through the related sysbuild configuration option (:kconfig:option:`SB_CONFIG_PARTITION_MANAGER`). + See the following documentation sections for details. + Memory layout in DTS ******************** @@ -42,7 +47,7 @@ The nRF Desktop application automatically adds the :file:`app.overlay` file if i For more details, see the :ref:`nrf_desktop_board_configuration` section. Some of the nRF Desktop application configurations define the non-volatile memory layout in :file:`memory_map.dtsi` files (for example, :file:`memory_map.dtsi` or :file:`memory_map_release.dtsi`). -These files are placed in the project's board configuration directory and are included by the DTS overlay file of the given build type (:file:`app.overlay` or :file:`app_release.overlay`). +These files are placed in the project's board configuration directory and are included by the DTS overlay file of the given build type (for example, :file:`app.overlay` or :file:`app_release.overlay`). See the nRF Desktop board configuration directories for examples of the DTS-based memory layout definitions. The following board targets use the DTS-based memory layout: @@ -50,8 +55,8 @@ The following board targets use the DTS-based memory layout: * ``nrf54h20dk/nrf54h20/cpuapp`` * ``nrf54l15dk/nrf54l15/cpuapp`` * ``nrf54l15dk/nrf54l05/cpuapp`` -* ``nrf54lm20dk/nrf54lm20a/cpuapp`` (only for the ``ram_load`` build type) -* ``nrf54lm20dk/nrf54lm20b/cpuapp`` (only for the ``ram_load`` build type) +* ``nrf54lm20dk/nrf54lm20a/cpuapp`` (only for the ``ram_load`` and ``release_ram_load`` build types) +* ``nrf54lm20dk/nrf54lm20b/cpuapp`` (only for the ``ram_load`` and ``release_ram_load`` build types) * ``nrf54ls05dk/nrf54ls05b/cpuapp`` .. important:: @@ -86,19 +91,21 @@ Take into account the following points: For an example of configuration, see the static partition maps defined for the existing configuration that uses a given DFU method. For more information about how to configure the non-volatile memory layout using the Partition Manager, see :ref:`partition_manager`. -.. _nrf_desktop_pm_external_flash: +.. _nrf_desktop_external_flash: External flash configuration ============================ -The Partition Manager supports partitions in external flash. - Enabling external flash can be useful especially for memory-limited devices. For example, the MCUboot can use it as a secondary image partition for the :ref:`background firmware upgrade `. The MCUboot moves the image data from the secondary image partition to the primary image partition before booting the new firmware. -To use external flash for the secondary image partition, in addition to defining the proper static Partition Manager configuration, you must enable the :kconfig:option:`SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY` Kconfig option in the sysbuild configuration. For an example of the nRF Desktop application configuration that uses an external flash, see the ``mcuboot_qspi`` configuration of the nRF52840 DK. This configuration uses the ``MX25R64`` external flash that is part of the development kit. -For detailed information, see the :ref:`partition_manager` documentation. +The memory map is defined in DTS (see :file:`memory_map_mcuboot_qspi.dtsi`), with the ``slot1_partition`` placed under the ``mx25r64`` node. + +.. note:: + In previous |NCS| releases, Partition Manager was used to control the memory partition layout. + The :kconfig:option:`SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY` sysbuild Kconfig option was used next to the proper static Partition Manager configuration to place the MCUboot secondary image slot in external flash. + For detailed information, see the :ref:`partition_manager` documentation. diff --git a/applications/nrf_desktop/src/modules/dfu.c b/applications/nrf_desktop/src/modules/dfu.c index 808bf41dcabb..f295d32dab09 100644 --- a/applications/nrf_desktop/src/modules/dfu.c +++ b/applications/nrf_desktop/src/modules/dfu.c @@ -130,18 +130,12 @@ LOG_MODULE_REGISTER(MODULE, CONFIG_DESKTOP_CONFIG_CHANNEL_DFU_LOG_LEVEL); #define MCUBOOT_PRIMARY_NODE DT_NODELABEL(slot0_partition) #define MCUBOOT_SECONDARY_NODE DT_NODELABEL(slot1_partition) - BUILD_ASSERT(UTIL_OR(DT_FIXED_PARTITION_EXISTS(MCUBOOT_PRIMARY_NODE), - DT_FIXED_SUBPARTITION_EXISTS(MCUBOOT_PRIMARY_NODE)), + BUILD_ASSERT(DT_PARTITION_EXISTS(MCUBOOT_PRIMARY_NODE), "Missing primary partition definition in DTS."); - BUILD_ASSERT(UTIL_OR(DT_FIXED_PARTITION_EXISTS(MCUBOOT_SECONDARY_NODE), - DT_FIXED_SUBPARTITION_EXISTS(MCUBOOT_SECONDARY_NODE)), + BUILD_ASSERT(DT_PARTITION_EXISTS(MCUBOOT_SECONDARY_NODE), "Missing secondary partition definition in DTS."); - - #define NVM_ADDRESS(node) \ - (COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(node), \ - (DT_FIXED_SUBPARTITION_ADDR(node)), \ - (DT_FIXED_PARTITION_ADDR(node)))) + #define NVM_ADDRESS(node) DT_PARTITION_ADDR(node) #define CODE_PARTITION_START_ADDR NVM_ADDRESS(CODE_PARTITION_NODE) #define MCUBOOT_PRIMARY_START_ADDR NVM_ADDRESS(MCUBOOT_PRIMARY_NODE) #define MCUBOOT_SECONDARY_START_ADDR NVM_ADDRESS(MCUBOOT_SECONDARY_NODE) @@ -154,8 +148,8 @@ LOG_MODULE_REGISTER(MODULE, CONFIG_DESKTOP_CONFIG_CHANNEL_DFU_LOG_LEVEL); #error Primary and secondary partitions cannot have the same address. #endif - #define MCUBOOT_PRIMARY_SLOT_ID DT_FIXED_PARTITION_ID(MCUBOOT_PRIMARY_NODE) - #define MCUBOOT_SECONDARY_SLOT_ID DT_FIXED_PARTITION_ID(MCUBOOT_SECONDARY_NODE) + #define MCUBOOT_PRIMARY_SLOT_ID DT_PARTITION_ID(MCUBOOT_PRIMARY_NODE) + #define MCUBOOT_SECONDARY_SLOT_ID DT_PARTITION_ID(MCUBOOT_SECONDARY_NODE) #if BUILD_TIME_DFU_SLOT_ID_INFO_IS_AVAILABLE /* Use range check to allow for placing MCUboot header in a separate diff --git a/applications/nrf_desktop/src/modules/failsafe.c b/applications/nrf_desktop/src/modules/failsafe.c index c0debf183e98..d041c121f594 100644 --- a/applications/nrf_desktop/src/modules/failsafe.c +++ b/applications/nrf_desktop/src/modules/failsafe.c @@ -38,11 +38,11 @@ static int failsafe_check(bool *failure_detected) static int failsafe_erase(void) { const struct flash_area *flash_area; - int err = flash_area_open(FIXED_PARTITION_ID(storage_partition), + int err = flash_area_open(PARTITION_ID(storage_partition), &flash_area); if (!err) { err = flash_area_erase(flash_area, 0, - FIXED_PARTITION_SIZE(storage_partition)); + PARTITION_SIZE(storage_partition)); flash_area_close(flash_area); } diff --git a/boards/nordic/nrf52820dongle/nrf52820dongle_nrf52820.dts b/boards/nordic/nrf52820dongle/nrf52820dongle_nrf52820.dts index d25170b8ce73..7658c4b6ee3e 100644 --- a/boards/nordic/nrf52820dongle/nrf52820dongle_nrf52820.dts +++ b/boards/nordic/nrf52820dongle/nrf52820dongle_nrf52820.dts @@ -120,26 +120,30 @@ * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions */ partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; reg = <0x000000000 0xd000>; }; slot0_partition: partition@d000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0000d000 0x30000>; }; slot1_partition: partition@3d000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x0003d000 0x1000>; }; storage_partition: partition@3e000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x0003e000 0x00002000>; }; diff --git a/boards/nordic/nrf52833dongle/nrf52833dongle_nrf52833.dts b/boards/nordic/nrf52833dongle/nrf52833dongle_nrf52833.dts index 8e88573665b4..f9fc25c1216a 100644 --- a/boards/nordic/nrf52833dongle/nrf52833dongle_nrf52833.dts +++ b/boards/nordic/nrf52833dongle/nrf52833dongle_nrf52833.dts @@ -125,31 +125,36 @@ * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions */ partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; reg = <0x000000000 0xc000>; }; slot0_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0000c000 0x32000>; }; slot1_partition: partition@3e000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x0003e000 0x32000>; }; scratch_partition: partition@70000 { + compatible = "zephyr,mapped-partition"; label = "image-scratch"; reg = <0x00070000 0xa000>; }; storage_partition: partition@7a000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x0007a000 0x00006000>; }; diff --git a/boards/nordic/nrf52840gmouse/nrf52840gmouse_nrf52840.dts b/boards/nordic/nrf52840gmouse/nrf52840gmouse_nrf52840.dts index f8681888a7f5..bca723994bec 100644 --- a/boards/nordic/nrf52840gmouse/nrf52840gmouse_nrf52840.dts +++ b/boards/nordic/nrf52840gmouse/nrf52840gmouse_nrf52840.dts @@ -115,31 +115,36 @@ * http://docs.zephyrproject.org/devices/dts/flash_partitions.html */ partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; reg = <0x000000000 0x0000c000>; }; slot0_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0000c000 0x000069000>; }; slot1_partition: partition@75000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x00075000 0x000069000>; }; scratch_partition: partition@de000 { + compatible = "zephyr,mapped-partition"; label = "image-scratch"; reg = <0x000de000 0x0001e000>; }; storage_partition: partition@fc000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x000fc000 0x00004000>; }; diff --git a/boards/nordic/nrf52dmouse/nrf52dmouse_nrf52832.dts b/boards/nordic/nrf52dmouse/nrf52dmouse_nrf52832.dts index da60da484d8f..8dc229ac39cd 100644 --- a/boards/nordic/nrf52dmouse/nrf52dmouse_nrf52832.dts +++ b/boards/nordic/nrf52dmouse/nrf52dmouse_nrf52832.dts @@ -87,31 +87,36 @@ * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions */ partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; reg = <0x00000000 0x0000c000>; }; slot0_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0000c000 0x00036000>; }; slot1_partition: partition@42000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x00042000 0x00036000>; }; scratch_partition: partition@78000 { + compatible = "zephyr,mapped-partition"; label = "image-scratch"; reg = <0x00078000 0x00004000>; }; storage_partition: partition@7c000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x0007c000 0x00004000>; }; diff --git a/boards/nordic/nrf52kbd/nrf52kbd_nrf52832.dts b/boards/nordic/nrf52kbd/nrf52kbd_nrf52832.dts index fd34cfeb6062..d5b1a10a5d69 100644 --- a/boards/nordic/nrf52kbd/nrf52kbd_nrf52832.dts +++ b/boards/nordic/nrf52kbd/nrf52kbd_nrf52832.dts @@ -67,31 +67,36 @@ * http://docs.zephyrproject.org/devices/dts/flash_partitions.html */ partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; reg = <0x000000000 0x0000c000>; }; slot0_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0000c000 0x000036000>; }; slot1_partition: partition@42000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x00042000 0x000036000>; }; scratch_partition: partition@78000 { + compatible = "zephyr,mapped-partition"; label = "image-scratch"; reg = <0x00078000 0x00004000>; }; storage_partition: partition@7c000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x0007c000 0x00004000>; }; diff --git a/boards/nordic/nrf54lm20dongle/Kconfig b/boards/nordic/nrf54lm20dongle/Kconfig index 1ab5035b67ea..aaaaa240e2ad 100644 --- a/boards/nordic/nrf54lm20dongle/Kconfig +++ b/boards/nordic/nrf54lm20dongle/Kconfig @@ -20,6 +20,7 @@ config NRF54LM20DONGLE_MCUMGR_RESET select RETAINED_MEM select RETENTION select RETENTION_BOOT_MODE + select UART_MCUMGR select ZCBOR help Enables the support for MCUmgr reset command sent over a dedicated diff --git a/boards/nordic/nrf54lm20dongle/Kconfig.sysbuild b/boards/nordic/nrf54lm20dongle/Kconfig.sysbuild new file mode 100644 index 000000000000..e240eb60e2f8 --- /dev/null +++ b/boards/nordic/nrf54lm20dongle/Kconfig.sysbuild @@ -0,0 +1,31 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +if BOARD_NRF54LM20DONGLE_NRF54LM20B_CPUAPP + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +choice MCUBOOT_MODE + default MCUBOOT_MODE_FIRMWARE_UPDATER +endchoice + +choice FIRMWARE_LOADER + default FIRMWARE_LOADER_IMAGE_USB_MCUMGR +endchoice + +configdefault MCUBOOT_SIGNATURE_USING_KMU + default y + +configdefault MCUBOOT_GENERATE_DEFAULT_KEY_FILE + default y + +configdefault BOOT_SIGNATURE_TYPE_PURE + default y + +configdefault MCUBOOT_MODE_FIRMWARE_UPDATER_BOOT_MODE_ENTRANCE + default y + +endif # BOARD_NRF54LM20DONGLE_NRF54LM20B_CPUAPP diff --git a/boards/nordic/nrf54lm20dongle/nrf54lm20b_cpuapp_common.dtsi b/boards/nordic/nrf54lm20dongle/nrf54lm20b_cpuapp_common.dtsi index 2b535ae2d160..58cd4e8203b4 100644 --- a/boards/nordic/nrf54lm20dongle/nrf54lm20b_cpuapp_common.dtsi +++ b/boards/nordic/nrf54lm20dongle/nrf54lm20b_cpuapp_common.dtsi @@ -116,6 +116,10 @@ status = "okay"; }; +&vregusb { + status = "okay"; +}; + zephyr_udc0: &usbhs { status = "okay"; diff --git a/boards/nordic/nrf54lm20dongle/nrf54lm20dongle_nrf54lm20b_cpuflpr.dts b/boards/nordic/nrf54lm20dongle/nrf54lm20dongle_nrf54lm20b_cpuflpr.dts index 4072e2aa9ec7..3b0c4dced96e 100644 --- a/boards/nordic/nrf54lm20dongle/nrf54lm20dongle_nrf54lm20b_cpuflpr.dts +++ b/boards/nordic/nrf54lm20dongle/nrf54lm20dongle_nrf54lm20b_cpuflpr.dts @@ -27,11 +27,12 @@ &cpuflpr_rram { partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; cpuflpr_code_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0 DT_SIZE_K(96)>; }; diff --git a/boards/nordic/nrf54ls05dk/board.cmake b/boards/nordic/nrf54ls05dk/board.cmake index 300af7c4b8f5..d1687b62ce08 100644 --- a/boards/nordic/nrf54ls05dk/board.cmake +++ b/boards/nordic/nrf54ls05dk/board.cmake @@ -1,8 +1,10 @@ # Copyright (c) 2025 Nordic Semiconductor ASA # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -if(CONFIG_SOC_NRF54LS05A_CPUAPP OR CONFIG_SOC_NRF54LS05B_CPUAPP) - board_runner_args(jlink "--device=cortex-m33" "--speed=4000") +if(CONFIG_SOC_NRF54LS05A_CPUAPP) + board_runner_args(jlink "--device=NRF54LS05A_M33" "--speed=4000") +elseif(CONFIG_SOC_NRF54LS05B_CPUAPP) + board_runner_args(jlink "--device=NRF54LS05B_M33" "--speed=4000") endif() include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) diff --git a/boards/nordic/nrf54ls05dk/doc/index.rst b/boards/nordic/nrf54ls05dk/doc/index.rst index 618ed7b060ca..9d7a98c7eef4 100644 --- a/boards/nordic/nrf54ls05dk/doc/index.rst +++ b/boards/nordic/nrf54ls05dk/doc/index.rst @@ -3,12 +3,17 @@ nRF54LS05 DK ############ +.. contents:: + :local: + :depth: 2 + .. note:: You can find more information about the nRF54LS05B SoC on the `nRF54LS05B System-on-Chip`_ product page. For the nRF54LS05B technical documentation and other resources (such as the SoC Datasheet), see :ref:`ug_nrf54l`. .. figure:: /images/nrf54ls05dk_nrf54ls05b.webp + :scale: 60% :alt: nRF54LS05 DK nRF54LS05 DK diff --git a/boards/nordic/nrf54ls05dk/nrf54ls05_a_b_cpuapp_common.dtsi b/boards/nordic/nrf54ls05dk/nrf54ls05_a_b_cpuapp_common.dtsi index d265c7dcd787..f4a32cb44733 100644 --- a/boards/nordic/nrf54ls05dk/nrf54ls05_a_b_cpuapp_common.dtsi +++ b/boards/nordic/nrf54ls05dk/nrf54ls05_a_b_cpuapp_common.dtsi @@ -48,27 +48,31 @@ &cpuapp_rram { partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; + /* FPROTECT requires partition to be max 62k */ + reg = <0x0 DT_SIZE_K(62)>; }; slot0_partition: partition@10000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x10000 DT_SIZE_K(204)>; }; slot1_partition: partition@43000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x43000 DT_SIZE_K(204)>; }; storage_partition: partition@76000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x76000 DT_SIZE_K(36)>; }; diff --git a/boards/nordic/nrf54lv10dk/doc/index.rst b/boards/nordic/nrf54lv10dk/doc/index.rst index 08d7f7247c3c..95193e6ac0b5 100644 --- a/boards/nordic/nrf54lv10dk/doc/index.rst +++ b/boards/nordic/nrf54lv10dk/doc/index.rst @@ -3,12 +3,17 @@ nRF54LV10 DK ############ +.. contents:: + :local: + :depth: 2 + .. note:: You can find more information about the nRF54LV10A SoC on the `nRF54LV10A System-on-Chip`_ product page. For the nRF54LV10A technical documentation and other resources (such as the SoC Datasheet), see :ref:`ug_nrf54l`. .. figure:: /images/nrf54lv10dk_nrf54lv10a.webp + :scale: 60% :alt: nRF54LV10 DK nRF54LV10 DK diff --git a/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuapp.dts b/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuapp.dts index 5aaf1805659e..471b8209777e 100644 --- a/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuapp.dts +++ b/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuapp.dts @@ -21,27 +21,31 @@ &cpuapp_rram { partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; + /* FPROTECT allows maximum size of 62k */ + reg = <0x0 DT_SIZE_K(62)>; }; slot0_partition: partition@10000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x10000 DT_SIZE_K(212)>; }; slot1_partition: partition@7a000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x7a000 DT_SIZE_K(212)>; }; storage_partition: partition@e4000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0xe4000 DT_SIZE_K(36)>; }; diff --git a/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr.dts b/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr.dts index e63ec7d1f3f6..65e1b50c9b75 100644 --- a/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr.dts +++ b/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr.dts @@ -9,7 +9,7 @@ #include "nrf54lv10dk_nrf54lv10a-common.dtsi" / { - model = "Nordic nRF54Lv10 DK nRF54Lv10a FLPR MCU"; + model = "Nordic nRF54LV10 DK nRF54LV10A FLPR MCU"; compatible = "nordic,nrf54lv10dk_nrf54lv10a-cpuflpr"; chosen { @@ -27,12 +27,12 @@ &cpuflpr_rram { partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; ranges; cpuflpr_code_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0 DT_SIZE_K(64)>; }; diff --git a/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr_0_7_0.yaml b/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr_0_7_0.yaml index d4daa2e66a82..aa7008ef6f84 100644 --- a/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr_0_7_0.yaml +++ b/boards/nordic/nrf54lv10dk/nrf54lv10dk_nrf54lv10a_cpuflpr_0_7_0.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause identifier: nrf54lv10dk@0.7.0/nrf54lv10a/cpuflpr -name: nRF54LV10-DK-nRF54LV10a-Fast-Lightweight-Peripheral-Processor (rev. 0.7.0) +name: nRF54LV10-DK-nRF54LV10A-Fast-Lightweight-Peripheral-Processor (rev. 0.7.0) type: mcu arch: riscv toolchain: diff --git a/boards/nordic/nrf9251dk/Kconfig.defconfig b/boards/nordic/nrf9251dk/Kconfig.defconfig new file mode 100644 index 000000000000..48644d7068cc --- /dev/null +++ b/boards/nordic/nrf9251dk/Kconfig.defconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +config HW_STACK_PROTECTION + default ARCH_HAS_STACK_PROTECTION + +if BOARD_NRF9251DK_NRF9251_CPUAPP + +if !USE_DT_CODE_PARTITION + +DT_CHOSEN_Z_FLASH := zephyr,flash + +config FLASH_LOAD_OFFSET + default $(sub_hex, $(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition), \ + $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))) + +config FLASH_LOAD_SIZE + default $(add_hex, $(dt_nodelabel_reg_addr_hex,cpuapp_slot0_partition), \ + $(dt_nodelabel_reg_size_hex,cpuapp_slot0_partition), \ + -$(dt_nodelabel_reg_addr_hex,cpuapp_boot_partition)) + +endif # !DT_USE_CODE_PARTITION + +endif # BOARD_NRF9251DK_NRF9251_CPUAPP diff --git a/boards/nordic/nrf9251dk/Kconfig.nrf9251dk b/boards/nordic/nrf9251dk/Kconfig.nrf9251dk new file mode 100644 index 000000000000..a588f7453a5a --- /dev/null +++ b/boards/nordic/nrf9251dk/Kconfig.nrf9251dk @@ -0,0 +1,9 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +config BOARD_NRF9251DK + select SOC_NRF9251_CPUAPP if BOARD_NRF9251DK_NRF9251_CPUAPP + select SOC_NRF9251_CPUPPR if (BOARD_NRF9251DK_NRF9251_CPUPPR || \ + BOARD_NRF9251DK_NRF9251_CPUPPR_XIP) + select SOC_NRF9251_CPUFLPR if (BOARD_NRF9251DK_NRF9251_CPUFLPR || \ + BOARD_NRF9251DK_NRF9251_CPUFLPR_XIP) diff --git a/boards/nordic/nrf9251dk/board.cmake b/boards/nordic/nrf9251dk/board.cmake new file mode 100644 index 000000000000..6bbb18cd4e19 --- /dev/null +++ b/boards/nordic/nrf9251dk/board.cmake @@ -0,0 +1,19 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) + +if(CONFIG_SOC_NRF9251_CPUAPP) + set(jlink_script_file ${CMAKE_CURRENT_LIST_DIR}/support/nrf9251_cpuapp.JLinkScript) + board_runner_args(jlink "--device=CORTEX-M33" "--speed=4000" "--tool-opt=-jlinkscriptfile ${jlink_script_file}") +elseif(CONFIG_SOC_NRF9251_CPUPPR) + set(jlink_script_file ${CMAKE_CURRENT_LIST_DIR}/support/nrf9251_cpuppr.JLinkScript) + # Workaround: Use device nRF54L15_RV32 until something else is defined. + board_runner_args(jlink "--device=nRF54L15_RV32" "--speed=4000" "--tool-opt=-jlinkscriptfile ${jlink_script_file}") +elseif(CONFIG_SOC_NRF9251_CPUFLPR) + set(jlink_script_file ${CMAKE_CURRENT_LIST_DIR}/support/nrf9251_cpuflpr.JLinkScript) + # Workaround: Use device nRF54L15_RV32 until something else is defined. + board_runner_args(jlink "--device=nRF54L15_RV32" "--speed=4000" "--tool-opt=-jlinkscriptfile ${jlink_script_file}") +endif() + +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/nordic/nrf9251dk/board.yml b/boards/nordic/nrf9251dk/board.yml new file mode 100644 index 000000000000..4456e26f16b2 --- /dev/null +++ b/boards/nordic/nrf9251dk/board.yml @@ -0,0 +1,53 @@ +board: + full_name: nRF9251 DK + name: nrf9251dk + vendor: nordic + socs: + - name: nrf9251 + variants: + - name: xip + cpucluster: cpuppr + - name: xip + cpucluster: cpuflpr + revision: + format: major.minor.patch + default: "0.1.0" + revisions: + - name: "0.1.0" +runners: + run_once: + '--recover': + - runners: + - nrfutil + run: first + groups: + - boards: + - nrf9251dk@0.1.0/nrf9251/cpuapp + - nrf9251dk@0.1.0/nrf9251/cpuppr + - nrf9251dk@0.1.0/nrf9251/cpuppr/xip + - nrf9251dk@0.1.0/nrf9251/cpuflpr + - nrf9251dk@0.1.0/nrf9251/cpuflpr/xip + '--erase': + - runners: + - jlink + - nrfutil + run: first + groups: + - boards: + - nrf9251dk@0.1.0/nrf9251/cpuapp + - nrf9251dk@0.1.0/nrf9251/cpuppr + - nrf9251dk@0.1.0/nrf9251/cpuppr/xip + - nrf9251dk@0.1.0/nrf9251/cpuflpr + - nrf9251dk@0.1.0/nrf9251/cpuflpr/xip + '--reset': + - runners: + - jlink + - nrfutil + run: last + groups: + - boards: + - nrf9251dk@0.1.0/nrf9251/cpuapp + - nrf9251dk@0.1.0/nrf9251/cpuppr + - nrf9251dk@0.1.0/nrf9251/cpuppr/xip + - nrf9251dk@0.1.0/nrf9251/cpuflpr + - nrf9251dk@0.1.0/nrf9251/cpuflpr/xip diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_common.dtsi b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_common.dtsi new file mode 100644 index 000000000000..be405e9cb1bc --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_common.dtsi @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + buttons { + compatible = "gpio-keys"; + + button0: button_0 { + gpios = <&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Button 0"; + }; + + button1: button_1 { + gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Button 1"; + }; + + button2: button_2 { + gpios = <&gpio0 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Button 2"; + }; + + button3: button_3 { + gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Button 3"; + }; + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio2 2 0>; + label = "LED0"; + }; + + led1: led_1 { + gpios = <&gpio2 3 0>; + label = "LED1"; + }; + + led2: led_2 { + gpios = <&gpio2 7 0>; + label = "LED2"; + }; + + led3: led_3 { + gpios = <&gpio2 9 0>; + label = "LED3"; + }; + }; +}; diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_common_0_1_0.overlay b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_common_0_1_0.overlay new file mode 100644 index 000000000000..27e4218bd9e4 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_common_0_1_0.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/* Delete led2. This can be removed after a fix in IronSide SE has been released. */ +/delete-node/ &led2; + +/ { + aliases { + /delete-property/ led2; + }; +}; diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp.dts b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp.dts new file mode 100644 index 000000000000..66a86b191071 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp.dts @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/dts-v1/; + +#include +#include "nrf9251dk_nrf9251_common.dtsi" + +#include +#include +#include + +/ { + compatible = "nordic,nrf9251dk_nrf9251-cpuapp"; + model = "Nordic nRF9251 DK nRF9251 Application MCU"; + + chosen { + zephyr,code-partition = &cpuapp_slot0_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuapp_ram0x_sram; + zephyr,entropy = &psa_rng; + zephyr,console = &uart133; + zephyr,shell-uart = &uart133; + zephyr,uart-mcumgr = &uart133; + }; + + aliases { + resetinfo = &cpuapp_resetinfo; + ipc-to-cpusys = &cpuapp_cpusys_ipc; + watchdog0 = &wdt010; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + pwm-led0 = &pwm_led0; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "okay"; + }; + + pwmleds { + compatible = "pwm-leds"; + + pwm_led0: pwm_led_0 { + pwms = <&pwm130 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&cpuapp_bellboard { + status = "okay"; + interrupts = <96 NRF_DEFAULT_IRQ_PRIORITY>; + interrupt-names = "irq0"; + /* The following bells on this bellboard are rang by these cores + * - Bell 0: cpusec + * - Bell 6: cpusys + * - Bell 13: cpuppr + * - Bell 14: cpuflpr + * - Bells 24, 25, 29, 31: cpucell + */ + nordic,interrupt-mapping = <0xa3046041 0>; +}; + +&cpuppr_vpr { + execution-memory = <&cpuppr_tcm_sram>; + source-memory = <&cpuppr_code_partition>; +}; + +&cpuflpr_vpr { + execution-memory = <&cpuflpr_tcm_sram>; + source-memory = <&cpuflpr_code_partition>; +}; + +&cpucell_bellboard { + status = "okay"; +}; + +&cpusys_vevif { + status = "okay"; +}; + +&cpuapp_cpusys_ipc { + status = "okay"; + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpusys_ipc_shm>; + rx-region = <&cpusys_cpuapp_ipc_shm>; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpuppr_ipc_shm>; + rx-region = <&cpuppr_cpuapp_ipc_shm>; +}; + +&cpuapp_cpuflpr_ipc { + mbox-names = "rx", "tx"; + tx-region = <&cpuapp_cpuflpr_ipc_shm>; + rx-region = <&cpuflpr_cpuapp_ipc_shm>; +}; + +&cpuapp_dma_region { + status = "okay"; +}; + +&gpiote130 { + status = "okay"; + owned-channels = <1 2 3 4 5 6 7>; +}; + +&grtc { + status = "okay"; + child-owned-channels = <5 6>; + nonsecure-channels = <4 5 6>; + owned-channels = <4 5 6>; +}; + +&pwm130 { + status = "okay"; + pinctrl-0 = <&pwm130_default>; + pinctrl-1 = <&pwm130_sleep>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; +}; + +&uart120 { + current-speed = <115200>; + pinctrl-0 = <&uart120_default>; + pinctrl-1 = <&uart120_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart132 { + current-speed = <115200>; + pinctrl-0 = <&uart132_default>; + pinctrl-1 = <&uart132_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart133 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart133_default>; + pinctrl-1 = <&uart133_sleep>; + pinctrl-names = "default", "sleep"; + memory-regions = <&cpuapp_dma_region>; +}; + +&adc { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; +}; + +&coresight { + pinctrl-0 = <&tpiu_default>; + pinctrl-names = "default"; +}; + +&nfct { + status = "okay"; + memory-regions = <&cpuapp_dma_region>; +}; + +&hfxo { + status = "okay"; +}; + +&fll16m { + status = "okay"; +}; + +&cpusec_bellboard { + status = "okay"; +}; + +&cpusec_cpuapp_ipc { + mbox-names = "tx", "rx"; + status = "okay"; +}; + +ironside_se_boot_report: &cpuapp_ironside_se_boot_report {}; + +boot_partition: &cpuapp_boot_partition { + label = "mcuboot"; +}; + +slot0_partition: &cpuapp_slot0_partition { + label = "image-0"; +}; + +slot1_partition: &cpuapp_slot1_partition { + label = "image-1"; +}; diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_0_1_0.overlay b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_0_1_0.overlay new file mode 100644 index 000000000000..63c6b0fc877e --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_0_1_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "nrf9251dk_nrf9251_common_0_1_0.overlay" diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_0_1_0.yaml b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_0_1_0.yaml new file mode 100644 index 000000000000..d7d9af46a1ca --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_0_1_0.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +identifier: nrf9251dk@0.1.0/nrf9251/cpuapp +name: nRF9251-DK-nRF9251-Application (rev. 0.1.0) +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 320 +flash: 336 +supported: + - adc + - counter + - gpio + - i2c + - pwm + - spi + - watchdog diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_defconfig b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_defconfig new file mode 100644 index 000000000000..2b05a16c248b --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuapp_defconfig @@ -0,0 +1,25 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +CONFIG_GPIO=y + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# MPU-based null-pointer dereferencing detection cannot be applied +# as the (0x0 - 0x400) region is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr.dts b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr.dts new file mode 100644 index 000000000000..0aa01d47a2ee --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr.dts @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/dts-v1/; + +#include +#include "nrf9251dk_nrf9251_common.dtsi" + +#include +#include +#include + +/delete-node/ &cpuapp_cpusys_ipc; +/delete-node/ &cpuapp_cpuppr_ipc; +/delete-node/ &cpusec_cpuapp_ipc; + +/ { + compatible = "nordic,nrf9251dk_nrf9251-cpuflpr"; + model = "Nordic nRF9251 DK nRF9251 Fast Lightweight Processor MCU"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart120; + zephyr,code-partition = &cpuflpr_code_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuflpr_tcm_sram; + }; +}; + +&cpuapp_cpuflpr_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuflpr_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpuflpr_ipc_shm>; +}; + +&grtc { + status = "okay"; + owned-channels = <6>; +}; + +&dma_fast_region { + status = "okay"; +}; + +&uart120 { + status = "okay"; + /* This will not work on this core. Use runtime configure to set baudrate. */ + current-speed = <115200>; + pinctrl-0 = <&uart120_default>; + pinctrl-1 = <&uart120_sleep>; + pinctrl-names = "default", "sleep"; + memory-regions = <&dma_fast_region>; +}; diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_0_1_0.overlay b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_0_1_0.overlay new file mode 100644 index 000000000000..63c6b0fc877e --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_0_1_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "nrf9251dk_nrf9251_common_0_1_0.overlay" diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_0_1_0.yaml b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_0_1_0.yaml new file mode 100644 index 000000000000..a9ed884978e8 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_0_1_0.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +identifier: nrf9251dk@0.1.0/nrf9251/cpuflpr +name: nRF9251-DK-nRF9251-FLPR (rev. 0.1.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 48 +flash: 48 +supported: + - gpio + - i2c + - pwm + - spi diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_defconfig b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_defconfig new file mode 100644 index 000000000000..30aba4037d81 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_defconfig @@ -0,0 +1,11 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_XIP=n diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip.dts b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip.dts new file mode 100644 index 000000000000..fbf9d8647da3 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip.dts @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "nrf9251dk_nrf9251_cpuflpr.dts" diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip_0_1_0.yaml b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip_0_1_0.yaml new file mode 100644 index 000000000000..0738c7ca41b7 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip_0_1_0.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +identifier: nrf9251dk@0.1.0/nrf9251/cpuflpr/xip +name: nRF9251-DK-nRF9251-FLPR (MRAM XIP) (rev. 0.1.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 48 +flash: 48 +supported: + - gpio + - counter diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip_defconfig b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip_defconfig new file mode 100644 index 000000000000..9228aaf69c06 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuflpr_xip_defconfig @@ -0,0 +1,13 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_XIP=y diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr.dts b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr.dts new file mode 100644 index 000000000000..90381bdbd32a --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr.dts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/dts-v1/; + +#include +#include "nrf9251dk_nrf9251_common.dtsi" + +#include +#include +#include + +/delete-node/ &cpuapp_cpusys_ipc; +/delete-node/ &cpuapp_cpuflpr_ipc; +/delete-node/ &cpusec_cpuapp_ipc; + +/ { + compatible = "nordic,nrf9251dk_nrf9251-cpuppr"; + model = "Nordic nRF9251 DK nRF9251 Peripheral Processor MCU"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,code-partition = &cpuppr_code_partition; + zephyr,flash = &mram1x; + zephyr,sram = &cpuppr_tcm_sram; + zephyr,console = &uart132; + }; +}; + +&cpuapp_cpuppr_ipc { + mbox-names = "tx", "rx"; + tx-region = <&cpuppr_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpuppr_ipc_shm>; +}; + +&grtc { + status = "okay"; + owned-channels = <5>; +}; + +&uart132 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart132_default>; + pinctrl-1 = <&uart132_sleep>; + pinctrl-names = "default", "sleep"; +}; diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_0_1_0.overlay b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_0_1_0.overlay new file mode 100644 index 000000000000..63c6b0fc877e --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_0_1_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "nrf9251dk_nrf9251_common_0_1_0.overlay" diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_0_1_0.yaml b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_0_1_0.yaml new file mode 100644 index 000000000000..524f029b61ef --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_0_1_0.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +identifier: nrf9251dk@0.1.0/nrf9251/cpuppr +name: nRF9251-DK-nRF9251-PPR (rev. 0.1.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 64 +flash: 64 +supported: + - counter + - gpio + - i2c + - pwm + - spi diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_defconfig b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_defconfig new file mode 100644 index 000000000000..9f160f24b8a1 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_defconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_XIP=n diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip.dts b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip.dts new file mode 100644 index 000000000000..1030412f6a16 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip.dts @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "nrf9251dk_nrf9251_cpuppr.dts" diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip_0_1_0.yaml b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip_0_1_0.yaml new file mode 100644 index 000000000000..f696b9e2920f --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip_0_1_0.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +identifier: nrf9251dk@0.1.0/nrf9251/cpuppr/xip +name: nRF9251-DK-nRF9251-PPR (MRAM XIP) (rev. 0.1.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 64 +flash: 64 +supported: + - gpio diff --git a/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip_defconfig b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip_defconfig new file mode 100644 index 000000000000..9228aaf69c06 --- /dev/null +++ b/boards/nordic/nrf9251dk/nrf9251dk_nrf9251_cpuppr_xip_defconfig @@ -0,0 +1,13 @@ +# Copyright (c) 2026 Nordic Semiconductor ASA +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_XIP=y diff --git a/boards/nordic/nrf9251dk/support/nrf9251_cpuapp.JLinkScript b/boards/nordic/nrf9251dk/support/nrf9251_cpuapp.JLinkScript new file mode 100644 index 000000000000..ff72e7de4664 --- /dev/null +++ b/boards/nordic/nrf9251dk/support/nrf9251_cpuapp.JLinkScript @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +__constant U32 _CPUCONF_ADDR = 0x52011000; +__constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; + +int SetupTarget(void) +{ + JLINK_TARGET_Halt(); + + // Disable CPU wait + JLINK_MEM_WriteU32(_CPUCONF_ADDR + _CPUCONF_CPUWAIT_OFFSET, 0); + + return 0; +} diff --git a/boards/nordic/nrf9251dk/support/nrf9251_cpuflpr.JLinkScript b/boards/nordic/nrf9251dk/support/nrf9251_cpuflpr.JLinkScript new file mode 100644 index 000000000000..b9ff8dde6073 --- /dev/null +++ b/boards/nordic/nrf9251dk/support/nrf9251_cpuflpr.JLinkScript @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +int InitTarget(void) { + // Base address where DMI registers can be found in the APB address space + JLINK_ExecCommand("CORESIGHT_SetCoreBaseAddr = 0x5F8D4400"); + + // Use AP[x] to communicate with the RISC-V + JLINK_ExecCommand("CORESIGHT_SetIndexAHBAPToUse = 0"); + + return 0; +} diff --git a/boards/nordic/nrf9251dk/support/nrf9251_cpuppr.JLinkScript b/boards/nordic/nrf9251dk/support/nrf9251_cpuppr.JLinkScript new file mode 100644 index 000000000000..fb0bc585e7a6 --- /dev/null +++ b/boards/nordic/nrf9251dk/support/nrf9251_cpuppr.JLinkScript @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +int InitTarget(void) { + // Base address where DMI registers can be found in the APB address space + JLINK_ExecCommand("CORESIGHT_SetCoreBaseAddr = 0x5F908400"); + + // Use AP[x] to communicate with the RISC-V + JLINK_ExecCommand("CORESIGHT_SetIndexAHBAPToUse = 0"); + + return 0; +} diff --git a/boards/nordic/thingy91/Kconfig.defconfig b/boards/nordic/thingy91/Kconfig.defconfig index e3e5b89bab23..3d60b7d1d58a 100644 --- a/boards/nordic/thingy91/Kconfig.defconfig +++ b/boards/nordic/thingy91/Kconfig.defconfig @@ -37,33 +37,6 @@ endchoice endif # BUILD_WITH_TFM -# For the secure version of the board the firmware is linked at the beginning -# of the flash, or into the code-partition defined in DT if it is intended to -# be loaded by MCUboot. If the secure firmware is to be combined with a non- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -if BOARD_THINGY91_NRF9160 && TRUSTED_EXECUTION_SECURE - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_THINGY91_NRF9160 && TRUSTED_EXECUTION_SECURE - -if BOARD_THINGY91_NRF9160_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_THINGY91_NRF9160_NS - config BT_HCI_VS default y if BT diff --git a/boards/nordic/thingy91/thingy91_nrf52840.dts b/boards/nordic/thingy91/thingy91_nrf52840.dts index 977268222960..47e022a2515b 100644 --- a/boards/nordic/thingy91/thingy91_nrf52840.dts +++ b/boards/nordic/thingy91/thingy91_nrf52840.dts @@ -76,34 +76,39 @@ zephyr_udc0: &usbd { &flash0 { partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; /* The size of this partition ensures that MCUBoot can be built * with an RTT console, CDC ACM support, and w/o optimizations. */ boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; reg = <0x000000000 0x00012000>; }; slot0_partition: partition@12000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x00012000 0x000069000>; }; slot1_partition: partition@7b000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x0007b000 0x000069000>; }; scratch_partition: partition@e4000 { + compatible = "zephyr,mapped-partition"; label = "image-scratch"; reg = <0x000e4000 0x00018000>; }; storage_partition: partition@fc000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x000fc000 0x00004000>; }; diff --git a/boards/nordic/thingy91/thingy91_nrf9160_common.dtsi b/boards/nordic/thingy91/thingy91_nrf9160_common.dtsi index b03de741c239..f30ce3a73454 100644 --- a/boards/nordic/thingy91/thingy91_nrf9160_common.dtsi +++ b/boards/nordic/thingy91/thingy91_nrf9160_common.dtsi @@ -220,68 +220,5 @@ pinctrl-names = "default", "sleep"; }; -&flash0 { - /* - * For more information, see: - * http://docs.zephyrproject.org/devices/dts/flash_partitions.html - */ - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x10000>; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - }; - - slot0_ns_partition: partition@40000 { - label = "image-0-nonsecure"; - }; - - slot1_partition: partition@80000 { - label = "image-1"; - }; - - slot1_ns_partition: partition@b0000 { - label = "image-1-nonsecure"; - }; - - scratch_partition: partition@f0000 { - label = "image-scratch"; - reg = <0x000f0000 0xa000>; - }; - - storage_partition: partition@fa000 { - label = "storage"; - reg = <0x000fa000 0x00006000>; - }; - }; -}; - -/ { - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_s: image_s@20000000 { - /* Secure image memory */ - }; - - sram0_bsd: image_bsd@20010000 { - /* BSD (shared) memory */ - }; - - sram0_ns: image_ns@20020000 { - /* Non-Secure image memory */ - }; - }; -}; - /* Include partition configuration file */ -#include "thingy91_nrf9160_partition_conf.dtsi" +#include "thingy91_nrf9160_partition.dtsi" diff --git a/boards/nordic/thingy91/thingy91_nrf9160_ns.dts b/boards/nordic/thingy91/thingy91_nrf9160_ns.dts index a0453c9aae9d..48f9c8095bd8 100644 --- a/boards/nordic/thingy91/thingy91_nrf9160_ns.dts +++ b/boards/nordic/thingy91/thingy91_nrf9160_ns.dts @@ -11,7 +11,7 @@ / { chosen { zephyr,flash = &flash0; - zephyr,sram = &sram0_ns; + zephyr,sram = &sram0_ns_app; zephyr,code-partition = &slot0_ns_partition; }; }; diff --git a/boards/nordic/thingy91/thingy91_nrf9160_partition.dtsi b/boards/nordic/thingy91/thingy91_nrf9160_partition.dtsi new file mode 100644 index 000000000000..c7a2aed8defd --- /dev/null +++ b/boards/nordic/thingy91/thingy91_nrf9160_partition.dtsi @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&flash0 { + /* + * 0x0000_0000 MCUboot ( 48 kB) + * 0x0000_c000 Primary area (420 kB) + * 0x0000_c000 Primary secure image ( 48 kB) + * 0x0001_8000 Primary non-secure image (372 kB) + * 0x0007_5000 Secondary area (420 kB) + * 0x0007_5000 Secondary secure image ( 48 kB) + * 0x0008_1000 Secondary non-secure image (372 kB) + * 0x000d_e000 DFU scratch area (120 kB) + * 0x000f_e000 Settings storage ( 8 kB) + */ + partitions { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; + label = "mcuboot"; + reg = <0x00000000 0xc000>; + }; + + slot0_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; + label = "image-0"; + reg = <0x0000c000 0x69000>; + ranges = <0x0 0x0000c000 0x69000>; + #address-cells = <1>; + #size-cells = <1>; + + slot0_s_partition: partition@0 { + compatible = "zephyr,mapped-partition"; + label = "image-0-secure"; + reg = <0x00000000 0xc000>; + }; + + slot0_ns_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; + label = "image-0-nonsecure"; + reg = <0x0000c000 0x5d000>; + }; + }; + + slot1_partition: partition@75000 { + compatible = "zephyr,mapped-partition"; + label = "image-1"; + reg = <0x00075000 0x69000>; + ranges = <0x0 0x00075000 0x69000>; + #address-cells = <1>; + #size-cells = <1>; + + slot1_s_partition: partition@0 { + compatible = "zephyr,mapped-partition"; + label = "image-1-secure"; + reg = <0x00000000 0xc000>; + }; + + slot1_ns_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; + label = "image-1-nonsecure"; + reg = <0x0000c000 0x5d000>; + }; + }; + + scratch_partition: partition@de000 { + compatible = "zephyr,mapped-partition"; + label = "image-scratch"; + reg = <0x000de000 0x1e000>; + }; + + storage_partition: partition@fe000 { + compatible = "zephyr,mapped-partition"; + label = "storage"; + reg = <0x000fe000 0x2000>; + }; + }; +}; + +#include diff --git a/boards/nordic/thingy91/thingy91_nrf9160_partition_conf.dtsi b/boards/nordic/thingy91/thingy91_nrf9160_partition_conf.dtsi deleted file mode 100644 index 56f8a705f88f..000000000000 --- a/boards/nordic/thingy91/thingy91_nrf9160_partition_conf.dtsi +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2019 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* - * Default Flash planning for thingy91_nrf9160. - * - * Zephyr build for nRF9160 with ARM TrustZone-M support, - * implies building Secure and Non-Secure Zephyr images. - * - * Secure image will be placed, by default, in flash0 - * (or in slot0, if MCUboot is present). - * Secure image will use sram0 for system memory. - * - * Non-Secure image will be placed in slot0_ns, and use - * sram0_ns for system memory. - * - * Note that the Secure image only requires knowledge of - * the beginning of the Non-Secure image (not its size). - */ - -&slot0_partition { - reg = <0x00010000 0x30000>; -}; - -&slot0_ns_partition { - reg = <0x00040000 0x40000>; -}; - -&slot1_partition { - reg = <0x00080000 0x30000>; -}; - -&slot1_ns_partition { - reg = <0x000b0000 0x40000>; -}; - -/* Default SRAM planning when building for nRF9160 with - * ARM TrustZone-M support - * - Lowest 64 kB SRAM allocated to Secure image (sram0). - * - 64 kB SRAM reserved for and used by the BSD socket - * library. - * - Upper 128 kB allocated to Non-Secure image (sram0_ns). - */ - -&sram0_s { - reg = <0x20000000 DT_SIZE_K(64)>; -}; - -&sram0_bsd { - reg = <0x20010000 DT_SIZE_K(64)>; -}; - -&sram0_ns { - reg = <0x20020000 DT_SIZE_K(128)>; -}; diff --git a/boards/nordic/thingy91x/Kconfig.defconfig.nrf9151 b/boards/nordic/thingy91x/Kconfig.defconfig.nrf9151 index e08b10917b22..1d3e0b69af32 100644 --- a/boards/nordic/thingy91x/Kconfig.defconfig.nrf9151 +++ b/boards/nordic/thingy91x/Kconfig.defconfig.nrf9151 @@ -28,33 +28,6 @@ config PM_PARTITION_SIZE_TFM_SRAM endif # BUILD_WITH_TFM -# For the secure version of the board the firmware is linked at the beginning -# of the flash, or into the code-partition defined in DT if it is intended to -# be loaded by MCUboot. If the secure firmware is to be combined with a non- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -if BOARD_THINGY91X && TRUSTED_EXECUTION_SECURE - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_THINGY91X && TRUSTED_EXECUTION_SECURE - -if BOARD_THINGY91X_NRF9151_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif # BOARD_THINGY91X_NRF9151_NS - config BT_HCI_VS default y if BT diff --git a/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts b/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts index 9e8f3c91c243..8b9cf292e65f 100644 --- a/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts +++ b/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts @@ -53,26 +53,30 @@ &flash1 { partitions { - compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; + ranges; boot_partition: partition@0 { + compatible = "zephyr,mapped-partition"; label = "mcuboot"; reg = <0x00000000 0xc000>; }; slot0_partition: partition@c000 { + compatible = "zephyr,mapped-partition"; label = "image-0"; reg = <0x0000c000 0x17000>; }; slot1_partition: partition@23000 { + compatible = "zephyr,mapped-partition"; label = "image-1"; reg = <0x00023000 0x17000>; }; storage_partition: partition@3a000 { + compatible = "zephyr,mapped-partition"; label = "storage"; reg = <0x0003a000 0x6000>; }; diff --git a/boards/nordic/thingy91x/thingy91x_nrf9151_common.dtsi b/boards/nordic/thingy91x/thingy91x_nrf9151_common.dtsi index cdbc03efaeae..3f440dbf0c56 100644 --- a/boards/nordic/thingy91x/thingy91x_nrf9151_common.dtsi +++ b/boards/nordic/thingy91x/thingy91x_nrf9151_common.dtsi @@ -191,5 +191,4 @@ }; /* Include default memory partition configuration file. */ -/* This is not the layout that's actually used! It's overridden by Partition Manager. */ -#include +#include "thingy91x_nrf9151_partition.dtsi" diff --git a/boards/nordic/thingy91x/thingy91x_nrf9151_partition.dtsi b/boards/nordic/thingy91x/thingy91x_nrf9151_partition.dtsi new file mode 100644 index 000000000000..6bd3a1c1935b --- /dev/null +++ b/boards/nordic/thingy91x/thingy91x_nrf9151_partition.dtsi @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2026 Nordic Semiconductor + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +&flash0 { + /* + * 0x0000_0000 MCUboot ( 32 kB) + * 0x0000_8000 Primary updatable MCUboot ( 80 kB) + * 0x0001_c000 Secondary updatable MCUboot ( 80 kB) + * 0x0003_0000 Primary image area (832 kB) + * 0x0003_0000 Primary secure image ( 32 kB) + * 0x0003_8000 Primary non-secure image (800 kB) + */ + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + b0_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x8000>; + }; + + s0_partition: partition@8000 { + label = "mcuboot-0"; + reg = <0x00008000 0x14000>; + }; + + s1_partition: partition@1c000 { + label = "mcuboot-1"; + reg = <0x0001c000 0x14000>; + }; + + slot0_partition: partition@30000 { + compatible = "fixed-subpartitions"; + label = "image-0"; + reg = <0x00030000 0xd0000>; + ranges = <0x0 0x00030000 0xd0000>; + #address-cells = <1>; + #size-cells = <1>; + + slot0_s_partition: partition@0 { + label = "image-0-secure"; + reg = <0x00000000 0x8000>; + }; + + slot0_ns_partition: partition@8000 { + label = "image-0-nonsecure"; + reg = <0x00008000 0xc8000>; + }; + }; + }; +}; + +&flash_ext { + /* + * 0x0000_0000 Secondary image area ( 832 kB) + * 0x0000_0000 Secondary secure image ( 32 kB) + * 0x0000_8000 Secondary non-secure image ( 800 kB) + * 0x000d_0000 Full Modem Firmware Update ( 4096 kB) + * 0x004d_0000 Settings ( 8 kB) + * 0x004d_2000 Free (27832 kB) + */ + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@0 { + compatible = "fixed-subpartitions"; + label = "image-1"; + reg = <0x00000000 0xd0000>; + ranges = <0x0 0x00000 0xd0000>; + #address-cells = <1>; + #size-cells = <1>; + + slot1_s_partition: partition@0 { + label = "image-1-secure"; + reg = <0x00000000 0x8000>; + }; + + slot1_ns_partition: partition@8000 { + label = "image-1-nonsecure"; + reg = <0x00008000 0xc8000>; + }; + }; + + fmfu_storage_partition: partition@d0000 { + label = "fmfu_storage"; + reg = <0x000d0000 0x400000>; + }; + + storage_partition: partition@4d0000 { + label = "settings_storage"; + reg = <0x004d0000 0x2000>; + }; + + external_flash_partition: partition@4d20000 { + label = "external_flash"; + reg = <0x0004d2000 0x1b2e000>; + }; + }; +}; + +#include diff --git a/boards/shields/pca63565/boards/nrf54ls05dk_nrf54ls05a_cpuapp.overlay b/boards/shields/pca63565/boards/nrf54ls05dk_nrf54ls05a_cpuapp.overlay new file mode 100644 index 000000000000..2b8a547c14ab --- /dev/null +++ b/boards/shields/pca63565/boards/nrf54ls05dk_nrf54ls05a_cpuapp.overlay @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2026 Nordic Semiconductor ASA + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + aliases { + sensor-bme688 = &i2c22; + accel0 = &adxl362; + accel-gyro = &bmi270; + /delete-property/ sw0; + /delete-property/ mcuboot-button0; + }; +}; + +/delete-node/ &button0; // P1.13 is adxl362 chip select signal + +&pinctrl { + i2c22_default: i2c22_default { + group1 { + psels = , + ; + }; + }; + + i2c22_sleep: i2c22_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + spi21_default: spi21_default { + group1 { + psels = , + , + ; + }; + }; + + spi21_sleep: spi21_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +&i2c22 { + status = "okay"; + zephyr,concat-buf-size = <512>; + pinctrl-0 = <&i2c22_default>; + pinctrl-1 = <&i2c22_sleep>; + pinctrl-names = "default", "sleep"; + + bme688: bme688@76 { + compatible = "bosch,bme680"; + status = "okay"; + reg = <0x76>; + }; +}; + +&spi21 { + status = "okay"; + pinctrl-0 = <&spi21_default>; + pinctrl-1 = <&spi21_sleep>; + pinctrl-names = "default", "sleep"; + cs-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>, + <&gpio1 26 GPIO_ACTIVE_LOW>; + + bmi270: bmi270@0 { + compatible = "bosch,bmi270"; + status = "okay"; + reg = <0>; + spi-max-frequency = ; + }; + + adxl362: adxl362@1 { + compatible = "adi,adxl362"; + status = "okay"; + reg = <1>; + int1-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; + spi-max-frequency = ; + }; +}; diff --git a/cmake/extensions.cmake b/cmake/extensions.cmake index 1c8b39009e0d..e7083f7fbce1 100644 --- a/cmake/extensions.cmake +++ b/cmake/extensions.cmake @@ -197,7 +197,7 @@ Please provide one of following: CONF_FILES") set(board_combined ${board_combined}@${BOARD_REVISION}) endif() - set(board_combined ${board_combined}${BOARD_QUALIFIERS}) + set(board_combined ${board_combined}/${BOARD_QUALIFIERS}) parse_board_components(board_combined board_name board_revision board_qualifiers) endif() diff --git a/cmake/hpf.cmake b/cmake/hpf.cmake index ce742a565c74..c154d433512c 100644 --- a/cmake/hpf.cmake +++ b/cmake/hpf.cmake @@ -78,7 +78,10 @@ function(hpf_assembly_generate soc hrt_srcs) ) endforeach() - add_dependencies(asm_gen syscall_list_h_target kobj_types_h_target) + add_dependencies(asm_gen + syscall_list_h_target + kobj_types_h_target + zephyr_generated_headers) endfunction() diff --git a/cmake/sysbuild/b0_mcuboot_signing.cmake b/cmake/sysbuild/b0_mcuboot_signing.cmake index bd734ae2ef2d..b401cddcbc56 100644 --- a/cmake/sysbuild/b0_mcuboot_signing.cmake +++ b/cmake/sysbuild/b0_mcuboot_signing.cmake @@ -10,6 +10,8 @@ # Since this file is brought in via include(), we do the work in a # function to avoid polluting the top-level scope. +include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/bootloader_dts_utils.cmake) + function(ncs_secure_boot_mcuboot_sign application bin_files signed_targets prefix) find_program(IMGTOOL imgtool.py HINTS ${ZEPHYR_MCUBOOT_MODULE_DIR}/scripts/ NAMES imgtool NAMES_PER_DIR) set(keyfile "${SB_CONFIG_BOOT_SIGNATURE_KEY_FILE}") @@ -25,8 +27,46 @@ function(ncs_secure_boot_mcuboot_sign application bin_files signed_targets prefi sysbuild_get(CONFIG_BUILD_OUTPUT_BIN IMAGE ${application} VAR CONFIG_BUILD_OUTPUT_BIN KCONFIG) sysbuild_get(CONFIG_BUILD_OUTPUT_HEX IMAGE ${application} VAR CONFIG_BUILD_OUTPUT_HEX KCONFIG) - string(TOUPPER "${application}" application_uppercase) - set(imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign --version ${SB_CONFIG_SECURE_BOOT_MCUBOOT_VERSION} --align 4 --slot-size $ --pad-header --header-size ${SB_CONFIG_PM_MCUBOOT_PAD}) + set(slot_size) # imgtool --slot-size + set(header_size) # imgtool --header + if(SB_CONFIG_PARTITION_MANAGER) + string(TOUPPER "${application}" application_uppercase) + set(slot_size $) + set(header_size ${SB_CONFIG_PM_MCUBOOT_PAD}) + set(slot_address $) + else() + # Get the partition node and pick size from it. + dt_chosen(code_partition_path PROPERTY "zephyr,code-partition" TARGET ${application}) + dt_partition_size(slot_size PATH "${code_partition_path}" TARGET ${application} REQUIRED) + dt_partition_addr(slot_address PATH "${code_partition_path}" TARGET ${application} REQUIRED ABSOLUTE) + # Header size is picked from the image that is being signed. + sysbuild_get(header_size IMAGE ${DEFAULT_IMAGE} VAR CONFIG_ROM_START_OFFSET KCONFIG) + + if(${header_size} EQUAL 0) + sysbuild_get(build_with_tfm IMAGE ${DEFAULT_IMAGE} VAR CONFIG_BUILD_WITH_TFM KCONFIG) + if(build_with_tfm) + sysbuild_get(header_size IMAGE ${DEFAULT_IMAGE} VAR CONFIG_TFM_MCUBOOT_HEADER_SIZE KCONFIG) + else() + message(FATAL_ERROR "imgtool header size picked from ${DEFAULT_IMAGE} is 0, check CONFIG_ROM_START_OFFSET value") + endif() + endif() + endif() + + # Partition Manager enabled binaries are built for IMAGE partition which does not include + # MCUboot header, instead the header has to be added post build. Builds for DTS partitions + # include the header into an image so, header padding is not needed. + # CPUNET targets are special case and they require padding for either configuration, + # as the header is not included neither in PM nor DTS builds and image starts exactly at + # partition start address. + if(SB_CONFIG_PARTITION_MANAGER) + set(pad_header --pad-header) + elseif("${prefix}" STREQUAL "CPUNET_") + set(pad_header --pad-header) + else() + set(pad_header) + endif() + + set(imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign --version ${SB_CONFIG_SECURE_BOOT_MCUBOOT_VERSION} --align 4 --slot-size ${slot_size} --header-size ${header_size} ${pad_header} --rom-fixed ${slot_address}) if(SB_CONFIG_MCUBOOT_HARDWARE_DOWNGRADE_PREVENTION) set(imgtool_extra --security-counter ${SB_CONFIG_MCUBOOT_HW_DOWNGRADE_PREVENTION_COUNTER_VALUE}) @@ -141,13 +181,37 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) if(SB_CONFIG_SECURE_BOOT_APPCORE) set(bin_files) set(signed_targets) + # extra_bin_data is used for generating zip file, and is set to information + # on variant S1 image, in case it is also added to a zip file. set(extra_bin_data) ncs_secure_boot_mcuboot_sign(mcuboot "${bin_files}" "${signed_targets}" "") + # Because S0/S1 images are build for slot they are designated for, we need + # slot addresses to be able to sign them for that specific slot. + # We also need slot, for signing sript. + set(s0_partition_address) + set(s1_partition_address) + if(SB_CONFIG_PARTITION_MANAGER) + set(s1_partition_address "$") + set(s0_partition_address "$") + else() + # The same DTS is used for all images, so the application selection does not + # matter here, so we just use the mcuboot + dt_partition_addr(s0_partition_address LABEL "s0_partition" TARGET mcuboot ABSOLUTE REQUIRED) + dt_partition_addr(s1_partition_address LABEL "s1_partition" TARGET mcuboot ABSOLUTE REQUIRED) + endif() + + # Signing the MCUboot image, secondary stage bootloader, that will be running from S1 slot. if(SB_CONFIG_SECURE_BOOT_BUILD_S1_VARIANT_IMAGE) - ncs_secure_boot_mcuboot_sign(s1_image "${bin_files}" "${signed_targets}" "") - set(extra_bin_data "signed_by_mcuboot_and_b0_s1_image.binload_address=$;signed_by_mcuboot_and_b0_s1_image.binslot=1") + if(SB_CONFIG_PARTITION_MANAGER) + ncs_secure_boot_mcuboot_sign(s1_image "${bin_files}" "${signed_targets}" "") + set(extra_bin_data "signed_by_mcuboot_and_b0_s1_image.binload_address=${s1_partition_address};signed_by_mcuboot_and_b0_s1_image.binslot=1") + else() + b0_image_name(s1_image_name) + ncs_secure_boot_mcuboot_sign(${s1_image_name} "${bin_files}" "${signed_targets}" "") + set(extra_bin_data "signed_by_mcuboot_and_b0_${s1_image_name}.binload_address=${s1_partition_address};signed_by_mcuboot_and_b0_${s1_image_name}.binslot=1") + endif() endif() if(bin_files) @@ -161,7 +225,7 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) TYPE mcuboot IMAGE mcuboot SCRIPT_PARAMS - "signed_by_mcuboot_and_b0_mcuboot.binload_address=$" + "signed_by_mcuboot_and_b0_mcuboot.binload_address=${s0_partition_address}" ${extra_bin_data} "version_MCUBOOT=${SB_CONFIG_SECURE_BOOT_MCUBOOT_VERSION}" "version_B0=${mcuboot_fw_info_firmware_version}" @@ -172,8 +236,12 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) endif() if(SB_CONFIG_SECURE_BOOT_NETCORE) - get_property(image_name GLOBAL PROPERTY DOMAIN_APP_CPUNET) - ncs_secure_boot_mcuboot_sign(${image_name} "${bin_files}" "${signed_targets}" CPUNET_) + if(SB_CONFIG_PARTITION_MANAGER) + get_property(image_name GLOBAL PROPERTY DOMAIN_APP_CPUNET) + ncs_secure_boot_mcuboot_sign(${image_name} "${bin_files}" "${signed_targets}" CPUNET_) + else() + ncs_secure_boot_mcuboot_sign(${SB_CONFIG_NETCORE_IMAGE_NAME} "${bin_files}" "${signed_targets}" CPUNET_) + endif() endif() # Clear temp variables diff --git a/cmake/sysbuild/b0_packaging.cmake b/cmake/sysbuild/b0_packaging.cmake index d46a6a97ca04..ef0e576fc7a5 100644 --- a/cmake/sysbuild/b0_packaging.cmake +++ b/cmake/sysbuild/b0_packaging.cmake @@ -8,29 +8,67 @@ function(dfu_app_b0_zip_package) sysbuild_get(app_fw_info_firmware_version IMAGE ${DEFAULT_IMAGE} VAR CONFIG_FW_INFO_FIRMWARE_VERSION KCONFIG) set(s0_name "signed_by_b0_${DEFAULT_IMAGE}.bin") - set(s1_name signed_by_b0_s1_image.bin) + b0_image_name(s1_image_name) + set(s1_name signed_by_b0_${s1_image_name}.bin) - generate_dfu_zip( - OUTPUT ${CMAKE_BINARY_DIR}/dfu_application.zip - BIN_FILES ${CMAKE_BINARY_DIR}/signed_by_b0_${DEFAULT_IMAGE}.bin ${CMAKE_BINARY_DIR}/signed_by_b0_s1_image.bin - ZIP_NAMES ${s0_name} ${s1_name} - TYPE application - IMAGE ${DEFAULT_IMAGE} - SCRIPT_PARAMS - "${s0_name}load_address=$" - "${s0_name}image_index=0" - "${s0_name}slot=0" - "${s0_name}version_B0=${app_fw_info_firmware_version}" - "${s1_name}load_address=$" - "${s1_name}image_index=0" - "${s1_name}slot=1" - "${s1_name}version_B0=${app_fw_info_firmware_version}" - DEPENDS - ${DEFAULT_IMAGE}_extra_byproducts - ${DEFAULT_IMAGE}_signed_kernel_hex_target - s1_image_extra_byproducts - s1_image_signed_kernel_hex_target + if(SB_CONFIG_PARTITION_MANAGER) + generate_dfu_zip( + OUTPUT ${CMAKE_BINARY_DIR}/dfu_application.zip + BIN_FILES + ${CMAKE_BINARY_DIR}/signed_by_b0_${DEFAULT_IMAGE}.bin + ${CMAKE_BINARY_DIR}/signed_by_b0_${s1_image_name}.bin + ZIP_NAMES + ${s0_name} + ${s1_name} + TYPE application + IMAGE ${DEFAULT_IMAGE} + SCRIPT_PARAMS + "${s0_name}load_address=$" + "${s0_name}image_index=0" + "${s0_name}slot=0" + "${s0_name}version_B0=${app_fw_info_firmware_version}" + "${s1_name}load_address=$" + "${s1_name}image_index=0" + "${s1_name}slot=1" + "${s1_name}version_B0=${app_fw_info_firmware_version}" + DEPENDS + ${DEFAULT_IMAGE}_extra_byproducts + ${DEFAULT_IMAGE}_signed_kernel_hex_target + s1_image_extra_byproducts + s1_image_signed_kernel_hex_target ) + else() + dt_chosen(s0_image_code_partition_path PROPERTY "zephyr,code-partition" TARGET ${DEFAULT_IMAGE}) + dt_partition_addr(s0_image_slot_address PATH "${s0_image_code_partition_path}" TARGET ${DEFAULT_IMAGE} REQUIRED) + dt_chosen(s1_image_code_partition_path PROPERTY "zephyr,code-partition" TARGET ${s1_image_name}) + dt_partition_addr(s1_image_slot_address PATH "${s1_image_code_partition_path}" TARGET ${s1_image_name} REQUIRED) + + generate_dfu_zip( + OUTPUT ${CMAKE_BINARY_DIR}/dfu_application.zip + BIN_FILES + ${CMAKE_BINARY_DIR}/signed_by_b0_${DEFAULT_IMAGE}.bin + ${CMAKE_BINARY_DIR}/signed_by_b0_${s1_image_name}.bin + ZIP_NAMES + ${s0_name} + ${s1_name} + TYPE application + IMAGE ${DEFAULT_IMAGE} + SCRIPT_PARAMS + "${s0_name}load_address=${s0_image_slot_address}" + "${s0_name}image_index=0" + "${s0_name}slot=0" + "${s0_name}version_B0=${app_fw_info_firmware_version}" + "${s1_name}load_address=${s1_image_slot_address}" + "${s1_name}image_index=0" + "${s1_name}slot=1" + "${s1_name}version_B0=${app_fw_info_firmware_version}" + DEPENDS + ${DEFAULT_IMAGE}_extra_byproducts + ${DEFAULT_IMAGE}_signed_kernel_hex_target + ${s1_image_name}_extra_byproducts + ${s1_image_name}_signed_kernel_hex_target + ) + endif() endfunction() if(SB_CONFIG_DFU_ZIP_APP) diff --git a/cmake/sysbuild/bootloader_dts_utils.cmake b/cmake/sysbuild/bootloader_dts_utils.cmake index 698fabac7723..32a14685f85d 100644 --- a/cmake/sysbuild/bootloader_dts_utils.cmake +++ b/cmake/sysbuild/bootloader_dts_utils.cmake @@ -84,30 +84,116 @@ function(dt_partition_addr var) dt_reg_addr(dt_partition_offset PATH "${arg_DT_PARTITION_PATH}" TARGET "${arg_DT_PARTITION_TARGET}") + # Read compatible property to adjust the offset and address caluculation for subpartitions. + dt_prop(partition_compat PATH "${arg_DT_PARTITION_PATH}" TARGET "${arg_DT_PARTITION_TARGET}" + PROPERTY compatible) + # The partition parent should be either a fixed-partitions or a fixed-subpartitions node. set(dt_partition_parent "${arg_DT_PARTITION_PATH}") dt_get_parent(dt_partition_parent) - if("${dt_partition_parent}" IN_LIST fixed_subpartitions) + if("${partition_compat}" STREQUAL "zephyr,mapped-partition") + dt_prop(parent_compat PATH "${dt_partition_parent}" TARGET "${arg_DT_PARTITION_TARGET}" + PROPERTY compatible) + # Go up in the tree until the NVM memory controller is reached. + while("${parent_compat}" STREQUAL "zephyr,mapped-partition") + dt_get_parent(dt_partition_parent) + dt_prop(parent_compat PATH "${dt_partition_parent}" TARGET "${arg_DT_PARTITION_TARGET}" + PROPERTY compatible) + endwhile() + elseif("${dt_partition_parent}" IN_LIST fixed_subpartitions) # Get the parent of the subpartition node, which should be a fixed-partitions node. dt_get_parent(dt_partition_parent) elseif(NOT "${dt_partition_parent}" IN_LIST fixed_partitions) - message(FATAL_ERROR "dt_partition_addr: Node is not a partition or subpartition: " + message(FATAL_ERROR "dt_partition_addr: Node is not a (mapped) partition or subpartition: " "${arg_DT_PARTITION_PATH} in target: ${arg_DT_PARTITION_TARGET}") endif() - if(NOT arg_DT_PARTITION_ABSOLUTE) - # A parent of the "fixed-partitions" node should be the memory controller. + if("${partition_compat}" STREQUAL "zephyr,mapped-partition") + if(NOT arg_DT_PARTITION_ABSOLUTE) + # Skip the "partitions" node. + dt_get_parent(dt_partition_parent) + # A grandparent of the upmost "mapped-partition" node should be the memory controller. + dt_reg_addr(mem_ctrl_addr PATH "${dt_partition_parent}" TARGET "${arg_DT_PARTITION_TARGET}") + # Subtract the memory controller base address to get a relative address. + math(EXPR dt_partition_offset "${dt_partition_offset} - ${mem_ctrl_addr}" OUTPUT_FORMAT + HEXADECIMAL) + endif() + elseif(arg_DT_PARTITION_ABSOLUTE) + # A parent of the "fixed-partitions" should be the memory controller. dt_get_parent(dt_partition_parent) # Add the memory controller base address to get an absolute address. dt_reg_addr(parent_addr PATH "${dt_partition_parent}" TARGET "${arg_DT_PARTITION_TARGET}") - math(EXPR dt_partition_offset "${dt_partition_offset} - ${parent_addr}" OUTPUT_FORMAT + math(EXPR dt_partition_offset "${dt_partition_offset} + ${parent_addr}" OUTPUT_FORMAT HEXADECIMAL) endif() set(${var} "${dt_partition_offset}" PARENT_SCOPE) endfunction() +# Usage: +# dt_partition_size( [LABEL