Skip to content

soc: espressif: Build MCUboot Espressif Port using sysbuild #87710

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

almir-okato
Copy link
Contributor

@almir-okato almir-okato commented Mar 26, 2025

Use sysbuild to build MCUboot Espressif Port as an external project.

The current sysbuild usage for Espressif should not be affected, so the regular west build <BOARD> <SAMPLE> --sysbuild still builds Zephyr Port. In order to build Espressif Port, the Kconfig CONFIG_BOOTLOADER_MCUBOOT_ESPRESSIF needs to be enabled on the sysbuild menuconfig, or it can be passed as sysbuild domain variable in the command line --sysbuild -DSB_CONFIG_BOOTLOADER_MCUBOOT_ESPRESSIF=y.

Kconfigs for Espressif's Kconfig.sysbuild were added to match MCUboot Espressif Port configuration, so they are partially similar to the regular Zephyr Port, but notice it's a different MCUboot Port.

CONFIG_MCUBOOT_ESPRESSIF indicates that the current build is MCUboot Espressif Port image. Defined in Espressif Port from MCUboot repository.
(SB_)CONFIG_BOOTLOADER_MCUBOOT_ESPRESSIF indicates to Espressif's sysbuild cmake that it needs to build the MCUboot Espressif Port bootloader and that it needs to set the main image as a MCUboot compatible image, similar as Zephyr already does with the CONFIG_BOOTLOADER_MCUBOOT for setting Zephyr Port and MCUboot compatibility when building with sysbuild.

How to build and test:

west build -b esp32c3_devkitc samples/hello_world --sysbuild -DSB_CONFIG_BOOTLOADER_MCUBOOT_ESPRESSIF=y -p
west flash

OR

west build -b esp32c3_devkitc ../bootloader/mcuboot/boot/espressif/zephyr/  -p
west flash
  • Update hal_espressif revision in west.yml
  • Update mcuboot revision in west.yml

@almir-okato almir-okato marked this pull request as draft March 27, 2025 12:11
@almir-okato almir-okato force-pushed the mcuboot_espressif_port_integration branch from 5d0b930 to 068b0c5 Compare April 5, 2025 22:21
@almir-okato almir-okato force-pushed the mcuboot_espressif_port_integration branch 3 times, most recently from dfbe166 to 9a4bf5f Compare April 11, 2025 14:00
@almir-okato almir-okato force-pushed the mcuboot_espressif_port_integration branch 2 times, most recently from 2077475 to db68a0f Compare April 14, 2025 19:40
@almir-okato almir-okato changed the title DRAFT: soc: espressif: Build MCUboot Espressif Port using sysbuild soc: espressif: Build MCUboot Espressif Port using sysbuild Apr 14, 2025
@almir-okato almir-okato marked this pull request as ready for review April 15, 2025 13:36
@github-actions github-actions bot requested a review from carlescufi April 15, 2025 13:38
@almir-okato almir-okato force-pushed the mcuboot_espressif_port_integration branch from db68a0f to 3d99369 Compare April 22, 2025 15:50
@almir-okato almir-okato requested a review from JarmouniA April 22, 2025 15:52
@almir-okato almir-okato force-pushed the mcuboot_espressif_port_integration branch from 3d99369 to 72de282 Compare April 23, 2025 13:35
@almir-okato almir-okato requested a review from nordicjm April 23, 2025 13:55
@almir-okato almir-okato force-pushed the mcuboot_espressif_port_integration branch 2 times, most recently from fd0fbcc to e1c5597 Compare April 24, 2025 15:28
@almir-okato almir-okato requested a review from nordicjm April 24, 2025 15:28
nordicjm
nordicjm previously approved these changes Apr 25, 2025
JarmouniA
JarmouniA previously approved these changes Apr 29, 2025
Copy link
Collaborator

@marekmatej marekmatej left a comment

Choose a reason for hiding this comment

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

Overall, LGTM, but we need to address the binding to the Zephyr application memory layout. Currently, the EP has a completely independent layout that would create an issue during the app loading.


/* Empty linker script to allow MCUboot Espressif Port to link in its
* own way when building using sysbuild.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think EP is missing the memory allocations for the bootloader images that are being calculated in the memory.h. The current layout in the boot/espressif/port/<soc>/bootloader.ld could interfere with the images with higher SRAM consumption. Ex. ESP32-S3 iram_loader.text is normally at the 0x403c6400, while the EP integration ld sets this to the 0x403ba000, which is ~50kB less.

Move BOOTLOADER_MCUBOOT configuration from
boards/espressif/<BOARD>/Kconfig.sysbuild to
soc/espressif/Kconfig.sysbuild so it applies generally to every
board with Espressif's SoC when building a project using sysbuild.

Signed-off-by: Almir Okato <[email protected]>
Enable sysbuild to build MCUboot Espressif's port as an
external project.

Signed-off-by: Almir Okato <[email protected]>
Signed-off-by: Lucas Tamborrino <[email protected]>
Signed-off-by: Marek Matej <[email protected]>
@almir-okato almir-okato force-pushed the mcuboot_espressif_port_integration branch from e1c5597 to af9776f Compare May 8, 2025 14:53
Copy link

github-actions bot commented May 8, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_espressif zephyrproject-rtos/hal_espressif@e794f93 zephyrproject-rtos/hal_espressif@023b034 (zephyr) zephyrproject-rtos/[email protected]

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants