diff --git a/samples/boards/nordic/nrf_ironside/update/CMakeLists.txt b/samples/boards/nordic/nrf_ironside/update/CMakeLists.txt new file mode 100644 index 00000000000..b3aa8c35c2a --- /dev/null +++ b/samples/boards/nordic/nrf_ironside/update/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(ironside_se_update) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/boards/nordic/nrf_ironside/update/Kconfig b/samples/boards/nordic/nrf_ironside/update/Kconfig new file mode 100644 index 00000000000..702b943ff60 --- /dev/null +++ b/samples/boards/nordic/nrf_ironside/update/Kconfig @@ -0,0 +1,11 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config UPDATE_BLOB_ADDRESS + hex "Address of the update blob" + default 0xe100000 + help + Address of the update blob. The default value matches the placement of the + update blobs delivered with the IRONside SE firmware. + +source "Kconfig.zephyr" diff --git a/samples/boards/nordic/nrf_ironside/update/README.rst b/samples/boards/nordic/nrf_ironside/update/README.rst new file mode 100644 index 00000000000..2f44feedf06 --- /dev/null +++ b/samples/boards/nordic/nrf_ironside/update/README.rst @@ -0,0 +1,74 @@ +.. zephyr:code-sample:: nrf_ironside_update + :name: Nordic IRONside SE firmware update + + Update the Nordic IRONside SE firmware. + +Overview +******** + +The Nordic IRONside SE Update sample updates the IRONside SE firmware on a SoC that already has IRONside SE installed. +It can update both the main image and the recovery image of IRONside SE using the IRONside SE firmware release ZIP file. + +Update procedure +**************** + +The update procedure works as follows: + +1. The application invokes the IRONside SE update service and passes the parameters that correspond to the location of the HEX file of the IRONside SE firmware update. + +#. The application prints the return value of the service call and outputs information from the update HEX file. + +#. After the service call completes, the IRONside SE firmware updates the internal state of the device. + +#. The firmware installs the update during the next device boot. + This operation can take several seconds. + +Once the operation has completed, you can read the boot report to verify that the update has taken place. + +Building and running the application for nrf54h20dk/nrf54h20/cpuapp/iron +************************************************************************ + +.. note:: + You can use this application only when there is already a version of IRONside SE installed on the device. + +1. Unzip the IRONside SE release ZIP to get the update hex file: + + .. code-block:: console + + unzip nrf54h20_soc_binaries_v.*.zip + +#. Program the appropriate update hex file from the release ZIP using one (not both) of the following commands: + + a) To update IRONside SE firmware: + + .. code-block:: console + + nrfutil device program --traits jlink --firmware update/ironside_se_update.hex + + b) To update IRONside SE recovery firmware: + + .. code-block:: console + + nrfutil device program --traits jlink --firmware update/ironside_se_recovery_update.hex + +#. Build and program the application: + + .. zephyr-app-commands:: + :zephyr-app: samples/boards/nordic/nrf_ironside/update + :board: nrf54h20dk/nrf54h20/cpuapp/iron + :goals: flash + +#. Trigger a reset: + +.. code-block:: console + + nrfutil device reset --reset-kind RESET_PIN --traits jlink + +#. Check that the new version is installed: + + .. code-block:: console + + # Read the version fields from the boot report + nrfutil x-read --direct --address 0x2f88fd04 --bytes 16 --traits jlink + # Read the update status in the boot report + nrfutil x-read --direct --address 0x2f88fd24 --bytes 4 --traits jlink diff --git a/samples/boards/nordic/nrf_ironside/update/prj.conf b/samples/boards/nordic/nrf_ironside/update/prj.conf new file mode 100644 index 00000000000..8682307eca6 --- /dev/null +++ b/samples/boards/nordic/nrf_ironside/update/prj.conf @@ -0,0 +1,3 @@ +CONFIG_LOG=y + +CONFIG_NRF_IRONSIDE_UPDATE_SERVICE=y diff --git a/samples/boards/nordic/nrf_ironside/update/sample.yaml b/samples/boards/nordic/nrf_ironside/update/sample.yaml new file mode 100644 index 00000000000..af3c24624b8 --- /dev/null +++ b/samples/boards/nordic/nrf_ironside/update/sample.yaml @@ -0,0 +1,12 @@ +sample: + name: Nordic IRONside SE update service + description: Demonstrates how to update the Nordic IRONside SE firmware +common: + build_only: true + tags: nrf_ironside + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp/iron + +tests: + sample.boards.nordic.nrf_ironside.update: + platform_allow: nrf54h20dk/nrf54h20/cpuapp/iron diff --git a/samples/boards/nordic/nrf_ironside/update/src/main.c b/samples/boards/nordic/nrf_ironside/update/src/main.c new file mode 100644 index 00000000000..09513497de9 --- /dev/null +++ b/samples/boards/nordic/nrf_ironside/update/src/main.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +LOG_MODULE_REGISTER(app, LOG_LEVEL_INF); + +int main(void) +{ + int err; + const struct ironside_update_blob *update = (void *)CONFIG_UPDATE_BLOB_ADDRESS; + + err = ironside_update(update); + LOG_INF("IRONside update retval: 0x%x", err); + + if (err == 0) { + LOG_HEXDUMP_INF(update->manifest, sizeof(update->manifest), "Update manifest:"); + LOG_HEXDUMP_INF(update->pubkey, sizeof(update->pubkey), "Public key:"); + LOG_HEXDUMP_INF(update->signature, sizeof(update->signature), "Signature:"); + LOG_HEXDUMP_INF(update->firmware, 8, "First 8 bytes of encrypted fw:"); + LOG_INF("Reboot the device to trigger the update"); + } else { + LOG_ERR("The request to update failed"); + } + + return 0; +}