aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2012-09-03 19:41:36 +0200
committerNicolas Schodet2012-09-03 19:53:43 +0200
commit2a35377980a05b6eb7ed47e9979b0ff3849d749f (patch)
treed5ad7602ca54169deb5d0f2f0229697f5342f230
parent11727f56c97fb3d007e0d08e59294b6791067bd1 (diff)
Clean up and make linker scripts more uniform
This includes: - fix some comments indent, - add entry point, - align exported symbols, - remove unneeded "." assignments.
-rw-r--r--lib/lm3s/libopencm3_lm3s.ld14
-rw-r--r--lib/lpc13xx/libopencm3_lpc13xx.ld14
-rw-r--r--lib/lpc17xx/libopencm3_lpc17xx.ld12
-rw-r--r--lib/lpc43xx/libopencm3_lpc43xx.ld6
-rw-r--r--lib/lpc43xx/libopencm3_lpc43xx_rom_to_ram.ld5
-rw-r--r--lib/stm32/f1/libopencm3_stm32f1.ld12
-rw-r--r--lib/stm32/f2/libopencm3_stm32f2.ld12
-rw-r--r--lib/stm32/f4/libopencm3_stm32f4.ld3
8 files changed, 37 insertions, 41 deletions
diff --git a/lib/lm3s/libopencm3_lm3s.ld b/lib/lm3s/libopencm3_lm3s.ld
index c1453fe..00ede3d 100644
--- a/lib/lm3s/libopencm3_lm3s.ld
+++ b/lib/lm3s/libopencm3_lm3s.ld
@@ -24,31 +24,34 @@
/* Enforce emmition of the vector table. */
EXTERN (vector_table)
+/* Define the entry point of the output file. */
+ENTRY(reset_handler)
+
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
*(.vectors) /* Vector table */
*(.text*) /* Program code */
+ . = ALIGN(4);
*(.rodata*) /* Read-only data */
+ . = ALIGN(4);
_etext = .;
} >rom
- . = ORIGIN(ram);
-
.data : {
_data = .;
*(.data*) /* Read-write initialized data */
+ . = ALIGN(4);
_edata = .;
} >ram AT >rom
.bss : {
*(.bss*) /* Read-write zero initialized data */
*(COMMON)
+ . = ALIGN(4);
_ebss = .;
- } >ram AT >rom
+ } >ram
/*
* The .eh_frame section appears to be used for C++ exception handling.
@@ -62,6 +65,7 @@ SECTIONS
*/
/DISCARD/ : { *(.ARM.exidx) }
+ . = ALIGN(4);
end = .;
}
diff --git a/lib/lpc13xx/libopencm3_lpc13xx.ld b/lib/lpc13xx/libopencm3_lpc13xx.ld
index 5f1630f..a1892cd 100644
--- a/lib/lpc13xx/libopencm3_lpc13xx.ld
+++ b/lib/lpc13xx/libopencm3_lpc13xx.ld
@@ -24,31 +24,34 @@
/* Enforce emmition of the vector table. */
EXTERN (vector_table)
+/* Define the entry point of the output file. */
+ENTRY(reset_handler)
+
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
*(.vectors) /* Vector table */
*(.text*) /* Program code */
+ . = ALIGN(4);
*(.rodata*) /* Read-only data */
+ . = ALIGN(4);
_etext = .;
} >rom
- . = ORIGIN(ram);
-
.data : {
_data = .;
*(.data*) /* Read-write initialized data */
+ . = ALIGN(4);
_edata = .;
} >ram AT >rom
.bss : {
*(.bss*) /* Read-write zero initialized data */
*(COMMON)
+ . = ALIGN(4);
_ebss = .;
- } >ram AT >rom
+ } >ram
/*
* The .eh_frame section appears to be used for C++ exception handling.
@@ -62,6 +65,7 @@ SECTIONS
*/
/DISCARD/ : { *(.ARM.exidx) }
+ . = ALIGN(4);
end = .;
}
diff --git a/lib/lpc17xx/libopencm3_lpc17xx.ld b/lib/lpc17xx/libopencm3_lpc17xx.ld
index 30a2c0f..a1892cd 100644
--- a/lib/lpc17xx/libopencm3_lpc17xx.ld
+++ b/lib/lpc17xx/libopencm3_lpc17xx.ld
@@ -1,4 +1,3 @@
-
/*
* This file is part of the libopencm3 project.
*
@@ -31,28 +30,28 @@ ENTRY(reset_handler)
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
*(.vectors) /* Vector table */
*(.text*) /* Program code */
+ . = ALIGN(4);
*(.rodata*) /* Read-only data */
+ . = ALIGN(4);
_etext = .;
} >rom
- . = ORIGIN(ram);
-
.data : {
_data = .;
*(.data*) /* Read-write initialized data */
+ . = ALIGN(4);
_edata = .;
} >ram AT >rom
.bss : {
*(.bss*) /* Read-write zero initialized data */
*(COMMON)
+ . = ALIGN(4);
_ebss = .;
- } >ram AT >rom
+ } >ram
/*
* The .eh_frame section appears to be used for C++ exception handling.
@@ -66,6 +65,7 @@ SECTIONS
*/
/DISCARD/ : { *(.ARM.exidx) }
+ . = ALIGN(4);
end = .;
}
diff --git a/lib/lpc43xx/libopencm3_lpc43xx.ld b/lib/lpc43xx/libopencm3_lpc43xx.ld
index 47b403b..2fedf09 100644
--- a/lib/lpc43xx/libopencm3_lpc43xx.ld
+++ b/lib/lpc43xx/libopencm3_lpc43xx.ld
@@ -32,8 +32,6 @@ ENTRY(reset_handler)
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
. = ALIGN(0x400);
_text_ram = 0; /* Start of Code in RAM NULL because Copy of Code from ROM to RAM disabled */
@@ -51,12 +49,11 @@ SECTIONS
} > rom
__exidx_end = .;
+ . = ALIGN(4);
_etext = .;
_etext_ram = 0; /* Start of Code in RAM NULL because Copy of Code from ROM to RAM disabled */
_etext_rom = 0; /* Start of Code in RAM NULL because Copy of Code from ROM to RAM disabled */
- . = ORIGIN(ram);
-
.data : {
_data = .;
*(.data*) /* Read-write initialized data */
@@ -88,6 +85,7 @@ SECTIONS
*/
/DISCARD/ : { *(.ARM.exidx) }
+ . = ALIGN(4);
end = .;
/* Leave room above stack for IAP to run. */
diff --git a/lib/lpc43xx/libopencm3_lpc43xx_rom_to_ram.ld b/lib/lpc43xx/libopencm3_lpc43xx_rom_to_ram.ld
index 0270ea8..e39f662 100644
--- a/lib/lpc43xx/libopencm3_lpc43xx_rom_to_ram.ld
+++ b/lib/lpc43xx/libopencm3_lpc43xx_rom_to_ram.ld
@@ -32,8 +32,6 @@ ENTRY(reset_handler)
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
. = ALIGN(0x400);
_text_ram = (. - ORIGIN(rom)) + ORIGIN(ram); /* Start of Code in RAM */
@@ -52,6 +50,7 @@ SECTIONS
} > rom
__exidx_end = .;
+ . = ALIGN(4);
_etext = .;
_etext_ram = (. - ORIGIN(rom)) + ORIGIN(ram);
_etext_rom = (. - ORIGIN(rom)) + ORIGIN(rom_flash);
@@ -64,7 +63,6 @@ SECTIONS
} >ram_data AT >rom
.bss : {
- . = _edata;
*(.bss*) /* Read-write zero initialized data */
*(COMMON)
. = ALIGN(4);
@@ -89,6 +87,7 @@ SECTIONS
*/
/DISCARD/ : { *(.ARM.exidx) }
+ . = ALIGN(4);
end = .;
/* Leave room above stack for IAP to run. */
diff --git a/lib/stm32/f1/libopencm3_stm32f1.ld b/lib/stm32/f1/libopencm3_stm32f1.ld
index a64a1f7..f4f8e3b 100644
--- a/lib/stm32/f1/libopencm3_stm32f1.ld
+++ b/lib/stm32/f1/libopencm3_stm32f1.ld
@@ -30,8 +30,6 @@ ENTRY(reset_handler)
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
*(.vectors) /* Vector table */
*(.text*) /* Program code */
@@ -42,9 +40,9 @@ SECTIONS
} >rom
/*
- * Another section used by C++ stuff, appears when using newlib with
- * 64bit (long long) printf support
- */
+ * Another section used by C++ stuff, appears when using newlib with
+ * 64bit (long long) printf support
+ */
.ARM.extab : {
*(.ARM.extab*)
} >rom
@@ -54,8 +52,6 @@ SECTIONS
__exidx_end = .;
} >rom
- . = ORIGIN(ram);
-
.data : AT (__exidx_end) {
_data = .;
*(.data*) /* Read-write initialized data */
@@ -68,7 +64,7 @@ SECTIONS
*(COMMON)
. = ALIGN(4);
_ebss = .;
- } >ram AT >rom
+ } >ram
/*
* The .eh_frame section appears to be used for C++ exception handling.
diff --git a/lib/stm32/f2/libopencm3_stm32f2.ld b/lib/stm32/f2/libopencm3_stm32f2.ld
index a64a1f7..f4f8e3b 100644
--- a/lib/stm32/f2/libopencm3_stm32f2.ld
+++ b/lib/stm32/f2/libopencm3_stm32f2.ld
@@ -30,8 +30,6 @@ ENTRY(reset_handler)
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
*(.vectors) /* Vector table */
*(.text*) /* Program code */
@@ -42,9 +40,9 @@ SECTIONS
} >rom
/*
- * Another section used by C++ stuff, appears when using newlib with
- * 64bit (long long) printf support
- */
+ * Another section used by C++ stuff, appears when using newlib with
+ * 64bit (long long) printf support
+ */
.ARM.extab : {
*(.ARM.extab*)
} >rom
@@ -54,8 +52,6 @@ SECTIONS
__exidx_end = .;
} >rom
- . = ORIGIN(ram);
-
.data : AT (__exidx_end) {
_data = .;
*(.data*) /* Read-write initialized data */
@@ -68,7 +64,7 @@ SECTIONS
*(COMMON)
. = ALIGN(4);
_ebss = .;
- } >ram AT >rom
+ } >ram
/*
* The .eh_frame section appears to be used for C++ exception handling.
diff --git a/lib/stm32/f4/libopencm3_stm32f4.ld b/lib/stm32/f4/libopencm3_stm32f4.ld
index 0624b96..cf7e9ec 100644
--- a/lib/stm32/f4/libopencm3_stm32f4.ld
+++ b/lib/stm32/f4/libopencm3_stm32f4.ld
@@ -30,8 +30,6 @@ ENTRY(reset_handler)
/* Define sections. */
SECTIONS
{
- . = ORIGIN(rom);
-
.text : {
*(.vectors) /* Vector table */
*(.text*) /* Program code */
@@ -48,6 +46,7 @@ SECTIONS
__exidx_end = .;
+ . = ALIGN(4);
_etext = .;
.data : {