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 <[email protected]>
  • Loading branch information
lyakh committed Nov 17, 2023
1 parent f25e220 commit b3af0f9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 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,16 @@ 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]
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 b3af0f9

Please sign in to comment.