Skip to content

Commit

Permalink
rimage: add TOML preprocessing
Browse files Browse the repository at this point in the history
TOML configuration files for rimage are composed of multiple logical
blocks, and those blocks are repeated between multiple configuration
files. We use the C preprocessor to merge those blocks, to substitude
any parameter values and to perform condition checking.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Nov 17, 2023
1 parent f25e220 commit af5b1bd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/west_commands/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def sign(self, command, build_dir, build_conf, formats):

#### -c sof/rimage/config/signing_schema.toml ####

cmake_toml = target + '.toml'
cmake_toml = target + '.toml.h'

if not args.quiet:
log.inf('Signing with tool {}'.format(tool_path))
Expand All @@ -504,7 +504,18 @@ def sign(self, command, build_dir, build_conf, formats):
else:
conf_dir = sof_src_dir / 'tools' / 'rimage' / 'config'

conf_path_cmd = ['-c', str(conf_dir / cmake_toml)] if conf_dir else []
if conf_dir:
pre_toml = target + '.toml'
output_toml = str(b / 'zephyr' / pre_toml)
compiler_path = cache.get("CMAKE_C_COMPILER", "")
preproc_cmd = [compiler_path] + ['-E', str(conf_dir / cmake_toml)] + ['-o', output_toml]
preproc_cmd += ['-I', str(sof_src_dir / 'src' / 'audio')]
preproc_cmd += ['-imacros', str(b / 'zephyr' / 'include' / 'generated' / 'autoconf.h')]
log.inf('Calling preprocessor\n' + quote_sh_list(preproc_cmd))
subprocess.check_call(preproc_cmd)
conf_path_cmd = ['-c', output_toml]
else:
conf_path_cmd = []

log.inf('Signing for SOC target ' + target)

Expand Down

0 comments on commit af5b1bd

Please sign in to comment.