From 3d90079f50eda04821b48a0a401fbffb5ea8a63f Mon Sep 17 00:00:00 2001 From: Federico Braghiroli Date: Wed, 13 Nov 2024 10:32:53 +0100 Subject: [PATCH] boards/stm32f103-minimum: fix unaligned pointer to .data section in ld.script This patch fix _eronly value which is used during boot process to initialize .data section to sram. Since .data section is 4 byte aligned in flash, also _eronly must follow this alignment to stay coherent with the start address of .data. If one of the sections preceeding .data has a size which is not 4 byte aligned, the _eronly value does not match with .data physical address resulting in wrong copy of data section to sram and thus an almost immediate hardfault. Signed-off-by: Federico Braghiroli --- boards/arm/stm32/stm32f103-minimum/scripts/ld.script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/arm/stm32/stm32f103-minimum/scripts/ld.script b/boards/arm/stm32/stm32f103-minimum/scripts/ld.script index f8de876977f..38b17fb8915 100644 --- a/boards/arm/stm32/stm32f103-minimum/scripts/ld.script +++ b/boards/arm/stm32/stm32f103-minimum/scripts/ld.script @@ -88,7 +88,7 @@ SECTIONS _etbss = ABSOLUTE(.); } > flash - _eronly = ABSOLUTE(.); + _eronly = LOADADDR(.data); /* The STM32F103C8T6 has 20Kb of SRAM beginning at the following address */