Skip to content

Commit

Permalink
applications: nrf_desktop: Align after migration to sysbuild
Browse files Browse the repository at this point in the history
Jira: NCSDK-27889

Signed-off-by: Mateusz Kapala <[email protected]>
  • Loading branch information
mkapala-nordic committed Jun 13, 2024
1 parent 1392818 commit 0a21be0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 36 deletions.
6 changes: 3 additions & 3 deletions applications/nrf_desktop/board_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ nRF52840 Gaming Mouse (``nrf52840gmouse``)
* Bluetooth is configured to use Nordic's SoftDevice link layer.

* The configuration with the B0 bootloader is set as default.
* The board supports ``debug`` (:file:`prj_fast_pair.conf`) and ``release`` (:file:`prj_release_fast_pair.conf`) :ref:`nrf_desktop_bluetooth_guide_fast_pair` configurations.
* The board supports ``debug`` (``fast_pair`` file suffix) and ``release`` (``release_fast_pair`` file suffix) :ref:`nrf_desktop_bluetooth_guide_fast_pair` configurations.
Both configurations use the MCUboot bootloader built in the direct-xip mode (``MCUBOOT+XIP``), and they support the firmware updates using the :ref:`nrf_desktop_dfu` and the :ref:`nrf_desktop_dfu_mcumgr`.

nRF52832 Desktop Mouse (``nrf52dmouse``) and nRF52810 Desktop Mouse (``nrf52810dmouse``)
Expand All @@ -58,7 +58,7 @@ Sample mouse, keyboard or dongle (``nrf52840dk/nrf52840``)
* The build types allow to build the application as mouse, keyboard or dongle.
* Inputs are simulated based on the hardware button presses.
* The configuration with the B0 bootloader is set as default.
* The board supports ``debug`` :ref:`nrf_desktop_bluetooth_guide_fast_pair` configuration that acts as a mouse (:file:`prj_fast_pair.conf`).
* The board supports ``debug`` :ref:`nrf_desktop_bluetooth_guide_fast_pair` configuration that acts as a mouse (``fast_pair`` file suffix).
The configuration uses the MCUboot bootloader built in the direct-xip mode (``MCUBOOT+XIP``), and supports firmware updates using the :ref:`nrf_desktop_dfu` and the :ref:`nrf_desktop_dfu_mcumgr`.

Sample dongle (``nrf52833dk/nrf52833``)
Expand All @@ -80,7 +80,7 @@ nRF52832 Desktop Keyboard (``nrf52kbd``)
* The application is configured to act as a keyboard, with the Bluetooth LE transport enabled.
* Bluetooth is configured to use Nordic Semiconductor's SoftDevice link layer.
* The preconfigured build types configure the device without the bootloader in debug mode and with B0 bootloader in release mode due to memory size limits.
* The board supports ``release`` :ref:`nrf_desktop_bluetooth_guide_fast_pair` configuration (:file:`prj_release_fast_pair.conf`).
* The board supports ``release`` :ref:`nrf_desktop_bluetooth_guide_fast_pair` configuration (``release_fast_pair`` file suffix).
The configuration uses the MCUboot bootloader built in the direct-xip mode (``MCUBOOT+XIP``), and supports firmware updates using the :ref:`nrf_desktop_dfu` and the :ref:`nrf_desktop_dfu_mcumgr`.

nRF52840 USB Dongle (``nrf52840dongle/nrf52840``) and nRF52833 USB Dongle (``nrf52833dongle``)
Expand Down
39 changes: 23 additions & 16 deletions applications/nrf_desktop/bootloader_dfu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,31 @@ See :ref:`nrf_desktop_memory_layout` for details.
Configuring the B0 bootloader
=============================

To enable the B0 bootloader, select the :kconfig:option:`CONFIG_SECURE_BOOT` Kconfig option in the application configuration.
To enable the B0 bootloader, select the :kconfig:option:`SB_CONFIG_SECURE_BOOT_APPCORE` Kconfig option in the sysbuild configuration.
It automatically enables the :kconfig:option:`SB_CONFIG_SECURE_BOOT_BUILD_S1_VARIANT_IMAGE` option to construct the application binaries for both application's slots in non-volatile memory.

The B0 bootloader additionally requires enabling the following options in the application configuration:
The B0 bootloader additionally requires enabling the following options:

* :kconfig:option:`CONFIG_SB_SIGNING_KEY_FILE` - Required for providing the signature used for image signing and verification.
* :kconfig:option:`CONFIG_FW_INFO` - Required for the application versioning information.
* :kconfig:option:`CONFIG_FW_INFO_FIRMWARE_VERSION` - Enable this option to set the version of the application after you enabled :kconfig:option:`CONFIG_FW_INFO`.
The nRF Desktop application with the B0 bootloader configuration builds two application images: one for the S0 slot and the other for the S1 slot.
To generate the DFU package, you need to update this configuration only in the main application image as the ``s1_image`` child image mirrors it.
You can do that by rebuilding the application from scratch or by changing the configuration of the main image through menuconfig.
* :kconfig:option:`CONFIG_BUILD_S1_VARIANT` - Required for the build system to be able to construct the application binaries for both application's slots in non-volatile memory.
* In the sysbuild configuration:

* :kconfig:option:`SB_CONFIG_SECURE_BOOT_SIGNING_KEY_FILE` - Required for providing the signature used for image signing and verification.

* In the application configuration:

* :kconfig:option:`CONFIG_FW_INFO` - Required for the application versioning information.
* :kconfig:option:`CONFIG_FW_INFO_FIRMWARE_VERSION` - Enable this option to set the version of the application after you enabled :kconfig:option:`CONFIG_FW_INFO`.
The nRF Desktop application with the B0 bootloader configuration builds two application images: one for the S0 slot and the other for the S1 slot.
To generate the DFU package, you need to update this configuration only in the main application image as the ``s1_image`` child image mirrors it.
You can do that by rebuilding the application from scratch or by changing the configuration of the main image through menuconfig.

.. _nrf_desktop_configuring_mcuboot_bootloader:

Configuring the MCUboot bootloader
==================================

To enable the MCUboot bootloader, select the :kconfig:option:`CONFIG_BOOTLOADER_MCUBOOT` Kconfig option in the application configuration.
To enable the MCUboot bootloader, select the :kconfig:option:`SB_CONFIG_BOOTLOADER_MCUBOOT` Kconfig option in the sysbuild configuration.

The MCUboot private key path (:kconfig:option:`CONFIG_BOOT_SIGNATURE_KEY_FILE`) must be set only in the MCUboot bootloader configuration file.
The MCUboot private key path (:kconfig:option:`SB_CONFIG_BOOT_SIGNATURE_KEY_FILE`) must be also set in the sysbuild configuration file.
The key is used both by the build system (to sign the application update images) and by the bootloader (to verify the application signature using public key derived from the selected private key).

The MCUboot bootloader configuration depends on the selected way of performing image upgrade.
Expand All @@ -116,9 +121,10 @@ Direct-xip mode

The direct-xip mode is used for the :ref:`background DFU <nrf_desktop_bootloader_background_dfu>`.
In this mode, the MCUboot bootloader boots an image directly from a given slot, so the swap operation is not needed.
To set the MCUboot mode of operations to the direct-xip mode, make sure to enable the :kconfig:option:`CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP` Kconfig option in the application configuration.
This option automatically enables :kconfig:option:`CONFIG_BOOT_BUILD_DIRECT_XIP_VARIANT` to build application update images for both slots.
To set the MCUboot mode of operations to the direct-xip mode, make sure to enable the :kconfig:option:`SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP` Kconfig option in the sysbuild configuration.
This option automatically enables :kconfig:option:`SB_CONFIG_MCUBOOT_BUILD_DIRECT_XIP_VARIANT` to build application update images for both slots.

.. TODO: It might be propagated from the sysbuild configuration -> nrf/sysbuild/CMakeLists.txt:L224
Enable the ``CONFIG_BOOT_DIRECT_XIP`` Kconfig option in the bootloader configuration to make the MCUboot run the image directly from both image slots.
The nRF Desktop's bootloader configurations do not enable the revert mechanism (``CONFIG_BOOT_DIRECT_XIP_REVERT``).
When the direct-xip mode is enabled (the :kconfig:option:`CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP` Kconfig option is set in the application configuration), the application modules that control the DFU transport do not request firmware upgrades and do not confirm the running image.
Expand Down Expand Up @@ -160,7 +166,7 @@ For an example of bootloader Kconfig configuration file defined by the applicati
.. note::
The nRF Desktop devices use either the serial recovery DFU with a single application slot or the background DFU.
Both mentioned firmware upgrade methods are not used simultaneously by any of the configurations.
For example, the ``nrf52840dk/nrf52840`` board in ``prj_mcuboot_smp.conf`` uses only the background DFU and does not enable the serial recovery feature.
For example, the ``nrf52840dk/nrf52840`` board in ``mcuboot_smp`` file suffix uses only the background DFU and does not enable the serial recovery feature.

.. _nrf_desktop_bootloader_background_dfu:

Expand Down Expand Up @@ -200,6 +206,7 @@ The update image is generated in the build directory when building the firmware
MCUboot and B0 bootloaders
--------------------------

.. TODO: Align path to file when the dfu_application.zip will be in one place for both bootloaders.
The :file:`zephyr/dfu_application.zip` file is used by both B0 and MCUboot bootloader for the background DFU through the :ref:`nrf_desktop_config_channel` and :ref:`nrf_desktop_dfu`.
The package contains firmware images along with additional metadata.
If the used bootloader boots the application directly from either slot 0 or slot 1, the host script transfers the update image that can be run from the unused slot.
Expand Down Expand Up @@ -284,13 +291,13 @@ Once the device enters the serial recovery mode, you can use the :ref:`mcumgr <z

* Query information about the present image.
* Upload the new image.
The :ref:`mcumgr <zephyr:device_mgmt>` uses the :file:`zephyr/app_update.bin` update image file.
The :ref:`mcumgr <zephyr:device_mgmt>` uses the :file:`zephyr/nrf_desktop/zephyr.signed.bin` update image file.
It is generated by the build system when building the firmware.

For example, the following line starts the upload of the new image to the device:

.. code-block:: console
mcumgr -t 60 --conntype serial --connstring=/dev/ttyACM0 image upload build-nrf52833dongle/zephyr/app_update.bin
mcumgr -t 60 --conntype serial --connstring=/dev/ttyACM0 image upload build-nrf52833dongle/zephyr/nrf_desktop/zephyr.signed.bin
The command assumes that ``/dev/ttyACM0`` serial device is used by the MCUboot bootloader for the serial recovery.
33 changes: 17 additions & 16 deletions applications/nrf_desktop/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,12 @@ See :ref:`nrf_desktop_porting_guide` for details.
nRF Desktop build types
=======================

The nRF Desktop application does not use a single :file:`prj.conf` file.
The nRF Desktop application uses multiple files to configure the particular build type.
Those files can be easily identified by their :ref:`zephyr:application-file-suffixes`.
Before you start testing the application, you can select one of the build types supported by the application.
Not every board supports all of the mentioned build types.

See :ref:`app_build_additions_build_types` and :ref:`cmake_options` for more information.
See :ref:`app_build_file_suffixes` and :ref:`cmake_options` for more information.

The application supports the following build types:

Expand All @@ -391,56 +392,56 @@ The application supports the following build types:
:header-rows: 1

* - Build type
- File name
- File suffix
- Supported board target
- Description
* - Debug (default)
- :file:`prj.conf`
- none
- All from `Requirements`_
- Debug version of the application; the same as the ``release`` build type, but with debug options enabled.
* - Release
- :file:`prj_release.conf`
- ``release``
- All from `Requirements`_
- Release version of the application with no debugging features.
* - Debug Fast Pair
- :file:`prj_fast_pair.conf`
- ``fast_pair``
- ``nrf52840dk/nrf52840``, ``nrf52840gmouse/nrf52840``
- Debug version of the application with `Fast Pair`_ support.
* - Release Fast Pair
- :file:`prj_release_fast_pair.conf`
- ``release_fast_pair``
- ``nrf52kbd/nrf52832``, ``nrf52840gmouse/nrf52840``
- Release version of the application with `Fast Pair`_ support.
* - Dongle
- :file:`prj_dongle.conf`
- ``dongle``
- ``nrf52840dk/nrf52840``
- Debug version of the application that lets you generate the application with the dongle role.
* - Keyboard
- :file:`prj_keyboard.conf`
- ``keyboard``
- ``nrf52840dk/nrf52840``
- Debug version of the application that lets you generate the application with the keyboard role.
* - MCUboot QSPI
- :file:`prj_mcuboot_qspi.conf`
- ``mcuboot_qspi``
- ``nrf52840dk/nrf52840``
- Debug version of the application that uses MCUboot with the secondary slot in the external QSPI FLASH.
* - MCUboot SMP
- :file:`prj_mcuboot_smp.conf`
- ``mcuboot_smp``
- ``nrf52840dk/nrf52840``, ``nrf52840gmouse/nrf52840``
- | Debug version of the application that enables MCUmgr with DFU support and offers support for the MCUboot DFU procedure over SMP.
| See the :ref:`nrf_desktop_bootloader_background_dfu` section for more information.
* - WWCB
- :file:`prj_wwcb.conf`
- ``wwcb``
- ``nrf52840dk/nrf52840``
- Debug version of the application with the support for the B0 bootloader enabled for `Works With ChromeBook (WWCB)`_.
* - Triple Bluetooth LE connection
- :file:`prj_3bleconn.conf`
- ``3bleconn``
- ``nrf52840dongle/nrf52840``
- Debug version of the application with the support for up to three simultaneous Bluetooth LE connections.
* - Quadruple LLPM connection
- :file:`prj_4llpmconn.conf`
- ``4llpmconn``
- ``nrf52840dongle/nrf52840``
- Debug version of the application with the support for up to four simultaneous Bluetooth LE connections, in Low Latency Packet Mode.
* - Release quadruple LLPM connection
- :file:`prj_release_4llpmconn.conf`
- ``release_4llpmconn``
- ``nrf52840dongle/nrf52840``
- Release version of the application with the support for up to four simultaneous Bluetooth LE connections, in Low Latency Packet Mode.

Expand Down Expand Up @@ -900,7 +901,7 @@ Selecting a build type
======================

Before you start testing the application, you can select one of the :ref:`nrf_desktop_requirements_build_types`, depending on your development kit.
See :ref:`cmake_options` for information about how to select a build type.
See :ref:`app_build_file_suffixes` and :ref:`cmake_options` for information about how to select a build type.

.. note::
If nRF Desktop is built with `Fast Pair`_ support, you must provide Fast Pair Model ID and Anti Spoofing private key as CMake options.
Expand Down
2 changes: 1 addition & 1 deletion applications/nrf_desktop/memory_layout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Memory layout in Partition Manager
When the :kconfig:option:`CONFIG_PARTITION_MANAGER_ENABLED` Kconfig option is enabled, the nRF Desktop application uses the Partition Manager for the memory layout configuration.
The nRF Desktop configurations use static configurations of partitions to ensure that the partition layout does not change between builds.

Add the :file:`pm_static_${BUILD_TYPE}.yml` file to the project's board configuration directory to define the static Partition Manager configuration for given board and build type.
Add the :file:`pm_static_${FILE_SUFFIX}.yml` file to the project's board configuration directory to define the static Partition Manager configuration for given board and build type.
For example, to define the static partition layout for the ``nrf52840dk/nrf52840`` board and ``release`` build type, you would need to add the :file:`pm_static_release.yml` file into the :file:`applicatons/nrf_desktop/configuration/nrf52840dk_nrf52840` directory.

Take into account the following points:
Expand Down

0 comments on commit 0a21be0

Please sign in to comment.