aboutsummaryrefslogtreecommitdiff
path: root/lib/libopenstm32.ld
diff options
context:
space:
mode:
authorUwe Hermann2010-10-19 02:00:28 +0200
committerUwe Hermann2010-10-19 02:00:28 +0200
commit1621fde1f47c5b5f86942562b955bebfb45683df (patch)
treee09bb7c4924b2c2d856bc29521882e9b16bdee7f /lib/libopenstm32.ld
parent68b7e255ad8d0bf5529855773b7acdb9ff83835c (diff)
Add proper C runtime init, add reset handler.
The C runtime wasn't initialized correctly (there was garbage in the data and bss sections). Add a reset_handler which initializes these sections before calling the application's main() function. The initial stack pointer is also defined in the linker script, allowing the application to override with a linker command line option "-Wl,--defsym,_stack=0x20005000". Thanks to Gareth McMullin <gareth@blacksphere.co.nz>.
Diffstat (limited to 'lib/libopenstm32.ld')
-rw-r--r--lib/libopenstm32.ld10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libopenstm32.ld b/lib/libopenstm32.ld
index 910b350..13efe44 100644
--- a/lib/libopenstm32.ld
+++ b/lib/libopenstm32.ld
@@ -33,15 +33,25 @@ SECTIONS
*(.vectors) /* Vector table */
*(.text) /* Program code */
*(.rodata) /* Read-only data */
+ _etext = .;
} >rom
. = ORIGIN(ram);
.data : {
+ _data = .;
*(.data) /* Read-write initialized data */
+ _edata = .;
} >ram AT >rom
.bss : {
*(.bss) /* Read-write zero initialized data */
+ *(COMMON)
+ _ebss = .;
} >ram AT >rom
+
+ end = .;
}
+
+PROVIDE(_stack = 0x20000800);
+