Skip to content

Commit

Permalink
samples: matter: rework PM static partitions for nRF54L
Browse files Browse the repository at this point in the history
* enabled mx25r64 external flash over SPI for Matter samples
* added pm_static* files that configures static memory map with
  MCUboot secondary slot residing on the external flash
* added MCUboot configuration to support DFU
* provided default/debug and release variants for every sample
* increased the RRAM and SRAM for nrf54L (by default the FLPR
  consumes 68k of SRAM and 96k of RRAM even if not used)
* left the pm_static file with internal flash only for the
  template sample as a reference for dual bank DFU with no
  external flash
* updated documentation to describe supported DFU variants

Signed-off-by: Marcin Kajor <[email protected]>
  • Loading branch information
markaj-nordic committed May 31, 2024
1 parent e895510 commit 4786440
Show file tree
Hide file tree
Showing 55 changed files with 870 additions and 454 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,6 @@ Matter samples that used :ref:`zephyr:nrf-ieee802154-rpmsg-sample` or :ref:`mult
* :ref:`matter_thermostat_sample` sample.
* :ref:`matter_window_covering_sample` sample.

DFU support for the nRF54L15 PDK is available only for the ``release`` build type.

* Enabled the Bluetooth® LE Extended Announcement feature for all samples, and increased advertising timeout from 15 minutes to 1 hour.

* :ref:`matter_lock_sample` sample:
Expand Down
7 changes: 2 additions & 5 deletions samples/matter/light_bulb/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ config MATTER_FACTORY_DATA
default y if !BOARD_NRF21540DK

choice BOOTLOADER
default BOOTLOADER_MCUBOOT if !BOARD_NRF21540DK && !BOARD_NRF54L15PDK_NRF54L15_CPUAPP
default BOOTLOADER_MCUBOOT if !BOARD_NRF21540DK
endchoice

config PARTITION_MANAGER
default n if BOARD_NRF54L15PDK_NRF54L15_CPUAPP

if BOOTLOADER_MCUBOOT

config DFU_MULTI_IMAGE_PACKAGE_BUILD
Expand Down Expand Up @@ -61,6 +58,6 @@ endif # BOOTLOADER_MCUBOOT
endif # (BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP)

config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
default y if BOARD_NRF52840DK_NRF52840 || BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP
default y if BOARD_NRF52840DK_NRF52840 || BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP

source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
4 changes: 0 additions & 4 deletions samples/matter/light_bulb/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ Device Firmware Upgrade support
:start-after: matter_door_lock_sample_build_with_dfu_start
:end-before: matter_door_lock_sample_build_with_dfu_end

.. include:: ../template/README.rst
:start-after: matter_template_nrf54l15_build_with_dfu_start
:end-before: matter_template_nrf54l15_build_with_dfu_end

FEM support
===========

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# Multirole is the only currently supported role by SoftDevice.
CONFIG_BT_LL_SOFTDEVICE_MULTIROLE=y

# TODO: Workaround to be removed once DFU and external flash will be supported on nRF54L.
CONFIG_CHIP_OTA_REQUESTOR=n
CONFIG_CHIP_QSPI_NOR=n

CONFIG_FPU=n
CONFIG_PM=n
CONFIG_HWINFO_NRF=n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
*/

/ {
aliases {
factory-data = &factory_data;
factory-data-memory-region = &cpuapp_rram;
chosen {
nordic,pm-ext-flash = &mx25r64;
};

aliases {
// Configure PWM module for led1 (LED2 on the board)
pwm-led1 = &pwm_led1;

Expand All @@ -24,34 +25,18 @@
};
};

/delete-node/ &cpuapp_rram;
// restore full RRAM and SRAM space - by default some parts are dedicated to FLRP
&cpuapp_rram {
reg = <0x0 DT_SIZE_K(1524)>;
};

&rram_controller {
reg = < 0x5004b000 0x17d000 >;
&cpuapp_sram {
reg = <0x20000000 DT_SIZE_K(256)>;
ranges = <0x0 0x20000000 0x40000>;
};

cpuapp_rram: rram@0 {
compatible = "soc-nv-flash";
erase-block-size = < 0x1000 >;
write-block-size = < 0x10 >;
reg = < 0x0 0x17d000 >;
partitions {
compatible = "fixed-partitions";
#address-cells = < 0x1 >;
#size-cells = < 0x1 >;
slot0_partition: partition@0 {
label = "image-0";
reg = < 0x0 0x174000 >;
};
factory_data: partition@174000 {
label = "factory-data";
reg = < 0x174000 0x1000 >;
};
storage_partition: partition@175000 {
label = "storage";
reg = < 0x175000 0x8000 >;
};
};
};
&mx25r64 {
status = "okay";
};

&pwm20 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@


/ {
aliases {
factory-data = &factory_data;
factory-data-memory-region = &cpuapp_rram;
chosen {
nordic,pm-ext-flash = &mx25r64;
};

aliases {
// Configure PWM module for led1 (LED2 on the board)
pwm-led1 = &pwm_led1;

Expand All @@ -25,34 +26,18 @@
};
};

/delete-node/ &cpuapp_rram;
// restore full RRAM and SRAM space - by default some parts are dedicated to FLRP
&cpuapp_rram {
reg = <0x0 DT_SIZE_K(1524)>;
};

&rram_controller {
reg = < 0x5004b000 0x17d000 >;
&cpuapp_sram {
reg = <0x20000000 DT_SIZE_K(256)>;
ranges = <0x0 0x20000000 0x40000>;
};

cpuapp_rram: rram@0 {
compatible = "soc-nv-flash";
erase-block-size = < 0x1000 >;
write-block-size = < 0x10 >;
reg = < 0x0 0x17d000 >;
partitions {
compatible = "fixed-partitions";
#address-cells = < 0x1 >;
#size-cells = < 0x1 >;
slot0_partition: partition@0 {
label = "image-0";
reg = < 0x0 0x174000 >;
};
factory_data: partition@174000 {
label = "factory-data";
reg = < 0x174000 0x1000 >;
};
storage_partition: partition@175000 {
label = "storage";
reg = < 0x175000 0x8000 >;
};
};
};
&mx25r64 {
status = "okay";
};

&pwm20 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# Multirole is the only currently supported role by SoftDevice.
CONFIG_BT_LL_SOFTDEVICE_MULTIROLE=y

# TODO: Workaround to be removed once external flash will be supported on nRF54L.
CONFIG_CHIP_QSPI_NOR=n

CONFIG_FPU=n
CONFIG_PM=n
CONFIG_HWINFO_NRF=n
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
mcuboot:
address: 0x0
region: flash_primary
size: 0xc000
mcuboot_pad:
address: 0xc000
region: flash_primary
size: 0x800
app:
address: 0xc800
region: flash_primary
size: 0x167800
mcuboot_primary:
orig_span: &id001
- mcuboot_pad
- app
span: *id001
address: 0xc000
region: flash_primary
size: 0x168000
mcuboot_primary_app:
orig_span: &id002
- app
span: *id002
address: 0xc800
region: flash_primary
size: 0x167800
factory_data:
address: 0x174000
region: flash_primary
size: 0x1000
settings_storage:
address: 0x175000
region: flash_primary
size: 0x8000
mcuboot_secondary:
address: 0x0
orig_span: &id003
- mcuboot_secondary_pad
- mcuboot_secondary_app
region: external_flash
size: 0x168000
span: *id003
mcuboot_secondary_pad:
region: external_flash
address: 0x0
size: 0x800
mcuboot_secondary_app:
region: external_flash
address: 0x800
size: 0x167800
external_flash:
address: 0x168000
size: 0x698000
device: MX25R64
region: external_flash
Original file line number Diff line number Diff line change
@@ -1,46 +1,30 @@
mcuboot:
address: 0x0
region: flash_primary
size: 0x7000
size: 0xc000
mcuboot_pad:
address: 0x7000
address: 0xc000
region: flash_primary
size: 0x800
app:
address: 0x7800
address: 0xc800
region: flash_primary
size: 0xb6000
size: 0x167800
mcuboot_primary:
address: 0x7000
orig_span: &id001
- app
- mcuboot_pad
region: flash_primary
size: 0xb6800
- app
span: *id001
address: 0xc000
region: flash_primary
size: 0x168000
mcuboot_primary_app:
address: 0x7800
orig_span: &id002
- app
region: flash_primary
size: 0xb6000
span: *id002
mcuboot_secondary:
address: 0xbd800
orig_span: &id003
- mcuboot_secondary_pad
- mcuboot_secondary_app
region: flash_primary
size: 0xb6800
span: *id003
mcuboot_secondary_pad:
address: 0xc800
region: flash_primary
address: 0xbd800
size: 0x800
mcuboot_secondary_app:
region: flash_primary
address: 0xbe000
size: 0xb6000
size: 0x167800
factory_data:
address: 0x174000
region: flash_primary
Expand All @@ -49,3 +33,24 @@ settings_storage:
address: 0x175000
region: flash_primary
size: 0x8000
mcuboot_secondary:
address: 0x0
orig_span: &id003
- mcuboot_secondary_pad
- mcuboot_secondary_app
region: external_flash
size: 0x168000
span: *id003
mcuboot_secondary_pad:
region: external_flash
address: 0x0
size: 0x800
mcuboot_secondary_app:
region: external_flash
address: 0x800
size: 0x167800
external_flash:
address: 0x168000
size: 0x698000
device: MX25R64
region: external_flash
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ CONFIG_FPROTECT=n
CONFIG_HW_STACK_PROTECTION=n

CONFIG_BOOT_WATCHDOG_FEED=n

# 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

# required by SPI driver
CONFIG_MULTITHREADING=y

CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

# Adjust the maximum sectors to the app image size of ~1.4MB
CONFIG_BOOT_MAX_IMG_SECTORS=512
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

// 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>;
};

&mx25r64 {
status = "okay";
};
7 changes: 2 additions & 5 deletions samples/matter/light_switch/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ config MATTER_FACTORY_DATA
default y if !BOARD_NRF21540DK

choice BOOTLOADER
default BOOTLOADER_MCUBOOT if !BOARD_NRF21540DK && !BOARD_NRF54L15PDK_NRF54L15_CPUAPP
default BOOTLOADER_MCUBOOT if !BOARD_NRF21540DK
endchoice

config PARTITION_MANAGER
default n if BOARD_NRF54L15PDK_NRF54L15_CPUAPP

if BOOTLOADER_MCUBOOT

config DFU_MULTI_IMAGE_PACKAGE_BUILD
Expand Down Expand Up @@ -61,6 +58,6 @@ endif # BOOTLOADER_MCUBOOT
endif # (BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP)

config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
default y if BOARD_NRF52840DK_NRF52840 || BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP
default y if BOARD_NRF52840DK_NRF52840 || BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF54L15PDK_NRF54L15_CPUAPP

source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
4 changes: 0 additions & 4 deletions samples/matter/light_switch/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ Device Firmware Upgrade support
:start-after: matter_door_lock_sample_build_with_dfu_start
:end-before: matter_door_lock_sample_build_with_dfu_end

.. include:: ../template/README.rst
:start-after: matter_template_nrf54l15_build_with_dfu_start
:end-before: matter_template_nrf54l15_build_with_dfu_end

Factory data support
====================

Expand Down
Loading

0 comments on commit 4786440

Please sign in to comment.