summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2023-05-11 15:45:53 +1000
committerDamien George <damien@micropython.org>2023-05-19 22:16:53 +1000
commitf03ac04321cbba4bd65b1790eddd4d121f649ce0 (patch)
treeccc673d5f37136e014c6cb4d0faf4eab60916e47
parentad216be5f13ac86e67cafa6257aea5d6e7f82cda (diff)
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 <andrew.leech@planetinnovation.com.au>
-rw-r--r--ports/stm32/mboot/pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/stm32/mboot/pack.c b/ports/stm32/mboot/pack.c
index 6a2b7d478..7d4adf478 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;