diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 715d858646040a..7807a4ddd3c24f 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -175,7 +175,7 @@ jobs: - name: Build example nRF Connect SDK All Clusters App on nRF52840 DK timeout-minutes: 10 run: | - scripts/examples/nrfconnect_example.sh all-clusters-app nrf52840dk_nrf52840 -DBUILD_WITH_DFU=1 + scripts/examples/nrfconnect_example.sh all-clusters-app nrf52840dk_nrf52840 -DCONFIG_CHIP_OTA_REQUESTOR=y .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nrfconnect nrf52840dk_nrf52840 all-clusters-app \ examples/all-clusters-app/nrfconnect/build/zephyr/zephyr.elf \ diff --git a/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf b/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf deleted file mode 100644 index 8292a2ba13f5d1..00000000000000 --- a/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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. -# - -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 - -# MCU Manager and SMP configuration -CONFIG_MCUMGR=y -CONFIG_MCUMGR_CMD_IMG_MGMT=y -CONFIG_MCUMGR_CMD_OS_MGMT=y -CONFIG_MCUMGR_SMP_BT=y -CONFIG_MCUMGR_SMP_BT_AUTHEN=n -CONFIG_MCUMGR_BUF_COUNT=6 - -# Increase BT MTU and RX buffer for big size DFU messages -CONFIG_BT_L2CAP_TX_MTU=498 -CONFIG_BT_BUF_ACL_RX_SIZE=502 - -# Increase system workqueue size, as SMP is processed within it -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2800 - -# FLASH nop device is enabled to prevent bus faults when mcumgr tries to access -# simulated partition with network core image data. -CONFIG_FLASH_NOP_DEVICE=y - -# Enable custom SMP request to erase settings partition. -CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y -CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y diff --git a/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf b/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf deleted file mode 100644 index d03b7dead22b4f..00000000000000 --- a/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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. -# - -CONFIG_BOOTLOADER_MCUBOOT=y - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -# MCU Manager and SMP configuration -CONFIG_MCUMGR=y -CONFIG_MCUMGR_CMD_IMG_MGMT=y -CONFIG_MCUMGR_CMD_OS_MGMT=y -CONFIG_MCUMGR_SMP_BT=y -CONFIG_MCUMGR_SMP_BT_AUTHEN=n -CONFIG_MCUMGR_BUF_COUNT=6 - -# Increase BT MTU and RX buffer for big size DFU messages -CONFIG_BT_L2CAP_TX_MTU=498 -CONFIG_BT_BUF_ACL_RX_SIZE=502 - -# Increase MCUMGR_BUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B -CONFIG_MCUMGR_BUF_SIZE=1024 - -# Increase system workqueue size, as SMP is processed within it -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2800 diff --git a/config/nrfconnect/app/overlay-usb_support.conf b/config/nrfconnect/app/overlay-usb_support.conf index 0983dd29efc76e..1b4a2d56fe8490 100644 --- a/config/nrfconnect/app/overlay-usb_support.conf +++ b/config/nrfconnect/app/overlay-usb_support.conf @@ -22,4 +22,3 @@ CONFIG_USB_UART_CONSOLE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y -CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" diff --git a/config/nrfconnect/app/sample-defaults.conf b/config/nrfconnect/app/sample-defaults.conf deleted file mode 100644 index 22625d175148f1..00000000000000 --- a/config/nrfconnect/app/sample-defaults.conf +++ /dev/null @@ -1,122 +0,0 @@ -# -# Copyright (c) 2020 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. -# - -CONFIG_CHIP=y -CONFIG_CHIP_DEVICE_VENDOR_ID=65521 - -CONFIG_STD_CPP14=y - -CONFIG_LOG=y -CONFIG_LOG_MODE_MINIMAL=y -CONFIG_MATTER_LOG_LEVEL_DBG=y -CONFIG_LOG_DEFAULT_LEVEL=2 -CONFIG_PRINTK_SYNC=y -CONFIG_ASSERT=y -CONFIG_HW_STACK_PROTECTION=y -CONFIG_FPU=y -CONFIG_SHELL=y - -# Enable getting reboot reasons information -CONFIG_HWINFO=y - -# Generic networking options -CONFIG_NETWORKING=y -CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POSIX_NAMES=n - -# Application stack size -CONFIG_MAIN_STACK_SIZE=8192 -CONFIG_INIT_STACKS=y - -# Enable Zephyr IPv6 multicast -CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=14 -CONFIG_NET_IPV6_MLD=y - -# Disable certain parts of Zephyr IPv6 stack -CONFIG_NET_IPV6_NBR_CACHE=n - -# Network buffers -CONFIG_NET_PKT_RX_COUNT=16 -CONFIG_NET_PKT_TX_COUNT=16 -CONFIG_NET_BUF_RX_COUNT=80 -CONFIG_NET_BUF_TX_COUNT=80 - -# Bluetooth Low Energy configs -CONFIG_BT=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_PERIPHERAL_PREF_MIN_INT=36 -CONFIG_BT_PERIPHERAL_PREF_MAX_INT=36 -CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y -CONFIG_BT_GATT_DYNAMIC_DB=y -CONFIG_BT_DEVICE_APPEARANCE=0 -CONFIG_BT_DEVICE_NAME_DYNAMIC=y -CONFIG_BT_DEVICE_NAME_MAX=15 -CONFIG_BT_MAX_CONN=1 -CONFIG_BT_L2CAP_TX_MTU=247 -CONFIG_BT_BUF_ACL_RX_SIZE=251 -CONFIG_BT_BUF_ACL_TX_SIZE=251 -CONFIG_BT_RX_STACK_SIZE=1120 - -# Enable NFC support -CONFIG_CHIP_NFC_COMMISSIONING=y - -# L2 OpenThread enabling -CONFIG_NET_L2_OPENTHREAD=y - -# Enable Thread 1.2 features -CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y - -# Use mbedTLS from nrf_security library -CONFIG_OPENTHREAD_NRF_SECURITY_CHOICE=y - -CONFIG_CC3XX_BACKEND=n -CONFIG_OBERON_BACKEND=y - -CONFIG_MBEDTLS_ENABLE_HEAP=y -CONFIG_MBEDTLS_HEAP_SIZE=15360 -CONFIG_MBEDTLS_TLS_LIBRARY=y -CONFIG_NRF_SECURITY_ADVANCED=y - -CONFIG_MBEDTLS_AES_C=y -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_CTR_DRBG_C=y -CONFIG_MBEDTLS_CIPHER_MODE_CTR=y -CONFIG_MBEDTLS_ECJPAKE_C=y -CONFIG_MBEDTLS_SHA256_C=y -CONFIG_MBEDTLS_PK_C=y -CONFIG_MBEDTLS_PK_WRITE_C=y -CONFIG_MBEDTLS_X509_CREATE_C=y -CONFIG_MBEDTLS_X509_CSR_WRITE_C=y - -# Disable unneeded crypto operations -CONFIG_MBEDTLS_SHA384_C=n -CONFIG_MBEDTLS_SHA512_C=n -CONFIG_MBEDTLS_CIPHER_MODE_XTS=n -CONFIG_MBEDTLS_CHACHA20_C=n -CONFIG_MBEDTLS_POLY1305_C=n -CONFIG_MBEDTLS_CHACHAPOLY_C=n -CONFIG_MBEDTLS_GCM_C=n -CONFIG_MBEDTLS_RSA_C=n - -# Disable not used shell modules -CONFIG_SENSOR_SHELL=n -CONFIG_DEVICE_SHELL=n -CONFIG_DATE_SHELL=n -CONFIG_DEVMEM_SHELL=n -CONFIG_MCUBOOT_SHELL=n -CONFIG_CLOCK_CONTROL_NRF_SHELL=n -CONFIG_FLASH_SHELL=n diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index 6a191a381ec7eb..9321d5f795840a 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -32,6 +32,7 @@ config CHIP_NFC_COMMISSIONING config CHIP_OTA_REQUESTOR bool imply DFU_TARGET + imply BOOTLOADER_MCUBOOT imply IMG_MANAGER imply STREAM_FLASH imply STREAM_FLASH_ERASE diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults new file mode 100644 index 00000000000000..435f3cd3095182 --- /dev/null +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -0,0 +1,328 @@ +# +# 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. +# + +if CHIP + +config LOG + bool + default y + +choice LOG_MODE + default LOG_MODE_MINIMAL +endchoice + +choice MATTER_LOG_LEVEL_CHOICE + default MATTER_LOG_LEVEL_DBG +endchoice + +config LOG_DEFAULT_LEVEL + int + default 2 + +config PRINTK_SYNC + bool + default y + +config ASSERT + bool + default y + +config HW_STACK_PROTECTION + bool + default y + +config FPU + bool + default y + +config SHELL + bool + default y + +# Enable getting reboot reasons information +config HWINFO + bool + default y + +# Generic networking options +config NETWORKING + bool + default y + +config NET_SOCKETS + bool + default y + +config NET_SOCKETS_POSIX_NAMES + bool + default n + +# Application stack size +config MAIN_STACK_SIZE + int + default 8192 + +config INIT_STACKS + bool + default y + +# Disable certain parts of Zephyr IPv6 stack +config NET_IPV6_NBR_CACHE + bool + default n + +config NET_IPV6_MLD + bool + default y + +config NET_IF_MCAST_IPV6_ADDR_COUNT + int + default 14 + +# Network buffers +config NET_PKT_RX_COUNT + int + default 16 + +config NET_PKT_TX_COUNT + int + default 16 + +config NET_BUF_RX_COUNT + int + default 80 + +config NET_BUF_TX_COUNT + int + default 80 + +# Bluetooth Low Energy configs + +config BT + bool + default y + +config BT_PERIPHERAL + bool + default y + +config BT_PERIPHERAL_PREF_MIN_INT + int + default 36 + +config BT_PERIPHERAL_PREF_MAX_INT + int + default 36 + +config BT_GAP_AUTO_UPDATE_CONN_PARAMS + bool + default y + +config BT_GATT_DYNAMIC_DB + bool + default y + +config BT_DEVICE_APPEARANCE + int + default 0 + +config BT_DEVICE_NAME_DYNAMIC + bool + default y + +config BT_DEVICE_NAME_MAX + int + default 15 + +config BT_MAX_CONN + int + default 1 + +config BT_L2CAP_TX_MTU + int + default 247 + +config BT_BUF_ACL_RX_SIZE + int + default 251 + +config BT_BUF_ACL_TX_SIZE + int + default 251 + +config BT_RX_STACK_SIZE + int + default 1120 + +# Enable NFC support + +config CHIP_NFC_COMMISSIONING + bool + default y + +config CHIP_OTA_REQUESTOR + bool + default y + +config CHIP_QSPI_NOR + bool + default y + +# Enable OpenThread + +config NET_L2_OPENTHREAD + bool + default y + +# Enable mbedTLS from nrf_security library + +choice OPENTHREAD_SECURITY + default OPENTHREAD_NRF_SECURITY_CHOICE +endchoice + +config CC3XX_BACKEND + bool + default n + +config OBERON_BACKEND + bool + default y + +config MBEDTLS_ENABLE_HEAP + bool + default y + +config MBEDTLS_HEAP_SIZE + int + default 15360 + +config MBEDTLS_TLS_LIBRARY + bool + default y + +config NRF_SECURITY_ADVANCED + bool + default y + +config MBEDTLS_AES_C + bool + default y + +config MBEDTLS_ECP_C + bool + default y + +config MBEDTLS_ECP_DP_SECP256R1_ENABLED + bool + default y + +config MBEDTLS_CTR_DRBG_C + bool + default y + +config MBEDTLS_CIPHER_MODE_CTR + bool + default y + +config MBEDTLS_ECJPAKE_C + bool + default y + +config MBEDTLS_SHA256_C + bool + default y + +config MBEDTLS_PK_C + bool + default y + +config MBEDTLS_PK_WRITE_C + bool + default y + +config MBEDTLS_X509_CREATE_C + bool + default y + +config MBEDTLS_X509_CSR_WRITE_C + bool + default y + +# Disable unneeded crypto operations + +config MBEDTLS_SHA384_C + bool + default n + +config MBEDTLS_SHA512_C + bool + default n + +config MBEDTLS_CIPHER_MODE_XTS + bool + default n + +config MBEDTLS_CHACHA20_C + bool + default n + +config MBEDTLS_POLY1305_C + bool + default n + +config MBEDTLS_CHACHAPOLY_C + bool + default n + +config MBEDTLS_GCM_C + bool + default n + +config MBEDTLS_RSA_C + bool + default n + +# Disable not used shell modules + +config SENSOR_SHELL + bool + default n + +config DEVICE_SHELL + bool + default n + +config DATE_SHELL + bool + default n + +config DEVMEM_SHELL + bool + default n + +config MCUBOOT_SHELL + bool + default n + +config CLOCK_CONTROL_NRF_SHELL + bool + default n + +config FLASH_SHELL + bool + default n + +endif diff --git a/config/nrfconnect/chip-module/Kconfig.features b/config/nrfconnect/chip-module/Kconfig.features new file mode 100644 index 00000000000000..4f467ee9db1aa8 --- /dev/null +++ b/config/nrfconnect/chip-module/Kconfig.features @@ -0,0 +1,116 @@ +# +# 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. +# + +if CHIP + +config CHIP_QSPI_NOR + bool + +if CHIP_QSPI_NOR + +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 + +endif + +config CHIP_DFU_OVER_BT_SMP + bool "ss" + imply CHIP_QSPI_NOR + imply BOOTLOADER_MCUBOOT + help + fewfwe + +if CHIP_DFU_OVER_BT_SMP + +# MCU Manager and SMP configuration +config MCUMGR + bool + default y + +config MCUMGR_CMD_IMG_MGMT + bool + default y + +config MCUMGR_CMD_OS_MGMT + bool + default y + +config MCUMGR_SMP_BT + bool + default y + +config MCUMGR_SMP_BT_AUTHEN + bool + default n + +config MCUMGR_BUF_COUNT + int + default 6 + +# Increase BT MTU and RX buffer for big size DFU messages +config BT_L2CAP_TX_MTU + int + default 498 + +config BT_BUF_ACL_RX_SIZE + int + default 502 + +# Increase MCUMGR_BUF_SIZE, as it must be big enough to fit MAX MTU + overhead and for single-image DFU default is 384 B +config MCUMGR_BUF_SIZE + int + default 1024 + +# Increase system workqueue size, as SMP is processed within it +config SYSTEM_WORKQUEUE_STACK_SIZE + int + default 2800 + +if SOC_SERIES_NRF53X + +config UPDATEABLE_IMAGE_NUMBER + int + default 2 + +# FLASH nop device is enabled to prevent bus faults when mcumgr tries to access +# simulated partition with network core image data. +config FLASH_NOP_DEVICE + bool + default y + +# Enable custom SMP request to erase settings partition. +config MCUMGR_GRP_ZEPHYR_BASIC + bool + default y + +config MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE + bool + default y + +endif + +endif + +endif diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index ea6962845cdf1a..9a9f938ba8b6f3 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -22,25 +22,7 @@ get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-cluster 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 ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -option(BUILD_WITH_DFU "Build target with Device Firmware Upgrade support" OFF) -if(BUILD_WITH_DFU) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - # Enable Matter OTA Requestor - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) -endif() +set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}") list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) diff --git a/examples/all-clusters-app/nrfconnect/Kconfig b/examples/all-clusters-app/nrfconnect/Kconfig index 4d6115b4b87e7c..176fd68f573c21 100644 --- a/examples/all-clusters-app/nrfconnect/Kconfig +++ b/examples/all-clusters-app/nrfconnect/Kconfig @@ -22,4 +22,6 @@ config STATE_LEDS Use LEDs to render the current state of the device such as the progress of commissioning of the device into a network or the factory reset initiation. +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" source "Kconfig.zephyr" diff --git a/examples/all-clusters-app/nrfconnect/README.md b/examples/all-clusters-app/nrfconnect/README.md index 2f994822b9966f..9c85bdec6a038f 100644 --- a/examples/all-clusters-app/nrfconnect/README.md +++ b/examples/all-clusters-app/nrfconnect/README.md @@ -35,6 +35,7 @@ into an existing Matter network and can be controlled by this network. - [Building with low-power configuration](#building-with-low-power-configuration) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Testing the example](#testing-the-example) - [Testing using CHIPTool](#testing-using-chiptool) @@ -278,7 +279,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -293,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 @@ -307,7 +308,7 @@ To build the example with configuration that supports DFU, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=1 + $ west build -b build-target -- -DCONFIG_CHIP_OTA_REQUESTOR=y > **Note**: > @@ -320,25 +321,13 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > > Currently the multi-image mode is not available for the Matter OTA DFU. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +`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`). #### Changing flash memory settings @@ -372,6 +361,18 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported features. Configuration files are provided for different build types and they are located in the `configuration/build-target` directory. + +The `prj.conf` file represents a debug build type. Other build types are covered by dedicated files with the build type added as a suffix to the prj part, as per the following list. For example, the release build type file name is `prj_release.conf`. If a board has other configuration files, for example associated with partition layout or child image configuration, these follow the same pattern. + +Before you start testing the application, you can select one of the build types supported by the sample. This sample supports the following build types, depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional features for verifying the application behavior, such as logs or command-line shell. +- release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/all-clusters-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf similarity index 100% rename from examples/all-clusters-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf rename to examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf diff --git a/examples/lighting-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf similarity index 100% rename from examples/lighting-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf rename to examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay similarity index 100% rename from examples/all-clusters-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay rename to examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay diff --git a/examples/all-clusters-app/nrfconnect/prj.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf similarity index 80% rename from examples/all-clusters-app/nrfconnect/prj.conf rename to examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf index d3ba4fab874572..5426c90d393ffb 100644 --- a/examples/all-clusters-app/nrfconnect/prj.conf +++ b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,6 +25,7 @@ CONFIG_DK_LIBRARY=y # Default OpenThread network settings +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_PANID=4660 CONFIG_OPENTHREAD_CHANNEL=15 CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" @@ -30,9 +34,16 @@ CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" # Bluetooth overrides CONFIG_BT_DEVICE_NAME="AllClusters" +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf new file mode 100644 index 00000000000000..740c2c5117552d --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf @@ -0,0 +1,62 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="AllClusters" + +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" + +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/all-clusters-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf similarity index 100% rename from examples/all-clusters-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf rename to examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf diff --git a/examples/lighting-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf similarity index 100% rename from examples/lighting-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf rename to examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf diff --git a/examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf similarity index 100% rename from examples/all-clusters-app/nrfconnect/child_image/multiprotocol_rpmsg.conf rename to examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf diff --git a/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf similarity index 77% rename from config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf rename to examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf index 51901e0f573240..b22013c122cf4d 100644 --- a/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf +++ b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf @@ -14,9 +14,9 @@ # limitations under the License. # -CONFIG_BOOTLOADER_MCUBOOT=y - -# QSPI configuration -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 +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 diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay similarity index 100% rename from examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf new file mode 100644 index 00000000000000..ec82a5c97c169d --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf @@ -0,0 +1,53 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="AllClusters" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" + +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 diff --git a/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf new file mode 100644 index 00000000000000..a2ef7070917238 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf @@ -0,0 +1,63 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="AllClusters" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" + +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/light-switch-app/nrfconnect/CMakeLists.txt b/examples/light-switch-app/nrfconnect/CMakeLists.txt index 3610cbfc72b526..c0f5f2e0a81115 100644 --- a/examples/light-switch-app/nrfconnect/CMakeLists.txt +++ b/examples/light-switch-app/nrfconnect/CMakeLists.txt @@ -22,38 +22,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) 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 ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) -endif() +set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}") list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -93,7 +62,7 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/light-switch-app/nrfconnect/Kconfig b/examples/light-switch-app/nrfconnect/Kconfig index 9bee833c7681de..59e94a75c47b31 100644 --- a/examples/light-switch-app/nrfconnect/Kconfig +++ b/examples/light-switch-app/nrfconnect/Kconfig @@ -23,4 +23,6 @@ config STATE_LEDS the device into a network or the factory reset initiation. Note that setting this option to 'n' does not disable the LED indicating the state of the simulated bolt. +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" source "Kconfig.zephyr" diff --git a/examples/light-switch-app/nrfconnect/README.md b/examples/light-switch-app/nrfconnect/README.md index a11642be5d72a6..8faa2fb6f887df 100644 --- a/examples/light-switch-app/nrfconnect/README.md +++ b/examples/light-switch-app/nrfconnect/README.md @@ -42,6 +42,7 @@ into an existing Matter network and can be controlled by this network. - [Building with low-power configuration](#building-with-low-power-configuration) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Testing the example](#testing-the-example) - [Binding process](#binding-process) @@ -446,7 +447,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -461,11 +462,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 @@ -475,13 +476,13 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + $ west build -b build-target -- -DCONFIG_CHIP_OTA_REQUESTOR=n -DCONFIG_CHIP_DFU_OVER_BT_SMP=n > **Note**: > @@ -492,29 +493,13 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > upgrading the application core and network core firmware in two-core nRF5340 > DK devices. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +`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`). Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -553,6 +538,18 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported features. Configuration files are provided for different build types and they are located in the `configuration/build-target` directory. + +The `prj.conf` file represents a debug build type. Other build types are covered by dedicated files with the build type added as a suffix to the prj part, as per the following list. For example, the release build type file name is `prj_release.conf`. If a board has other configuration files, for example associated with partition layout or child image configuration, these follow the same pattern. + +Before you start testing the application, you can select one of the build types supported by the sample. This sample supports the following build types, depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional features for verifying the application behavior, such as logs or command-line shell. +- release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/lock-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf similarity index 100% rename from examples/lock-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf rename to examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf diff --git a/examples/pump-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf similarity index 100% rename from examples/pump-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf rename to examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf diff --git a/examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay similarity index 100% rename from examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay rename to examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay diff --git a/examples/light-switch-app/nrfconnect/prj.conf b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf similarity index 82% rename from examples/light-switch-app/nrfconnect/prj.conf rename to examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf index e40660a99c276f..d23877fbb435e0 100644 --- a/examples/light-switch-app/nrfconnect/prj.conf +++ b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,6 +25,7 @@ CONFIG_DK_LIBRARY=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n @@ -29,9 +33,13 @@ CONFIG_OPENTHREAD_FTD=n # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterSwitch" +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf new file mode 100644 index 00000000000000..fcdadb8bcf8a2a --- /dev/null +++ b/examples/light-switch-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf @@ -0,0 +1,57 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterSwitch" + +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32772 == 0x8004 (example light-switch-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lock-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf similarity index 100% rename from examples/lock-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf rename to examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf diff --git a/examples/pump-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf similarity index 100% rename from examples/pump-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf rename to examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf diff --git a/examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf similarity index 100% rename from examples/light-switch-app/nrfconnect/child_image/multiprotocol_rpmsg.conf rename to examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf diff --git a/examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf similarity index 100% rename from examples/lighting-app/nrfconnect/child_image/multiprotocol_rpmsg.conf rename to examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf diff --git a/examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay similarity index 100% rename from examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf new file mode 100644 index 00000000000000..2ee2d8135124ef --- /dev/null +++ b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf @@ -0,0 +1,48 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterSwitch" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32772 == 0x8004 (example light-switch-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 diff --git a/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf new file mode 100644 index 00000000000000..44fdcf67f39bb1 --- /dev/null +++ b/examples/light-switch-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf @@ -0,0 +1,58 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterSwitch" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32772 == 0x8004 (example light-switch-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index c3a87f4b99ced2..7b2131c77a45c6 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -22,43 +22,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) 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 ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -if(NOT BOARD STREQUAL "nrf52840dongle_nrf52840") - set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") -else() - set(BUILD_WITH_DFU "OFF" CACHE STRING "Build target with Device Firmware Upgrade support") -endif() - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - # Enable Matter OTA Requestor - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) -endif() +set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}") list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -104,7 +68,7 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/Kconfig similarity index 74% rename from examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf rename to examples/lighting-app/nrfconnect/Kconfig index ce2e61edce82ca..d862fc1d2ace52 100644 --- a/examples/light-switch-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/examples/lighting-app/nrfconnect/Kconfig @@ -13,5 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +mainmenu "Matter nRF Connect Lighting Example Application" -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +source "Kconfig.zephyr" diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index ac041d994de9c5..e98cd2e86ac849 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -36,6 +36,7 @@ into an existing Matter network and can be controlled by this network. - [Building with Pigweed RPCs](#building-with-pigweed-rpcs) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Flashing on the development kits](#nrfdks_flashing) - [Flashing on the nRF52840 Dongle](#nrf52840dongle_flashing) @@ -391,7 +392,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -414,13 +415,13 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + $ west build -b build-target -- -DCONFIG_CHIP_OTA_REQUESTOR=n -DCONFIG_CHIP_DFU_OVER_BT_SMP=n > **Note**: > @@ -434,29 +435,13 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > Currently the multi-image mode is only available for the DFU over Bluetooth LE > method. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +`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`). Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -495,6 +480,18 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported features. Configuration files are provided for different build types and they are located in the `configuration/build-target` directory. + +The `prj.conf` file represents a debug build type. Other build types are covered by dedicated files with the build type added as a suffix to the prj part, as per the following list. For example, the release build type file name is `prj_release.conf`. If a board has other configuration files, for example associated with partition layout or child image configuration, these follow the same pattern. + +Before you start testing the application, you can select one of the build types supported by the sample. This sample supports the following build types, depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional features for verifying the application behavior, such as logs or command-line shell. +- release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 0b169c5894fab9..00000000000000 --- a/examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 5816e439e81409..00000000000000 --- a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y - diff --git a/examples/pump-controller-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf similarity index 100% rename from examples/pump-controller-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf rename to examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf diff --git a/examples/light-switch-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf similarity index 96% rename from examples/light-switch-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf rename to examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf index 56e61619aef7d4..807ba68b805796 100644 --- a/examples/light-switch-app/nrfconnect/configuration/mcuboot_single_image_dfu.conf +++ b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2021 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. diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay similarity index 100% rename from examples/lighting-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay rename to examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay diff --git a/examples/lighting-app/nrfconnect/prj.conf b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf similarity index 86% rename from examples/lighting-app/nrfconnect/prj.conf rename to examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf index 9851733db5f347..641b356e1f7819 100644 --- a/examples/lighting-app/nrfconnect/prj.conf +++ b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -23,6 +26,7 @@ CONFIG_DK_LIBRARY=y CONFIG_PWM=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y # Default OpenThread network settings @@ -34,6 +38,9 @@ CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterLight" +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y diff --git a/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf new file mode 100644 index 00000000000000..aabb5ae4d121ad --- /dev/null +++ b/examples/lighting-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf @@ -0,0 +1,65 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y +CONFIG_PWM=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLight" + +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32773 == 0x8005 (example lighting-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 + +# Enable CHIP pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf b/examples/lighting-app/nrfconnect/configuration/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.conf similarity index 100% rename from examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.conf rename to examples/lighting-app/nrfconnect/configuration/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.conf diff --git a/examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay b/examples/lighting-app/nrfconnect/configuration/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.overlay similarity index 100% rename from examples/lighting-app/nrfconnect/boards/nrf52840dongle_nrf52840.overlay rename to examples/lighting-app/nrfconnect/configuration/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.overlay diff --git a/examples/lighting-app/nrfconnect/configuration/nrf52840dongle_nrf52840/prj.conf b/examples/lighting-app/nrfconnect/configuration/nrf52840dongle_nrf52840/prj.conf new file mode 100644 index 00000000000000..6e05de8c5408fb --- /dev/null +++ b/examples/lighting-app/nrfconnect/configuration/nrf52840dongle_nrf52840/prj.conf @@ -0,0 +1,70 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y +CONFIG_PWM=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLight" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32773 == 0x8005 (example lighting-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 + +# Make sure the pairing window starts automatically upon startup as the nRF52840 Dongle +# has only one button and it is reserved for the factory reset +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Configure shell and logging over USB +CONFIG_USB_DEVICE_STACK=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_UART_LINE_CTRL=y +CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51 + +# The minimal logging mode does not work properly with the USB CDC device, so use the deferred mode +CONFIG_LOG_MODE_MINIMAL=n +CONFIG_LOG_MODE_DEFERRED=y +CONFIG_LOG_STRDUP_MAX_STRING=128 +CONFIG_LOG_STRDUP_BUF_COUNT=24 + +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n diff --git a/examples/pump-controller-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf similarity index 100% rename from examples/pump-controller-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf rename to examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf diff --git a/examples/light-switch-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf similarity index 90% rename from examples/light-switch-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf rename to examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf index 2c4579fd928b52..ccc69439f449f0 100644 --- a/examples/light-switch-app/nrfconnect/configuration/mcuboot_multi_image_dfu.conf +++ b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Project CHIP Authors +# Copyright (c) 2021 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. @@ -31,6 +31,10 @@ 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_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y + # bootloader size optimization CONFIG_LOG=n CONFIG_CONSOLE=n diff --git a/examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf similarity index 100% rename from examples/lock-app/nrfconnect/child_image/multiprotocol_rpmsg.conf rename to examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf diff --git a/examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf similarity index 100% rename from examples/pump-app/nrfconnect/child_image/multiprotocol_rpmsg.conf rename to examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf diff --git a/examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay similarity index 100% rename from examples/lighting-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf new file mode 100644 index 00000000000000..65612bfc8f8aff --- /dev/null +++ b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf @@ -0,0 +1,56 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y +CONFIG_PWM=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLight" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32773 == 0x8005 (example lighting-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 + +# Enable CHIP pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf new file mode 100644 index 00000000000000..44bc002c2aa259 --- /dev/null +++ b/examples/lighting-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf @@ -0,0 +1,66 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y +CONFIG_PWM=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_FTD=y + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLight" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32773 == 0x8005 (example lighting-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 + +# Enable CHIP pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index 9c813ca962a5c4..192aa765a65878 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -21,38 +21,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) 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 ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) -endif() +set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}") list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -95,6 +64,6 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/lock-app/nrfconnect/Kconfig b/examples/lock-app/nrfconnect/Kconfig index 2b702dc9fc0ebe..ccf45058d8fca3 100644 --- a/examples/lock-app/nrfconnect/Kconfig +++ b/examples/lock-app/nrfconnect/Kconfig @@ -23,4 +23,6 @@ config STATE_LEDS the device into a network or the factory reset initiation. Note that setting this option to 'n' does not disable the LED indicating the state of the simulated bolt. +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" source "Kconfig.zephyr" diff --git a/examples/lock-app/nrfconnect/README.md b/examples/lock-app/nrfconnect/README.md index 4ad73a8b7d4f90..92581dc9266a84 100644 --- a/examples/lock-app/nrfconnect/README.md +++ b/examples/lock-app/nrfconnect/README.md @@ -36,6 +36,7 @@ into an existing Matter network and can be controlled by this network. - [Building with low-power configuration](#building-with-low-power-configuration) - [Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Testing the example](#testing-the-example) - [Testing using CHIPTool](#testing-using-chiptool) @@ -375,7 +376,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -390,11 +391,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 @@ -404,13 +405,13 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + $ west build -b build-target -- -DCONFIG_CHIP_OTA_REQUESTOR=n -DCONFIG_CHIP_DFU_OVER_BT_SMP=n > **Note**: > @@ -421,29 +422,13 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > upgrading the application core and network core firmware in two-core nRF5340 > DK devices. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +`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`). Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -482,6 +467,18 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported features. Configuration files are provided for different build types and they are located in the `configuration/build-target` directory. + +The `prj.conf` file represents a debug build type. Other build types are covered by dedicated files with the build type added as a suffix to the prj part, as per the following list. For example, the release build type file name is `prj_release.conf`. If a board has other configuration files, for example associated with partition layout or child image configuration, these follow the same pattern. + +Before you start testing the application, you can select one of the build types supported by the sample. This sample supports the following build types, depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional features for verifying the application behavior, such as logs or command-line shell. +- release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 0b169c5894fab9..00000000000000 --- a/examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 5816e439e81409..00000000000000 --- a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y - diff --git a/config/nrfconnect/app/release.conf b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf similarity index 55% rename from config/nrfconnect/app/release.conf rename to examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf index 22f3704b63b416..4bd385555cf1b4 100644 --- a/config/nrfconnect/app/release.conf +++ b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Project CHIP Authors +# Copyright (c) 2021 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. @@ -14,24 +14,25 @@ # limitations under the License. # -# This file contains settings which are not suitable for development phase of -# a project (in which debugging facilities should be enabled by default), but -# are perfectly valid for release builds which aim to generate binaries with -# minimal memory footprint. +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 -# Disable assertions -CONFIG_ASSERT=n +CONFIG_BOOT_MAX_IMG_SECTORS=256 -# Disable shell/console -CONFIG_SHELL=n -CONFIG_OPENTHREAD_SHELL=n +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n CONFIG_CONSOLE=n -CONFIG_UART_CONSOLE=n CONFIG_SERIAL=n - -# Disable logs -CONFIG_LOG=n -CONFIG_LOG_MODE_MINIMAL=n - -# Disable other debugging features -CONFIG_THREAD_NAME=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf new file mode 100644 index 00000000000000..4bd385555cf1b4 --- /dev/null +++ b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf @@ -0,0 +1,38 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay similarity index 100% rename from examples/lock-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay rename to examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf similarity index 83% rename from examples/lock-app/nrfconnect/prj.conf rename to examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf index dabdbeef761f31..39a5044a1581f7 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 Project CHIP Authors +# 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. @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,6 +25,7 @@ CONFIG_DK_LIBRARY=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n @@ -35,6 +39,9 @@ CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterLock" +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y diff --git a/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf new file mode 100644 index 00000000000000..7a59e7a28c5a19 --- /dev/null +++ b/examples/lock-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf @@ -0,0 +1,63 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLock" + +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32774 == 0x8006 (example lock-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf new file mode 100644 index 00000000000000..4daff546711a62 --- /dev/null +++ b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf @@ -0,0 +1,52 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 +CONFIG_BOOT_UPGRADE_ONLY=y +# 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=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_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf new file mode 100644 index 00000000000000..4daff546711a62 --- /dev/null +++ b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf @@ -0,0 +1,52 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 +CONFIG_BOOT_UPGRADE_ONLY=y +# 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=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_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg.conf b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf similarity index 100% rename from examples/pump-controller-app/nrfconnect/child_image/multiprotocol_rpmsg.conf rename to examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf diff --git a/config/nrfconnect/app/overlay-ota_requestor.conf b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf similarity index 79% rename from config/nrfconnect/app/overlay-ota_requestor.conf rename to examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf index 51f0acd210a330..329d787b50feab 100644 --- a/config/nrfconnect/app/overlay-ota_requestor.conf +++ b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf @@ -14,4 +14,9 @@ # limitations under the License. # -CONFIG_CHIP_OTA_REQUESTOR=y +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 diff --git a/examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay similarity index 100% rename from examples/lock-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf new file mode 100644 index 00000000000000..0038efbb5e0e0e --- /dev/null +++ b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf @@ -0,0 +1,54 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLock" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32774 == 0x8006 (example lock-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 diff --git a/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf new file mode 100644 index 00000000000000..d730a92b932f97 --- /dev/null +++ b/examples/lock-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf @@ -0,0 +1,64 @@ +# +# 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterLock" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32774 == 0x8006 (example lock-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/pigweed-app/nrfconnect/CMakeLists.txt b/examples/pigweed-app/nrfconnect/CMakeLists.txt index 0011014caa2537..20be593146793d 100644 --- a/examples/pigweed-app/nrfconnect/CMakeLists.txt +++ b/examples/pigweed-app/nrfconnect/CMakeLists.txt @@ -22,7 +22,8 @@ set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") 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) +set(CONF_FILE prj.conf) + if(${BOARD} STREQUAL "nrf52840dongle_nrf52840") list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-usb_support.conf) endif() diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/pigweed-app/nrfconnect/Kconfig similarity index 74% rename from examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf rename to examples/pigweed-app/nrfconnect/Kconfig index ce2e61edce82ca..d862fc1d2ace52 100644 --- a/examples/all-clusters-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/examples/pigweed-app/nrfconnect/Kconfig @@ -13,5 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +mainmenu "Matter nRF Connect Lighting Example Application" -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +source "Kconfig.zephyr" diff --git a/examples/pigweed-app/nrfconnect/prj.conf b/examples/pigweed-app/nrfconnect/prj.conf index 58a0fe63277b34..b160abba763e81 100644 --- a/examples/pigweed-app/nrfconnect/prj.conf +++ b/examples/pigweed-app/nrfconnect/prj.conf @@ -13,12 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +CONFIG_CHIP=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + # Export POSIX names for functions implementing a subset of POSIX standard in Zephyr CONFIG_POSIX_API=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y + # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y @@ -26,6 +35,9 @@ CONFIG_MPU_STACK_GUARD=y # Enable Pigweed RPC CONFIG_CHIP_PW_RPC=y +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n + # Add support for C++17 to build Pigweed components CONFIG_STD_CPP14=n CONFIG_STD_CPP17=y diff --git a/examples/pump-app/nrfconnect/CMakeLists.txt b/examples/pump-app/nrfconnect/CMakeLists.txt index c251817163c0e6..b2608c4a2393fa 100644 --- a/examples/pump-app/nrfconnect/CMakeLists.txt +++ b/examples/pump-app/nrfconnect/CMakeLists.txt @@ -21,38 +21,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) 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 ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) -endif() +set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}") list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -95,6 +64,6 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/pump-app/nrfconnect/Kconfig similarity index 74% rename from examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.conf rename to examples/pump-app/nrfconnect/Kconfig index fb419f0c7aa921..d862fc1d2ace52 100644 --- a/examples/light-switch-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ b/examples/pump-app/nrfconnect/Kconfig @@ -13,5 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +mainmenu "Matter nRF Connect Lighting Example Application" -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +source "Kconfig.zephyr" diff --git a/examples/pump-app/nrfconnect/README.md b/examples/pump-app/nrfconnect/README.md index c9dbacc8ee7f6f..3632c83acf8deb 100644 --- a/examples/pump-app/nrfconnect/README.md +++ b/examples/pump-app/nrfconnect/README.md @@ -33,6 +33,7 @@ into an existing Matter network and can be controlled by this network. - [Using native shell for setup](#using-native-shell-for-setup) - [Building](#building) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Testing the example](#testing-the-example) - [Testing using CHIPTool](#testing-using-chiptool) @@ -368,7 +369,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -381,13 +382,13 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + $ west build -b build-target -- -DCONFIG_CHIP_OTA_REQUESTOR=n -DCONFIG_CHIP_DFU_OVER_BT_SMP=n > **Note**: > @@ -401,29 +402,13 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > Currently the multi-image mode is only available for the DFU over Bluetooth LE > method. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +`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`). Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -462,6 +447,18 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported features. Configuration files are provided for different build types and they are located in the `configuration/build-target` directory. + +The `prj.conf` file represents a debug build type. Other build types are covered by dedicated files with the build type added as a suffix to the prj part, as per the following list. For example, the release build type file name is `prj_release.conf`. If a board has other configuration files, for example associated with partition layout or child image configuration, these follow the same pattern. + +Before you start testing the application, you can select one of the build types supported by the sample. This sample supports the following build types, depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional features for verifying the application behavior, such as logs or command-line shell. +- release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/pump-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/pump-app/nrfconnect/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 0b169c5894fab9..00000000000000 --- a/examples/pump-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 5816e439e81409..00000000000000 --- a/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y - diff --git a/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf new file mode 100644 index 00000000000000..4bd385555cf1b4 --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf @@ -0,0 +1,38 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf new file mode 100644 index 00000000000000..4bd385555cf1b4 --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf @@ -0,0 +1,38 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay similarity index 100% rename from examples/pump-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay rename to examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay diff --git a/examples/pump-app/nrfconnect/prj.conf b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf similarity index 85% rename from examples/pump-app/nrfconnect/prj.conf rename to examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf index b6e1e7eae71fa6..ddeb6692becd65 100644 --- a/examples/pump-app/nrfconnect/prj.conf +++ b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,6 +25,7 @@ CONFIG_DK_LIBRARY=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n @@ -35,6 +39,9 @@ CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterPump" +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y diff --git a/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf new file mode 100644 index 00000000000000..88fd0551f3a892 --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf @@ -0,0 +1,63 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterPump" + +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32784 == 0x8010 (example pump-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf new file mode 100644 index 00000000000000..4daff546711a62 --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf @@ -0,0 +1,52 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 +CONFIG_BOOT_UPGRADE_ONLY=y +# 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=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_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf new file mode 100644 index 00000000000000..4daff546711a62 --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf @@ -0,0 +1,52 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 +CONFIG_BOOT_UPGRADE_ONLY=y +# 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=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_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_GPIO=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf new file mode 100644 index 00000000000000..329d787b50feab --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf @@ -0,0 +1,22 @@ +# +# Copyright (c) 2021 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. +# + +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 diff --git a/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf new file mode 100644 index 00000000000000..329d787b50feab --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf @@ -0,0 +1,22 @@ +# +# Copyright (c) 2021 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. +# + +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 diff --git a/examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay similarity index 100% rename from examples/pump-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf new file mode 100644 index 00000000000000..02abc3206dbdb4 --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf @@ -0,0 +1,53 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterPump" + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32784 == 0x8010 (example pump-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 diff --git a/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf new file mode 100644 index 00000000000000..0c7ef05ec308f0 --- /dev/null +++ b/examples/pump-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf @@ -0,0 +1,64 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterPump" + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32784 == 0x8010 (example pump-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/pump-controller-app/nrfconnect/CMakeLists.txt b/examples/pump-controller-app/nrfconnect/CMakeLists.txt index f71527619100db..ec7bd816c0562d 100644 --- a/examples/pump-controller-app/nrfconnect/CMakeLists.txt +++ b/examples/pump-controller-app/nrfconnect/CMakeLists.txt @@ -21,38 +21,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) 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 ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.conf) - list(APPEND CONF_FILE boards/${BOARD}.conf) -endif() - -set(BUILD_WITH_DFU "MATTER" CACHE STRING "Build target with Device Firmware Upgrade support") - -if(NOT BUILD_WITH_DFU STREQUAL "OFF") - if(BUILD_WITH_DFU STREQUAL "BLE") - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-multi_image_smp_dfu_support.conf) - else() - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-single_image_smp_dfu_support.conf) - endif() - elseif(NOT BUILD_WITH_DFU STREQUAL "MATTER") - message(FATAL_ERROR "Selected invalid BUILD_WITH_DFU value: ${BUILD_WITH_DFU}") - endif() - - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-mcuboot_qspi_nor_support.conf) - list(INSERT OVERLAY_CONFIG 0 ${CHIP_ROOT}/config/nrfconnect/app/overlay-ota_requestor.conf) - - if(BOARD STREQUAL "nrf5340dk_nrf5340_cpuapp") - # DFU over Matter doesn't support multi-image update yet, but using this configs should not harm it anyway. - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_multi_image_dfu.conf CACHE INTERNAL "") - else() - set(mcuboot_OVERLAY_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/configuration/mcuboot_single_image_dfu.conf CACHE INTERNAL "") - endif() - - set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml) -endif() +set(APPLICATION_CONFIG_DIR "configuration/\${BOARD}") list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) @@ -95,6 +64,6 @@ if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) endif() -if(BUILD_WITH_DFU STREQUAL "BLE") +if(CONFIG_MCUMGR_SMP_BT) target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/all-clusters-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/pump-controller-app/nrfconnect/Kconfig similarity index 74% rename from examples/all-clusters-app/nrfconnect/boards/nrf52840dk_nrf52840.conf rename to examples/pump-controller-app/nrfconnect/Kconfig index fb419f0c7aa921..d862fc1d2ace52 100644 --- a/examples/all-clusters-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ b/examples/pump-controller-app/nrfconnect/Kconfig @@ -13,5 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +mainmenu "Matter nRF Connect Lighting Example Application" -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +source "Kconfig.zephyr" diff --git a/examples/pump-controller-app/nrfconnect/README.md b/examples/pump-controller-app/nrfconnect/README.md index bfe847869c5cda..4621cbcd949fe9 100644 --- a/examples/pump-controller-app/nrfconnect/README.md +++ b/examples/pump-controller-app/nrfconnect/README.md @@ -34,6 +34,7 @@ into an existing Matter network and can be controlled by this network. - [Using native shell for setup](#using-native-shell-for-setup) - [Building](#building) - [Configuring the example](#configuring-the-example) + - [Example build types](#example-build-types) - [Flashing and debugging](#flashing-and-debugging) - [Testing the example](#testing-the-example) - [Testing using CHIPTool](#testing-using-chiptool) @@ -368,7 +369,7 @@ following command: To build the example with release configuration that disables the diagnostic features like logs and command-line interface, run the following command: - $ west build -b build-target -- -DOVERLAY_CONFIG=third_party/connectedhomeip/config/nrfconnect/app/release.conf + $ west build -b build-target -- -DCONF_FILE=prj_release.conf Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. @@ -381,13 +382,13 @@ To enable DFU over Bluetooth LE, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=BLE + $ west build -b build-target -- -DCONFIG_CHIP_DFU_OVER_BT_SMP=y To completely disable support for both DFU methods, run the following command with _build-target_ replaced with the build target name of the Nordic Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): - $ west build -b build-target -- -DBUILD_WITH_DFU=OFF + $ west build -b build-target -- -DCONFIG_CHIP_OTA_REQUESTOR=n -DCONFIG_CHIP_DFU_OVER_BT_SMP=n > **Note**: > @@ -401,29 +402,13 @@ Semiconductor kit you are using (for example `nrf52840dk_nrf52840`): > Currently the multi-image mode is only available for the DFU over Bluetooth LE > method. -#### Changing Device Firmware Upgrade configuration - -To change the default DFU configuration, edit the following overlay files -corresponding to the selected configuration: - -- `overlay-mcuboot_qspi_nor_support.conf` - general file enabling MCUboot and - QSPI NOR support, used by all DFU configurations -- `overlay-single_image_smp_dfu_support.conf` - file enabling single-image DFU - over Bluetooth LE using SMP -- `overlay-multi_image_smp_dfu_support.conf` - file enabling multi-image DFU - over Bluetooth LE using SMP -- `overlay-ota_requestor.conf` - file enabling Matter OTA Requestor support. - -The files are located in the `config/nrfconnect/app` directory. You can also -define the desired options in your example's `prj.conf` file. - #### Changing bootloader configuration To change the default MCUboot configuration, edit the -`mcuboot_single_image_dfu.conf` or `mcuboot_multi_image_dfu.conf` overlay files -depending on whether the build target device supports multi-image DFU (nRF5340 -DK) or single-image DFU (nRF52840 DK). The files are located in the -`configuration` directory. +`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`). Make sure to keep the configuration consistent with changes made to the application configuration. This is necessary for the configuration to work, as @@ -462,6 +447,18 @@ Semiconductor's kit you own. Changes done with menuconfig will be lost if the `build` directory is deleted. To make them persistent, save the configuration options in the `prj.conf` file. + +### Example build types + +The example uses different configuration files depending on the supported features. Configuration files are provided for different build types and they are located in the `configuration/build-target` directory. + +The `prj.conf` file represents a debug build type. Other build types are covered by dedicated files with the build type added as a suffix to the prj part, as per the following list. For example, the release build type file name is `prj_release.conf`. If a board has other configuration files, for example associated with partition layout or child image configuration, these follow the same pattern. + +Before you start testing the application, you can select one of the build types supported by the sample. This sample supports the following build types, depending on the selected board: + +- debug -- Debug version of the application - can be used to enable additional features for verifying the application behavior, such as logs or command-line shell. +- release -- Release version of the application - can be used to enable only the necessary application functionalities to optimize its performance. + For more information, see the [Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) page. diff --git a/examples/pump-controller-app/nrfconnect/boards/nrf52840dk_nrf52840.conf b/examples/pump-controller-app/nrfconnect/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 0b169c5894fab9..00000000000000 --- a/examples/pump-controller-app/nrfconnect/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf b/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 5816e439e81409..00000000000000 --- a/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (c) 2021 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. -# - -CONFIG_XOROSHIRO_RANDOM_GENERATOR=y - diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf new file mode 100644 index 00000000000000..807ba68b805796 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot.conf @@ -0,0 +1,38 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf new file mode 100644 index 00000000000000..807ba68b805796 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/child_image/mcuboot_release.conf @@ -0,0 +1,38 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-controller-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay similarity index 100% rename from examples/pump-controller-app/nrfconnect/boards/nrf52840dk_nrf52840.overlay rename to examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay diff --git a/examples/pump-controller-app/nrfconnect/prj.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf similarity index 85% rename from examples/pump-controller-app/nrfconnect/prj.conf rename to examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf index ec6dfbc35d01ab..2d1a1822fd4d62 100644 --- a/examples/pump-controller-app/nrfconnect/prj.conf +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj.conf @@ -14,7 +14,10 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. @@ -22,6 +25,7 @@ CONFIG_DK_LIBRARY=y # OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n @@ -35,6 +39,9 @@ CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterPumpCtrl" +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf new file mode 100644 index 00000000000000..a103535e5e2204 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf52840dk_nrf52840/prj_release.conf @@ -0,0 +1,63 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterPumpCtrl" + +# Increase maximum data length of PDU supported in the Controller +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32785 == 0x8011 (example pump-controller-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf new file mode 100644 index 00000000000000..ccc69439f449f0 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot.conf @@ -0,0 +1,52 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 +CONFIG_BOOT_UPGRADE_ONLY=y +# 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=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_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf new file mode 100644 index 00000000000000..ccc69439f449f0 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/mcuboot_release.conf @@ -0,0 +1,52 @@ +# +# Copyright (c) 2021 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. +# + +# QSPI configuration +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 +CONFIG_BOOT_UPGRADE_ONLY=y +# 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=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_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y + +# bootloader size optimization +CONFIG_LOG=n +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_CONSOLE_HANDLER=n +CONFIG_BOOT_BANNER=n +CONFIG_TIMESLICING=n +CONFIG_RESET_ON_FATAL_ERROR=n +CONFIG_MULTITHREADING=n +CONFIG_TICKLESS_KERNEL=n +CONFIG_TIMEOUT_64BIT=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n +CONFIG_NRF_ENABLE_ICACHE=n diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf new file mode 100644 index 00000000000000..329d787b50feab --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg.conf @@ -0,0 +1,22 @@ +# +# Copyright (c) 2021 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. +# + +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 diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf new file mode 100644 index 00000000000000..329d787b50feab --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/child_image/multiprotocol_rpmsg_release.conf @@ -0,0 +1,22 @@ +# +# Copyright (c) 2021 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. +# + +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 diff --git a/examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay similarity index 100% rename from examples/pump-controller-app/nrfconnect/boards/nrf5340dk_nrf5340_cpuapp.overlay rename to examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf new file mode 100644 index 00000000000000..e9976847fbcd00 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj.conf @@ -0,0 +1,53 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterPumpCtrl" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Additional configs for debbugging experience. +CONFIG_THREAD_NAME=y +CONFIG_MPU_STACK_GUARD=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32785 == 0x8011 (example pump-controller-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 \ No newline at end of file diff --git a/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf new file mode 100644 index 00000000000000..794d8a4e70b082 --- /dev/null +++ b/examples/pump-controller-app/nrfconnect/configuration/nrf5340dk_nrf5340_cpuapp/prj_release.conf @@ -0,0 +1,64 @@ +# +# Copyright (c) 2020 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. +# + +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# Add support for LEDs and buttons on Nordic development kits +CONFIG_DK_LIBRARY=y + +# OpenThread configs +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y +CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y +CONFIG_OPENTHREAD_MTD=y +CONFIG_OPENTHREAD_FTD=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Bluetooth overrides +CONFIG_BT_DEVICE_NAME="MatterPumpCtrl" + +# Generate random numbers using Xoroshiro algorithm instead of direct calls +# to the cryptocell library to workaround firmware hangs. +CONFIG_XOROSHIRO_RANDOM_GENERATOR=y + +# Enable system reset on fatal error +CONFIG_RESET_ON_FATAL_ERROR=y + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" +# 32785 == 0x8011 (example pump-controller-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 + +# Disable all debug features +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_PRINTK=n +CONFIG_THREAD_NAME=n diff --git a/examples/shell/nrfconnect/CMakeLists.txt b/examples/shell/nrfconnect/CMakeLists.txt index 87f43c4dff3e61..099f60ba63c0e2 100644 --- a/examples/shell/nrfconnect/CMakeLists.txt +++ b/examples/shell/nrfconnect/CMakeLists.txt @@ -21,7 +21,8 @@ get_filename_component(APP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. REALPATH) 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) +set(CONF_FILE prj.conf) + list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nrfconnect/chip-module) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) diff --git a/examples/shell/nrfconnect/Kconfig b/examples/shell/nrfconnect/Kconfig new file mode 100644 index 00000000000000..d862fc1d2ace52 --- /dev/null +++ b/examples/shell/nrfconnect/Kconfig @@ -0,0 +1,20 @@ +# +# 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. +# +mainmenu "Matter nRF Connect Lighting Example Application" + +rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults" +rsource "../../../config/nrfconnect/chip-module/Kconfig.features" +source "Kconfig.zephyr" diff --git a/examples/shell/nrfconnect/prj.conf b/examples/shell/nrfconnect/prj.conf index 8dcc92edfa3891..4e2efc75b58344 100644 --- a/examples/shell/nrfconnect/prj.conf +++ b/examples/shell/nrfconnect/prj.conf @@ -14,10 +14,15 @@ # limitations under the License. # -# This sample uses sample-defaults.conf to set options common for all +CONFIG_CHIP=y +CONFIG_STD_CPP14=y + +# This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample # or overrides of default values. +CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y + # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y @@ -33,6 +38,9 @@ CONFIG_OPENTHREAD_FTD=y CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +# Disable OTA requestor +CONFIG_CHIP_OTA_REQUESTOR=n + # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="CHIPProjectConfig.h" # 32786 == 0x8012 (example shell-app)