From b8d7c44f2a66a08684f8cf250a27743bab6e34d3 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Mon, 10 Feb 2020 17:22:57 +0100 Subject: [PATCH] Fix EEPROM hardfault: eeprom_buffer should be 8 bytes aligned Due to some cast on (uint64_t *) of eeprom_buffer, compiler may use asm instruction LDRD which required an alignment: 4 bytes on Armv7 architecture, and 8 bytes (depending on SCTLR.U) on Armv6 architecture. To fit to all cases, alignment is made on 8 bytes. Fixes #930 --- libraries/SrcWrapper/src/stm32/stm32_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/SrcWrapper/src/stm32/stm32_eeprom.c b/libraries/SrcWrapper/src/stm32/stm32_eeprom.c index cbc6ad26f7..66eeae4e1c 100644 --- a/libraries/SrcWrapper/src/stm32/stm32_eeprom.c +++ b/libraries/SrcWrapper/src/stm32/stm32_eeprom.c @@ -142,7 +142,7 @@ static inline uint32_t get_flash_end(void) #endif #endif /* FLASH_BASE_ADDRESS */ -static uint8_t eeprom_buffer[E2END + 1] = {0}; +static uint8_t eeprom_buffer[E2END + 1] __attribute__((aligned(8))) = {0}; /** * @brief Function reads a byte from emulated eeprom (flash)