Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: new mcuboot configuration #652

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions samples/sid_end_device/pm_static_nrf54l15dk_nrf54l10_cpuapp.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
app:
address: 0xc800
address: 0xd800
end_address: 0xfd000
region: flash_primary
size: 0xf0800
size: 0xef800
mcuboot:
address: 0x0
end_address: 0xc000
end_address: 0xd000
placement:
before:
- mcuboot_primary
region: flash_primary
size: 0xc000
size: 0xd000
mcuboot_pad:
address: 0xc000
end_address: 0xc800
address: 0xd000
end_address: 0xd800
placement:
before:
- mcuboot_primary_app
region: flash_primary
size: 0x800
mcuboot_primary:
address: 0xc000
address: 0xd000
end_address: 0xfd000
orig_span: &id001
- mcuboot_pad
- app
region: flash_primary
size: 0xf1000
size: 0xf0000
span: *id001
mcuboot_primary_app:
address: 0xc800
address: 0xd800
end_address: 0xfd000
orig_span: &id002
- app
region: flash_primary
size: 0xf0800
size: 0xef800
span: *id002
settings_storage:
address: 0xfd000
Expand All @@ -53,11 +53,11 @@ mfg_storage:
size: 0x1000
mcuboot_secondary:
address: 0x0
end_address: 0xf1000
end_address: 0xf0000
placement:
align:
start: 0x4
region: external_flash
share_size:
- mcuboot_primary
size: 0xf1000
size: 0xf0000
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ CONFIG_TICKLESS_KERNEL=y

CONFIG_BOOT_WATCHDOG_FEED=n

CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

# nRF54L15DK 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
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

# required by SPI driver
CONFIG_MULTITHREADING=y

# Activate LTO
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
1 change: 1 addition & 0 deletions samples/sid_end_device/sysbuild/mcuboot/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ CONFIG_MULTITHREADING=n
CONFIG_TICKLESS_KERNEL=n
CONFIG_TIMEOUT_64BIT=n
CONFIG_NRF_ENABLE_ICACHE=n
CONFIG_SIZE_OPTIMIZATIONS=y
27 changes: 19 additions & 8 deletions tests/manual/simple_bootloader/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ endchoice

if BOOTLOADER_MCUBOOT

# Downgrade prevention
choice MCUBOOT_MODE
default MCUBOOT_MODE_OVERWRITE_ONLY
endchoice

config DFU_MULTI_IMAGE_PACKAGE_BUILD
default y

config DFU_MULTI_IMAGE_PACKAGE_APP
default y

config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
default y if !BOARD_NRF54L15DK_NRF54L15_CPUAPP || !BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS

if (BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP)

config MCUBOOT_UPDATEABLE_IMAGES
default 2

choice MCUBOOT_MODE
default MCUBOOT_MODE_OVERWRITE_ONLY
endchoice

choice BOOT_SIGNATURE_TYPE
default BOOT_SIGNATURE_TYPE_RSA
endchoice
Expand All @@ -44,11 +48,18 @@ config NETCORE_APP_UPDATE
config DFU_MULTI_IMAGE_PACKAGE_NET
default y

endif # BOOTLOADER_MCUBOOT

endif # (BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP)

config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
default y if BOARD_NRF52840DK_NRF52840 || BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP
if (BOARD_NRF54L15DK_NRF54L15_CPUAPP || BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS || BOARD_NRF54L15DK_NRF54L10_CPUAPP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use SOC series Kconfig instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in next pr: #659
should be quick to merge, then I rebase this one


# TODO: NCSDK-28931: Cannot use fprotect twice, so disable it in MCUboot to
# test protecting factory data. It can be enabled while there is a support
# for protection more than one region.
config MCUBOOT_FPROTECT_ALLOW_COMBINED_REGIONS
default n

endif # (BOARD_NRF54L15DK_NRF54L15_CPUAPP || BOARD_NRF54L15DK_NRF54L15_CPUAPP_NS)

endif # BOOTLOADER_MCUBOOT

source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_POWEROFF=y

# nRF54L15DK uses SPI NOR external flash for DFU
CONFIG_FLASH=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_MULTITHREADING=y
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
CONFIG_MCUMGR_GRP_IMG_ALLOW_ERASE_PENDING=y
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
*
* 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(1024)>;
};
Expand All @@ -14,3 +11,18 @@
reg = <0x20000000 DT_SIZE_K(192)>;
ranges = <0x0 0x20000000 DT_SIZE_K(192)>;
};

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

&mx25r64 {
status = "okay";
};

// TODO: re-enable HWFC once it's fixed
&uart20 {
/delete-property/ hw-flow-control;
};
Original file line number Diff line number Diff line change
@@ -1,54 +1,51 @@
app:
address: 0xc800
end_address: 0x84800
address: 0xd800
end_address: 0xfd000
region: flash_primary
size: 0x78000
size: 0xef800
mcuboot:
address: 0x0
end_address: 0xc000
end_address: 0xd000
placement:
before:
- mcuboot_primary
region: flash_primary
size: 0xc000
size: 0xd000
mcuboot_pad:
address: 0xc000
end_address: 0xc800
address: 0xd000
end_address: 0xd800
placement:
before:
- mcuboot_primary_app
region: flash_primary
size: 0x800
mcuboot_primary:
address: 0xc000
end_address: 0x84800
address: 0xd000
end_address: 0xfd000
orig_span: &id001
- mcuboot_pad
- app
region: flash_primary
sharers: 0x1
size: 0x78800
size: 0xf0000
span: *id001
mcuboot_primary_app:
address: 0xc800
end_address: 0x84800
address: 0xd800
end_address: 0xfd000
orig_span: &id002
- app
region: flash_primary
size: 0x78000
size: 0xef800
span: *id002
mcuboot_secondary:
address: 0x84800
end_address: 0xfd000
address: 0x0
end_address: 0xf0000
placement:
after:
- mcuboot_primary
align:
start: 0x1000
region: flash_primary
start: 0x4
region: external_flash
share_size:
- mcuboot_primary
size: 0x78800
size: 0xf0000
mfg_storage:
address: 0xff000
end_address: 0x100000
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Configure QSPI for external flash
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16

# Disable the Flash Patch and Breakpoint (FPB) feature
# to increase the security of the device.
CONFIG_DISABLE_FLASH_PATCH=y
CONFIG_REBOOT=y
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ CONFIG_FLASH_SIMULATOR=y
CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
CONFIG_FLASH_SIMULATOR_STATS=n

# Enable custom command to erase settings partition.
CONFIG_ENABLE_MGMT_PERUSER=y
CONFIG_ZCBOR=y
CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y
Original file line number Diff line number Diff line change
@@ -1,54 +1,37 @@
#
# Copyright (c) 2021 Nordic Semiconductor ASA
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# TODO: NCSDK-28931: Cannot use fprotect twice, so disable it in MCUboot to
# test protecting Matter factory data. It can be enabled while there is a support
# test protecting factory data. It can be enabled while there is a support
# for protection more than one region.
CONFIG_FPROTECT=n

# TODO: Workaround, disable memory guard to avoid false faults in application after boot
CONFIG_HW_STACK_PROTECTION=n

CONFIG_BOOT_WATCHDOG_FEED=n

# Disable all debug features
CONFIG_USE_SEGGER_RTT=n
CONFIG_SHELL=n
CONFIG_OPENTHREAD_SHELL=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_LOG=n
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_ASSERT_VERBOSE=n
CONFIG_ASSERT_NO_FILE_INFO=y
CONFIG_PRINTK=n
CONFIG_PRINTK_SYNC=n
CONFIG_THREAD_NAME=n
CONFIG_BOOT_BANNER=n

CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

# Ensure that the qspi driver is disabled by default
CONFIG_GPIO=n
CONFIG_SPI=n
CONFIG_SPI_NOR=n
CONFIG_NORDIC_QSPI_NOR=n
CONFIG_MULTITHREADING=n

CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y


# Workaroud: fprotect and watchdog feed
# are not supported in NCS v2.6.0
CONFIG_FPROTECT=n
CONFIG_BOOT_WATCHDOG_FEED=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
# 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 tickles kernel for mcuboot.
CONFIG_TICKLESS_KERNEL=y

CONFIG_BOOT_WATCHDOG_FEED=n

# nRF54L15DK 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
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

# required by SPI driver
CONFIG_MULTITHREADING=y

# Activate LTO
CONFIG_LTO=y
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

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

/* Application does not use cpuflpr core. Assign whole RRAM to cpuapp. */
/* Application does not use cpuflpr core. Assign whole RRAM and RAM to cpuapp. */
&cpuapp_rram {
reg = <0x0 DT_SIZE_K(1024)>;
};
Expand All @@ -14,3 +19,7 @@
reg = <0x20000000 DT_SIZE_K(192)>;
ranges = <0x0 0x20000000 DT_SIZE_K(192)>;
};

&mx25r64 {
status = "okay";
};
Loading
Loading