Commit Graph

41 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 30b9470afa rimage: add support for relocatable objects
Relocatable ELF objects don't contain segments, update rimage to
prevent it from aborting in such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-04-16 15:30:02 +01:00
Damian Nikodem 57d65790ca tools: toml: add src_lite module definition
Add the missing src_lite module definition to the toml
file for the LNL project.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2024-03-19 19:46:46 +02:00
Guennadi Liakhovetski 8bfb4896c7 llext: add or improve comments
Address clarity improvement requests from an earlier pull-request
review.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-29 18:42:23 +02:00
Guennadi Liakhovetski d119d93cae rimage: add a generic platform.toml
Instead of including TOML files for each platform explicitly, add a
generic platform.toml, that will contain all respective platform
TOML files, and select the correct one, based on build configucation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-26 17:56:14 +02:00
Guennadi Liakhovetski a967d955db rimage: mtl: extract platform part from mtl.toml.h
A part of mtl.toml.h is also needed for loadable modules, built for
MTL. Extract it into a separate file.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-26 17:56:14 +02:00
Guennadi Liakhovetski ab29f8db82 llext: add a new module type
We need to be able to distinguish LLEXT loadable dynamically linkable
modules at run-time. Add a new type for them. Compatibility is
preserved.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-26 17:56:14 +02:00
Seppo Ingalsuo 7b5475b0af Tools: Rimage: Config: Add IGO NR component for TGL, MTL, LNL platforms
This patch enables to load the component in the changed platforms.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-01-18 16:39:29 +00:00
Seppo Ingalsuo 14237ed126 Tools: Rimage: Add RTNR component to TGL, MTL, and LNL platforms
This patch allows load of RTNR component with these platforms.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-01-17 13:19:40 +00:00
Adrian Warecki 6c188298b9 rimage: loadable_modules: Set correct image type
The image header contains a bitfield with flags specifying a image type.
This commit sets correct image type depending on whether firmware or
a loadable module is being signed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-01-12 17:52:53 +02:00
Guennadi Liakhovetski cf9a444bfc toml: modularise TOML configuration
Split TOML configuration files into platform and module parts. Use
the C preprocessor to merge them back together.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-21 13:07:13 +00:00
Marc Herbert ded019bd46 xtensa-build-zephyr.py: remove IPC3/IPC4 "cavs" switch
Rename:
- tgl-cavs.toml   to tgl.toml
- tgl-h-cavs.toml to tgl-h.toml

Remove the IPC3/IPC4 switch added by commit 6f71808e3e
("xtensa-build-zephyr.py: add ipc4 build support for tgl")

This brings back consistency which is required for the .toml
split (#8490)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-12 23:50:40 +02:00
Marc Herbert 79e5080175 rimage: remove obsolete, IPC3 tgl.toml and tgl-h.toml
The main branch hasn't supported IPC3 for tgl for a long time.

Follow-up to commit a17c2823d3 ("xtensa-build-zephyr: remove ipc
option")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-12 23:50:40 +02:00
Adrian Bonislawski fd61ed6151 rimage: elf: fixed error handling from file operation
Fixes error handling

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-12-11 17:03:31 +02:00
Adrian Bonislawski e30fedc992 rimage: file_simple: remove dead code
remove logically dead code

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-12-11 17:03:31 +02:00
Adrian Bonislawski 17c226b683 rimage: ext_manifest: check fwrite status
Check fwrite status for error

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-12-11 17:03:31 +02:00
Adrian Bonislawski 0f72917521 rimage: ext_manifest: fix fwrite arguments
this will fix parameter order to: size, count

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-12-11 17:03:31 +02:00
Adrian Warecki 7a63f66961 rimage: Introduce ALIGN_UP macro
Created ALIGN_UP macro to simplify calculations.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-12-11 12:38:39 +02:00
Adrian Warecki e91f077a52 rimage: manifest: Use DIV_ROUND_UP macro
Used DIV_ROUND_UP macro to calculate page count.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-12-11 12:38:39 +02:00
Adrian Warecki d8113fabc9 rimage: Limit input module count to module array size
Added limit of a number of input modules provided in a command line to the
maximum number of supported modules (size of module array / MAX_MODULES)

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-12-11 12:38:39 +02:00
Adrian Warecki e36b77c380 rimage: manifest: Improved handling of empty RODATA segment
If the RODATA segment does not contain any data, its type is marked as
empty. Cleared the readonly flag because this segment also contains .data
sections.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-12-04 10:42:34 +02:00
Adrian Warecki c9fb8d48d5 rimage: module: Fix calculation of segment size in file
If a given output segment type did not contain any input section
(was empty), its size was incorrectly calculated as 1 and then rounded to
the page size (4096). This resulted in an unnecessary segment in a output
file.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-12-04 10:42:34 +02:00
Adrian Warecki 2b4e484427 rimage: module: Use file name in error message in module_write_whole_elf
By oversight, the error message did not use the file name passed as a
parameter to the module_write_whole_elf function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-28 17:05:27 +02:00
Adrian Warecki 2b23146df6 rimage: elf_file: Fix elf_free behavior on unopened elf file
If more modules are provided in a command line than defined in a toml file,
the program outputs an error message. It frees the module structures
even though they have not been opened before. This resulted in an error
when trying to close a file that was not previously open. Added a check to
ensure that a file has been opened before trying to close it.
Error handling in the elf_open function has been simplified.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-28 17:05:27 +02:00
Michal Bukowski ae31a28741 rimage: mtl: add cadence module entry
Added entry allows to enable cadence codec module.

Signed-off-by: Michal Bukowski <michal.bukowski@intel.com>
2023-11-20 15:27:53 +00:00
Adrian Warecki cb64c68bcd rimage: manifest: Ignore lack of .bss section for a loadable modules
Loadable libraries do not need to have a .bss section. After this change,
its absence will be ignored when generating a image of the loadable module.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-09 11:28:30 +02:00
Yong Zhi e62e333e50 rimage: mtl: Use DP scheduler for AEC module
Change domain_types to DP, and allow it to run all 3 cores.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2023-10-31 20:35:12 +02:00
Adrian Bonislawski 86497b46bf rimage: mtl/lnl: fix key slot setup based on imr type
Clean cherry-picks of two commits from separate rimage repo
https://github.com/thesofproject/rimage/commits/stable-v2.7

This will properly setup partition_usage field
and remove fixed 0x23 value from MTL toml

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
(cherry picked from commit fbea59358d06ffa86645cdf4ce0996e352742eb5)

Second, squashed LNL commit:

config/lnl.toml: drop now invalid signed_pkg.partition_usage

Fixes commit fbea59358d06 ("rimage: mtl: fix key slot setup based on imr
type") which broke LNL compilation like this:

```
error: 1 unparsed keys left in 'signed_pkg'
error: key 'signed_pkg' parsing error
```

This commit does not change the final image (compared to before rimage
commit fbea59358d06) because the default value is now 0x20 + IMR type.

Fixes are normally submitted to the main branch first and then cherry
picked to stable branches. However MTL fbea59358d06 has been made in
stable-v2.7 first so the LNL change was also in stable-v2.7 first for
consistency.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
(cherry picked from commit 469102a8f6052ce6a374b870ea945a84d04c3b1a)
2023-10-31 15:05:50 +00:00
Adrian Warecki 3cb13e7c74 rimage: module: Fix section order in output image
Fixed the order in which sections are placed in the output firmware image
for platforms using a simple manifest.

Fixes: #8336

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-10-31 13:59:55 +02:00
Marc Herbert 20705ad4c1 rimage/toml_utils: fix signature and doxygen of parse_uuid()
Add missing `const` and warn that the endianness can't be relied on.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-26 17:09:17 +03:00
Marc Herbert c180e8cb95 rimage/toml_utils.c: remove uint32_t d0 shortcut in parse_uuid()
Fixes compilation failure with clang 15:

rimage/src/toml_utils.c:297:67: error: taking address of packed member
  'd0' of class or structure 'uuid_t' may result in an unaligned pointer
  value [-Werror,-Waddress-of-packed-member]
  sscanf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", &id.d0,
                                                                   ^~~~

This also aligns indexes.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-26 17:09:17 +03:00
Marc Herbert a01fcc2f52 rimage/toml_utils.c: stop ignoring errors in parse_uuid()
assert() that sscanf returns the expected value.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-26 17:09:17 +03:00
Fabiola Kwasowiec 90fef5afd2 src_lite: add module
Addition of SRC Lite module,
which only supports a subset of conversions
supported by the SRC module.

Purpose of SRC Lite module is memory optimization.
Code of SRC Lite is drastically reduced and requires
significantly less memory. When needed one of
defined conversions, driver can choose SRC Lite
module instead of SRC module to optimize memory utilization.

48 -> 16kHz
44.1 -> 16 kHz
32 -> 16 kHz
44.1 -> 48

Signed-off-by: Fabiola Kwasowiec <fabiola.kwasowiec@intel.com>
2023-10-26 17:08:29 +03:00
Marc Herbert e114166983 Delete inherited tools/rimage/.gitignore
rimage is not so special that it needs its personalized .gitignore

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-20 12:28:42 +01:00
SaiSurya Ch 4c5409235e rimage: config: add acp_6_3 toml file to support acp_6_3 build
Add acp_6_3 toml file to support sof-acp_6_3.ri binary build

Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
2023-10-19 20:47:38 +03:00
Seppo Ingalsuo fab0f72901 Tools: Rimage: Config: Add RTC_AEC to TGL. TGL-H, and LNL
This patch adds same RTC_AEC module entry as added earlier
to config/mtl.toml. The purpose is enable testing the component
in other platforms.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-10-18 14:50:18 +03:00
Marc Herbert 8bbad9f263 .github: re-enable rimage workflows
Migrate rimage build and cppcheck workflows from
sof/tools/rimage/.github/workflows/ (where they're ignored) to
sof/.github/workflows/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-18 13:42:40 +03:00
Marc Herbert 13a9c2558d Delete inherited rimage/.github/ workflows yamllint and checkpatch
We already have these checks in sof.git so they don't need to be
migrated.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-18 13:42:40 +03:00
Mac Chiang 457142ea1e mtl: add dts-codec support
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
2023-10-17 15:44:11 +01:00
Marc Herbert aadbfa0a3b tools/rimage/README.md: update following transfer to sof.git
We still have tomlc99 as a git submodule for now.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-17 15:36:55 +01:00
Marc Herbert 99206de401 Clean just inherited tools/rimage/.gitmodules file (for tomlc99)
.gitmodules files have no effect unless they're at the top-level.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-09 13:06:12 -07:00
Marc Herbert b5f3ed9fa5 rimage: move everything down to subdir tools/rimage/, prepare move to sof
Preparation to move everything back into the
https://github.com/thesofproject/sof/ repo, see
https://github.com/thesofproject/sof/issues/8178 for details.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-05 10:18:11 -07:00