From 74cd991e7e8972cf22933743c847b5ce2b165798 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 3 Sep 2012 19:49:47 +0200 Subject: Use a specific symbol for data source address in flash That way, data source address does not depend on any other unrelated change in linker script. This also fixes cases when .data input section is aligned on 8 bytes. The new version does not provide any address for the output section so that it is aligned to the strictest input section. The _data_loadaddr symbol will always take this alignment into account. --- lib/stm32/f4/vector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/stm32/f4/vector.c') diff --git a/lib/stm32/f4/vector.c b/lib/stm32/f4/vector.c index 1c901da..3429bfb 100644 --- a/lib/stm32/f4/vector.c +++ b/lib/stm32/f4/vector.c @@ -21,7 +21,7 @@ #define WEAK __attribute__ ((weak)) /* Symbols exported by the linker script(s): */ -extern unsigned _etext, _data, _edata, _ebss, _stack; +extern unsigned _data_loadaddr, _data, _edata, _ebss, _stack; void main(void); void reset_handler(void); @@ -224,7 +224,7 @@ void reset_handler(void) __asm__("MSR msp, %0" : : "r"(&_stack)); - for (src = &_etext, dest = &_data; dest < &_edata; src++, dest++) + for (src = &_data_loadaddr, dest = &_data; dest < &_edata; src++, dest++) *dest = *src; while (dest < &_ebss) -- cgit v1.2.3