Skip to content

Commit 6b0f635

Browse files
committed
Arm backend: Add example linkerscripts for U55/U85
Add linkerscripts for exector_runner targeting U55/U85 in examples/arm instead of using the linkerscripts from core_platform and then applying patches. The patches are deleted since they are no longer needed. Change-Id: I379cf1cd3d9464227fee0555e39847e5b61cc392 Signed-off-by: [email protected]
1 parent 72580d2 commit 6b0f635

File tree

6 files changed

+392
-140
lines changed

6 files changed

+392
-140
lines changed

examples/arm/ethos-u-setup/core_platform/0001-Add-got-section-to-the-DDR.patch

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/arm/ethos-u-setup/core_platform/0002-Move-input_data_sec-to-NOLOAD-area.patch

Lines changed: 0 additions & 71 deletions
This file was deleted.

examples/arm/ethos-u-setup/core_platform/0003-Move-the-portable-kernels-to-the-BRAM.patch

Lines changed: 0 additions & 42 deletions
This file was deleted.

examples/arm/executor_runner/CMakeLists.txt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,28 @@ target_sources(
143143
arm_memory_allocator.cpp
144144
)
145145

146-
# Include the target's bare-metal linker script
147-
ethosu_eval_link_options(arm_executor_runner)
146+
# Use our own linkerscripts
147+
# Check for "U55" in SYSTEM_CONFIG
148+
string(FIND "${SYSTEM_CONFIG}" "U55" U55_FOUND)
149+
150+
# Check for "U85" in SYSTEM_CONFIG
151+
string(FIND "${SYSTEM_CONFIG}" "U85" U85_FOUND)
152+
153+
# Check if neither "U55" nor "U85" was found
154+
if(U55_FOUND EQUAL -1 AND U85_FOUND EQUAL -1)
155+
message(FATAL_ERROR "SYSTEM_CONFIG does not contain 'U55' or 'U85'. Configuration aborting.")
156+
endif()
157+
158+
# Proceed with specific actions if either is found
159+
if(NOT U55_FOUND EQUAL -1)
160+
message(STATUS "SYSTEM_CONFIG contains 'U55'.")
161+
target_link_options(arm_executor_runner PRIVATE "-T" "${CMAKE_SOURCE_DIR}/Corstone-300.ld")
162+
endif()
163+
164+
if(NOT U85_FOUND EQUAL -1)
165+
message(STATUS "SYSTEM_CONFIG contains 'U85'.")
166+
target_link_options(arm_executor_runner PRIVATE "-T" "${CMAKE_SOURCE_DIR}/Corstone-320.ld")
167+
endif()
148168

149169
set(arm_executor_runner_link)
150170
list(
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
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

Comments
 (0)