cmake: update configure_linker_script() to prepend -D on defines

Currently all calls to `configure_linker_script()` specifies `-D<name>`
when calling `configure_linker_script()`.

This works well for the gcc pre-processed ld linker script templates,
but Zephyr also supports a CMake linker script generator which can be
used for ld scripts and armlink scatter files.

In this case, a `-D` must be stripped.

This commit changes this so that Zephyr CMake build system calls
`configure_linker_script()` without `-D`.
Thus the `LINKER_SCRIPT` choice can decide how this information should
be passed to underlying linker script functionality, that is `-D` for
linker script template and CMake variable for the CMake linker script
generator.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-11-01 12:53:28 +01:00 committed by Carles Cufí
commit 1fa3f15137
5 changed files with 17 additions and 10 deletions

View file

@ -1061,7 +1061,7 @@ if(CONFIG_USERSPACE)
configure_linker_script(
linker_app_smem_unaligned.cmd
"-DLINKER_APP_SMEM_UNALIGNED"
"LINKER_APP_SMEM_UNALIGNED"
${CODE_RELOCATION_DEP}
${APP_SMEM_UNALIGNED_DEP}
${APP_SMEM_UNALIGNED_LD}
@ -1246,7 +1246,7 @@ endif()
configure_linker_script(
linker_zephyr_prebuilt.cmd
"-DLINKER_ZEPHYR_PREBUILT"
"LINKER_ZEPHYR_PREBUILT"
${APP_SMEM_ALIGNED_DEP}
${KOBJECT_LINKER_DEP}
${CODE_RELOCATION_DEP}
@ -1298,7 +1298,7 @@ else()
# file and preprocessed with the define LINKER_ZEPHYR_FINAL.
configure_linker_script(
linker.cmd
"-DLINKER_ZEPHYR_FINAL"
"LINKER_ZEPHYR_FINAL"
${CODE_RELOCATION_DEP}
${ZEPHYR_PREBUILT_EXECUTABLE}
zephyr_generated_headers