aboutsummaryrefslogtreecommitdiff
path: root/lib/lm3s/vector.c
diff options
context:
space:
mode:
authorNicolas Schodet2012-09-03 19:49:47 +0200
committerNicolas Schodet2012-09-03 20:28:12 +0200
commit74cd991e7e8972cf22933743c847b5ce2b165798 (patch)
treece953690259f50a8f3606fc26006c3a221793289 /lib/lm3s/vector.c
parent2a35377980a05b6eb7ed47e9979b0ff3849d749f (diff)
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.
Diffstat (limited to 'lib/lm3s/vector.c')
-rw-r--r--lib/lm3s/vector.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/lm3s/vector.c b/lib/lm3s/vector.c
index 5968d76..3a1c4d1 100644
--- a/lib/lm3s/vector.c
+++ b/lib/lm3s/vector.c
@@ -20,7 +20,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);
@@ -61,9 +61,10 @@ void (*const vector_table[]) (void) = {
void reset_handler(void)
{
volatile unsigned *src, *dest;
+
__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)