Skip to content

Commit

Permalink
[nrfconnect] Refactored configuration for child images
Browse files Browse the repository at this point in the history
Currently used approach for nrfconnect regarding child images
results in significant duplication of configuration files,
what hardens maintenance.

* Created Kconfig.mcuboot.defaults file that sets default
configuration for all examples using mcuboot child image
* Created Kconfig.multiprotocol_rpmsg file that sets
default configuration for all examples using multiprotocol
rpmsg child image
* Flatten configuration structure by removing
configuration/board-name/ files and creating common prj.confs
in the application root directory
* Removed from rpc.overlay comment describing how to use it,
as it duplicates example README.md information
  • Loading branch information
kkasperczyk-no committed Apr 7, 2022
1 parent 7dede20 commit 10d92ef
Show file tree
Hide file tree
Showing 137 changed files with 1,164 additions and 2,539 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/examples-nrfconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 10
run: |
scripts/examples/nrfconnect_example.sh lighting-app nrf52840dongle_nrf52840 -DCONFIG_CHIP_ROTATING_DEVICE_ID=y
scripts/examples/nrfconnect_example.sh lighting-app nrf52840dongle_nrf52840 -DCONF_FILE=prj_no_dfu.conf -DCONFIG_CHIP_ROTATING_DEVICE_ID=y
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf52840dongle_nrf52840 lighting-app \
examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \
Expand All @@ -113,7 +113,7 @@ jobs:
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 20
run: |
scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840 -DOVERLAY_CONFIG=../../rpc.overlay
scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840 -DOVERLAY_CONFIG=rpc.overlay
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf52840dk_nrf52840+rpc lighting-app \
examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \
Expand Down
21 changes: 21 additions & 0 deletions config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,25 @@ config FLASH_SHELL
bool
default n

# SoC series related configuration

if SOC_SERIES_NRF52X

# Increase maximum data length of PDU supported in the Controller
config BT_CTLR_DATA_LENGTH_MAX
int
default 251

endif # SOC_SERIES_NRF52X

if SOC_SERIES_NRF53X

# Generate random numbers using Xoroshiro algorithm instead of direct calls
# to the cryptocell library to workaround firmware hangs.
choice RNG_GENERATOR_CHOICE
default XOROSHIRO_RANDOM_GENERATOR
endchoice

endif # SOC_SERIES_NRF53X

endif
145 changes: 145 additions & 0 deletions config/nrfconnect/chip-module/Kconfig.mcuboot.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#
# Copyright (c) 2022 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# The purpose of this file is to define new default values of settings used when building mcuboot child image for Matter samples.

config MAIN_STACK_SIZE
int
default 10240

config BOOT_SWAP_SAVE_ENCTLV
bool
default n

config BOOT_ENCRYPT_RSA
bool
default n

config BOOT_ENCRYPT_EC256
bool
default n

config BOOT_ENCRYPT_X25519
bool
default n

choice BOOT_IMAGE_UPGRADE_MODE
default BOOT_UPGRADE_ONLY
endchoice

config BOOT_BOOTSTRAP
bool
default n

config PM
bool
default n

config FLASH
bool
default y

config FPROTECT
bool
default y

config NORDIC_QSPI_NOR
bool
default y

config NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE
int
default 4096

config NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE
int
default 16

config BOOT_MAX_IMG_SECTORS
int
default 256

config LOG
bool
default n

config CONSOLE_HANDLER
bool
default n

config BOOT_BANNER
bool
default n

config TIMESLICING
bool
default n

config RESET_ON_FATAL_ERROR
bool
default n

config MULTITHREADING
bool
default n

config TICKLESS_KERNEL
bool
default n

config TIMEOUT_64BIT
bool
default n

config NRF_ENABLE_ICACHE
bool
default n

if SOC_SERIES_NRF53X

# The following configurations are required to support simultaneous multi image update
config PCD_APP
bool
default y

config UPDATEABLE_IMAGE_NUMBER
int
default 2

# The network core cannot access external flash directly. The flash simulator must be used to
# provide a memory region that is used to forward the new firmware to the network core.
config FLASH_SIMULATOR
bool
default y

config FLASH_SIMULATOR_DOUBLE_WRITES
bool
default y

config FLASH_SIMULATOR_STATS
bool
default n

# Enable custom command to erase settings partition.
config ENABLE_MGMT_PERUSER
bool
default y

config BOOT_MGMT_CUSTOM_STORAGE_ERASE
bool
default y

endif # SOC_SERIES_NRF53X
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
# limitations under the License.
#

CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=n
CONFIG_BT_MAX_CONN=1
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
# The purpose of this file is to create a wrapper Kconfig file that will be set as
# mcuboot_KCONFIG_ROOT and processed before any other Kconfig for mcuboot child image.

rsource "Kconfig.mcuboot.defaults"
source "${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr/Kconfig"
99 changes: 99 additions & 0 deletions config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#
# Copyright (c) 2022 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# The purpose of this file is to define new default values of settings used when building multiprotocol_rpmsg child image for Matter samples.

config LOG
bool
default n

config HEAP_MEM_POOL_SIZE
int
default 8192

config MAIN_STACK_SIZE
int
default 2048

config SYSTEM_WORKQUEUE_STACK_SIZE
int
default 2048

config BT
bool
default y

config BT_HCI_RAW
bool
default y

config BT_MAX_CONN
int
default 1

config BT_PERIPHERAL
bool
default y

config BT_CENTRAL
bool
default n

config BT_BUF_ACL_RX_SIZE
int
default 502

config BT_BUF_ACL_TX_SIZE
int
default 251

config BT_CTLR_DATA_LENGTH_MAX
int
default 251

config BT_CTLR_ASSERT_HANDLER
bool
default y

config BT_HCI_RAW_RESERVE
int
default 1

# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
# Host number of completed commands does not follow normal flow control.
config BT_BUF_CMD_TX_COUNT
int
default 10

config ASSERT
bool
default y

config DEBUG_INFO
bool
default y

config EXCEPTION_STACK_TRACE
bool
default y

config NRF_802154_SER_RADIO
bool
default y

config NRF_RTC_TIMER_USER_CHAN_COUNT
int
default 2
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
# limitations under the License.
#

CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=n
CONFIG_BT_MAX_CONN=1
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
# The purpose of this file is to create a wrapper Kconfig file that will be set as
# multiprotocol_rpmsg_KCONFIG_ROOT and processed before any other Kconfig for multiprotocol_rpmsg child image.

rsource "Kconfig.multiprotocol_rpmsg.defaults"
source "Kconfig.zephyr"
4 changes: 3 additions & 1 deletion examples/all-clusters-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-cluster

include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)

set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}")
# Set Kconfig root files that will be processed as a first Kconfig for used child images.
set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root)
set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root)

if(NOT CONF_FILE STREQUAL "prj.conf")
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml)
Expand Down
11 changes: 4 additions & 7 deletions examples/all-clusters-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@ To build for the low-power configuration, run the following command with
_build-target_ replaced with the build target name of the Nordic Semiconductor's
kit you own (for example `nrf52840dk_nrf52840`):

$ west build -b build-target -- -DOVERLAY_CONFIG=../../overlay-low_power.conf
$ west build -b build-target -- -DOVERLAY_CONFIG=overlay-low_power.conf

For example, use the following command for `nrf52840dk_nrf52840`:

$ west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=../../overlay-low_power.conf
$ west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=overlay-low_power.conf

### Building with Device Firmware Upgrade support

Expand All @@ -323,11 +323,8 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`):
#### Changing bootloader configuration

To change the default MCUboot configuration, edit the `mcuboot.conf` or
`mcuboot_release.conf` overlay files depending on whether you build the target
with debug or release configuration. The files are located in the
`configuration/build-target/child_image` directory (_build-target_ is your board
name, for example `nrf52840dk_nrf52840`).
To change the default MCUboot configuration, edit the `prj.conf` file located in the
`child_image/mcuboot` directory.

#### Changing flash memory settings

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright (c) 2022 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This target uses Kconfig.mcuboot.defaults to set options common for all
# samples using mcuboot. This file should contain only options specific for this sample
# mcuboot configuration or overrides of default values.

CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"

# Bootloader size optimization
# Disable not used modules that cannot be set in Kconfig.mcuboot.defaults due to overriding
# in board files.
CONFIG_GPIO=n
CONFIG_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
CONFIG_USE_SEGGER_RTT=n
Loading

0 comments on commit 10d92ef

Please sign in to comment.