-
Notifications
You must be signed in to change notification settings - Fork 666
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
Byte Alignment to support STM32U5 #1955
Conversation
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 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded spaces within ().
There was a problem hiding this 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!
#if !defined( BOOT_MAX_ALIGN ) | ||
#define BOOT_MAX_ALIGN 8 | ||
#endif |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that mcuboot runs just fine on STM32U5 using the max align options in both the configuration and the imagetool.
Only the naming is misleading, since actually it is a minimal alignment requirement, not a maximum.
its working with the changes suggested, Thank you |
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]