Skip to content
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
13 changes: 7 additions & 6 deletions subsys/mgmt/mcumgr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ add_subdirectory_ifdef(CONFIG_SMP_CLIENT smp_client)

zephyr_library_link_libraries(mgmt_mcumgr)

if (CONFIG_BOOT_IMAGE_ACCESS_HOOKS)
zephyr_include_directories(
${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include
${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include
)
zephyr_library_sources(bootutil_hooks/nrf53_hooks.c)
if(CONFIG_MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK)
zephyr_include_directories(
${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/bootutil/include
${ZEPHYR_MCUBOOT_MODULE_DIR}/boot/zephyr/include
)

zephyr_library_sources(bootutil_hooks/nrf53_hooks.c)
endif()
2 changes: 1 addition & 1 deletion subsys/mgmt/mcumgr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ menuconfig MCUMGR
bool "mcumgr Support"
depends on NET_BUF
depends on ZCBOR
imply BOOT_IMAGE_ACCESS_HOOKS if (SOC_NRF5340_CPUAPP_QKAA && MCUMGR_GRP_IMG)
imply BOOT_IMAGE_ACCESS_HOOKS if SOC_NRF5340_CPUAPP && MCUMGR_GRP_IMG && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1
help
This option enables the mcumgr management library.

Expand Down
15 changes: 3 additions & 12 deletions subsys/mgmt/mcumgr/bootutil_hooks/nrf53_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,10 @@
#include <zephyr/device.h>
#include "bootutil/bootutil_public.h"

#if CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER != -1
/* Sysbuild */
#define NET_CORE_IMAGE CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER
#else
/* Legacy child/parent */
#define NET_CORE_IMAGE 1
#endif

int boot_read_swap_state_primary_slot_hook(int image_index,
struct boot_swap_state *state)
int boot_read_swap_state_primary_slot_hook(int image_index, struct boot_swap_state *state)
{
if (image_index == NET_CORE_IMAGE) {
/* Pretend that primary slot of image 1 unpopulated */
if (image_index == CONFIG_MCUBOOT_NETWORK_CORE_IMAGE_NUMBER) {
/* Pretend that primary slot of the network core update image is unpopulated */
state->magic = BOOT_MAGIC_UNSET;
state->swap_type = BOOT_SWAP_TYPE_NONE;
state->image_num = image_index;
Expand Down
8 changes: 8 additions & 0 deletions subsys/mgmt/mcumgr/grp/img_mgmt/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ config MCUMGR_GRP_IMG_QSPI_XIP_SPLIT_IMAGE
sysbuild if needed. This enables selecting the correct slot when running a QSPI XIP
split image application in DirectXIP mode.

config MCUMGR_GRP_IMG_NRF5340_BOOTUTIL_HOOK
bool "nRF5340 network core bootutil hook"
depends on SOC_NRF5340_CPUAPP && BOOT_IMAGE_ACCESS_HOOKS && MCUBOOT_NETWORK_CORE_IMAGE_NUMBER > -1
default y
help
This option will enable a bootutil hook that populates the network core update image
slot with dummy data to allow for uploading a firmware update to the network core.

module = MCUMGR_GRP_IMG
module-str = mcumgr_grp_img
source "subsys/logging/Kconfig.template.log_config"
Expand Down