Skip to content

Commit 3720e16

Browse files
committed
Add semihosting to cmake for executor_runner
Add cmake option to enable semihosting for the executor runner application. Change-Id: I5db7271413b39e5122f86f321d15dd2a1086a547
1 parent 910f851 commit 3720e16

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ add_compile_definitions(
5858
add_link_options(
5959
-mcpu=${GCC_CPU}
6060
-mthumb
61-
--specs=nosys.specs)
61+
)
62+
63+
if(SEMIHOSTING)
64+
add_link_options(--specs=rdimon.specs)
65+
else()
66+
add_link_options(--specs=nosys.specs)
67+
endif()
6268

6369
# Set floating point unit
6470
if(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+fp")

examples/arm/executor_runner/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ if(NOT DEFINED ET_PTE_FILE_PATH)
1212
"model is built into the binary.")
1313
endif()
1414

15+
option(SEMIHOSTING "Enable semihosting" OFF)
16+
1517
# Example ExecuTorch demo for bare metal Cortex-M based systems
1618
set(ET_DIR_PATH "../../.." CACHE PATH
1719
"Path to ExecuTorch dir")
@@ -105,3 +107,17 @@ target_include_directories(arm_executor_runner PRIVATE
105107
${CMAKE_CURRENT_BINARY_DIR})
106108

107109
add_dependencies(arm_executor_runner gen_model_header)
110+
111+
112+
if(SEMIHOSTING)
113+
target_compile_definitions(arm_executor_runner PUBLIC SEMIHOSTING)
114+
endif()
115+
116+
# Fixup compilation of retarget.c
117+
if(SEMIHOSTING)
118+
# Remove this when MLBEDSW-8910 is closed.
119+
set_source_files_properties(
120+
${ETHOS_SDK_PATH}/core_platform/targets/corstone-300/retarget.c
121+
PROPERTIES HEADER_FILE_ONLY TRUE
122+
)
123+
endif()

0 commit comments

Comments
 (0)