Skip to content

Commit 1e22329

Browse files
tejlmandcarlescufi
authored andcommitted
[nrf fromtree] cmake: code relocation setting.
With code relocation directives passed to the gen_relocate_app.py script using generated file, then each directive can be place on individual line in the file and thus free up the `|` character as separator. Furthermore, a multi-line file with each directive on separate line is also more user-readable, making debugging easier. Signed-off-by: Torsten Rasmussen <[email protected]> (cherry picked from commit cb8f99a)
1 parent 6c9b2f2 commit 1e22329

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cmake/modules/extensions.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,15 +1521,15 @@ function(zephyr_code_relocate)
15211521
if(CODE_REL_PHDR)
15221522
set(CODE_REL_LOCATION "${CODE_REL_LOCATION}\ :${CODE_REL_PHDR}")
15231523
endif()
1524-
# We use the "|" character to separate code relocation directives, instead of
1524+
# Each code relocation directive is placed on an independent line, instead of
15251525
# using set_property(APPEND) to produce a ";"-separated CMake list. This way,
15261526
# each directive can embed multiple CMake lists, representing flags and files,
15271527
# the latter of which can come from generator expressions.
15281528
get_property(code_rel_str TARGET code_data_relocation_target
15291529
PROPERTY INTERFACE_SOURCES)
15301530
set_property(TARGET code_data_relocation_target
15311531
PROPERTY INTERFACE_SOURCES
1532-
"${code_rel_str}|${CODE_REL_LOCATION}:${flag_list}:${file_list}")
1532+
"${code_rel_str}\n${CODE_REL_LOCATION}:${flag_list}:${file_list}")
15331533
endfunction()
15341534

15351535
# Usage:

scripts/build/gen_relocate_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,10 @@ def create_dict_wrt_mem():
526526
rel_dict = dict()
527527
phdrs = dict()
528528

529-
input_rel_dict = args.input_rel_dict.read()
530-
if input_rel_dict == '':
529+
input_rel_dict = args.input_rel_dict.read().splitlines()
530+
if not input_rel_dict:
531531
sys.exit("Disable CONFIG_CODE_DATA_RELOCATION if no file needs relocation")
532-
for line in input_rel_dict.split('|'):
532+
for line in input_rel_dict:
533533
if ':' not in line:
534534
continue
535535

0 commit comments

Comments
 (0)