From 7546ad9736af3d7fa6d5ce1caa9008aecd97f651 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sat, 12 Nov 2011 13:22:25 +1300 Subject: Fixed loading of .data in linker scripts. This fixes a problem where the linker included some padding bytes between the end of the .text section (_etext) and the start of the .data section. The C runtime copies from _etext, so all static initialised data was corrupted. This change forces the .data section to be written at _etext to avoid this problem. --- lib/stm32/f4/libopencm3_stm32f4.ld | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/stm32/f4/libopencm3_stm32f4.ld') diff --git a/lib/stm32/f4/libopencm3_stm32f4.ld b/lib/stm32/f4/libopencm3_stm32f4.ld index 54cf07f..57ca309 100644 --- a/lib/stm32/f4/libopencm3_stm32f4.ld +++ b/lib/stm32/f4/libopencm3_stm32f4.ld @@ -40,12 +40,12 @@ SECTIONS . = ORIGIN(ram); - .data : { + .data : AT(_etext) { _data = .; *(.data*) /* Read-write initialized data */ . = ALIGN(4); _edata = .; - } >ram AT >rom + } >ram .bss : { *(.bss*) /* Read-write zero initialized data */ -- cgit v1.2.3