Commit Graph

641 Commits

Author SHA1 Message Date
Curtis Malainey 52e944036d fuzz: add support for 64 bit builds
This is needed for MSAN

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-10-02 14:41:32 +01:00
Guennadi Liakhovetski 58ec860a5b rimage: use platform extra flags when signing LLEXT modules
The user can configure west to pass additional arguments to rimage
for signing, we need to use them when signing LLEXT modules too.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-26 17:38:38 +01:00
Grzegorz Bernat 3304e6f34d app: board: Change the soc from ace30_ptl to ace30
Renamed soc from ace30_ptl to ace30.
We were previously using the wrong soc name.
The correct name is ace30.

There is only one ptl platform, but there can be several ace30 platforms.

Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
2024-09-26 15:59:28 +01:00
Curtis Malainey 186251cddc fuzzer: add ubsan support
Adds support for undefined fuzzing

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-09-11 14:04:01 +03:00
SaiSurya Ch 14efeb8091 scripts: add support for ACP_7_0 platform
Add support for ACP_7_0 in build scripts.

Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
2024-09-11 09:28:36 +03:00
Guennadi Liakhovetski 9f48037505 llext: automatically calculate module addresses
Currently LLEXT module starting addresses are hard-coded in their
respective CMakeLists.txt files. This is very wasteful, since it's
unknown in what order modules are loaded, inflexible and not easily
extendible to other platforms. Switch to calculating addresses
automatically based on a single per-platform Kconfig value.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-10 09:23:24 +03:00
Marc Herbert ffe80eb0e6 xtensa-build-zephyr.py: cosmetic: rename "overlays" variable
The Zephyr documentation uses the term "overlay" for Device Tree, not
for Kconfig.

This commit does not change the wrongly named --overlay option not to
break anything but it stops that wrong name from leaking all over the
code. Also tweak the --help text.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-09-09 10:16:39 +01:00
Curtis Malainey f383b0ffab fuzz: add argument to support other sanitizers
Allows for switching out zephyr configs for other sanitizers

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-09-06 21:27:05 +03:00
Kai Vehmanen c8163bb58b xtensa-build-zephyr.py: create /lib/firmware tarball
With addition of loadable modules, SOF firmware installation depends
much more on symbolic links. Add a step to build script to create a
tarball of the installed firmware binaries in the build-staging-sof
tree. The created tarball (e.g. build-sof-staging/sof/sof.tar.gz)
provides a ready structure that can be unpacked to e.g. /lib/firmware on
Linux target machines.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-09-06 09:28:16 -07:00
Seppo Ingalsuo 828b450c4d Scripts: Add testbench build for Intel PTL platform DSP
This patch adds to "scripts/rebuild-testbench.sh -p ptl" option
to test processing components with PTL ACE3.0 DSP build.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-09-06 12:31:47 +03:00
Seppo Ingalsuo 7683707944 Scripts: Cleanup set_xtensa_params.sh
This script is used to get detailed build parameters for
testbench-xt version build. The PLATFORM is in most cases
the same as the platform name in build command line so it
can be set as default. Only the cases when the name
is different need to be preserved.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-09-06 12:31:47 +03:00
Marc Herbert 2a23f3be21 Add new `fuzz_*features.conf` files to add more CONFIG_ when fuzzing
The goal of these new files is to:
1. Fuzz more code
2. Reduce the configuration gap between fuzzed SOF and the real thing.

See the fuzz_features.conf header for more details.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-09-02 16:48:32 +01:00
Marc Herbert 8a99c58906 fuzz.sh: add -i3 and -i4; shortcuts for -DCONFIG_IPC_MAJOR_$i=y
Only a shortcut for now but allow more IPC version-dependent logic
later.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-09-02 16:48:32 +01:00
Marc Herbert 577c9ae3e7 fuzz.sh: add new boards/native_sim_libfuzzer.conf
Extract -DCONFIG_* definitions hardcoded inside the script and move them
to a new .conf file where they belong.

This is a first, baby-step towards addressing the more general lack of
.config control described in #9386

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-23 13:28:23 +01:00
Marc Herbert cda94e1688 fuzz.sh: replace deprecated OVERLAY_CONFIG with newer EXTRA_CONF_FILE
OVERLAY_CONFIG was deprecated in Zephyr 3.4 commit
https://github.com/zephyrproject-rtos/zephyr/commits/3a345682ba81

Also enhance example and demonstrate the syntax to pass multiple files.

This finishes the work started by commit 6cd34c89a1
("xtensa-build-zephyr.py: use EXTRA_CONF_FILE instead of OVERLAY_CONFIG")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-21 14:25:56 +01:00
Marc Herbert 72aaf783ba rebuild-testbench.sh: switch to new SOF_CC_BASE variable
It was awkward to depend on ZEPHYR_TOOLCHAIN_VARIANT when the testbench
has absolutely nothing to do with it.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-14 09:58:38 +03:00
Marc Herbert cbb08a7451 scripts: add new SOF_CC_BASE={xcc,clang,gcc} variable
This is required to allow building XTOS with newer, clang-based, Cadence
toolchains as just submitted for ACP_7_0 in #9351

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-14 09:58:38 +03:00
Marc Herbert 1ce1b2882a xtensa-build-all.sh: do not fallback on gcc when xcc dir is wrong
If the user requested the Cadence toolchain by defining
$XTENSA_TOOLS_ROOT, then do not "correct" the user and fallback on gcc
when that variable is wrong. Fail and point at the problem instead. No
one ever pays attention to build logs; as shown by new warnings being
submitted on a regular basis.

This also removes the local variable "XCC", the name of which was
collision-prone and confusingly capitalized.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-14 09:58:38 +03:00
Marc Herbert 8236f38d08 xtensa-build-all.sh: rename local variable COMPILER to build_dir_suffix
"COMPILER" is a very common name with a high risk of collision. Don't
use it for a minor, local variable. This also reduces confusion.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-14 09:58:38 +03:00
Marc Herbert b8a4ddffac set_xtensa_params.sh: silence warnings which are wrong when sourced
We can't have a shebang and of course all variables are unused.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-14 09:58:38 +03:00
Guennadi Liakhovetski a98fb5c79c llext: fix Windows builds
Under windows the Python interpreter has to be called explicitly.
Without it an attempt to execute a Python script fails silently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Suggested-by: Marc Herbert <marc.herbert@intel.com>
2024-07-16 15:29:47 +03:00
Andy Ross 51a5fb9c80 uuid: Add app-global UUID registry
Add a very simple uuid-registry.txt file containing all known UUIDs in
the tree, use it to generate a C header (the script validates it in
the process) that can then be used for a simplified
SOF_DEFINE_REG_UUID() mechanism that avoids the risk and temptation
temptation of components incorrectly implementing UUIDs.

The intent is that in the longer term, this file can be used by other
downstream tooling (manifest and topology generation) to more easily
reference known IDs by name in a way that avoids duplication and
error.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 0868b1f71e zephyr: Remove legacy logging artifacts
The sof-logger/smex tools and the .ldc formats are all dead code in
Zephyr builds.  The logging/trace macros don't emit the correct
metadata anymore, using Zephry logging instead (and I don't think they
ever did?), and the resulting .ldc files are degenerate containing
just the header and the records for component UUIDs, which nothing
uses.

Save a few milliseconds of build time and a few bytes of output, and
free up the evolution path by not having to support legacy tools.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 2688f6345a platform/posix: Port fuzzer to upstream "native_sim" board
The older native_posix board is being deprecated, use native_sim,
which is the future-proof API.  Mostly just swap the board target and
change the C API names.

Note the NATIVE_SIMULATOR_IF decoaration on LLVMFuzzerTestOneInput():
that forces the function to be included in the first-stage zephyr.elf
link (otherwise it would be dropped as Zephyr/SOF itself doesn't
reference the entry point) and to be visible as a global symbol to the
libfuzzer instrumentation layer.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-04 10:34:47 +03:00
Marc Herbert d9e6b7b977 xtensa-build-zephyr.py: move PTL out of "all" and into "extra".
As reported in #9262, this fixes the --all option.

Fixes commit 05bfc36dac ("ptl: Add initial PTL configuration")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-07-02 18:40:30 +03:00
Marc Herbert 6cd34c89a1 xtensa-build-zephyr.py: use EXTRA_CONF_FILE instead of OVERLAY_CONFIG
OVERLAY_CONFIG has been deprecated by EXTRA_CONF_FILE since Zephyr 3.4

Also fix the corresponding --help string.

Zephyr 3.4 is one year old and has just been end-of-lifed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-07-02 11:30:19 +03:00
Jaroslaw Stelter 05bfc36dac ptl: Add initial PTL configuration
Patch adds PTL configuration basing on MTL

DMIC depends on PM_DEVICE_RUNTIME and PM_DEVICE_POWER_DOMIAN settings.
To effectively enable DMIC these flags must be set.
Additionally DMIC Ownership bit is not supported on ACE 2.0 and ACE 3.0.
Therefore CONFIG_DAI_DMIC_HAS_OWNERSHIP is switched off.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-06-24 16:15:41 +02:00
Guennadi Liakhovetski 908d69ceac llext: remove hard-coded section names
It was clear that hard-coded section names aren't reliable enough but
they broke down way earlier than has been expected.

This patch replaces hard-coded sections with a loop, scanning all
sections and selecting them based on their flags and types.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-04 12:53:49 +03:00
Guennadi Liakhovetski 799f8279f7 llext: automatically select LLEXT type
When using a clang Cadence toolchain to build SOF and LLEXT modules
we need to select a different LLEXT type than when using a Zephyr gcc
toolchain.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-04 12:53:49 +03:00
Kai Vehmanen 013e210209 west.ytml: update to Zephyr 53ddff639562
Update Zephyr baseline to 53ddff639562 . The location of generated
headers has changed, so modify the SOF build scripts to use the new
location.

Change affecting SOF build targets:

6509b8199b02 shell: add shell backend for audio DSP using shared memory window
5a7600bec60b soc: intel_adsp: tools: add shell support to cavstool.py
db00b813f043 soc: intel_adsp: tools: align code style in maps_regs()
44dd5a4da9c0 soc: intel_adsp: tools: fix ace20 fw load flow
fa798ce2d5be soc: intel_adsp: only implement FW_STATUS boot protocol for cavs
8fc76f1b6d16 soc: intel_adsp: tools: improve FW boot handling on ace1.x
024bd41efb65 llext: xtensa: add support for the xt-clang toolchain

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-06-04 11:04:04 +03:00
Zoran Zhan 90c54a6116 scripts: Add support for MediaTek mt8188 platform
Add MediaTek mt8188 platform to the DEFAULT_PLATFORMS list.

Signed-off-by: Zoran Zhan <zoran.zhan@mediatek.com>
2024-05-27 13:07:19 +03:00
Zoran Zhan 9d65e938c2 docker_build: Add support for MediaTek mt8188
Add support for building MediaTek mt8188 toolchains in docker image.

Signed-off-by: Zoran Zhan <zoran.zhan@mediatek.com>
2024-05-27 13:06:15 +03:00
Marc Herbert e0701e54d1 xtensa-build-zephyr.py: checksum .llext files
Even with the cryptographic salt, the ability to match a download with
the corresponding build log is still useful.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-05-27 13:04:58 +03:00
Marc Herbert 3c1b3b0622 xtensa-build-zephyr.py: clean staging / sof-ipc4-lib/ directories
Delete per-platform, "build-sof-staging/sof/intel/sof-ipc4-lib/mtl/"
directories every time just like we've always done it for
"build-sof-staging/sof/intel/sof-ipc4/mtl/". This is especially
important considering the new LLEXT complexity, symbolic links etc.

There is no way the build can be smart enough and extend "incremental"
builds to the staging directory.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-05-27 13:04:58 +03:00
Fred Oh 4cbff552bf scripts/docker-run.sh: thesofproject/sof:latest to default
latest_ubuntu22.04 was used when upgrading to Ubuntu 22.04.
Now it is time to go back to the latest.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2024-05-22 15:24:11 +01:00
Guennadi Liakhovetski 89d90ae0af build: remove a redundant call to 'str()'
west.configuration.get() already returns a string, no need to call
'str()' on it again.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-14 14:37:44 +01:00
Guennadi Liakhovetski 05e69e1bb9 llext: update to use add_llext_target()
Zephyr now provides a convenient cmake API for LLEXT modules, update
SOF to use it by defining common cmake functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-14 14:37:44 +01:00
Marc Herbert afc769f3c9 llext_link_helper.py: use a raw string for '\.so$' regex
Always use a "raw string" for regular expressions, otherwise the
backslash is used to start Unicode escape sequences.

Fixes hopefully harmless error:
```
scripts/llext_link_helper.py:38: SyntaxWarning: invalid escape sequence '\.'
  p = re.compile('(^lib|\.so$)')
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-05-09 11:16:51 +03:00
Marc Herbert 59bc4e26ba fuzz.sh: fix ZEPHYR_BASE comment
Explain why and when ZEPHYR_BASE is useful. Zero code change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-05-09 11:16:51 +03:00
Andy Ross e7f76eec4d platform/posix: Unbreak fuzzer support
Upstream Zephyr moved the LLVM fuzzer entry point out of the arch
layer and made it an app responsibility, so we broke.  Add back the
support here that got removed.

Fixes #9101

Signed-off-by: Andy Ross <andyross@google.com>
2024-05-09 11:13:15 +03:00
Guennadi Liakhovetski 6ead80fa55 deployable build: install LLEXT modules into the tree
Install loadable LLEXT modules into the deployment tree and
create symbolic links for them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-07 10:51:34 +03:00
Guennadi Liakhovetski 7cb5ef0ad2 llext: catch only the expected exception
When an ELF section isn't found .get_section_by_name() raises an
AttributeError exception, catch it specitically instead of catching
any exception.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-07 10:51:34 +03:00
Marc Herbert a64e2817b6 xtensa-build-zephyr.py: remove obsolete and misleading comment
Pure comment fix, zero code change.

Fixes miss in commit f55338a985 ("Switch Zephyr build to new
sof/tools/rimage location")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-05-06 17:34:48 +01:00
Marc Herbert 665817fe84 xtensa-build-zephyr.py: add flexibility to generate `tools/` only
Installing most of the tools/ directory does not technically require
building any platform, so add that possibility.

This is useful because the Jenkins-based CI builds the (userspace) tools
separately. So far it has been picking hardcoded source paths but of
course the HWMv2 transition just broke that:
https://github.com/thesofproject/sof/pull/8913

While it's too late this time (we want to keep CI able to test stable
branches for some time), this commit prepares a future where all CIs can
stop hardcoding Zephyr source paths and pick the output of the
xtensa-build-zephyr.py installer and indirection layer instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-04-22 18:26:09 +03:00
Guennadi Liakhovetski ed33af4d33 llext: add support for building relocatable modules
Add support for relocatable objects to the llext module build system.
In such builds no ELF segments are created, so we need to process all
sections individually.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-04-16 15:30:02 +01:00
Marc Herbert 9d7c33adc3 xtensa-build-zephyr.py: make --deployable-build the default
Every Linux developer should use deployable builds by default.

Until Peter Ujfalusi's very recent work in this script, we had a
complete `/lib/firmware/` structure disconnect between the IPC4 output
of this script and the IPC4 expectations of the Linux kernel. To
workaround this disconnect, every CI and Linux developer used to
implement duplicate and inconsistent firmware deployment hacks.

People crafting sof-bin releases also had to organize IPC4 releases
manually, which was extremely error-prone and with limited test
coverage (Thanks Kai and Mengdong!)

Now that Peter gracefully fixed the layout, documented it in sof-docs
and implemented it in this script, the time for all Linux developers to
drop their inconsistent deployment hacks is overdue. All these hacks
must be replaced with a simple, one-line recursive copy which makes sure
the layout committed in version control is constantly tested by
everyone.

So, make deployable builds the new default.

The new default will also help with sof-bin releases, making sure they
use a well tested /lib/firmware/ layout.

The --no-deployable-build was recently introduced to help minimize
disruption and migration effort for people and automation who do NOT use
Linux. The `/lib/firmware/` directory structure is irrelevant outside
Linux (but everyone is of course free to choose it)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-04-02 20:00:13 +03:00
Laurentiu Mihalcea f0740ed103 west.yml: update Zephyr to 1f55be8b42df
Contains the following squashed SOF commits:

nxp: imx8ulp: change SOC name to MIMX8UD7
zephyr: CMakeLists.txt use new `CONFIG_SOC_C` for 8ULP
cmake: update configs for NXP ADSP

and the following Zephyr patches affecting SOF:

951763939034 nxp: imx8ulp: change SOC name to MIMX8UD7
b8214b673970 dts: xtensa: nxp_imx8: add SAI1 node
a0e32f07ef76 dts: intel_adsp: ace: update host dma copy alignment
3fde2c50c6ef tracing: add intel ADSP memory window backend
6b9d01f995c7 intel_adsp/ace: power: No pending transaction before power gate
6ea749de5283 arch: rename arch_start_cpu() to arch_cpu_start()
b69d2486fee6 kernel: rename Z_KERNEL_STACK_BUFFER to K_KERNEL_STACK_BUFFER
1f55be8b42df nxp: imx8: change CONFIG_SOC_<name> to match the value
688fbb53aeb2 intel_adsp: ace: Fix sparse error

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2024-04-02 13:13:07 +03:00
Marc Herbert 12ad82a756 xtensa-build-zephyr.py: checksum autoconf.h instead of configs.c
autoconf.h has strings, configs.c has not.

We can do this now since this $BOARD_REVISION fix:

https://github.com/zephyrproject-rtos/zephyr/commit/811a74c0199f

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-18 14:45:27 +02:00
Laurentiu Mihalcea 7cb15d722a scripts: xtensa-build-all: remove imx8ulp
XTOS is going to be deprecated on i.MX8ULP so prevent
building it by removing it from the list of supported
platforms from `xtensa-build-all.sh`. This is needed for
switching to Zephyr native drivers.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-15 13:14:15 +02:00
Marc Herbert 469c0a7e63 xtensa-build-zephyr.py: checksum newly generated rimage_config.toml file
Add new file generated since commit cf9a444bfc ("toml: modularise TOML
configuration")

Optional because it's not generated for all platforms.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-11 20:12:01 +02:00