1/* 2 * Copyright (c) 2023 HPMicro 3 * SPDX-License-Identifier: BSD-3-Clause 4 */ 5 6ENTRY(_start) 7 8STACK_SIZE = _stack_size; 9HEAP_SIZE = _heap_size; 10UF2_BOOTLOADER_RESERVED_LENGTH = DEFINED(_uf2_bl_length) ? _uf2_bl_length : 0x20000; 11 12MEMORY 13{ 14 XPI0 (rx) : ORIGIN = 0x80000000 + UF2_BOOTLOADER_RESERVED_LENGTH, LENGTH = _flash_size - UF2_BOOTLOADER_RESERVED_LENGTH 15 ILM (wx) : ORIGIN = 0x00000000, LENGTH = 128K 16 DLM (w) : ORIGIN = 0x00080000, LENGTH = 128K 17 AHB_SRAM (w) : ORIGIN = 0xF0400000, LENGTH = 32k 18} 19 20SECTIONS 21{ 22 .start : { 23 KEEP(*(.uf2_signature)) 24 KEEP(*(.start)) 25 } > XPI0 26 27 __vector_load_addr__ = ADDR(.start) + SIZEOF(.start); 28 .vectors ORIGIN(ILM) : AT(__vector_load_addr__) { 29 . = ALIGN(8); 30 __vector_ram_start__ = .; 31 KEEP(*(.vector_table)) 32 KEEP(*(.isr_vector)) 33 KEEP(*(.vector_s_table)) 34 KEEP(*(.isr_s_vector)) 35 . = ALIGN(8); 36 __vector_ram_end__ = .; 37 } > ILM 38 39 .text (__vector_load_addr__ + SIZEOF(.vectors)): { 40 . = ALIGN(8); 41 *(.text) 42 *(.text*) 43 *(.rodata) 44 *(.rodata*) 45 *(.srodata) 46 *(.srodata*) 47 48 *(.hash) 49 *(.dyn*) 50 *(.gnu*) 51 *(.pl*) 52 53 KEEP (*(.init)) 54 KEEP (*(.fini)) 55 56 /* section information for usbh class */ 57 . = ALIGN(8); 58 __usbh_class_info_start__ = .; 59 KEEP(*(.usbh_class_info)) 60 __usbh_class_info_end__ = .; 61 62 /* RT-Thread related sections - Start */ 63 /* section information for finsh shell */ 64 . = ALIGN(4); 65 __fsymtab_start = .; 66 KEEP(*(FSymTab)) 67 __fsymtab_end = .; 68 . = ALIGN(4); 69 __vsymtab_start = .; 70 KEEP(*(VSymTab)) 71 __vsymtab_end = .; 72 . = ALIGN(4); 73 74 . = ALIGN(4); 75 __rt_init_start = .; 76 KEEP(*(SORT(.rti_fn*))) 77 __rt_init_end = .; 78 . = ALIGN(4); 79 80 /* section information for modules */ 81 . = ALIGN(4); 82 __rtmsymtab_start = .; 83 KEEP(*(RTMSymTab)) 84 __rtmsymtab_end = .; 85 86 /* RT-Thread related sections - end */ 87 . = ALIGN(8); 88 } > XPI0 89 90 .eh_frame : 91 { 92 __eh_frame_start = .; 93 KEEP(*(.eh_frame)) 94 __eh_frame_end = .; 95 } > XPI0 96 97 .eh_frame_hdr : 98 { 99 KEEP(*(.eh_frame_hdr)) 100 } > XPI0 101 __eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0; 102 __eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0; 103 104 105 .rel : { 106 KEEP(*(.rel*)) 107 } > XPI0 108 109 PROVIDE (__etext = .); 110 PROVIDE (_etext = .); 111 PROVIDE (etext = .); 112 113 __data_load_addr__ = etext; 114 .data : AT(__data_load_addr__) { 115 . = ALIGN(8); 116 __data_start__ = .; 117 __global_pointer$ = . + 0x800; 118 *(.data) 119 *(.data*) 120 *(.sdata) 121 *(.sdata*) 122 123 KEEP(*(.jcr)) 124 KEEP(*(.dynamic)) 125 KEEP(*(.got*)) 126 KEEP(*(.got)) 127 KEEP(*(.gcc_except_table)) 128 KEEP(*(.gcc_except_table.*)) 129 130 . = ALIGN(8); 131 PROVIDE(__preinit_array_start = .); 132 KEEP(*(.preinit_array)) 133 PROVIDE(__preinit_array_end = .); 134 135 . = ALIGN(8); 136 PROVIDE(__init_array_start = .); 137 KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*))) 138 KEEP(*(.init_array)) 139 PROVIDE(__init_array_end = .); 140 141 . = ALIGN(8); 142 PROVIDE(__finit_array_start = .); 143 KEEP(*(SORT_BY_INIT_PRIORITY(.finit_array.*))) 144 KEEP(*(.finit_array)) 145 PROVIDE(__finit_array_end = .); 146 147 . = ALIGN(8); 148 KEEP(*crtbegin*.o(.ctors)) 149 KEEP(*(EXCLUDE_FILE (*crtend*.o) .ctors)) 150 KEEP(*(SORT(.ctors.*))) 151 KEEP(*(.ctors)) 152 153 . = ALIGN(8); 154 KEEP(*crtbegin*.o(.dtors)) 155 KEEP(*(EXCLUDE_FILE (*crtend*.o) .dtors)) 156 KEEP(*(SORT(.dtors.*))) 157 KEEP(*(.dtors)) 158 . = ALIGN(8); 159 __data_end__ = .; 160 PROVIDE (__edata = .); 161 PROVIDE (_edata = .); 162 PROVIDE (edata = .); 163 } > DLM 164 165 __fast_load_addr__ = etext + SIZEOF(.data); 166 .fast : AT(__fast_load_addr__) { 167 . = ALIGN(8); 168 PROVIDE(__ramfunc_start__ = .); 169 *(.fast) 170 *(.fast.*) 171 . = ALIGN(8); 172 PROVIDE(__ramfunc_end__ = .); 173 } > ILM 174 175 __tdata_load_addr__ = etext + SIZEOF(.data) + SIZEOF(.fast); 176 .tdata : AT(__tdata_load_addr__) { 177 . = ALIGN(8); 178 PROVIDE(__tdata_start__ = .); 179 *(.tdata) 180 *(.tdata.*) 181 *(.gnu.linkonce.td.*) 182 . = ALIGN(8); 183 PROVIDE(__tdata_end__ = .); 184 } > DLM 185 186 .tbss (NOLOAD) : { 187 . = ALIGN(8); 188 PROVIDE(__tbss_start__ = .); 189 __thread_pointer$ = .; 190 *(.tbss) 191 *(.tbss.*) 192 *(.gnu.linkonce.tb.*) 193 *(.tcommon) 194 . = ALIGN(8); 195 PROVIDE(__tbss_end__ = .); 196 } > DLM 197 198 __noncacheable_init_load_addr__ = etext + SIZEOF(.data) + SIZEOF(.fast) + SIZEOF(.tdata); 199 .noncacheable.init : AT(__noncacheable_init_load_addr__) { 200 . = ALIGN(8); 201 __noncacheable_init_start__ = .; 202 KEEP(*(.noncacheable.init)) 203 __noncacheable_init_end__ = .; 204 . = ALIGN(8); 205 } > DLM 206 207 __fast_ram_init_load_addr__ = etext + SIZEOF(.data) + SIZEOF(.fast) + SIZEOF(.tdata) + SIZEOF(.noncacheable.init); 208 .fast_ram.init : AT(__fast_ram_init_load_addr__) { 209 . = ALIGN(8); 210 __fast_ram_init_start__ = .; 211 KEEP(*(.fast_ram.init)) 212 __fast_ram_init_end__ = .; 213 . = ALIGN(8); 214 } > DLM 215 216 .ahb_sram (NOLOAD) : { 217 KEEP(*(.ahb_sram)) 218 } > AHB_SRAM 219 220 .bss (NOLOAD) : { 221 . = ALIGN(8); 222 __bss_start__ = .; 223 *(.bss) 224 *(.bss*) 225 *(.sbss*) 226 *(.scommon) 227 *(.scommon*) 228 *(.dynsbss*) 229 *(COMMON) 230 . = ALIGN(8); 231 _end = .; 232 __bss_end__ = .; 233 } > DLM 234 235 .framebuffer (NOLOAD) : { 236 . = ALIGN(8); 237 KEEP(*(.framebuffer)) 238 . = ALIGN(8); 239 } > DLM 240 241 242 .noncacheable.bss (NOLOAD) : { 243 . = ALIGN(8); 244 KEEP(*(.noncacheable)) 245 __noncacheable_bss_start__ = .; 246 KEEP(*(.noncacheable.bss)) 247 __noncacheable_bss_end__ = .; 248 . = ALIGN(8); 249 } > DLM 250 251 .fast_ram.bss (NOLOAD) : { 252 . = ALIGN(8); 253 KEEP(*(.fast_ram)) 254 __fast_ram_bss_start__ = .; 255 KEEP(*(.fast_ram.bss)) 256 __fast_ram_bss_end__ = .; 257 . = ALIGN(8); 258 } > DLM 259 260 .heap (NOLOAD) : { 261 . = ALIGN(8); 262 __heap_start__ = .; 263 . += HEAP_SIZE; 264 __heap_end__ = .; 265 } > DLM 266 267 .stack (NOLOAD) : { 268 . = ALIGN(16); 269 __stack_base__ = .; 270 . += STACK_SIZE; 271 . = ALIGN(16); 272 PROVIDE (_stack = .); 273 PROVIDE (_stack_safe = .); 274 } > DLM 275 276 __fw_size__ = SIZEOF(.start) + SIZEOF(.vectors) + SIZEOF(.rel) + SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.fast) + SIZEOF(.tdata) + SIZEOF(.noncacheable.init) + SIZEOF(.fast_ram.init); 277 __last_addr__ = __fast_ram_init_load_addr__ + SIZEOF(.fast_ram.init); 278 ASSERT(((__fw_size__ <= LENGTH(XPI0)) && (__last_addr__ <= (ORIGIN(XPI0) + LENGTH(XPI0)))), "****** FAILED! XPI0 has not enough space! ******") 279} 280