Austin Schuh | 41baf20 | 2022-01-01 14:33:40 -0800 | [diff] [blame^] | 1 | /* Linker script for Dialog DA1469x devices |
| 2 | * |
| 3 | * Version: Sourcery G++ 4.5-1 |
| 4 | * Support: https://support.codesourcery.com/GNUToolchain/ |
| 5 | * |
| 6 | * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc. |
| 7 | * |
| 8 | * The authors hereby grant permission to use, copy, modify, distribute, |
| 9 | * and license this software and its documentation for any purpose, provided |
| 10 | * that existing copyright notices are retained in all copies and that this |
| 11 | * notice is included verbatim in any distributions. No written agreement, |
| 12 | * license, or royalty fee is required for any of the authorized uses. |
| 13 | * Modifications to this software may be copyrighted by their authors |
| 14 | * and need not follow the licensing terms described here, provided that |
| 15 | * the new terms are clearly indicated on the first page of each file where |
| 16 | * they apply. |
| 17 | */ |
| 18 | OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") |
| 19 | |
| 20 | /* Linker script to place sections and symbol values. Should be used together |
| 21 | * with other linker script that defines memory regions FLASH and RAM. |
| 22 | * It references following symbols, which must be defined in code: |
| 23 | * Reset_Handler : Entry of reset handler |
| 24 | * |
| 25 | * It defines following symbols, which code can use without definition: |
| 26 | * __exidx_start |
| 27 | * __exidx_end |
| 28 | * __etext |
| 29 | * __data_start__ |
| 30 | * __preinit_array_start |
| 31 | * __preinit_array_end |
| 32 | * __init_array_start |
| 33 | * __init_array_end |
| 34 | * __fini_array_start |
| 35 | * __fini_array_end |
| 36 | * __data_end__ |
| 37 | * __bss_start__ |
| 38 | * __bss_end__ |
| 39 | * __HeapBase |
| 40 | * __HeapLimit |
| 41 | * __StackLimit |
| 42 | * __StackTop |
| 43 | * __stack |
| 44 | * __bssnz_start__ |
| 45 | * __bssnz_end__ |
| 46 | */ |
| 47 | ENTRY(Reset_Handler) |
| 48 | |
| 49 | SECTIONS |
| 50 | { |
| 51 | .imghdr (NOLOAD): |
| 52 | { |
| 53 | . = . + _imghdr_size; |
| 54 | } > FLASH |
| 55 | |
| 56 | __text = .; |
| 57 | |
| 58 | .text : |
| 59 | { |
| 60 | __isr_vector_start = .; |
| 61 | KEEP(*(.isr_vector)) |
| 62 | /* ISR vector shall have exactly 512 bytes */ |
| 63 | . = __isr_vector_start + 0x200; |
| 64 | __isr_vector_end = .; |
| 65 | |
| 66 | *(.text) |
| 67 | *(.text.*) |
| 68 | |
| 69 | KEEP(*(.init)) |
| 70 | KEEP(*(.fini)) |
| 71 | |
| 72 | /* .ctors */ |
| 73 | *crtbegin.o(.ctors) |
| 74 | *crtbegin?.o(.ctors) |
| 75 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
| 76 | *(SORT(.ctors.*)) |
| 77 | *(.ctors) |
| 78 | |
| 79 | /* .dtors */ |
| 80 | *crtbegin.o(.dtors) |
| 81 | *crtbegin?.o(.dtors) |
| 82 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
| 83 | *(SORT(.dtors.*)) |
| 84 | *(.dtors) |
| 85 | |
| 86 | *(.rodata*) |
| 87 | |
| 88 | *(.eh_frame*) |
| 89 | . = ALIGN(4); |
| 90 | } > FLASH |
| 91 | |
| 92 | .ARM.extab : |
| 93 | { |
| 94 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
| 95 | . = ALIGN(4); |
| 96 | } > FLASH |
| 97 | |
| 98 | __exidx_start = .; |
| 99 | .ARM.exidx : |
| 100 | { |
| 101 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
| 102 | . = ALIGN(4); |
| 103 | } > FLASH |
| 104 | __exidx_end = .; |
| 105 | |
| 106 | .intvect : |
| 107 | { |
| 108 | . = ALIGN(4); |
| 109 | __intvect_start__ = .; |
| 110 | . = . + (__isr_vector_end - __isr_vector_start); |
| 111 | . = ALIGN(4); |
| 112 | } > RAM |
| 113 | |
| 114 | .sleep_state (NOLOAD) : |
| 115 | { |
| 116 | . = ALIGN(4); |
| 117 | *(sleep_state) |
| 118 | } > RAM |
| 119 | |
| 120 | /* This section will be zeroed by RTT package init */ |
| 121 | .rtt (NOLOAD): |
| 122 | { |
| 123 | . = ALIGN(4); |
| 124 | *(.rtt) |
| 125 | . = ALIGN(4); |
| 126 | } > RAM |
| 127 | |
| 128 | __text_ram_addr = LOADADDR(.text_ram); |
| 129 | |
| 130 | .text_ram : |
| 131 | { |
| 132 | . = ALIGN(4); |
| 133 | __text_ram_start__ = .; |
| 134 | *(.text_ram*) |
| 135 | . = ALIGN(4); |
| 136 | __text_ram_end__ = .; |
| 137 | } > RAM AT > FLASH |
| 138 | |
| 139 | __etext = LOADADDR(.data); |
| 140 | |
| 141 | .data : |
| 142 | { |
| 143 | __data_start__ = .; |
| 144 | *(vtable) |
| 145 | *(.data*) |
| 146 | |
| 147 | . = ALIGN(4); |
| 148 | /* preinit data */ |
| 149 | PROVIDE_HIDDEN (__preinit_array_start = .); |
| 150 | *(.preinit_array) |
| 151 | PROVIDE_HIDDEN (__preinit_array_end = .); |
| 152 | |
| 153 | . = ALIGN(4); |
| 154 | /* init data */ |
| 155 | PROVIDE_HIDDEN (__init_array_start = .); |
| 156 | *(SORT(.init_array.*)) |
| 157 | *(.init_array) |
| 158 | PROVIDE_HIDDEN (__init_array_end = .); |
| 159 | |
| 160 | |
| 161 | . = ALIGN(4); |
| 162 | /* finit data */ |
| 163 | PROVIDE_HIDDEN (__fini_array_start = .); |
| 164 | *(SORT(.fini_array.*)) |
| 165 | *(.fini_array) |
| 166 | PROVIDE_HIDDEN (__fini_array_end = .); |
| 167 | |
| 168 | *(.jcr) |
| 169 | . = ALIGN(4); |
| 170 | /* All data end */ |
| 171 | __data_end__ = .; |
| 172 | } > RAM AT > FLASH |
| 173 | |
| 174 | .bssnz : |
| 175 | { |
| 176 | . = ALIGN(4); |
| 177 | __bssnz_start__ = .; |
| 178 | *(.bss.core.nz*) |
| 179 | . = ALIGN(4); |
| 180 | __bssnz_end__ = .; |
| 181 | } > RAM |
| 182 | |
| 183 | .bss : |
| 184 | { |
| 185 | . = ALIGN(4); |
| 186 | __bss_start__ = .; |
| 187 | *(.bss*) |
| 188 | *(COMMON) |
| 189 | . = ALIGN(4); |
| 190 | __bss_end__ = .; |
| 191 | } > RAM |
| 192 | |
| 193 | .cmac (NOLOAD) : |
| 194 | { |
| 195 | . = ALIGN(0x400); |
| 196 | *(.libcmac.ram) |
| 197 | } > RAM |
| 198 | |
| 199 | /* Heap starts after BSS */ |
| 200 | . = ALIGN(8); |
| 201 | __HeapBase = .; |
| 202 | |
| 203 | /* .stack_dummy section doesn't contains any symbols. It is only |
| 204 | * used for linker to calculate size of stack sections, and assign |
| 205 | * values to stack symbols later */ |
| 206 | .stack_dummy (COPY): |
| 207 | { |
| 208 | *(.stack*) |
| 209 | } > RAM |
| 210 | |
| 211 | _ram_start = ORIGIN(RAM); |
| 212 | |
| 213 | /* Set stack top to end of RAM, and stack limit move down by |
| 214 | * size of stack_dummy section */ |
| 215 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
| 216 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
| 217 | PROVIDE(__stack = __StackTop); |
| 218 | |
| 219 | /* Top of head is the bottom of the stack */ |
| 220 | __HeapLimit = __StackLimit; |
| 221 | |
| 222 | /* Check if data + heap + stack exceeds RAM limit */ |
| 223 | ASSERT(__HeapBase <= __HeapLimit, "region RAM overflowed with stack") |
| 224 | |
| 225 | /* Check that intvect is at the beginning of RAM */ |
| 226 | ASSERT(__intvect_start__ == ORIGIN(RAM), "intvect is not at beginning of RAM") |
| 227 | } |
| 228 | |