Skip to content

Commit 1c4de12

Browse files
authored
Arm backend: Add example linkerscripts for U55/U85 (#13404)
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. Signed-off-by: [email protected]
1 parent 13569b7 commit 1c4de12

File tree

6 files changed

+636
-140
lines changed

6 files changed

+636
-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: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,47 @@ 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+
# Check for "U55" in SYSTEM_CONFIG
147+
string(FIND "${SYSTEM_CONFIG}" "U55" U55_FOUND)
148+
149+
# Check for "U85" in SYSTEM_CONFIG
150+
string(FIND "${SYSTEM_CONFIG}" "U85" U85_FOUND)
151+
152+
# Check if neither "U55" nor "U85" was found
153+
if(U55_FOUND EQUAL -1 AND U85_FOUND EQUAL -1)
154+
message(
155+
FATAL_ERROR
156+
"SYSTEM_CONFIG does not contain 'U55' or 'U85'. Configuration aborting."
157+
)
158+
endif()
159+
160+
# Proceed with specific actions if either is found
161+
if(NOT U55_FOUND EQUAL -1)
162+
message(STATUS "SYSTEM_CONFIG contains 'U55'.")
163+
set(LINK_FILE_IN "${CMAKE_SOURCE_DIR}/Corstone-300.ld")
164+
endif()
165+
166+
if(NOT U85_FOUND EQUAL -1)
167+
message(STATUS "SYSTEM_CONFIG contains 'U85'.")
168+
set(LINK_FILE_IN "${CMAKE_SOURCE_DIR}/Corstone-320.ld")
169+
endif()
170+
171+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
172+
set(LINK_FILE_EXT ld)
173+
set(LINK_FILE_OPTION "-T")
174+
set(COMPILER_PREPROCESSOR_OPTIONS -E -x c -P)
175+
endif()
176+
177+
get_filename_component(LINK_FILE_OUT_BASE ${LINK_FILE} NAME)
178+
set(LINK_FILE_OUT
179+
${CMAKE_CURRENT_BINARY_DIR}/${LINK_FILE_OUT_BASE}.${LINK_FILE_EXT}
180+
)
181+
182+
execute_process(
183+
COMMAND ${CMAKE_C_COMPILER} ${COMPILER_PREPROCESSOR_OPTIONS} -o
184+
${LINK_FILE_OUT} ${LINK_FILE_IN}
185+
)
186+
target_link_options(arm_executor_runner PRIVATE "-T" "${LINK_FILE_OUT}")
148187

149188
set(arm_executor_runner_link)
150189
list(

0 commit comments

Comments
 (0)