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 <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2022-01-05 11:25:26 +01:00 committed by Carles Cufí
commit 6d72d915f9
2 changed files with 2 additions and 8 deletions

View file

@ -802,6 +802,7 @@ if(CONFIG_HAS_DTS)
--kernel $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
--zephyr-base ${ZEPHYR_BASE}
--start-symbol "$<TARGET_PROPERTY:linker,devices_start_symbol>"
VERBATIM
DEPENDS ${ZEPHYR_LINK_STAGE_EXECUTABLE}
)
set_property(GLOBAL APPEND PROPERTY GENERATED_APP_SOURCE_FILES dev_handles.c)

View file

@ -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)