From 8885b465df537980ca95d6c089b1df359a614750 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Wed, 20 May 2020 13:24:29 +0200 Subject: [PATCH] tools: sof-ri-info: move parsing adsp mft outside cse mft There might be binaries where cse mft is not included. And adsp mft begins at std offset 0x2000 from the optional extended manifest. Signed-off-by: Marcin Maka --- tools/sof_ri_info/sof_ri_info.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/sof_ri_info/sof_ri_info.py b/tools/sof_ri_info/sof_ri_info.py index 07284296a..d1bbf60b1 100755 --- a/tools/sof_ri_info/sof_ri_info.py +++ b/tools/sof_ri_info/sof_ri_info.py @@ -316,7 +316,7 @@ def parse_extended_manifest(reader): return ext_mft -def parse_cse_manifest(reader, add_module_entries): +def parse_cse_manifest(reader): """ Parses CSE manifest form sof binary """ cse_mft = CseManifest(reader.get_offset()) @@ -359,6 +359,9 @@ def parse_cse_manifest(reader, add_module_entries): hdr_entry.add_a(Ahex('entry_length', entry_length)) hdr.add_comp(hdr_entry) + reader.info('CSE Entry name {} length {}'.format(entry_name, + entry_length)) + if '.man' in entry_name: entry = CssManifest(entry_name, entry_offset) cur_off = reader.set_offset(reader.ext_mft_length + entry_offset) @@ -371,10 +374,8 @@ def parse_cse_manifest(reader, add_module_entries): entry.name = '{} ({})'.format(entry_name, entry.name) reader.set_offset(cur_off) else: - # override offset with precise one - cur_off = reader.set_offset(reader.ext_mft_length + 0x2000) - entry = parse_adsp_manifest(reader, entry_name, add_module_entries) - reader.set_offset(cur_off) + # indicate the place, the entry is enumerated. mft parsed later + entry = Component('adsp_mft_cse_entry', entry_name, entry_offset) cse_mft.add_comp(entry) nb_index += 1 @@ -576,7 +577,10 @@ def parse_fw_bin(path, verbose, add_module_entries): parsed_bin.add_a(Astring('file_name', reader.file_name)) parsed_bin.add_a(Auint('file_size', reader.file_size)) parsed_bin.add_comp(parse_extended_manifest(reader)) - parsed_bin.add_comp(parse_cse_manifest(reader, add_module_entries)) + parsed_bin.add_comp(parse_cse_manifest(reader)) + reader.set_offset(reader.ext_mft_length + 0x2000) + parsed_bin.add_comp(parse_adsp_manifest(reader, 'cavs0015', + add_module_entries)) reader.info('Parsing finished', show_offset = False) return parsed_bin @@ -587,6 +591,7 @@ class BinReader(): def __init__(self, path, verbose): self.verbose = verbose self.cur_offset = 0 + self.ext_mft_length = 0 self.info('Reading SOF ri image ' + path) self.file_name = path # read the content