Skip to content

Commit cb8f99a

Browse files
tejlmandkartben
authored andcommitted
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]>
1 parent ed9c6d8 commit cb8f99a

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
@@ -1522,15 +1522,15 @@ function(zephyr_code_relocate)
15221522
if(CODE_REL_PHDR)
15231523
set(CODE_REL_LOCATION "${CODE_REL_LOCATION}\ :${CODE_REL_PHDR}")
15241524
endif()
1525-
# We use the "|" character to separate code relocation directives, instead of
1525+
# Each code relocation directive is placed on an independent line, instead of
15261526
# using set_property(APPEND) to produce a ";"-separated CMake list. This way,
15271527
# each directive can embed multiple CMake lists, representing flags and files,
15281528
# the latter of which can come from generator expressions.
15291529
get_property(code_rel_str TARGET code_data_relocation_target
15301530
PROPERTY INTERFACE_SOURCES)
15311531
set_property(TARGET code_data_relocation_target
15321532
PROPERTY INTERFACE_SOURCES
1533-
"${code_rel_str}|${CODE_REL_LOCATION}:${flag_list}:${file_list}")
1533+
"${code_rel_str}\n${CODE_REL_LOCATION}:${flag_list}:${file_list}")
15341534
endfunction()
15351535

15361536
# 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)