diff --git a/doc/samples/sid_end_device.rst b/doc/samples/sid_end_device.rst index 323790f223..091457f78f 100644 --- a/doc/samples/sid_end_device.rst +++ b/doc/samples/sid_end_device.rst @@ -117,13 +117,13 @@ You can build the ``release`` firmware for ``build_target`` by running the follo .. parsed-literal:: :class: highlight - $ west build -b *build_target* -- -DCONF_FILE=prj_release.conf + $ west build -b *build_target* -- -DFILE_SUFFIX=release For example: .. code-block:: console - $ west build -b nrf52840dk/nrf52840 -- -DCONF_FILE=prj_release.conf + $ west build -b nrf52840dk/nrf52840 -- -DFILE_SUFFIX=release .. note:: Selecting a build type is optional. diff --git a/samples/sid_end_device/CMakeLists.txt b/samples/sid_end_device/CMakeLists.txt index 1e4cb07590..648914c5fd 100644 --- a/samples/sid_end_device/CMakeLists.txt +++ b/samples/sid_end_device/CMakeLists.txt @@ -6,9 +6,6 @@ cmake_minimum_required(VERSION 3.20.0) -# Sidewalk version -include(bootloader_version.cmake) - # Zephyr CMake project find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(sidewalk_sid_end_device) diff --git a/samples/sid_end_device/Kconfig.sysbuild b/samples/sid_end_device/Kconfig.sysbuild new file mode 100644 index 0000000000..812f557fd8 --- /dev/null +++ b/samples/sid_end_device/Kconfig.sysbuild @@ -0,0 +1,54 @@ +# +# Copyright (c) 2023 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +config NRF_DEFAULT_BLUETOOTH + default y if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +if BOOTLOADER_MCUBOOT + +config DFU_MULTI_IMAGE_PACKAGE_BUILD + default y + +config DFU_MULTI_IMAGE_PACKAGE_APP + default y + +if (BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP) + +config MCUBOOT_UPDATEABLE_IMAGES + default 2 + +choice MCUBOOT_MODE + default MCUBOOT_MODE_OVERWRITE_ONLY +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_RSA +endchoice + +config SECURE_BOOT + default y + +config SECURE_BOOT_NETCORE + default y + +config NETCORE_APP_UPDATE + default y + +config DFU_MULTI_IMAGE_PACKAGE_NET + default y + +endif # BOOTLOADER_MCUBOOT + +endif # (BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP) + +config PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY + default y if BOARD_NRF52840DK_NRF52840 || BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_THINGY53_NRF5340_CPUAPP + +source "${ZEPHYR_BASE}/share/sysbuild/Kconfig" diff --git a/samples/sid_end_device/VERSION b/samples/sid_end_device/VERSION new file mode 100644 index 0000000000..808984a04c --- /dev/null +++ b/samples/sid_end_device/VERSION @@ -0,0 +1,5 @@ +VERSION_MAJOR = 2 +VERSION_MINOR = 6 +PATCHLEVEL = 99 +VERSION_TWEAK = 0 +EXTRAVERSION = diff --git a/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp.conf b/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp.conf deleted file mode 100644 index 1fd018020a..0000000000 --- a/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -# Allow for storing two images in MCUboot partitions -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 - -# Store new images inside external flash -CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y - -# Configure QSPI for external flash -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_DFU_MULTI_IMAGE=y -CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y diff --git a/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp_release.conf b/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp_release.conf deleted file mode 100644 index 1fd018020a..0000000000 --- a/samples/sid_end_device/boards/nrf5340dk_nrf5340_cpuapp_release.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -# Allow for storing two images in MCUboot partitions -CONFIG_UPDATEABLE_IMAGE_NUMBER=2 - -# Store new images inside external flash -CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y - -# Configure QSPI for external flash -CONFIG_NORDIC_QSPI_NOR=y -CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 -CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 - -CONFIG_DFU_MULTI_IMAGE=y -CONFIG_NRF53_ENFORCE_IMAGE_VERSION_EQUALITY=y diff --git a/samples/sid_end_device/sample.yaml b/samples/sid_end_device/sample.yaml index 8b730a99c9..cfef717477 100644 --- a/samples/sid_end_device/sample.yaml +++ b/samples/sid_end_device/sample.yaml @@ -2,6 +2,7 @@ sample: name: Sidewalk end device sample description: Sample implementing Amazon Sidewalk End Device common: + sysbuild: true build_only: true platform_allow: - nrf52840dk/nrf52840 @@ -19,7 +20,7 @@ tests: sample.sidewalk.hello.release: extra_args: - CONF_FILE=prj_release.conf + FILE_SUFFIX=release extra_configs: - CONFIG_SID_END_DEVICE_PERSISTENT_LINK_MASK=y tags: Sidewalk hello @@ -31,7 +32,7 @@ tests: sample.sidewalk.hello.ble_only.release: extra_args: - CONF_FILE=prj_release.conf + FILE_SUFFIX=release extra_configs: - CONFIG_SIDEWALK_SUBGHZ_SUPPORT=n tags: Sidewalk hello BLE diff --git a/samples/sid_end_device/sysbuild/hci_ipc/prj.conf b/samples/sid_end_device/sysbuild/hci_ipc/prj.conf new file mode 100644 index 0000000000..77a23bfdc5 --- /dev/null +++ b/samples/sid_end_device/sysbuild/hci_ipc/prj.conf @@ -0,0 +1,36 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +CONFIG_HEAP_MEM_POOL_SIZE=8192 +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 + +# Bluetooth +CONFIG_BT=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 +CONFIG_BT_CTLR_ASSERT_HANDLER=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_HCI_RAW_RESERVE=1 + +# Workaround: Unable to allocate command buffer when using K_NO_WAIT since +# Host number of completed commands does not follow normal flow control. +CONFIG_BT_BUF_CMD_TX_COUNT=10 + +# IPC +CONFIG_IPC_SERVICE=y +CONFIG_MBOX=y + +# Debug +CONFIG_LOG=n +CONFIG_SERIAL=n +CONFIG_ASSERT=y +CONFIG_DEBUG_INFO=y +CONFIG_EXCEPTION_STACK_TRACE=y +CONFIG_RESET_ON_FATAL_ERROR=y diff --git a/samples/sid_end_device/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf new file mode 100644 index 0000000000..c333f7b0b4 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.conf @@ -0,0 +1,10 @@ +# +# Copyright (c) 2023 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Configure QSPI for external flash +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 diff --git a/samples/sid_end_device/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 0000000000..6ea64210d7 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/samples/sid_end_device/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf new file mode 100644 index 0000000000..96cb33e553 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -0,0 +1,28 @@ +# +# Copyright (c) 2021 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# The following configurations are required to support simultaneous multi image update +CONFIG_PCD_APP=y +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +CONFIG_BOOT_SWAP_USING_MOVE=n +# Multi-image updates do not support image swapping yet. +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_ZCBOR=y +CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y diff --git a/samples/sid_end_device/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000..6ea64210d7 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/samples/sid_end_device/sysbuild/mcuboot/boards/nrf54l15pdk_nrf54l15_cpuapp.conf b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf54l15pdk_nrf54l15_cpuapp.conf new file mode 100644 index 0000000000..b8b20c99e5 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/boards/nrf54l15pdk_nrf54l15_cpuapp.conf @@ -0,0 +1,13 @@ +# +# Copyright (c) 2021 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Ensure that the qspi driver is disabled by default +CONFIG_NORDIC_QSPI_NOR=n + +# Workaroud: fprotect and watchdog feed +# are not supported in NCS v2.6.0 +CONFIG_FPROTECT=n +CONFIG_BOOT_WATCHDOG_FEED=n diff --git a/samples/sid_end_device/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf b/samples/sid_end_device/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf new file mode 100644 index 0000000000..561529faa3 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf @@ -0,0 +1,33 @@ +# +# Copyright (c) 2021 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Configure MCUboot features +CONFIG_NRF53_MULTI_IMAGE_UPDATE=y +CONFIG_BOOT_UPGRADE_ONLY=y +CONFIG_BOOT_MAX_IMG_SECTORS=256 +CONFIG_MCUBOOT_DOWNGRADE_PREVENTION=y + +# Allow for storing two images in MCUboot partitions +CONFIG_UPDATEABLE_IMAGE_NUMBER=2 + +# Store new images inside external flash +CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y + +# Enable flash simulator +CONFIG_PCD_APP=y +CONFIG_FLASH_SIMULATOR=y +CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y +CONFIG_FLASH_SIMULATOR_STATS=n + +# Configure QSPI for external flash +CONFIG_FLASH=y +CONFIG_FPROTECT=y +CONFIG_NORDIC_QSPI_NOR=y +CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 +CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 + +# Disable USB CDC ACM +CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n diff --git a/samples/sid_end_device/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay b/samples/sid_end_device/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000..6ea64210d7 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/ { + chosen { + zephyr,code-partition = &boot_partition; + nordic,pm-ext-flash = &mx25r64; + }; +}; diff --git a/samples/sid_end_device/sysbuild/mcuboot/prj.conf b/samples/sid_end_device/sysbuild/mcuboot/prj.conf new file mode 100644 index 0000000000..75d0279299 --- /dev/null +++ b/samples/sid_end_device/sysbuild/mcuboot/prj.conf @@ -0,0 +1,36 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +CONFIG_MAIN_STACK_SIZE=10240 + +CONFIG_BOOT_SWAP_SAVE_ENCTLV=n +CONFIG_BOOT_BOOTSTRAP=n +CONFIG_PM=n + +CONFIG_FLASH=y +CONFIG_FPROTECT=y + +CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" + +CONFIG_BOOT_MAX_IMG_SECTORS=256 + +# Use minimal C library instead of the Picolib +CONFIG_MINIMAL_LIBC=y + +# Bootloader size optimization +CONFIG_CONSOLE=n +CONFIG_SERIAL=n +CONFIG_UART_CONSOLE=n +CONFIG_USE_SEGGER_RTT=n +CONFIG_GPIO=n +CONFIG_LOG=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_NRF_ENABLE_ICACHE=n diff --git a/scripts/generate_version_info_overlay.py b/scripts/generate_version_info_overlay.py deleted file mode 100644 index 8d441ed2a4..0000000000 --- a/scripts/generate_version_info_overlay.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - -import subprocess -from pathlib import Path -import os -import re - - -def subtext(text, regex, if_none): - exp = re.search(regex, text) - return if_none if exp is None else exp.group(1) - - -git_describe_cmd = subprocess.run(["git", "describe"], cwd=Path( - os.path.normpath(__file__)).parents[2] / "sidewalk", capture_output=True) -if git_describe_cmd.returncode != 0: - version = "unknown" - -version = git_describe_cmd.stdout.decode("utf-8") -version_numbers = subtext(version, r"v(\d+\.\d+\.\d+)", "0.0.0") + \ - "+" + subtext(version, r"v[\d\.]+-(\d+)", "0") -print(f"CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION=\"{version_numbers}\"")