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