From acc6b85c0086ff4a37d2108ec9edfb8faf6f43e6 Mon Sep 17 00:00:00 2001 From: Kshitij Sisodia Date: Tue, 1 Mar 2022 10:23:11 +0000 Subject: MLECO-2983: Preliminary support to allow semihosting Adding basic support to allow applications to build with semihosting support. Default state is always disabled. Signed-off-by: Kshitij Sisodia Change-Id: I1d34c3a246560aaffcb34eee801e1a87d887d559 --- scripts/cmake/toolchains/bare-metal-gcc.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts/cmake/toolchains/bare-metal-gcc.cmake') diff --git a/scripts/cmake/toolchains/bare-metal-gcc.cmake b/scripts/cmake/toolchains/bare-metal-gcc.cmake index 89201fb..a5688d6 100644 --- a/scripts/cmake/toolchains/bare-metal-gcc.cmake +++ b/scripts/cmake/toolchains/bare-metal-gcc.cmake @@ -85,11 +85,21 @@ add_link_options( -mcpu=${CPU_NAME} -mfloat-abi=${FLOAT_ABI} -mlittle-endian - --specs=nosys.specs --stats "SHELL:-Xlinker --gc-sections" "$<$:--no-debug>") +function(configure_semihosting TARGET_NAME SEMIHOSTING) + if (${SEMIHOSTING}) + target_link_options(${TARGET_NAME} PUBLIC "--specs=rdimon.specs") + target_compile_options(${TARGET_NAME} PUBLIC "--specs=rdimon.specs") + target_compile_definitions(${TARGET_NAME} PUBLIC USE_SEMIHOSTING) + else() + target_link_options(${TARGET_NAME} PUBLIC --specs=nosys.specs) + target_compile_options(${TARGET_NAME} PUBLIC "--specs=nosys.specs") + endif() +endfunction() + # Function to add a map file output for the linker to dump diagnostic information to. function(add_target_map_file TARGET_NAME MAP_FILE_PATH) target_link_options(${TARGET_NAME} PUBLIC -- cgit v1.2.1