Skip to content
Open
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
30 changes: 30 additions & 0 deletions cmake/sysbuild/bootconf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

function(setup_bootconf_data)
add_custom_target(bootconf_target
Copy link
Contributor

Choose a reason for hiding this comment

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

cmake indent is 2 spaces, also move file up a folder as this does not run in sysbuild context

ALL
DEPENDS ${CMAKE_BINARY_DIR}/bootconf.hex
)

dt_nodelabel(boot_partition_node_full_path NODELABEL "boot_partition")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dt_nodelabel(boot_partition_node_full_path NODELABEL "boot_partition")
dt_nodelabel(boot_partition_node_full_path NODELABEL "boot_partition" REQUIRED)

dt_reg_size(boot_partition_node_size PATH "${boot_partition_node_full_path}")
if(${boot_partition_node_size} GREATER 0x7c00)
message(WARNING "boot_partition doesn't fit into protection region.
Protection will be applied over maximum allowed span.")
endif()

add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bootconf.hex
Copy link
Contributor

Choose a reason for hiding this comment

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

this creates the file but does not flash it. A special project can be created that will allow flashing of the file with west flash, see zephyrproject-rtos/zephyr#94796 for how to do this (note: more complex)

COMMAND ${Python3_EXECUTABLE}
${ZEPHYR_NRF_MODULE_DIR}/scripts/reglock.py
--output ${CMAKE_BINARY_DIR}/bootconf.hex
--size ${boot_partition_node_size}
VERBATIM
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

endfunction()

setup_bootconf_data()
1 change: 1 addition & 0 deletions modules/mcuboot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ include(${ZEPHYR_NRF_MODULE_DIR}/modules/mcuboot/CMakeLists.txt)
if(CONFIG_MCUBOOT AND CONFIG_NCS_BM)
include(${ZEPHYR_NRF_BM_MODULE_DIR}/cmake/image_signing_softdevice.cmake)
include(${ZEPHYR_NRF_BM_MODULE_DIR}/cmake/flash_metadata.cmake)
include(${ZEPHYR_NRF_BM_MODULE_DIR}/cmake/sysbuild/bootconf.cmake)
endif()
7 changes: 7 additions & 0 deletions sysbuild/Kconfig.bm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ config BM_BOOT_IMG_HASH_ALG_PURE

endchoice

config BM_BOOT_BOOTCONF_LOCK_WRITES
bool "Protect bootloader's NVM from writes"
depends on SOC_NRF54L15_CPUAPP || SOC_NRF54L05_CPUAPP || SOC_NRF54L10_CPUAPP
default y
help
Sets RRAMC's BOOTCONF region protection to disable writes.

endmenu

endif # BM_BOOTLOADER_MCUBOOT
Expand Down