Skip to content

Add semihosting to cmake for executor_runner #3008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ add_compile_definitions(
add_link_options(
-mcpu=${GCC_CPU}
-mthumb
--specs=nosys.specs)
)

if(SEMIHOSTING)
add_link_options(--specs=rdimon.specs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include a rationale for enabling this in the commit / PR summary?

else()
add_link_options(--specs=nosys.specs)
endif()

# Set floating point unit
if(CMAKE_SYSTEM_PROCESSOR MATCHES "\\+fp")
Expand Down
16 changes: 16 additions & 0 deletions examples/arm/executor_runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ if(NOT DEFINED ET_PTE_FILE_PATH)
"model is built into the binary.")
endif()

option(SEMIHOSTING "Enable semihosting" OFF)

# Example ExecuTorch demo for bare metal Cortex-M based systems
set(ET_DIR_PATH "../../.." CACHE PATH
"Path to ExecuTorch dir")
Expand Down Expand Up @@ -105,3 +107,17 @@ target_include_directories(arm_executor_runner PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

add_dependencies(arm_executor_runner gen_model_header)


if(SEMIHOSTING)
target_compile_definitions(arm_executor_runner PUBLIC SEMIHOSTING)
endif()

# Fixup compilation of retarget.c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also create a ET GH task and refer that here?

if(SEMIHOSTING)
# Remove this when MLBEDSW-8910 is closed.
set_source_files_properties(
${ETHOS_SDK_PATH}/core_platform/targets/corstone-300/retarget.c
PROPERTIES HEADER_FILE_ONLY TRUE
)
endif()