build system: fix quoting of fragments list passed to ldgen

This commit is contained in:
Ivan Grokhotkov
2020-10-09 19:06:33 +02:00
parent 6b361d923c
commit 29489a3303
2 changed files with 27 additions and 12 deletions

View File

@@ -53,23 +53,24 @@ function(__ldgen_process_template template output)
if($ENV{LDGEN_CHECK_MAPPING}) if($ENV{LDGEN_CHECK_MAPPING})
set(ldgen_check "--check-mapping" set(ldgen_check "--check-mapping"
"--check-mapping-exceptions=${idf_path}/tools/ci/check_ldgen_mapping_exceptions.txt") "--check-mapping-exceptions" "${idf_path}/tools/ci/check_ldgen_mapping_exceptions.txt")
message(STATUS "Mapping check enabled in ldgen") message(STATUS "Mapping check enabled in ldgen")
endif() endif()
add_custom_command( add_custom_command(
OUTPUT ${output} OUTPUT ${output}
COMMAND ${python} ${idf_path}/tools/ldgen/ldgen.py COMMAND ${python} "${idf_path}/tools/ldgen/ldgen.py"
--config ${sdkconfig} --config "${sdkconfig}"
--fragments "$<JOIN:${ldgen_fragment_files},\t>" --fragments-list "${ldgen_fragment_files}"
--input ${template} --input "${template}"
--output ${output} --output "${output}"
--kconfig ${root_kconfig} --kconfig "${root_kconfig}"
--env-file "${config_env_path}" --env-file "${config_env_path}"
--libraries-file ${build_dir}/ldgen_libraries --libraries-file "${build_dir}/ldgen_libraries"
--objdump ${CMAKE_OBJDUMP} --objdump "${CMAKE_OBJDUMP}"
${ldgen_check} ${ldgen_check}
DEPENDS ${template} ${ldgen_fragment_files} ${ldgen_depends} ${SDKCONFIG} DEPENDS ${template} ${ldgen_fragment_files} ${ldgen_depends} ${SDKCONFIG}
VERBATIM
) )
get_filename_component(_name ${output} NAME) get_filename_component(_name ${output} NAME)

View File

@@ -50,11 +50,20 @@ def main():
help='Linker template file', help='Linker template file',
type=argparse.FileType('r')) type=argparse.FileType('r'))
argparser.add_argument( fragments_group = argparser.add_mutually_exclusive_group()
fragments_group.add_argument(
'--fragments', '-f', '--fragments', '-f',
type=argparse.FileType('r'), type=argparse.FileType('r'),
help='Input fragment files', help='Input fragment files',
nargs='+') nargs='+'
)
fragments_group.add_argument(
'--fragments-list',
help='Input fragment files as a semicolon-separated list',
type=str
)
argparser.add_argument( argparser.add_argument(
'--libraries-file', '--libraries-file',
@@ -102,13 +111,18 @@ def main():
args = argparser.parse_args() args = argparser.parse_args()
input_file = args.input input_file = args.input
fragment_files = [] if not args.fragments else args.fragments
libraries_file = args.libraries_file libraries_file = args.libraries_file
config_file = args.config config_file = args.config
output_path = args.output output_path = args.output
kconfig_file = args.kconfig kconfig_file = args.kconfig
objdump = args.objdump objdump = args.objdump
fragment_files = []
if args.fragments_list:
fragment_files = args.fragments_list.split(';')
elif args.fragments:
fragment_files = args.fragments
check_mapping = args.check_mapping check_mapping = args.check_mapping
if args.check_mapping_exceptions: if args.check_mapping_exceptions:
check_mapping_exceptions = [line.strip() for line in args.check_mapping_exceptions] check_mapping_exceptions = [line.strip() for line in args.check_mapping_exceptions]