meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
78:ed8466a608b4
Child:
93:e188a91d3eaa
dgdgr

Who changed what in which revision?

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