From 9025562312fe3384ccd7d946b7269ca09eccaab1 Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk <66371704+kkasperczyk-no@users.noreply.github.com> Date: Fri, 18 Jun 2021 18:51:31 +0200 Subject: [PATCH] [nrfconnect] Fixed storing root certificate during commissioning. (#7748) In some specific cases like building on nRF5340 or nRF52840 with MCUboot enabled appears problem with storing key root certificate to the NVS. That is because of the too small settings storage size. * Added config option for nRF5340 overlay increasing settings size from 8kB to 32kB. * Modified pm_static.yml file for nRF52840 to increase settings size from 8kB to 32kB. --- config/nrfconnect/app/overlay-dfu_support.conf | 2 +- examples/lighting-app/nrfconnect/CMakeLists.txt | 5 +++++ .../boards/nrf5340dk_nrf5340_cpuapp.conf | 2 ++ .../nrfconnect/child_image/mcuboot.conf | 2 +- .../nrf52840dk_nrf52840/pm_static.yml | 14 +++++++------- examples/lock-app/nrfconnect/CMakeLists.txt | 5 +++++ .../boards/nrf5340dk_nrf5340_cpuapp.conf | 2 ++ .../lock-app/nrfconnect/child_image/mcuboot.conf | 2 +- .../nrf52840dk_nrf52840/pm_static.yml | 14 +++++++------- 9 files changed, 31 insertions(+), 17 deletions(-) diff --git a/config/nrfconnect/app/overlay-dfu_support.conf b/config/nrfconnect/app/overlay-dfu_support.conf index c09ef695ee0ae3..82c22732e3d77f 100644 --- a/config/nrfconnect/app/overlay-dfu_support.conf +++ b/config/nrfconnect/app/overlay-dfu_support.conf @@ -24,7 +24,7 @@ CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=4 # External flash memory configuration CONFIG_PM_EXTERNAL_FLASH=y CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="MX25R64" -CONFIG_PM_EXTERNAL_FLASH_SIZE=0xf2000 +CONFIG_PM_EXTERNAL_FLASH_SIZE=0xec000 CONFIG_PM_EXTERNAL_FLASH_BASE=0 # MCU Manager and SMP configuration diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index bb98ad9d4492c2..524b8a72ec72c6 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -24,6 +24,11 @@ include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) # Load NCS/Zephyr build system set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf) + +if (EXISTS boards/${BOARD}.conf) + list(APPEND CONF_FILE boards/${BOARD}.conf) +endif() + # TODO: temporary fix to remove after solving static addressing problem on nrf5340 if(${BOARD} STREQUAL "nrf5340dk_nrf5340_cpuapp") list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-bt_private_addresses.conf) diff --git a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf index b9f4ed7648da78..9ecf3ca36ed0d2 100644 --- a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -15,3 +15,5 @@ # CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000 diff --git a/examples/lighting-app/nrfconnect/child_image/mcuboot.conf b/examples/lighting-app/nrfconnect/child_image/mcuboot.conf index 7097c7c93260dd..af5628a8cbf966 100644 --- a/examples/lighting-app/nrfconnect/child_image/mcuboot.conf +++ b/examples/lighting-app/nrfconnect/child_image/mcuboot.conf @@ -25,5 +25,5 @@ CONFIG_BOOT_MAX_IMG_SECTORS=256 # External flash memory configuration CONFIG_PM_EXTERNAL_FLASH=y CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="MX25R64" -CONFIG_PM_EXTERNAL_FLASH_SIZE=0xf2000 +CONFIG_PM_EXTERNAL_FLASH_SIZE=0xec000 CONFIG_PM_EXTERNAL_FLASH_BASE=0 diff --git a/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml index b194f921be3b26..bfeb165d92a860 100644 --- a/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml +++ b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml @@ -7,32 +7,32 @@ mcuboot_pad: size: 0x200 app: address: 0xc200 - size: 0xf1e00 + size: 0xebe00 mcuboot_primary: orig_span: &id001 - mcuboot_pad - app span: *id001 address: 0xc000 - size: 0xf2000 + size: 0xec000 region: flash_primary mcuboot_primary_app: orig_span: &id002 - app span: *id002 address: 0xc200 - size: 0xf1e00 + size: 0xebe00 settings_storage: - address: 0xfe000 - size: 0x2000 + address: 0xf8000 + size: 0x8000 region: flash_primary mcuboot_secondary: address: 0x0 - size: 0xf2000 + size: 0xec000 device: MX25R64 region: external_flash external_flash: - address: 0xf2000 + address: 0xec000 size: 0x0 device: MX25R64 region: external_flash diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index 3c73f243f59b7a..09f299aa24831d 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -24,6 +24,11 @@ include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake) # Load NCS/Zephyr build system set(CONF_FILE ${CHIP_ROOT}/config/nrfconnect/app/sample-defaults.conf prj.conf) + +if (EXISTS boards/${BOARD}.conf) + list(APPEND CONF_FILE boards/${BOARD}.conf) +endif() + # TODO: temporary fix to remove after solving static addressing problem on nrf5340 if(${BOARD} STREQUAL "nrf5340dk_nrf5340_cpuapp") list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-bt_private_addresses.conf) diff --git a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf index b9f4ed7648da78..9ecf3ca36ed0d2 100644 --- a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -15,3 +15,5 @@ # CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000 diff --git a/examples/lock-app/nrfconnect/child_image/mcuboot.conf b/examples/lock-app/nrfconnect/child_image/mcuboot.conf index 7097c7c93260dd..af5628a8cbf966 100644 --- a/examples/lock-app/nrfconnect/child_image/mcuboot.conf +++ b/examples/lock-app/nrfconnect/child_image/mcuboot.conf @@ -25,5 +25,5 @@ CONFIG_BOOT_MAX_IMG_SECTORS=256 # External flash memory configuration CONFIG_PM_EXTERNAL_FLASH=y CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="MX25R64" -CONFIG_PM_EXTERNAL_FLASH_SIZE=0xf2000 +CONFIG_PM_EXTERNAL_FLASH_SIZE=0xec000 CONFIG_PM_EXTERNAL_FLASH_BASE=0 diff --git a/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml index b194f921be3b26..bfeb165d92a860 100644 --- a/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml +++ b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/pm_static.yml @@ -7,32 +7,32 @@ mcuboot_pad: size: 0x200 app: address: 0xc200 - size: 0xf1e00 + size: 0xebe00 mcuboot_primary: orig_span: &id001 - mcuboot_pad - app span: *id001 address: 0xc000 - size: 0xf2000 + size: 0xec000 region: flash_primary mcuboot_primary_app: orig_span: &id002 - app span: *id002 address: 0xc200 - size: 0xf1e00 + size: 0xebe00 settings_storage: - address: 0xfe000 - size: 0x2000 + address: 0xf8000 + size: 0x8000 region: flash_primary mcuboot_secondary: address: 0x0 - size: 0xf2000 + size: 0xec000 device: MX25R64 region: external_flash external_flash: - address: 0xf2000 + address: 0xec000 size: 0x0 device: MX25R64 region: external_flash