Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applications: nrf_desktop: Add SMP SUIT DFU support for nrf54h20 #15553

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

zycz
Copy link
Contributor

@zycz zycz commented May 28, 2024

Add SMP SUIT DFU support for nrf_desktop application.

JIRA: NCSDK-26998

@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label May 28, 2024
@NordicBuilder
Copy link
Contributor

NordicBuilder commented May 28, 2024

Test specification

CI/Jenkins/NRF

  • Integration Platforms

CI/Jenkins/integration

Test Module File based changes Manually selected West overwrite
desktop52_verification X

Detailed information of selected test modules

Note: This message is automatically posted and updated by the CI

@NordicBuilder
Copy link
Contributor

You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds.

Note: This comment is automatically posted by the Documentation Publishing GitHub Action.

@zycz zycz removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label May 28, 2024
Copy link
Contributor

@kapi-no kapi-no left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, suggested a few improvements

@kapi-no kapi-no added this to the 2.7.0 milestone May 29, 2024
@zycz zycz requested a review from kapi-no May 29, 2024 07:44
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label May 29, 2024
@zycz zycz force-pushed the issue26998_dfu_new branch 2 times, most recently from c8ddd78 to 1ced105 Compare May 29, 2024 08:32
applications/nrf_desktop/src/modules/dfu_mcumgr.c Outdated Show resolved Hide resolved
suit_manifest_class_id_t *)&manifest_class_id,
&seq_num, NULL, NULL, NULL, NULL);
if (!err) {
LOG_INF("SUIT image version: %d", seq_num);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call it SUIT sequence number? To be consistent with how SUIT names it.

@@ -9,20 +9,16 @@ menuconfig DESKTOP_DFU_MCUMGR_ENABLE
select EXPERIMENTAL
select CAF_BLE_SMP_TRANSFER_EVENTS if MCUMGR_TRANSPORT_BT
select MCUMGR
select MCUMGR_GRP_IMG
select MCUMGR_GRP_OS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need CONFIG_MCUMGR_GRP_OS for SUIT?

Copy link
Contributor Author

@zycz zycz Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because:

Allow a DFU host to retrieve information about the number and size of MCUmgr buffers.
The nRF Connect Device Manager uses this information to speed up the DFU.

CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y

Copy link
Contributor

@MarekPieta MarekPieta Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's only speed improvement (not an actual requirement) it should be enabled in *.conf file I think (or eventually it can be implied). Keep in mind that OS mgmt is required for SMP DFU on nRF52, because it enables system reboot command that is used right after finalized DFU image transfer (phone triggers reboot command automatically on finalized DFU).

select MCUMGR_GRP_OS
select MCUMGR_MGMT_NOTIFICATION_HOOKS
select MCUMGR_GRP_IMG_MUTEX if DESKTOP_DFU_LOCK
select MCUMGR_SMP_COMMAND_STATUS_HOOKS
select NET_BUF
select ZCBOR
select CRC
select IMG_MANAGER
select MCUBOOT_BOOTUTIL_LIB
select STREAM_FLASH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is stream flash used by SUIT? (please also double check the remaining Kconfig options selected as common)

@kapi-no
Copy link
Contributor

kapi-no commented May 29, 2024

@zycz, could you resolve Compliance issue?

@zycz zycz force-pushed the issue26998_dfu_new branch 4 times, most recently from 82b4b6f to 4c1ec45 Compare June 3, 2024 13:57
applications/nrf_desktop/src/util/desktop_suit.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/util/desktop_suit.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/modules/dfu_mcumgr.c Outdated Show resolved Hide resolved
applications/nrf_desktop/src/util/CMakeLists.txt Outdated Show resolved Hide resolved
@zycz zycz requested a review from mkapala-nordic June 3, 2024 16:38
@zycz zycz force-pushed the issue26998_dfu_new branch 2 times, most recently from 5d77a95 to 877c939 Compare June 3, 2024 16:42

# Allow for large Bluetooth data packets.
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=251
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also set CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 ?

#ifndef _DESKTOP_SUIT_UTIL_H_
#define _DESKTOP_SUIT_UTIL_H_

int suit_get_installed_manifest_seq_num(unsigned int *seq_num);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's worth to use separate file for this function (it's like 3 lines of code, it may be simply copy-pasted to the DFU module if needed)

img_mgmt_reset_upload();
#elif defined CONFIG_DESKTOP_DFU_BACKEND_SUIT
suit_dfu_cleanup();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check returned value, please.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomchy, do you plan to expose a suitfu API to allow application trigger the upload cleanup or we can rely on suit_dfu_cleanup here? If you are going to cache some information about the image upload, our current approach may introduce side-effect for you - that's why I decided to notify you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check returned value, please.

module state error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to provide suit_dfu module if you want to manage the update in a more advanced way, so this usage is correct.
The SUITFU resets the internal state whenever an upload with off == 0 is received.

@zycz zycz force-pushed the issue26998_dfu_new branch 2 times, most recently from f47c2ce to 305040e Compare June 4, 2024 08:37
depends on BOOTLOADER_MCUBOOT
select FLASH_MAP
select ZCBOR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra empty line, please

if (!err) {
LOG_INF("SUIT sequence number: %d", seq_num);
} else {
LOG_ERR("suit_get_installed_manifest_seq_num failed (err: %d)", err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error log seems outdated

applications/nrf_desktop/Kconfig.sysbuild Outdated Show resolved Hide resolved
@@ -52,3 +52,18 @@
};
};
};

&cpuapp_rw_partitions {
dfu_partition: partition@13c000 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to remember about it in #15490 🙂

img_mgmt_reset_upload();
#elif defined CONFIG_DESKTOP_DFU_BACKEND_SUIT
suit_dfu_cleanup();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to provide suit_dfu module if you want to manage the update in a more advanced way, so this usage is correct.
The SUITFU resets the internal state whenever an upload with off == 0 is received.

Add SMP SUIT DFU support for nrf_desktop application.

JIRA: NCSDK-26998
      NCSDK-25024

Signed-off-by: Jan Zyczkowski <[email protected]>
@kapi-no kapi-no removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Jun 4, 2024
@rlubos rlubos merged commit 96bd576 into nrfconnect:main Jun 4, 2024
15 checks passed
@zycz zycz deleted the issue26998_dfu_new branch June 4, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants