From f03ac04321cbba4bd65b1790eddd4d121f649ce0 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 11 May 2023 15:45:53 +1000 Subject: [PATCH] stm32/mboot: Fix alignment of packed final buffer. Once all the firmware has been flashed and the final signatures checked, mboot writes the "all good" byte into the header of the application. This step uses the buffer firmware_head which, if unaligned in the build, fails when cast to a uint64_t* in flash.c. Signed-off-by: Andrew Leech --- ports/stm32/mboot/pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm32/mboot/pack.c b/ports/stm32/mboot/pack.c index 6a2b7d4780..7d4adf4780 100644 --- a/ports/stm32/mboot/pack.c +++ b/ports/stm32/mboot/pack.c @@ -59,7 +59,7 @@ static uint8_t uncompressed_buf[MBOOT_PACK_GZIP_BUFFER_SIZE] __attribute__((alig // Buffer to hold the start of the firmware, which is only written once the // entire firmware is validated. This is 8 bytes due to STM32WB MCUs requiring // that a double-word write to flash can only be done once (due to ECC). -static uint8_t firmware_head[8]; +static uint8_t firmware_head[8] __attribute__((aligned(8))); // Flag to indicate that firmware_head contains valid data. static bool firmware_head_valid;