mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32F4XX/TOOLCHAIN_GCC_ARM/STM32F407.ld@20:4263a77256ae, 2013-09-10 (annotated)
- Committer:
- bogdanm
- Date:
- Tue Sep 10 15:14:19 2013 +0300
- Revision:
- 20:4263a77256ae
Sync with git revision 171dda705c947bf910926a0b73d6a4797802554d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 20:4263a77256ae | 1 | /* Linker script for STM32F407 */ |
bogdanm | 20:4263a77256ae | 2 | |
bogdanm | 20:4263a77256ae | 3 | /* Linker script to configure memory regions. */ |
bogdanm | 20:4263a77256ae | 4 | MEMORY |
bogdanm | 20:4263a77256ae | 5 | { |
bogdanm | 20:4263a77256ae | 6 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K |
bogdanm | 20:4263a77256ae | 7 | CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K |
bogdanm | 20:4263a77256ae | 8 | RAM (rwx) : ORIGIN = 0x20000188, LENGTH = 0x1FE78 |
bogdanm | 20:4263a77256ae | 9 | } |
bogdanm | 20:4263a77256ae | 10 | |
bogdanm | 20:4263a77256ae | 11 | /* Linker script to place sections and symbol values. Should be used together |
bogdanm | 20:4263a77256ae | 12 | * with other linker script that defines memory regions FLASH and RAM. |
bogdanm | 20:4263a77256ae | 13 | * It references following symbols, which must be defined in code: |
bogdanm | 20:4263a77256ae | 14 | * Reset_Handler : Entry of reset handler |
bogdanm | 20:4263a77256ae | 15 | * |
bogdanm | 20:4263a77256ae | 16 | * It defines following symbols, which code can use without definition: |
bogdanm | 20:4263a77256ae | 17 | * __exidx_start |
bogdanm | 20:4263a77256ae | 18 | * __exidx_end |
bogdanm | 20:4263a77256ae | 19 | * __etext |
bogdanm | 20:4263a77256ae | 20 | * __data_start__ |
bogdanm | 20:4263a77256ae | 21 | * __preinit_array_start |
bogdanm | 20:4263a77256ae | 22 | * __preinit_array_end |
bogdanm | 20:4263a77256ae | 23 | * __init_array_start |
bogdanm | 20:4263a77256ae | 24 | * __init_array_end |
bogdanm | 20:4263a77256ae | 25 | * __fini_array_start |
bogdanm | 20:4263a77256ae | 26 | * __fini_array_end |
bogdanm | 20:4263a77256ae | 27 | * __data_end__ |
bogdanm | 20:4263a77256ae | 28 | * __bss_start__ |
bogdanm | 20:4263a77256ae | 29 | * __bss_end__ |
bogdanm | 20:4263a77256ae | 30 | * __end__ |
bogdanm | 20:4263a77256ae | 31 | * end |
bogdanm | 20:4263a77256ae | 32 | * __HeapLimit |
bogdanm | 20:4263a77256ae | 33 | * __StackLimit |
bogdanm | 20:4263a77256ae | 34 | * __StackTop |
bogdanm | 20:4263a77256ae | 35 | * __stack |
bogdanm | 20:4263a77256ae | 36 | */ |
bogdanm | 20:4263a77256ae | 37 | ENTRY(Reset_Handler) |
bogdanm | 20:4263a77256ae | 38 | |
bogdanm | 20:4263a77256ae | 39 | SECTIONS |
bogdanm | 20:4263a77256ae | 40 | { |
bogdanm | 20:4263a77256ae | 41 | .text : |
bogdanm | 20:4263a77256ae | 42 | { |
bogdanm | 20:4263a77256ae | 43 | KEEP(*(.isr_vector)) |
bogdanm | 20:4263a77256ae | 44 | *(.text*) |
bogdanm | 20:4263a77256ae | 45 | |
bogdanm | 20:4263a77256ae | 46 | KEEP(*(.init)) |
bogdanm | 20:4263a77256ae | 47 | KEEP(*(.fini)) |
bogdanm | 20:4263a77256ae | 48 | |
bogdanm | 20:4263a77256ae | 49 | /* .ctors */ |
bogdanm | 20:4263a77256ae | 50 | *crtbegin.o(.ctors) |
bogdanm | 20:4263a77256ae | 51 | *crtbegin?.o(.ctors) |
bogdanm | 20:4263a77256ae | 52 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
bogdanm | 20:4263a77256ae | 53 | *(SORT(.ctors.*)) |
bogdanm | 20:4263a77256ae | 54 | *(.ctors) |
bogdanm | 20:4263a77256ae | 55 | |
bogdanm | 20:4263a77256ae | 56 | /* .dtors */ |
bogdanm | 20:4263a77256ae | 57 | *crtbegin.o(.dtors) |
bogdanm | 20:4263a77256ae | 58 | *crtbegin?.o(.dtors) |
bogdanm | 20:4263a77256ae | 59 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
bogdanm | 20:4263a77256ae | 60 | *(SORT(.dtors.*)) |
bogdanm | 20:4263a77256ae | 61 | *(.dtors) |
bogdanm | 20:4263a77256ae | 62 | |
bogdanm | 20:4263a77256ae | 63 | *(.rodata*) |
bogdanm | 20:4263a77256ae | 64 | |
bogdanm | 20:4263a77256ae | 65 | KEEP(*(.eh_frame*)) |
bogdanm | 20:4263a77256ae | 66 | } > FLASH |
bogdanm | 20:4263a77256ae | 67 | |
bogdanm | 20:4263a77256ae | 68 | .ARM.extab : |
bogdanm | 20:4263a77256ae | 69 | { |
bogdanm | 20:4263a77256ae | 70 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
bogdanm | 20:4263a77256ae | 71 | } > FLASH |
bogdanm | 20:4263a77256ae | 72 | |
bogdanm | 20:4263a77256ae | 73 | __exidx_start = .; |
bogdanm | 20:4263a77256ae | 74 | .ARM.exidx : |
bogdanm | 20:4263a77256ae | 75 | { |
bogdanm | 20:4263a77256ae | 76 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
bogdanm | 20:4263a77256ae | 77 | } > FLASH |
bogdanm | 20:4263a77256ae | 78 | __exidx_end = .; |
bogdanm | 20:4263a77256ae | 79 | |
bogdanm | 20:4263a77256ae | 80 | __etext = .; |
bogdanm | 20:4263a77256ae | 81 | |
bogdanm | 20:4263a77256ae | 82 | .data : AT (__etext) |
bogdanm | 20:4263a77256ae | 83 | { |
bogdanm | 20:4263a77256ae | 84 | __data_start__ = .; |
bogdanm | 20:4263a77256ae | 85 | *(vtable) |
bogdanm | 20:4263a77256ae | 86 | *(.data*) |
bogdanm | 20:4263a77256ae | 87 | |
bogdanm | 20:4263a77256ae | 88 | . = ALIGN(4); |
bogdanm | 20:4263a77256ae | 89 | /* preinit data */ |
bogdanm | 20:4263a77256ae | 90 | PROVIDE_HIDDEN (__preinit_array_start = .); |
bogdanm | 20:4263a77256ae | 91 | KEEP(*(.preinit_array)) |
bogdanm | 20:4263a77256ae | 92 | PROVIDE_HIDDEN (__preinit_array_end = .); |
bogdanm | 20:4263a77256ae | 93 | |
bogdanm | 20:4263a77256ae | 94 | . = ALIGN(4); |
bogdanm | 20:4263a77256ae | 95 | /* init data */ |
bogdanm | 20:4263a77256ae | 96 | PROVIDE_HIDDEN (__init_array_start = .); |
bogdanm | 20:4263a77256ae | 97 | KEEP(*(SORT(.init_array.*))) |
bogdanm | 20:4263a77256ae | 98 | KEEP(*(.init_array)) |
bogdanm | 20:4263a77256ae | 99 | PROVIDE_HIDDEN (__init_array_end = .); |
bogdanm | 20:4263a77256ae | 100 | |
bogdanm | 20:4263a77256ae | 101 | |
bogdanm | 20:4263a77256ae | 102 | . = ALIGN(4); |
bogdanm | 20:4263a77256ae | 103 | /* finit data */ |
bogdanm | 20:4263a77256ae | 104 | PROVIDE_HIDDEN (__fini_array_start = .); |
bogdanm | 20:4263a77256ae | 105 | KEEP(*(SORT(.fini_array.*))) |
bogdanm | 20:4263a77256ae | 106 | KEEP(*(.fini_array)) |
bogdanm | 20:4263a77256ae | 107 | PROVIDE_HIDDEN (__fini_array_end = .); |
bogdanm | 20:4263a77256ae | 108 | |
bogdanm | 20:4263a77256ae | 109 | KEEP(*(.jcr*)) |
bogdanm | 20:4263a77256ae | 110 | . = ALIGN(4); |
bogdanm | 20:4263a77256ae | 111 | /* All data end */ |
bogdanm | 20:4263a77256ae | 112 | __data_end__ = .; |
bogdanm | 20:4263a77256ae | 113 | |
bogdanm | 20:4263a77256ae | 114 | } > RAM |
bogdanm | 20:4263a77256ae | 115 | |
bogdanm | 20:4263a77256ae | 116 | .bss : |
bogdanm | 20:4263a77256ae | 117 | { |
bogdanm | 20:4263a77256ae | 118 | . = ALIGN(4); |
bogdanm | 20:4263a77256ae | 119 | __bss_start__ = .; |
bogdanm | 20:4263a77256ae | 120 | *(.bss*) |
bogdanm | 20:4263a77256ae | 121 | *(COMMON) |
bogdanm | 20:4263a77256ae | 122 | . = ALIGN(4); |
bogdanm | 20:4263a77256ae | 123 | __bss_end__ = .; |
bogdanm | 20:4263a77256ae | 124 | } > RAM |
bogdanm | 20:4263a77256ae | 125 | |
bogdanm | 20:4263a77256ae | 126 | .heap (COPY): |
bogdanm | 20:4263a77256ae | 127 | { |
bogdanm | 20:4263a77256ae | 128 | __end__ = .; |
bogdanm | 20:4263a77256ae | 129 | end = __end__; |
bogdanm | 20:4263a77256ae | 130 | *(.heap*) |
bogdanm | 20:4263a77256ae | 131 | __HeapLimit = .; |
bogdanm | 20:4263a77256ae | 132 | } > RAM |
bogdanm | 20:4263a77256ae | 133 | |
bogdanm | 20:4263a77256ae | 134 | /* .stack_dummy section doesn't contains any symbols. It is only |
bogdanm | 20:4263a77256ae | 135 | * used for linker to calculate size of stack sections, and assign |
bogdanm | 20:4263a77256ae | 136 | * values to stack symbols later */ |
bogdanm | 20:4263a77256ae | 137 | .stack_dummy (COPY): |
bogdanm | 20:4263a77256ae | 138 | { |
bogdanm | 20:4263a77256ae | 139 | *(.stack*) |
bogdanm | 20:4263a77256ae | 140 | } > RAM |
bogdanm | 20:4263a77256ae | 141 | |
bogdanm | 20:4263a77256ae | 142 | /* Set stack top to end of RAM, and stack limit move down by |
bogdanm | 20:4263a77256ae | 143 | * size of stack_dummy section */ |
bogdanm | 20:4263a77256ae | 144 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
bogdanm | 20:4263a77256ae | 145 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
bogdanm | 20:4263a77256ae | 146 | PROVIDE(__stack = __StackTop); |
bogdanm | 20:4263a77256ae | 147 | |
bogdanm | 20:4263a77256ae | 148 | /* Check if data + heap + stack exceeds RAM limit */ |
bogdanm | 20:4263a77256ae | 149 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") |
bogdanm | 20:4263a77256ae | 150 | } |
bogdanm | 20:4263a77256ae | 151 |