The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_KL25Z/TOOLCHAIN_GCC_ARM/MKL25Z4.ld@99:7f6c6de930c0, 2015-05-03 (annotated)
- Committer:
- Mikchel
- Date:
- Sun May 03 16:04:42 2015 +0000
- Revision:
- 99:7f6c6de930c0
- Parent:
- 69:4a7918f48478
12
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 69:4a7918f48478 | 1 | /* |
emilmont | 69:4a7918f48478 | 2 | * KL25Z ARM GCC linker script file |
emilmont | 69:4a7918f48478 | 3 | */ |
emilmont | 69:4a7918f48478 | 4 | |
emilmont | 69:4a7918f48478 | 5 | MEMORY |
emilmont | 69:4a7918f48478 | 6 | { |
emilmont | 69:4a7918f48478 | 7 | VECTORS (rx) : ORIGIN = 0x00000000, LENGTH = 0x00000400 |
emilmont | 69:4a7918f48478 | 8 | FLASH_PROTECTION (rx) : ORIGIN = 0x00000400, LENGTH = 0x00000010 |
emilmont | 69:4a7918f48478 | 9 | FLASH (rx) : ORIGIN = 0x00000410, LENGTH = 128K - 0x00000410 |
emilmont | 69:4a7918f48478 | 10 | RAM (rwx) : ORIGIN = 0x1FFFF0C0, LENGTH = 16K - 0xC0 |
emilmont | 69:4a7918f48478 | 11 | } |
emilmont | 69:4a7918f48478 | 12 | |
emilmont | 69:4a7918f48478 | 13 | /* Linker script to place sections and symbol values. Should be used together |
emilmont | 69:4a7918f48478 | 14 | * with other linker script that defines memory regions FLASH and RAM. |
emilmont | 69:4a7918f48478 | 15 | * It references following symbols, which must be defined in code: |
emilmont | 69:4a7918f48478 | 16 | * _reset_init : Entry of reset handler |
emilmont | 69:4a7918f48478 | 17 | * |
emilmont | 69:4a7918f48478 | 18 | * It defines following symbols, which code can use without definition: |
emilmont | 69:4a7918f48478 | 19 | * __exidx_start |
emilmont | 69:4a7918f48478 | 20 | * __exidx_end |
emilmont | 69:4a7918f48478 | 21 | * __etext |
emilmont | 69:4a7918f48478 | 22 | * __data_start__ |
emilmont | 69:4a7918f48478 | 23 | * __preinit_array_start |
emilmont | 69:4a7918f48478 | 24 | * __preinit_array_end |
emilmont | 69:4a7918f48478 | 25 | * __init_array_start |
emilmont | 69:4a7918f48478 | 26 | * __init_array_end |
emilmont | 69:4a7918f48478 | 27 | * __fini_array_start |
emilmont | 69:4a7918f48478 | 28 | * __fini_array_end |
emilmont | 69:4a7918f48478 | 29 | * __data_end__ |
emilmont | 69:4a7918f48478 | 30 | * __bss_start__ |
emilmont | 69:4a7918f48478 | 31 | * __bss_end__ |
emilmont | 69:4a7918f48478 | 32 | * __end__ |
emilmont | 69:4a7918f48478 | 33 | * end |
emilmont | 69:4a7918f48478 | 34 | * __HeapLimit |
emilmont | 69:4a7918f48478 | 35 | * __StackLimit |
emilmont | 69:4a7918f48478 | 36 | * __StackTop |
emilmont | 69:4a7918f48478 | 37 | * __stack |
emilmont | 69:4a7918f48478 | 38 | */ |
emilmont | 69:4a7918f48478 | 39 | ENTRY(Reset_Handler) |
emilmont | 69:4a7918f48478 | 40 | |
emilmont | 69:4a7918f48478 | 41 | SECTIONS |
emilmont | 69:4a7918f48478 | 42 | { |
emilmont | 69:4a7918f48478 | 43 | .isr_vector : |
emilmont | 69:4a7918f48478 | 44 | { |
emilmont | 69:4a7918f48478 | 45 | __vector_table = .; |
emilmont | 69:4a7918f48478 | 46 | KEEP(*(.vector_table)) |
emilmont | 69:4a7918f48478 | 47 | *(.text.Reset_Handler) |
emilmont | 69:4a7918f48478 | 48 | *(.text.System_Init) |
emilmont | 69:4a7918f48478 | 49 | . = ALIGN(4); |
emilmont | 69:4a7918f48478 | 50 | } > VECTORS |
emilmont | 69:4a7918f48478 | 51 | |
emilmont | 69:4a7918f48478 | 52 | .flash_protect : |
emilmont | 69:4a7918f48478 | 53 | { |
emilmont | 69:4a7918f48478 | 54 | KEEP(*(.kinetis_flash_config_field)) |
emilmont | 69:4a7918f48478 | 55 | . = ALIGN(4); |
emilmont | 69:4a7918f48478 | 56 | } > FLASH_PROTECTION |
emilmont | 69:4a7918f48478 | 57 | |
emilmont | 69:4a7918f48478 | 58 | .text : |
emilmont | 69:4a7918f48478 | 59 | { |
emilmont | 69:4a7918f48478 | 60 | *(.text*) |
emilmont | 69:4a7918f48478 | 61 | |
emilmont | 69:4a7918f48478 | 62 | KEEP(*(.init)) |
emilmont | 69:4a7918f48478 | 63 | KEEP(*(.fini)) |
emilmont | 69:4a7918f48478 | 64 | |
emilmont | 69:4a7918f48478 | 65 | /* .ctors */ |
emilmont | 69:4a7918f48478 | 66 | *crtbegin.o(.ctors) |
emilmont | 69:4a7918f48478 | 67 | *crtbegin?.o(.ctors) |
emilmont | 69:4a7918f48478 | 68 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
emilmont | 69:4a7918f48478 | 69 | *(SORT(.ctors.*)) |
emilmont | 69:4a7918f48478 | 70 | *(.ctors) |
emilmont | 69:4a7918f48478 | 71 | |
emilmont | 69:4a7918f48478 | 72 | /* .dtors */ |
emilmont | 69:4a7918f48478 | 73 | *crtbegin.o(.dtors) |
emilmont | 69:4a7918f48478 | 74 | *crtbegin?.o(.dtors) |
emilmont | 69:4a7918f48478 | 75 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
emilmont | 69:4a7918f48478 | 76 | *(SORT(.dtors.*)) |
emilmont | 69:4a7918f48478 | 77 | *(.dtors) |
emilmont | 69:4a7918f48478 | 78 | |
emilmont | 69:4a7918f48478 | 79 | *(.rodata*) |
emilmont | 69:4a7918f48478 | 80 | |
emilmont | 69:4a7918f48478 | 81 | KEEP(*(.eh_frame*)) |
emilmont | 69:4a7918f48478 | 82 | } > FLASH |
emilmont | 69:4a7918f48478 | 83 | |
emilmont | 69:4a7918f48478 | 84 | .ARM.extab : |
emilmont | 69:4a7918f48478 | 85 | { |
emilmont | 69:4a7918f48478 | 86 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
emilmont | 69:4a7918f48478 | 87 | } > FLASH |
emilmont | 69:4a7918f48478 | 88 | |
emilmont | 69:4a7918f48478 | 89 | __exidx_start = .; |
emilmont | 69:4a7918f48478 | 90 | .ARM.exidx : |
emilmont | 69:4a7918f48478 | 91 | { |
emilmont | 69:4a7918f48478 | 92 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
emilmont | 69:4a7918f48478 | 93 | } > FLASH |
emilmont | 69:4a7918f48478 | 94 | __exidx_end = .; |
emilmont | 69:4a7918f48478 | 95 | |
emilmont | 69:4a7918f48478 | 96 | __etext = .; |
emilmont | 69:4a7918f48478 | 97 | |
emilmont | 69:4a7918f48478 | 98 | .data : AT (__etext) |
emilmont | 69:4a7918f48478 | 99 | { |
emilmont | 69:4a7918f48478 | 100 | __data_start__ = .; |
emilmont | 69:4a7918f48478 | 101 | *(vtable) |
emilmont | 69:4a7918f48478 | 102 | *(.data*) |
emilmont | 69:4a7918f48478 | 103 | |
emilmont | 69:4a7918f48478 | 104 | . = ALIGN(4); |
emilmont | 69:4a7918f48478 | 105 | /* preinit data */ |
emilmont | 69:4a7918f48478 | 106 | PROVIDE_HIDDEN (__preinit_array_start = .); |
emilmont | 69:4a7918f48478 | 107 | KEEP(*(.preinit_array)) |
emilmont | 69:4a7918f48478 | 108 | PROVIDE_HIDDEN (__preinit_array_end = .); |
emilmont | 69:4a7918f48478 | 109 | |
emilmont | 69:4a7918f48478 | 110 | . = ALIGN(4); |
emilmont | 69:4a7918f48478 | 111 | /* init data */ |
emilmont | 69:4a7918f48478 | 112 | PROVIDE_HIDDEN (__init_array_start = .); |
emilmont | 69:4a7918f48478 | 113 | KEEP(*(SORT(.init_array.*))) |
emilmont | 69:4a7918f48478 | 114 | KEEP(*(.init_array)) |
emilmont | 69:4a7918f48478 | 115 | PROVIDE_HIDDEN (__init_array_end = .); |
emilmont | 69:4a7918f48478 | 116 | |
emilmont | 69:4a7918f48478 | 117 | |
emilmont | 69:4a7918f48478 | 118 | . = ALIGN(4); |
emilmont | 69:4a7918f48478 | 119 | /* finit data */ |
emilmont | 69:4a7918f48478 | 120 | PROVIDE_HIDDEN (__fini_array_start = .); |
emilmont | 69:4a7918f48478 | 121 | KEEP(*(SORT(.fini_array.*))) |
emilmont | 69:4a7918f48478 | 122 | KEEP(*(.fini_array)) |
emilmont | 69:4a7918f48478 | 123 | PROVIDE_HIDDEN (__fini_array_end = .); |
emilmont | 69:4a7918f48478 | 124 | |
emilmont | 69:4a7918f48478 | 125 | . = ALIGN(4); |
emilmont | 69:4a7918f48478 | 126 | /* All data end */ |
emilmont | 69:4a7918f48478 | 127 | __data_end__ = .; |
emilmont | 69:4a7918f48478 | 128 | |
emilmont | 69:4a7918f48478 | 129 | } > RAM |
emilmont | 69:4a7918f48478 | 130 | |
emilmont | 69:4a7918f48478 | 131 | .bss : |
emilmont | 69:4a7918f48478 | 132 | { |
emilmont | 69:4a7918f48478 | 133 | __bss_start__ = .; |
emilmont | 69:4a7918f48478 | 134 | *(.bss*) |
emilmont | 69:4a7918f48478 | 135 | *(COMMON) |
emilmont | 69:4a7918f48478 | 136 | __bss_end__ = .; |
emilmont | 69:4a7918f48478 | 137 | } > RAM |
emilmont | 69:4a7918f48478 | 138 | |
emilmont | 69:4a7918f48478 | 139 | .heap : |
emilmont | 69:4a7918f48478 | 140 | { |
emilmont | 69:4a7918f48478 | 141 | __end__ = .; |
emilmont | 69:4a7918f48478 | 142 | end = __end__; |
emilmont | 69:4a7918f48478 | 143 | *(.heap*) |
emilmont | 69:4a7918f48478 | 144 | __HeapLimit = .; |
emilmont | 69:4a7918f48478 | 145 | } > RAM |
emilmont | 69:4a7918f48478 | 146 | |
emilmont | 69:4a7918f48478 | 147 | /* .stack_dummy section doesn't contains any symbols. It is only |
emilmont | 69:4a7918f48478 | 148 | * used for linker to calculate size of stack sections, and assign |
emilmont | 69:4a7918f48478 | 149 | * values to stack symbols later */ |
emilmont | 69:4a7918f48478 | 150 | .stack_dummy : |
emilmont | 69:4a7918f48478 | 151 | { |
emilmont | 69:4a7918f48478 | 152 | *(.stack) |
emilmont | 69:4a7918f48478 | 153 | } > RAM |
emilmont | 69:4a7918f48478 | 154 | |
emilmont | 69:4a7918f48478 | 155 | /* Set stack top to end of RAM, and stack limit move down by |
emilmont | 69:4a7918f48478 | 156 | * size of stack_dummy section */ |
emilmont | 69:4a7918f48478 | 157 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
emilmont | 69:4a7918f48478 | 158 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
emilmont | 69:4a7918f48478 | 159 | PROVIDE(__stack = __StackTop); |
emilmont | 69:4a7918f48478 | 160 | |
emilmont | 69:4a7918f48478 | 161 | /* Check if data + heap + stack exceeds RAM limit */ |
emilmont | 69:4a7918f48478 | 162 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") |
emilmont | 69:4a7918f48478 | 163 | } |