memmap_sdboot_200k.ld (6446B)
1 /* Linker script del multi-booter viejo de ClockworkPi (Code/pico_multi_booter): 2 la app arranca en flash + 200k. Solo para el target <juego>_sd200k (ver comun_pico.cmake). */ 3 MEMORY 4 { 5 FLASH(rx) : ORIGIN = 0x10000000 + 200k, LENGTH = 2048k - 200k 6 RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k 7 SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k 8 SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k 9 } 10 11 ENTRY(_entry_point) 12 13 SECTIONS 14 { 15 /* Second stage bootloader is prepended to the image. It must be 256 bytes big 16 and checksummed. It is usually built by the boot_stage2 target 17 in the Raspberry Pi Pico SDK 18 */ 19 20 .flash_begin : { 21 __flash_binary_start = .; 22 } > FLASH 23 24 /* The second stage will always enter the image at the start of .text. 25 The debugger will use the ELF entry point, which is the _entry_point 26 symbol if present, otherwise defaults to start of .text. 27 This can be used to transfer control back to the bootrom on debugger 28 launches only, to perform proper flash setup. 29 */ 30 31 .text : { 32 __logical_binary_start = .; 33 KEEP (*(.vectors)) 34 KEEP (*(.binary_info_header)) 35 __binary_info_header_end = .; 36 KEEP (*(.reset)) 37 /* TODO revisit this now memset/memcpy/float in ROM */ 38 /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from 39 * FLASH ... we will include any thing excluded here in .data below by default */ 40 *(.init) 41 *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) 42 *(.fini) 43 /* Pull all c'tors into .text */ 44 *crtbegin.o(.ctors) 45 *crtbegin?.o(.ctors) 46 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) 47 *(SORT(.ctors.*)) 48 *(.ctors) 49 /* Followed by destructors */ 50 *crtbegin.o(.dtors) 51 *crtbegin?.o(.dtors) 52 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) 53 *(SORT(.dtors.*)) 54 *(.dtors) 55 56 *(.eh_frame*) 57 . = ALIGN(4); 58 } > FLASH 59 60 .rodata : { 61 *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) 62 . = ALIGN(4); 63 *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) 64 . = ALIGN(4); 65 } > FLASH 66 67 .ARM.extab : 68 { 69 *(.ARM.extab* .gnu.linkonce.armextab.*) 70 } > FLASH 71 72 __exidx_start = .; 73 .ARM.exidx : 74 { 75 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 76 } > FLASH 77 __exidx_end = .; 78 79 /* Machine inspectable binary information */ 80 . = ALIGN(4); 81 __binary_info_start = .; 82 .binary_info : 83 { 84 KEEP(*(.binary_info.keep.*)) 85 *(.binary_info.*) 86 } > FLASH 87 __binary_info_end = .; 88 . = ALIGN(4); 89 90 .ram_vector_table (NOLOAD): { 91 *(.ram_vector_table) 92 } > RAM 93 94 .data : { 95 __data_start__ = .; 96 *(vtable) 97 98 *(.time_critical*) 99 100 /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ 101 *(.text*) 102 . = ALIGN(4); 103 *(.rodata*) 104 . = ALIGN(4); 105 106 *(.data*) 107 108 . = ALIGN(4); 109 *(.after_data.*) 110 . = ALIGN(4); 111 /* preinit data */ 112 PROVIDE_HIDDEN (__mutex_array_start = .); 113 KEEP(*(SORT(.mutex_array.*))) 114 KEEP(*(.mutex_array)) 115 PROVIDE_HIDDEN (__mutex_array_end = .); 116 117 . = ALIGN(4); 118 /* preinit data */ 119 PROVIDE_HIDDEN (__preinit_array_start = .); 120 KEEP(*(SORT(.preinit_array.*))) 121 KEEP(*(.preinit_array)) 122 PROVIDE_HIDDEN (__preinit_array_end = .); 123 124 . = ALIGN(4); 125 /* init data */ 126 PROVIDE_HIDDEN (__init_array_start = .); 127 KEEP(*(SORT(.init_array.*))) 128 KEEP(*(.init_array)) 129 PROVIDE_HIDDEN (__init_array_end = .); 130 131 . = ALIGN(4); 132 /* finit data */ 133 PROVIDE_HIDDEN (__fini_array_start = .); 134 *(SORT(.fini_array.*)) 135 *(.fini_array) 136 PROVIDE_HIDDEN (__fini_array_end = .); 137 138 *(.jcr) 139 . = ALIGN(4); 140 /* All data end */ 141 __data_end__ = .; 142 } > RAM AT> FLASH 143 /* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */ 144 __etext = LOADADDR(.data); 145 146 .uninitialized_data (NOLOAD): { 147 . = ALIGN(4); 148 *(.uninitialized_data*) 149 } > RAM 150 151 /* Start and end symbols must be word-aligned */ 152 .scratch_x : { 153 __scratch_x_start__ = .; 154 *(.scratch_x.*) 155 . = ALIGN(4); 156 __scratch_x_end__ = .; 157 } > SCRATCH_X AT > FLASH 158 __scratch_x_source__ = LOADADDR(.scratch_x); 159 160 .scratch_y : { 161 __scratch_y_start__ = .; 162 *(.scratch_y.*) 163 . = ALIGN(4); 164 __scratch_y_end__ = .; 165 } > SCRATCH_Y AT > FLASH 166 __scratch_y_source__ = LOADADDR(.scratch_y); 167 168 .bss : { 169 . = ALIGN(4); 170 __bss_start__ = .; 171 *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) 172 *(COMMON) 173 . = ALIGN(4); 174 __bss_end__ = .; 175 } > RAM 176 177 .heap (NOLOAD): 178 { 179 __end__ = .; 180 end = __end__; 181 KEEP(*(.heap*)) 182 __HeapLimit = .; 183 } > RAM 184 185 /* .stack*_dummy section doesn't contains any symbols. It is only 186 * used for linker to calculate size of stack sections, and assign 187 * values to stack symbols later 188 * 189 * stack1 section may be empty/missing if platform_launch_core1 is not used */ 190 191 /* by default we put core 0 stack at the end of scratch Y, so that if core 1 192 * stack is not used then all of SCRATCH_X is free. 193 */ 194 .stack1_dummy (NOLOAD): 195 { 196 *(.stack1*) 197 } > SCRATCH_X 198 .stack_dummy (NOLOAD): 199 { 200 KEEP(*(.stack*)) 201 } > SCRATCH_Y 202 203 .flash_end : { 204 PROVIDE(__flash_binary_end = .); 205 } > FLASH 206 207 /* stack limit is poorly named, but historically is maximum heap ptr */ 208 __StackLimit = ORIGIN(RAM) + LENGTH(RAM); 209 __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); 210 __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); 211 __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); 212 __StackBottom = __StackTop - SIZEOF(.stack_dummy); 213 PROVIDE(__stack = __StackTop); 214 215 /* Check if data + heap + stack exceeds RAM limit */ 216 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") 217 218 ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary") 219 /* todo assert on extra code */ 220 } 221