|
| 1 | +/* |
| 2 | + * Copyright 2025 Arm Limited and/or its affiliates. |
| 3 | + * |
| 4 | + * This source code is licensed under the BSD-style license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + */ |
| 7 | + |
| 8 | + /* |
| 9 | + * This is a simplified linkerscript for the Corstone-300 memory system. |
| 10 | + * This example has been modified to place certain sections in specific memory. |
| 11 | + * Please refer to the Corstone SSE-300 Technical Reference Manual for |
| 12 | + * further information. |
| 13 | + * |
| 14 | + * https://developer.arm.com/Processors/Corstone-300 |
| 15 | + */ |
| 16 | + |
| 17 | +__STACK_SIZE = 0x00008000; |
| 18 | +__HEAP_SIZE = 0x00008000; |
| 19 | +MEMORY |
| 20 | +{ |
| 21 | + ITCM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00080000 |
| 22 | + BRAM (rw) : ORIGIN = 0x11000000, LENGTH = 0x00100000 |
| 23 | + DTCM (rw) : ORIGIN = 0x30000000, LENGTH = 0x00080000 |
| 24 | + SRAM (rw) : ORIGIN = 0x31000000, LENGTH = 0x00200000 |
| 25 | + QSPI (rw) : ORIGIN = 0x38000000, LENGTH = 0x00800000 |
| 26 | + DDR (rwx) : ORIGIN = 0x70000000, LENGTH = 0x60000000 |
| 27 | +} |
| 28 | +PHDRS |
| 29 | +{ |
| 30 | + rom_exec PT_LOAD; |
| 31 | + rom_dram PT_LOAD; |
| 32 | + null PT_NULL; |
| 33 | +} |
| 34 | +ENTRY(Reset_Handler) |
| 35 | +SECTIONS |
| 36 | +{ |
| 37 | + .text : |
| 38 | + { |
| 39 | + _vectors = .; |
| 40 | + KEEP(*(.vectors)) |
| 41 | + *(EXCLUDE_FILE( |
| 42 | + *op_*.cpp.obj |
| 43 | + ) |
| 44 | + .text*) |
| 45 | + KEEP(*(.init)) |
| 46 | + KEEP(*(.fini)) |
| 47 | + *crtbegin.o(.ctors) |
| 48 | + *crtbegin?.o(.ctors) |
| 49 | + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
| 50 | + *(SORT(.ctors.*)) |
| 51 | + *(.ctors) |
| 52 | + *crtbegin.o(.dtors) |
| 53 | + *crtbegin?.o(.dtors) |
| 54 | + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
| 55 | + *(SORT(.dtors.*)) |
| 56 | + *(.dtors) |
| 57 | + KEEP(*(.eh_frame*)) |
| 58 | + } > ITCM :rom_exec |
| 59 | + .ARM.extab : |
| 60 | + { |
| 61 | + *(.ARM.extab* .gnu.linkonce.armextab.*) |
| 62 | + } > ITCM :rom_exec |
| 63 | + .ARM.exidx : |
| 64 | + { |
| 65 | + __exidx_start = .; |
| 66 | + *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
| 67 | + __exidx_end = .; |
| 68 | + } > ITCM :rom_exec |
| 69 | + .copy.table : |
| 70 | + { |
| 71 | + . = ALIGN(4); |
| 72 | + __copy_table_start__ = .; |
| 73 | + LONG (__etext) |
| 74 | + LONG (__data_start__) |
| 75 | + LONG ((__data_end__ - __data_start__) / 4) |
| 76 | + LONG (__eddr_data) |
| 77 | + LONG (__sram_data_start__) |
| 78 | + LONG ((__sram_data_end__ - __sram_data_start__) / 4) |
| 79 | + LONG (__eddr_data + (__sram_data_end__ - __sram_data_start__)) |
| 80 | + LONG (__rodata_start__) |
| 81 | + LONG ((__rodata_end__ - __rodata_start__) / 4) |
| 82 | + __copy_table_end__ = .; |
| 83 | + } > ITCM :rom_exec |
| 84 | + .zero.table : |
| 85 | + { |
| 86 | + . = ALIGN(4); |
| 87 | + __zero_table_start__ = .; |
| 88 | + LONG (__bss_start__) |
| 89 | + LONG ((__bss_end__ - __bss_start__) / 4) |
| 90 | + __zero_table_end__ = .; |
| 91 | + __etext = ALIGN (4); |
| 92 | + } > ITCM :rom_exec |
| 93 | + .data : AT(__etext) |
| 94 | + { |
| 95 | + __data_start__ = .; |
| 96 | + *(vtable) |
| 97 | + *(.data) |
| 98 | + *(.data.*) |
| 99 | + . = ALIGN(4); |
| 100 | + PROVIDE_HIDDEN (__preinit_array_start = .); |
| 101 | + KEEP(*(.preinit_array)) |
| 102 | + PROVIDE_HIDDEN (__preinit_array_end = .); |
| 103 | + . = ALIGN(4); |
| 104 | + PROVIDE_HIDDEN (__init_array_start = .); |
| 105 | + KEEP(*(SORT(.init_array.*))) |
| 106 | + KEEP(*(.init_array)) |
| 107 | + PROVIDE_HIDDEN (__init_array_end = .); |
| 108 | + . = ALIGN(4); |
| 109 | + PROVIDE_HIDDEN (__fini_array_start = .); |
| 110 | + KEEP(*(SORT(.fini_array.*))) |
| 111 | + KEEP(*(.fini_array)) |
| 112 | + PROVIDE_HIDDEN (__fini_array_end = .); |
| 113 | + KEEP(*(.jcr*)) |
| 114 | + . = ALIGN(4); |
| 115 | + __data_end__ = .; |
| 116 | + } > DTCM :rom_exec |
| 117 | + .sram.bss : |
| 118 | + { |
| 119 | + . = ALIGN(16); |
| 120 | + . = ALIGN(32); |
| 121 | + *(.bss.tensor_arena) |
| 122 | + . = ALIGN(16); |
| 123 | + *(.bss.ethosu_scratch); |
| 124 | + *.(output_data_sec) |
| 125 | + } > SRAM :null |
| 126 | + .ddr : |
| 127 | + { |
| 128 | + . = ALIGN(16); |
| 129 | + *(network_model_sec) |
| 130 | + * (expected_output_data_sec) |
| 131 | + . = ALIGN(16); |
| 132 | + * (sec_command_stream, sec_weight_data, sec_input_data) |
| 133 | + * (.got*) |
| 134 | + * (ethosu_core_in_queue) |
| 135 | + * (ethosu_core_out_queue) |
| 136 | + . = ALIGN(4); |
| 137 | + } > DDR :rom_dram |
| 138 | + .ddr_noload (NOLOAD) : |
| 139 | + { |
| 140 | + . = ALIGN(16); |
| 141 | + *(input_data_sec) |
| 142 | + . = ALIGN(16); |
| 143 | + } > DDR :null |
| 144 | + __eddr_data = ALIGN(4); |
| 145 | + .sram.data : |
| 146 | + { |
| 147 | + __sram_data_start__ = .; |
| 148 | + *(.sram.data) |
| 149 | + . = ALIGN(4); |
| 150 | + *op_*.cpp.obj (*.text*) |
| 151 | + __sram_data_end__ = .; |
| 152 | + } > BRAM AT >DDR :rom_dram |
| 153 | + .rodata : |
| 154 | + { |
| 155 | + __rodata_start__ = .; |
| 156 | + *(.rodata) |
| 157 | + *(.rodata.*) |
| 158 | + . = ALIGN(4); |
| 159 | + __rodata_end__ = .; |
| 160 | + } > DTCM AT >DDR :rom_dram |
| 161 | + .bss : |
| 162 | + { |
| 163 | + . = ALIGN(4); |
| 164 | + __bss_start__ = .; |
| 165 | + *(.bss) |
| 166 | + *(.bss.*) |
| 167 | + *(COMMON) |
| 168 | + . = ALIGN(4); |
| 169 | + __bss_end__ = .; |
| 170 | + } > DTCM :null |
| 171 | + .heap (COPY) : |
| 172 | + { |
| 173 | + . = ALIGN(8); |
| 174 | + __end__ = .; |
| 175 | + PROVIDE(end = .); |
| 176 | + . = . + __HEAP_SIZE; |
| 177 | + . = ALIGN(8); |
| 178 | + __HeapLimit = .; |
| 179 | + } > DTCM :null |
| 180 | + .stack (ORIGIN(DTCM) + LENGTH(DTCM) - __STACK_SIZE) (COPY) : |
| 181 | + { |
| 182 | + . = ALIGN(8); |
| 183 | + __StackLimit = .; |
| 184 | + . = . + __STACK_SIZE; |
| 185 | + . = ALIGN(8); |
| 186 | + __StackTop = .; |
| 187 | + } > DTCM :null |
| 188 | + PROVIDE(__stack = __StackTop); |
| 189 | + __RAM_segment_used_end__ = .; |
| 190 | + ASSERT(__StackLimit >= __HeapLimit, "region DTCM overflowed with stack") |
| 191 | +} |
0 commit comments