Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy zephyr based sof image toml files from rimage to sof and split to platform and module toml #8243

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class PlatformConfig:
XTENSA_CORE: str
DEFAULT_TOOLCHAIN_VARIANT: str = "xt-clang"
RIMAGE_KEY: pathlib.Path = pathlib.Path(SOF_TOP, "keys", "otc_private_key_3k.pem")
IPC4_RIMAGE_DESC: str = None
IPC4_CONFIG_OVERLAY: str = "ipc4_overlay.conf"
aliases: list = dataclasses.field(default_factory=list)

Expand All @@ -93,15 +92,13 @@ class PlatformConfig:
f"RG-2017.8{xtensa_tools_version_postfix}",
"cavs2x_LX6HiFi3_2017_8",
"xcc",
IPC4_RIMAGE_DESC = "tgl-cavs.toml",
aliases = ['adl', 'ehl']
),
"tgl-h" : PlatformConfig(
"tgl-h", "intel_adsp_cavs25_tgph",
f"RG-2017.8{xtensa_tools_version_postfix}",
"cavs2x_LX6HiFi3_2017_8",
"xcc",
IPC4_RIMAGE_DESC = "tgl-h-cavs.toml",
aliases = ['adl-s']
),
"mtl" : PlatformConfig(
Expand Down Expand Up @@ -550,7 +547,7 @@ def rimage_west_configuration(platform_dict, dest_dir):
# the user input. We could just append and leave duplicates but that would be
# at best confusing and at worst relying on undocumented rimage precedence.
extra_args = []
for default_opt in rimage_options(platform_dict):
for default_opt in rimage_options(platform_dict, dest_dir):
if not default_opt[0] in workspace_extra_args:
extra_args += default_opt

Expand Down Expand Up @@ -585,8 +582,32 @@ def build_rimage():
rimage_build_cmd.append("-v")
execute_command(rimage_build_cmd, cwd=west_top)


def rimage_options(platform_dict):
def concat_rimage_configs(platform_name, dest_dir):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nak, lets use the pre-processor. We also need to add Kconfig detail into the toml too.

'''Concatenate sof image toml configs, and return the concatenated config file path.
[Caution]: Due to the limitation in tomlc99 library used by rimage, the platform toml
has to be the first. When adding new toml file, add a number prefix to the file name,
and make sure platform toml has the minimum number.
'''
toml_dir = SOF_TOP / "config" / platform_name
toml_name = platform_name + '.toml'
out_toml = dest_dir / toml_name
lines = []

for root_dir, _, files in os.walk(toml_dir):
for toml in sorted(files):
toml_path = root_dir + '/' + toml
f = open(toml_path, 'r', encoding="utf8")
lines.extend(f.readlines())
lines.append('\n') # Append a newline between each file
f.close()

out_fd = open(out_toml, 'w', encoding='utf8')
out_fd.writelines(lines)
out_fd.close()

return str(out_toml)

def rimage_options(platform_dict, dest_dir):
"""Return a list of default rimage options as a list of tuples,
example: [ (-f, 2.5.0), (-b, 1), (-k, key.pem),... ]

Expand Down Expand Up @@ -619,12 +640,8 @@ def rimage_options(platform_dict):
# test_00_01_load_fw_and_check_version
opts.append(("-b", "1"))

if platform_dict.get("IPC4_RIMAGE_DESC", None) is not None:
rimage_desc = platform_dict["IPC4_RIMAGE_DESC"]
else:
rimage_desc = platform_dict["name"] + ".toml"

opts.append(("-c", str(RIMAGE_SOURCE_DIR / "config" / rimage_desc)))
rimage_desc = concat_rimage_configs(platform_dict["name"], dest_dir)
opts.append(("-c", rimage_desc))

return opts

Expand Down
Loading