|
| 1 | +/* |
| 2 | + GNU linker script for SAMD51 |
| 3 | +*/ |
| 4 | + |
| 5 | +/* Specify the memory areas */ |
| 6 | +MEMORY |
| 7 | +{ |
| 8 | + FLASH (rx) : ORIGIN = 0x00000000 + 0x4000, LENGTH = 0x00080000 - 0x4000 - 0x00040000 /* Leave 16KiB for the bootloader and 256KiB for the internal file system. */ |
| 9 | + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x00030000 /* 192 KiB */ |
| 10 | +} |
| 11 | + |
| 12 | +/* top end of the stack */ |
| 13 | +_estack = ORIGIN(RAM) + LENGTH(RAM); |
| 14 | + |
| 15 | +/* define output sections */ |
| 16 | +SECTIONS |
| 17 | +{ |
| 18 | + /* The program code and other data goes into FLASH */ |
| 19 | + .text : |
| 20 | + { |
| 21 | + . = ALIGN(4); |
| 22 | + _sfixed = .; |
| 23 | + KEEP(*(.vectors)) /* isr vector table */ |
| 24 | + *(.text) /* .text sections (code) */ |
| 25 | + *(.text*) /* .text* sections (code) */ |
| 26 | + *(.rodata) /* .rodata sections (constants, strings, etc.) */ |
| 27 | + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ |
| 28 | + |
| 29 | + . = ALIGN(4); |
| 30 | + _etext = .; /* define a global symbol at end of code */ |
| 31 | + } >FLASH |
| 32 | + |
| 33 | + .ARM.exidx : |
| 34 | + { |
| 35 | + *(.ARM.exidx*) |
| 36 | + *(.gnu.linkonce.armexidx.*) |
| 37 | + _sidata = .; /* This is used by the startup in order to initialize the .data section */ |
| 38 | + } > FLASH |
| 39 | + |
| 40 | + /* This is the initialized data section |
| 41 | + The program executes knowing that the data is in the RAM |
| 42 | + but the loader puts the initial values in the FLASH (inidata). |
| 43 | + It is one task of the startup to copy the initial values from FLASH to RAM. */ |
| 44 | + .data : AT ( _sidata ) |
| 45 | + { |
| 46 | + . = ALIGN(4); |
| 47 | + _srelocate = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */ |
| 48 | + *(.ramfunc) |
| 49 | + *(.ramfunc*) |
| 50 | + *(.data) /* .data sections */ |
| 51 | + *(.data*) /* .data* sections */ |
| 52 | + |
| 53 | + . = ALIGN(4); |
| 54 | + _erelocate = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */ |
| 55 | + } >RAM |
| 56 | + |
| 57 | + /* Uninitialized data section */ |
| 58 | + .bss : |
| 59 | + { |
| 60 | + . = ALIGN(4); |
| 61 | + _sbss = .; |
| 62 | + _szero = .; /* define a global symbol at bss start; used by startup code */ |
| 63 | + *(.bss) |
| 64 | + *(.bss*) |
| 65 | + *(COMMON) |
| 66 | + |
| 67 | + . = ALIGN(4); |
| 68 | + _ezero = .; /* define a global symbol at bss end; used by startup code */ |
| 69 | + _ebss = .; |
| 70 | + } >RAM |
| 71 | + |
| 72 | + /* this just checks there is enough RAM for a minimal stack */ |
| 73 | + .stack : |
| 74 | + { |
| 75 | + . = ALIGN(4); |
| 76 | + . = . + 0x800; /* Reserve a minimum of 2K for the stack. */ |
| 77 | + . = ALIGN(4); |
| 78 | + } >RAM |
| 79 | + |
| 80 | + .ARM.attributes 0 : { *(.ARM.attributes) } |
| 81 | +} |
0 commit comments