diff options
author | Alexander Voronov <avv.0@ya.ru> | 2020-07-07 23:04:13 +0300 |
---|---|---|
committer | Alexander Voronov <avv.0@ya.ru> | 2020-07-07 23:04:13 +0300 |
commit | b3434fa65887f1cd18d00a8d7d44f98af7d4e1c1 (patch) | |
tree | ac85d5547b21f191b26007302bd15d7c9949bc35 | |
parent | 030e3b47b83534d5188191accf39bc6d24bfb933 (diff) |
Added linker script for common commands
All used linker scripts have common part. To clarify differences between
scripts for particular platform this part was moved into sections.ld.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | demo/sections.ld | 81 | ||||
-rw-r--r-- | demo/stm32f070xb.ld | 83 | ||||
-rw-r--r-- | demo/stm32f103x6.ld | 83 | ||||
-rw-r--r-- | demo/stm32f105xb.ld | 83 | ||||
-rw-r--r-- | demo/stm32f303xe.ld | 83 | ||||
-rw-r--r-- | demo/stm32f429xi.ld | 83 | ||||
-rw-r--r-- | demo/stm32f446xc.ld | 83 | ||||
-rw-r--r-- | demo/stm32g431xb.ld | 83 | ||||
-rw-r--r-- | demo/stm32l052x8.ld | 87 | ||||
-rw-r--r-- | demo/stm32l100xc.ld | 87 | ||||
-rw-r--r-- | demo/stm32l433xc.ld | 83 | ||||
-rw-r--r-- | demo/stm32l476xg.ld | 93 |
13 files changed, 110 insertions, 904 deletions
@@ -24,7 +24,7 @@ CFLAGS ?= -mcpu=cortex-m3 DEFINES ?= STM32F1 STM32F103x6 ARFLAGS = -cvq -LDFLAGS = --specs=nano.specs -nostartfiles -Wl,--gc-sections +LDFLAGS = --specs=nano.specs -nostartfiles -Wl,--gc-sections -L demo INCLUDES = $(CMSISDEV)/ST $(CMSISCORE) inc CFLAGS2 ?= $(CFLAGS) -mthumb -std=gnu99 $(OPTFLAGS) diff --git a/demo/sections.ld b/demo/sections.ld new file mode 100644 index 0000000..5451898 --- /dev/null +++ b/demo/sections.ld @@ -0,0 +1,81 @@ +SECTIONS +{ + .text : + { + KEEP(*(.isr_vector)) + *(.text*) + KEEP(*(.init)) KEEP(*(.fini)) + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) + *(SORT(.dtors.*)) + *(.dtors) + *(.rodata*) + KEEP(*(.eh_frame*)) + } > ROM + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > ROM + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > ROM + __exidx_end = .; + __etext = .; + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + __data_end__ = .; + } > RAM + .bss (NOLOAD) : + { + __bss_start__ = .; + *(.bss*) + *(COMMON) + __bss_end__ = .; + } > RAM + .heap (NOLOAD) : + { + __end__ = .; + *(.heap*) + __HeapLimit = .; + } > RAM + .stack_dummy (NOLOAD) : + { + *(.stack) + } > RAM + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") + PROVIDE(_estack = __stack); + PROVIDE(_sidata = __etext); + PROVIDE(_sdata = __data_start__); + PROVIDE(_edata = __data_end__); + PROVIDE(_sbss = __bss_start__); + PROVIDE(_ebss = __bss_end__); +} diff --git a/demo/stm32f070xb.ld b/demo/stm32f070xb.ld index 2b7836c..247453b 100644 --- a/demo/stm32f070xb.ld +++ b/demo/stm32f070xb.ld @@ -4,84 +4,5 @@ MEMORY ROM (rx): ORIGIN = 0x08000000, LENGTH = 128K RAM (rwx): ORIGIN = 0x20000000, LENGTH = 16K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} + +INCLUDE sections.ld diff --git a/demo/stm32f103x6.ld b/demo/stm32f103x6.ld index 8ebe14f..06581a0 100644 --- a/demo/stm32f103x6.ld +++ b/demo/stm32f103x6.ld @@ -4,84 +4,5 @@ MEMORY ROM (rx): ORIGIN = 0x08000000, LENGTH = 32K RAM (rwx): ORIGIN = 0x20000000, LENGTH = 10K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} + +INCLUDE sections.ld diff --git a/demo/stm32f105xb.ld b/demo/stm32f105xb.ld index 62c838d..842a238 100644 --- a/demo/stm32f105xb.ld +++ b/demo/stm32f105xb.ld @@ -4,84 +4,5 @@ MEMORY ROM (rx): ORIGIN = 0x08000000, LENGTH = 128K RAM (rwx): ORIGIN = 0x20000000, LENGTH = 64K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} + +INCLUDE sections.ld diff --git a/demo/stm32f303xe.ld b/demo/stm32f303xe.ld index eea2e34..aad6334 100644 --- a/demo/stm32f303xe.ld +++ b/demo/stm32f303xe.ld @@ -5,84 +5,5 @@ MEMORY RAM (rwx): ORIGIN = 0x20000000, LENGTH = 64K CCMRAM (rwx): ORIGIN = 0x10000000, LENGTH = 16K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} + +INCLUDE sections.ld diff --git a/demo/stm32f429xi.ld b/demo/stm32f429xi.ld index 9f1f440..dd6aa04 100644 --- a/demo/stm32f429xi.ld +++ b/demo/stm32f429xi.ld @@ -10,86 +10,5 @@ MEMORY SRAM3 (rwx): ORIGIN = 0x20020000, LENGTH = 64K CMRAM (rwx): ORIGIN = 0x10000000, LENGTH = 64K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} +INCLUDE sections.ld diff --git a/demo/stm32f446xc.ld b/demo/stm32f446xc.ld index 12f5dc6..3ac95f5 100644 --- a/demo/stm32f446xc.ld +++ b/demo/stm32f446xc.ld @@ -4,84 +4,5 @@ MEMORY ROM (rx): ORIGIN = 0x08000000, LENGTH = 256K RAM (rwx): ORIGIN = 0x20000000, LENGTH = 128K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} + +INCLUDE sections.ld diff --git a/demo/stm32g431xb.ld b/demo/stm32g431xb.ld index a672d2d..a68225e 100644 --- a/demo/stm32g431xb.ld +++ b/demo/stm32g431xb.ld @@ -5,84 +5,5 @@ MEMORY RAM (rwx): ORIGIN = 0x20000000, LENGTH = 22K SRAM (rwx): ORIGIN = 0x10000000, LENGTH = 10K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} + +INCLUDE sections.ld diff --git a/demo/stm32l052x8.ld b/demo/stm32l052x8.ld index 45b2947..f8e32dc 100644 --- a/demo/stm32l052x8.ld +++ b/demo/stm32l052x8.ld @@ -1,87 +1,8 @@ ENTRY(Reset_Handler) MEMORY { - ROM (rx): ORIGIN = 0x08000000, LENGTH = 64K - RAM (rwx): ORIGIN = 0x20000000, LENGTH = 8K -} -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); + ROM (rx): ORIGIN = 0x08000000, LENGTH = 64K + RAM (rwx): ORIGIN = 0x20000000, LENGTH = 8K } + +INCLUDE sections.ld diff --git a/demo/stm32l100xc.ld b/demo/stm32l100xc.ld index 0e32531..7b5af60 100644 --- a/demo/stm32l100xc.ld +++ b/demo/stm32l100xc.ld @@ -1,89 +1,8 @@ ENTRY(Reset_Handler) MEMORY { - ROM (rx): ORIGIN = 0x08000000, LENGTH = 192K - RAM (rwx): ORIGIN = 0x20000000, LENGTH = 20K + ROM (rx): ORIGIN = 0x08000000, LENGTH = 192K + RAM (rwx): ORIGIN = 0x20000000, LENGTH = 20K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} +INCLUDE sections.ld diff --git a/demo/stm32l433xc.ld b/demo/stm32l433xc.ld index 06157cd..f43bbca 100644 --- a/demo/stm32l433xc.ld +++ b/demo/stm32l433xc.ld @@ -5,84 +5,5 @@ MEMORY RAM (rwx): ORIGIN = 0x20000000, LENGTH = 48K SRAM (rwx): ORIGIN = 0x10000000, LENGTH = 16K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} + +INCLUDE sections.ld diff --git a/demo/stm32l476xg.ld b/demo/stm32l476xg.ld index fe131a5..f682258 100644 --- a/demo/stm32l476xg.ld +++ b/demo/stm32l476xg.ld @@ -1,92 +1,11 @@ ENTRY(Reset_Handler) MEMORY { - ROM (rx): ORIGIN = 0x08000000, LENGTH = 1024K - BANK0 (rx): ORIGIN = 0x08000000, LENGTH = 512K - BANK1 (rx): ORIGIN = 0x08080000, LENGTH = 512K - RAM (rwx): ORIGIN = 0x20000000, LENGTH = 96K - RAM2 (rwx): ORIGIN = 0x10000000, LENGTH = 32K + ROM (rx): ORIGIN = 0x08000000, LENGTH = 1024K + BANK0 (rx): ORIGIN = 0x08000000, LENGTH = 512K + BANK1 (rx): ORIGIN = 0x08080000, LENGTH = 512K + RAM (rwx): ORIGIN = 0x20000000, LENGTH = 96K + RAM2 (rwx): ORIGIN = 0x10000000, LENGTH = 32K } -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - KEEP(*(.init)) KEEP(*(.fini)) - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o).dtors) - *(SORT(.dtors.*)) - *(.dtors) - *(.rodata*) - KEEP(*(.eh_frame*)) - } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > ROM - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > ROM - __exidx_end = .; - __etext = .; - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - . = ALIGN(4); - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - . = ALIGN(4); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - . = ALIGN(4); - __data_end__ = .; - } > RAM - .bss (NOLOAD) : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - .heap (NOLOAD) : - { - __end__ = .; - *(.heap*) - __HeapLimit = .; - } > RAM - .stack_dummy (NOLOAD) : - { - *(.stack) - } > RAM - - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") - PROVIDE(_estack = __stack); - PROVIDE(_sidata = __etext); - PROVIDE(_sdata = __data_start__); - PROVIDE(_edata = __data_end__); - PROVIDE(_sbss = __bss_start__); - PROVIDE(_ebss = __bss_end__); -} +INCLUDE sections.ld |