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

Byte Alignment to support STM32U5 #1955

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

Conversation

macharlachanakya
Copy link

@macharlachanakya macharlachanakya commented May 7, 2024

  • Modified #if BOOT_MAX_ALIGN == 8 to #if (BOOT_MAX_ALIGN == 8) || (BOOT_MAX_ALIGN == 16) for boot_img_magic in boot/bootutil/src/bootutil_public.c, because STM32U5 supports 16 Byte alignment.

  • Provided #if !defined( BOOT_MAX_ALIGN ) preprocessor directive for #define BOOT_MAX_ALIGN 8 in boot/bootutil/include/bootutil/bootutil_public.h, because STM32U5 supports 16 Byte alignment which can be provided with preprocessor options as #define BOOT_MAX_ALIGN 16.

Signed-off-by: Chanakya Macharla [email protected]

Provide user to define the BOOT_MAX_ALIGN based on system requirement





Signed-off-by: Chanakya Macharla <[email protected]>
Added BOOT_MAX_ALIGN == 16 condition for boot_img_magic in boot/bootutil/src/bootutil_public.c, because STM32U5 supports 16 Byte alignment.





Signed-off-by: Chanakya Macharla <[email protected]>
@@ -93,7 +93,11 @@ _Static_assert(MCUBOOT_BOOT_MAX_ALIGN >= 8 && MCUBOOT_BOOT_MAX_ALIGN <= 32,
#define BOOT_MAX_ALIGN MCUBOOT_BOOT_MAX_ALIGN
#define BOOT_MAGIC_ALIGN_SIZE ALIGN_UP(BOOT_MAGIC_SZ, BOOT_MAX_ALIGN)
#else

#if !defined( BOOT_MAX_ALIGN )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unneeded spaces within ().

Copy link
Collaborator

@davidvincze davidvincze left a comment

Choose a reason for hiding this comment

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

You can use 16 alignment by defining MCUBOOT_BOOT_MAX_ALIGN 16 in the MCUboot configuration file or adding it as a compile option,
plus using imgtool's --max-align 16 option when signing the image.

Thanks!

Comment on lines +97 to +99
#if !defined( BOOT_MAX_ALIGN )
#define BOOT_MAX_ALIGN 8
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

BOOT_MAX_ALIGN is always defined, it's used internally.
Please use the MCUBOOT_BOOT_MAX_ALIGN as public config interface, its value will be assigned to BOOT_MAX_ALIGN in line 93.

@@ -57,7 +57,7 @@ BOOT_LOG_MODULE_DECLARE(mcuboot);
BOOT_LOG_MODULE_REGISTER(mcuboot_util);
#endif

#if BOOT_MAX_ALIGN == 8
#if (BOOT_MAX_ALIGN == 8) || (BOOT_MAX_ALIGN == 16)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check the design doc's trailer section (https://github.com/mcu-tools/mcuboot/blob/main/docs/design.md#image-trailer) at point 7.

IMHO this modification is not needed.

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.

None yet

3 participants