Skip to content

Zephyr DFU subsystem incompatible with Espressif MCUBoot and Flash Encryption #88097

Open
@epneo-sebastianbaier

Description

@epneo-sebastianbaier

Describe the bug

The Zephyr DFU subsystem is not compatible with the Espressif MCUBoot Port when Flash Encryption is enabled, as it is not possible (at least for the Espressif chip) to adjust the value of MCUBOOT_BOOT_MAX_ALIGN with Zephyr build-in options. There is also a discussion about this in the Zephyr Discord server.

Currently, a Zephyr Sysbuild with the Espressif MCUBoot Port is also not possible, which would possibly avoid or solve the problem.

According to a discussion in the Zephyr Discord, it should be possible to customize the MCUBOOT_BOOT_MAX_ALIGN define via the device tree and the write-block-size parameter of the flash. However, this does not work without Sybuild or with an Espressif chip.

In detail, the problem is caused by the fact that the Zephyr DFU subsystem also depends on the value of MCUBOOT_BOOT_MAX_ALIGN (which then differs between the application and the Espressif MCUBoot port), because it uses the bootutil of MCUBoot to write its header.

To Reproduce

  1. Activate Flash Encryption in the Espressif MCUBoot port. (CONFIG_SECURE_FLASH_ENC_ENABLED=y)
  2. Flash MCUBoot with activated Flash Encryption to an ESP32S3 chip, for example.
  3. Flash any example that uses the Zephyr DFU subsystem to the controller.
  4. Update the application via the Zephyr DFU subsystem.
  5. The update will not be bootable.

Expected behavior

A possibility in Zephyr without Sysbuild to customize the Define MCUBOOT_BOOT_MAX_ALIGN so that the Zephyr DFU subsystem is compatible with the Espressif MCUBoot Port.

Impact

Manual patching of Zephyr to ensure compatibility.

Environment

  • OS: Ubuntu 24.04.2 LTS within WSL2
  • Toolchain: zephyr-sdk-0.17.0

Metadata

Metadata

Assignees

Labels

bugThe issue is a bug, or the PR is fixing a bugplatform: ESP32Espressif ESP32priority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions