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 <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2025-02-12 14:58:43 +01:00 committed by Benjamin Cabé
commit cb8f99ab7a
2 changed files with 5 additions and 5 deletions

View file

@ -1522,7 +1522,7 @@ function(zephyr_code_relocate)
if(CODE_REL_PHDR) if(CODE_REL_PHDR)
set(CODE_REL_LOCATION "${CODE_REL_LOCATION}\ :${CODE_REL_PHDR}") set(CODE_REL_LOCATION "${CODE_REL_LOCATION}\ :${CODE_REL_PHDR}")
endif() endif()
# We use the "|" character to separate code relocation directives, instead of # Each code relocation directive is placed on an independent line, instead of
# using set_property(APPEND) to produce a ";"-separated CMake list. This way, # using set_property(APPEND) to produce a ";"-separated CMake list. This way,
# each directive can embed multiple CMake lists, representing flags and files, # each directive can embed multiple CMake lists, representing flags and files,
# the latter of which can come from generator expressions. # the latter of which can come from generator expressions.
@ -1530,7 +1530,7 @@ function(zephyr_code_relocate)
PROPERTY INTERFACE_SOURCES) PROPERTY INTERFACE_SOURCES)
set_property(TARGET code_data_relocation_target set_property(TARGET code_data_relocation_target
PROPERTY INTERFACE_SOURCES PROPERTY INTERFACE_SOURCES
"${code_rel_str}|${CODE_REL_LOCATION}:${flag_list}:${file_list}") "${code_rel_str}\n${CODE_REL_LOCATION}:${flag_list}:${file_list}")
endfunction() endfunction()
# Usage: # Usage:

View file

@ -526,10 +526,10 @@ def create_dict_wrt_mem():
rel_dict = dict() rel_dict = dict()
phdrs = dict() phdrs = dict()
input_rel_dict = args.input_rel_dict.read() input_rel_dict = args.input_rel_dict.read().splitlines()
if input_rel_dict == '': if not input_rel_dict:
sys.exit("Disable CONFIG_CODE_DATA_RELOCATION if no file needs relocation") sys.exit("Disable CONFIG_CODE_DATA_RELOCATION if no file needs relocation")
for line in input_rel_dict.split('|'): for line in input_rel_dict:
if ':' not in line: if ':' not in line:
continue continue