From 6d72d915f9e87c1c6e6e817d998d5bf3dfa30c16 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 5 Jan 2022 11:25:26 +0100 Subject: [PATCH] cmake: remove platform / build file specific escaping Fixes: #41435 Remove build host specific escaping of start symbol command argument. The start symbol for armlink is: Image$$device$$Base and were escaped as: Image\\$$\\$$device\\$$\\$$Base However, the $ must only be escaped in Linux and MacOS, not on windows hosts. Instead of escaping the start symbol in the CMake code then it is better to use the VERBATIM flag on `add_custom_command()` which ensures correct escaping for the build host. Signed-off-by: Torsten Rasmussen --- CMakeLists.txt | 1 + cmake/linker/armlink/target.cmake | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f95c97ba3de..5087be083de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -802,6 +802,7 @@ if(CONFIG_HAS_DTS) --kernel $ --zephyr-base ${ZEPHYR_BASE} --start-symbol "$" + VERBATIM DEPENDS ${ZEPHYR_LINK_STAGE_EXECUTABLE} ) set_property(GLOBAL APPEND PROPERTY GENERATED_APP_SOURCE_FILES dev_handles.c) diff --git a/cmake/linker/armlink/target.cmake b/cmake/linker/armlink/target.cmake index 561faab5cb9..912a72353b9 100644 --- a/cmake/linker/armlink/target.cmake +++ b/cmake/linker/armlink/target.cmake @@ -1,13 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -# In order to ensure that the armlink symbol name is correctly passed to -# gen_handles.py, we must first ensure that it is properly escaped. -# For Python to work, the `$` must be passed as `\$` on command line. -# In order to pass a single `\` to command line it must first be escaped, that is `\\`. -# In ninja build files, a `$` is not accepted but must be passed as `$$`. -# CMake, Python and Ninja combined results in `\\$$` in order to pass a sing `\$` to Python, -# so `$$` thus becomes: `\\$$\\$$`. -set_property(TARGET linker PROPERTY devices_start_symbol "Image\\$$\\$$device\\$$\\$$Base") +set_property(TARGET linker PROPERTY devices_start_symbol "Image$$device$$Base") find_program(CMAKE_LINKER ${CROSS_COMPILE}armlink PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)