diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-09-06 17:18:28 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-09-07 23:34:23 -0400 |
commit | b232da196a4b97a45da92212afdd8e2364b833c2 (patch) | |
tree | 61caaeb867544b6dd684961049e128b9b9b2c4f2 /support/ld | |
parent | db9ac39e9dd87ba57f2b32ce211f9b35779b9e80 (diff) | |
download | librambutan-b232da196a4b97a45da92212afdd8e2364b833c2.tar.gz librambutan-b232da196a4b97a45da92212afdd8e2364b833c2.zip |
[support/ld] Factor out header from common_rom.inc, common_ram.inc.
The linker scripts share an initial section. Factor this out into a
new file common_header.inc, and have the main linker scripts include
this file. Apart from eliminating a redundancy, this will make it
easier to add new linker scripts in the future.
Diffstat (limited to 'support/ld')
-rw-r--r-- | support/ld/common_header.inc | 39 | ||||
-rw-r--r-- | support/ld/common_ram.inc | 40 | ||||
-rw-r--r-- | support/ld/common_rom.inc | 42 |
3 files changed, 48 insertions, 73 deletions
diff --git a/support/ld/common_header.inc b/support/ld/common_header.inc new file mode 100644 index 0000000..ad1eca2 --- /dev/null +++ b/support/ld/common_header.inc @@ -0,0 +1,39 @@ +/* "Preamble" for linker scripts (such as common_rom.inc) */ + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") +ENTRY(_start) +SEARCH_DIR(.) + +/* + * Link against libgcc, libc, and libm + */ +GROUP(libgcc.a libc.a libm.a) + +/* These force the linker to search for particular symbols from + * the start of the link process and thus ensure the user's + * overrides are picked up + */ +INCLUDE names.inc + +/* STM32 vector table. See stm32_vector_table.S */ +EXTERN(__cs3_stm32_vector_table) + +/* libcs3 C start function. See cs3.h */ +EXTERN(__cs3_start_c) + +/* main entry point */ +EXTERN(main) + +/* Initial stack pointer value. */ +EXTERN(__cs3_stack) +PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram); + +/* Reset vector and chip reset entry point. See start.S */ +EXTERN(_start) +PROVIDE(__cs3_reset = _start); + +/* Beginning of the heap */ +PROVIDE(__cs3_heap_start = _end); + +/* End of the heap */ +PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram); diff --git a/support/ld/common_ram.inc b/support/ld/common_ram.inc index be83e84..0654e85 100644 --- a/support/ld/common_ram.inc +++ b/support/ld/common_ram.inc @@ -1,42 +1,10 @@ -/* Linker script for STM32 (by Lanchon with Mods by LeafLabs) */ - -OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") -SEARCH_DIR(.) /* - * Link against libgcc, libc, and libm - */ -GROUP(libgcc.a libc.a libm.a) - -/* These force the linker to search for particular symbols from - * the start of the link process and thus ensure the user's - * overrides are picked up + * Linker script for RAM builds. + * + * Original author "lanchon" from ST forums, with modifications by LeafLabs. */ -INCLUDE names.inc - -/* STM32 vector table. See stm32_vector_table.S */ -EXTERN(__cs3_stm32_vector_table) - -/* libcs3 C start function. See cs3.h */ -EXTERN(__cs3_start_c) - -/* main entry point */ -EXTERN(main) - -/* Initial stack pointer value. */ -EXTERN(__cs3_stack) -PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram); - -/* Reset vector and chip reset entry point. See start.S */ -EXTERN(_start) -ENTRY(_start) -PROVIDE(__cs3_reset = _start); - -/* Beginning of the heap */ -PROVIDE(__cs3_heap_start = _end); - -/* End of the heap */ -PROVIDE(__cs3_heap_end = __cs3_region_start_ram + LENGTH(ram)); +INCLUDE common_header.inc SECTIONS { diff --git a/support/ld/common_rom.inc b/support/ld/common_rom.inc index e0c295f..ab3e760 100644 --- a/support/ld/common_rom.inc +++ b/support/ld/common_rom.inc @@ -1,42 +1,10 @@ -/* Linker script for STM32 (by Lanchon with Mods by LeafLabs) */ - -OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") -ENTRY(_start) -SEARCH_DIR(.) /* - * Link against libgcc, libc, and libm - */ -GROUP(libgcc.a libc.a libm.a) - -/* These force the linker to search for particular symbols from - * the start of the link process and thus ensure the user's - * overrides are picked up + * Linker script for Flash (ROM) builds. + * + * Original author "lanchon" from ST forums, with modifications by LeafLabs. */ -INCLUDE names.inc - -/* STM32 vector table. See stm32_vector_table.S */ -EXTERN(__cs3_stm32_vector_table) - -/* libcs3 C start function. See cs3.h */ -EXTERN(__cs3_start_c) - -/* main entry point */ -EXTERN(main) - -/* Initial stack pointer value. */ -EXTERN(__cs3_stack) -PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram); - -/* Reset vector and chip reset entry point. See start.S */ -EXTERN(_start) -PROVIDE(__cs3_reset = _start); - -/* Beginning of the heap */ -PROVIDE(__cs3_heap_start = _end); - -/* End of the heap */ -PROVIDE(__cs3_heap_end = __cs3_region_start_ram + LENGTH(ram)); - + +INCLUDE common_header.inc SECTIONS { |