-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: Toolchain abstraction: Introduce toolchain_ld_relocation macro
No functional change expected. This is motivated by the wish to abstract Zephyr's usage of toolchains, permitting non-intrusive porting to other (commercial) toolchains. Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
- Loading branch information
1 parent
87d1f06
commit 86a3e8f
Showing
3 changed files
with
27 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# See root CMakeLists.txt for description and expectations of these macros | ||
|
||
macro(toolchain_ld_relocation) | ||
set(MEM_RELOCATAION_LD "${PROJECT_BINARY_DIR}/include/generated/linker_relocate.ld") | ||
set(MEM_RELOCATAION_CODE "${PROJECT_BINARY_DIR}/code_relocation.c") | ||
|
||
add_custom_command( | ||
OUTPUT ${MEM_RELOCATAION_CODE} ${MEM_RELOCATAION_LD} | ||
COMMAND | ||
${PYTHON_EXECUTABLE} | ||
${ZEPHYR_BASE}/scripts/gen_relocate_app.py | ||
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose> | ||
-d ${APPLICATION_BINARY_DIR} | ||
-i '$<TARGET_PROPERTY:code_data_relocation_target,COMPILE_DEFINITIONS>' | ||
-o ${MEM_RELOCATAION_LD} | ||
-c ${MEM_RELOCATAION_CODE} | ||
DEPENDS app kernel ${ZEPHYR_LIBS_PROPERTY} | ||
) | ||
|
||
add_library(code_relocation_source_lib STATIC ${MEM_RELOCATAION_CODE}) | ||
target_link_libraries(code_relocation_source_lib zephyr_interface) | ||
endmacro() |