| 1 |
/* |
| 2 |
Linker File for RA6M2 MCU |
| 3 |
*/ |
| 4 |
|
| 5 |
/* Linker script to configure memory regions. */ |
| 6 |
MEMORY |
| 7 |
{ |
| 8 |
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x000e0000 /* 896KB/1MB */ |
| 9 |
FLASH_FS (r) : ORIGIN = 0x000e0000, LENGTH = 0x00020000 /* 128KB/1MB */ |
| 10 |
RAM (rwx) : ORIGIN = 0x1FFE0000, LENGTH = 0x00060000 /* 384KB */ |
| 11 |
DATA_FLASH (rx) : ORIGIN = 0x40100000, LENGTH = 0x00008000 /* 32KB */ |
| 12 |
ID_CODE (rx) : ORIGIN = 0x0100A150, LENGTH = 0x00000010 /* 32bytes */ |
| 13 |
} |
| 14 |
|
| 15 |
/* Library configurations */ |
| 16 |
/*GROUP(libgcc.a libc.a libm.a libnosys.a) */ |
| 17 |
|
| 18 |
/* Linker script to place sections and symbol values. Should be used together |
| 19 |
* with other linker script that defines memory regions FLASH and RAM. |
| 20 |
* It references following symbols, which must be defined in code: |
| 21 |
* Reset_Handler : Entry of reset handler |
| 22 |
* |
| 23 |
* It defines following symbols, which code can use without definition: |
| 24 |
* __exidx_start |
| 25 |
* __exidx_end |
| 26 |
* __copy_table_start__ |
| 27 |
* __copy_table_end__ |
| 28 |
* __zero_table_start__ |
| 29 |
* __zero_table_end__ |
| 30 |
* __etext |
| 31 |
* __data_start__ |
| 32 |
* __preinit_array_start |
| 33 |
* __preinit_array_end |
| 34 |
* __init_array_start |
| 35 |
* __init_array_end |
| 36 |
* __fini_array_start |
| 37 |
* __fini_array_end |
| 38 |
* __data_end__ |
| 39 |
* __bss_start__ |
| 40 |
* __bss_end__ |
| 41 |
* __end__ |
| 42 |
* end |
| 43 |
* __HeapLimit |
| 44 |
* __StackLimit |
| 45 |
* __StackTop |
| 46 |
* __stack |
| 47 |
* __Vectors_End |
| 48 |
* __Vectors_Size |
| 49 |
*/ |
| 50 |
ENTRY(Reset_Handler) |
| 51 |
|
| 52 |
SECTIONS |
| 53 |
{ |
| 54 |
.text : |
| 55 |
{ |
| 56 |
_stext = .; |
| 57 |
__ROM_Start = .; |
| 58 |
|
| 59 |
/* Even though the vector table is not 256 entries (1KB) long, we still allocate that much |
| 60 |
* space because ROM registers are at address 0x400 and there is very little space |
| 61 |
* in between. */ |
| 62 |
KEEP(*(.fixed_vectors*)) |
| 63 |
KEEP(*(.application_vectors*)) |
| 64 |
__Vectors_End = .; |
| 65 |
__end__ = .; |
| 66 |
|
| 67 |
/* ROM Registers start at address 0x00000400 */ |
| 68 |
. = __ROM_Start + 0x400; |
| 69 |
KEEP(*(.rom_registers*)) |
| 70 |
|
| 71 |
/* Reserving 0x100 bytes of space for ROM registers. */ |
| 72 |
. = __ROM_Start + 0x500; |
| 73 |
|
| 74 |
*(.text*) |
| 75 |
|
| 76 |
KEEP(*(.version)) |
| 77 |
KEEP(*(.init)) |
| 78 |
KEEP(*(.fini)) |
| 79 |
|
| 80 |
/* .ctors */ |
| 81 |
*crtbegin.o(.ctors) |
| 82 |
*crtbegin?.o(.ctors) |
| 83 |
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
| 84 |
*(SORT(.ctors.*)) |
| 85 |
*(.ctors) |
| 86 |
|
| 87 |
/* .dtors */ |
| 88 |
*crtbegin.o(.dtors) |
| 89 |
*crtbegin?.o(.dtors) |
| 90 |
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
| 91 |
*(SORT(.dtors.*)) |
| 92 |
*(.dtors) |
| 93 |
|
| 94 |
*(.rodata*) |
| 95 |
__usb_dev_descriptor_start_fs = .; |
| 96 |
KEEP(*(.usb_device_desc_fs*)) |
| 97 |
__usb_cfg_descriptor_start_fs = .; |
| 98 |
KEEP(*(.usb_config_desc_fs*)) |
| 99 |
__usb_interface_descriptor_start_fs = .; |
| 100 |
KEEP(*(.usb_interface_desc_fs*)) |
| 101 |
__usb_descriptor_end_fs = .; |
| 102 |
__usb_dev_descriptor_start_hs = .; |
| 103 |
KEEP(*(.usb_device_desc_hs*)) |
| 104 |
__usb_cfg_descriptor_start_hs = .; |
| 105 |
KEEP(*(.usb_config_desc_hs*)) |
| 106 |
__usb_interface_descriptor_start_hs = .; |
| 107 |
KEEP(*(.usb_interface_desc_hs*)) |
| 108 |
__usb_descriptor_end_hs = .; |
| 109 |
|
| 110 |
KEEP(*(.eh_frame*)) |
| 111 |
|
| 112 |
__ROM_End = .; |
| 113 |
_etext = .; |
| 114 |
} > FLASH = 0xFF |
| 115 |
|
| 116 |
__Vectors_Size = __Vectors_End - __Vectors; |
| 117 |
|
| 118 |
.ARM.extab : |
| 119 |
{ |
| 120 |
*(.ARM.extab* .gnu.linkonce.armextab.*) |
| 121 |
} > FLASH |
| 122 |
|
| 123 |
__exidx_start = .; |
| 124 |
.ARM.exidx : |
| 125 |
{ |
| 126 |
*(.ARM.exidx* .gnu.linkonce.armexidx.*) |
| 127 |
} > FLASH |
| 128 |
__exidx_end = .; |
| 129 |
|
| 130 |
/* To copy multiple ROM to RAM sections, |
| 131 |
* uncomment .copy.table section and, |
| 132 |
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ |
| 133 |
/* |
| 134 |
.copy.table : |
| 135 |
{ |
| 136 |
. = ALIGN(4); |
| 137 |
__copy_table_start__ = .; |
| 138 |
LONG (__etext) |
| 139 |
LONG (__data_start__) |
| 140 |
LONG (__data_end__ - __data_start__) |
| 141 |
LONG (__etext2) |
| 142 |
LONG (__data2_start__) |
| 143 |
LONG (__data2_end__ - __data2_start__) |
| 144 |
__copy_table_end__ = .; |
| 145 |
} > FLASH |
| 146 |
*/ |
| 147 |
|
| 148 |
/* To clear multiple BSS sections, |
| 149 |
* uncomment .zero.table section and, |
| 150 |
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ |
| 151 |
/* |
| 152 |
.zero.table : |
| 153 |
{ |
| 154 |
. = ALIGN(4); |
| 155 |
__zero_table_start__ = .; |
| 156 |
LONG (__bss_start__) |
| 157 |
LONG (__bss_end__ - __bss_start__) |
| 158 |
LONG (__bss2_start__) |
| 159 |
LONG (__bss2_end__ - __bss2_start__) |
| 160 |
__zero_table_end__ = .; |
| 161 |
} > FLASH |
| 162 |
*/ |
| 163 |
|
| 164 |
__etext = .; |
| 165 |
|
| 166 |
/* If DTC is used, put the DTC vector table at the start of SRAM. |
| 167 |
This avoids memory holes due to 1K alignment required by it. */ |
| 168 |
.fsp_dtc_vector_table (NOLOAD) : |
| 169 |
{ |
| 170 |
. = ORIGIN(RAM); |
| 171 |
*(.fsp_dtc_vector_table) |
| 172 |
} > RAM |
| 173 |
|
| 174 |
/* Initialized data section. */ |
| 175 |
.data : |
| 176 |
{ |
| 177 |
_sidata = .; |
| 178 |
_sdata = .; |
| 179 |
__data_start__ = .; |
| 180 |
*(vtable) |
| 181 |
*(.data.*) |
| 182 |
|
| 183 |
. = ALIGN(4); |
| 184 |
/* preinit data */ |
| 185 |
PROVIDE_HIDDEN (__preinit_array_start = .); |
| 186 |
KEEP(*(.preinit_array)) |
| 187 |
PROVIDE_HIDDEN (__preinit_array_end = .); |
| 188 |
|
| 189 |
. = ALIGN(4); |
| 190 |
/* init data */ |
| 191 |
PROVIDE_HIDDEN (__init_array_start = .); |
| 192 |
KEEP(*(SORT(.init_array.*))) |
| 193 |
KEEP(*(.init_array)) |
| 194 |
PROVIDE_HIDDEN (__init_array_end = .); |
| 195 |
|
| 196 |
|
| 197 |
. = ALIGN(4); |
| 198 |
/* finit data */ |
| 199 |
PROVIDE_HIDDEN (__fini_array_start = .); |
| 200 |
KEEP(*(SORT(.fini_array.*))) |
| 201 |
KEEP(*(.fini_array)) |
| 202 |
PROVIDE_HIDDEN (__fini_array_end = .); |
| 203 |
|
| 204 |
KEEP(*(.jcr*)) |
| 205 |
. = ALIGN(4); |
| 206 |
|
| 207 |
__Code_In_RAM_Start = .; |
| 208 |
|
| 209 |
KEEP(*(.code_in_ram*)) |
| 210 |
__Code_In_RAM_End = .; |
| 211 |
|
| 212 |
/* All data end */ |
| 213 |
__data_end__ = .; |
| 214 |
_edata = .; |
| 215 |
|
| 216 |
} > RAM AT > FLASH |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
.noinit (NOLOAD): |
| 221 |
{ |
| 222 |
. = ALIGN(4); |
| 223 |
__noinit_start = .; |
| 224 |
KEEP(*(.noinit*)) |
| 225 |
__noinit_end = .; |
| 226 |
} > RAM |
| 227 |
|
| 228 |
.bss : |
| 229 |
{ |
| 230 |
. = ALIGN(4); |
| 231 |
_sbss = .; |
| 232 |
__bss_start__ = .; |
| 233 |
*(.bss*) |
| 234 |
*(COMMON) |
| 235 |
. = ALIGN(4); |
| 236 |
__bss_end__ = .; |
| 237 |
_ebss = .; |
| 238 |
} > RAM |
| 239 |
|
| 240 |
.heap (NOLOAD): |
| 241 |
{ |
| 242 |
. = ALIGN(8); |
| 243 |
__HeapBase = .; |
| 244 |
__end__ = .; |
| 245 |
end = __end__; |
| 246 |
KEEP(*(.heap*)) |
| 247 |
__HeapLimit = .; |
| 248 |
} > RAM |
| 249 |
|
| 250 |
/* Stacks are stored in this section. */ |
| 251 |
.stack_dummy (NOLOAD): |
| 252 |
{ |
| 253 |
. = ALIGN(8); |
| 254 |
_sstack = .; |
| 255 |
__StackLimit = .; |
| 256 |
/* Main stack */ |
| 257 |
KEEP(*(.stack)) |
| 258 |
__StackTop = .; |
| 259 |
/* Thread stacks */ |
| 260 |
KEEP(*(.stack*)) |
| 261 |
__StackTopAll = .; |
| 262 |
_estack = .; |
| 263 |
} > RAM |
| 264 |
|
| 265 |
PROVIDE(__stack = __StackTopAll); |
| 266 |
|
| 267 |
/* This symbol represents the end of user allocated RAM. The RAM after this symbol can be used |
| 268 |
at run time for things such as ThreadX memory pool allocations. */ |
| 269 |
__RAM_segment_used_end__ = ALIGN(__StackTopAll , 4); |
| 270 |
|
| 271 |
/* Data flash. */ |
| 272 |
.data_flash : |
| 273 |
{ |
| 274 |
__Data_Flash_Start = .; |
| 275 |
KEEP(*(.data_flash*)) |
| 276 |
__Data_Flash_End = .; |
| 277 |
} > DATA_FLASH |
| 278 |
|
| 279 |
.id_code : |
| 280 |
{ |
| 281 |
__ID_Code_Start = .; |
| 282 |
KEEP(*(.id_code*)) |
| 283 |
__ID_Code_End = .; |
| 284 |
} > ID_CODE |
| 285 |
} |
| 286 |
/* produce a link error if there is not this amount of RAM for these sections */ |
| 287 |
/* _minimum_stack_size = 2K; */ |
| 288 |
/* _minimum_heap_size = 16K; */ |
| 289 |
|
| 290 |
/* Define tho top end of the stack. The stack is full descending so begins just |
| 291 |
above last byte of RAM. Note that EABI requires the stack to be 8-byte |
| 292 |
aligned for a call. */ |
| 293 |
_estack = ORIGIN(RAM) + LENGTH(RAM); |
| 294 |
|
| 295 |
/* RAM extents for the garbage collector */ |
| 296 |
_ram_start = ORIGIN(RAM); |
| 297 |
_ram_end = ORIGIN(RAM) + LENGTH(RAM); |
| 298 |
_heap_start = __HeapBase; /* heap starts just after statically allocated memory */ |
| 299 |
_heap_end = __HeapLimit; /* tunable */ |
| 300 |
|
| 301 |
_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); |
| 302 |
_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); |