Commit Graph

563 Commits

Author SHA1 Message Date
Daniel Baluta af3fa413cb xtensa-build-zephyr.py: Re-add imx8ulp to -all
This re-adds imx8ulp to --all platform list. This was removed
in commit 7737efadf4 ("xtensa-build-zephyr.py: remove imx8ulp from --all")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2023-12-14 11:42:21 +02:00
Marc Herbert 3e09f233a4 set_xtensa_params.sh: add ZEPHYR_TOOLCHAIN_VARIANT
This helps with Zephyr and does not hurt anyone else.

Adjust rebuild-testbench.sh accordingly.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-13 22:17:35 +02:00
Marc Herbert 7b8068963c scripts: rename XTENSA_TOOLS_VERSION to TOOLCHAIN_VER as in Zephyr
Rename the variable name used by SOF script with the one expected by the
Zephyr build system for simplicity and consistency.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-13 22:17:35 +02:00
Marc Herbert d661aadd7c xtensa-build-zephyr.py: don't pass -c $plat.toml to rimage
Let west/sign.py find the appropriate .toml file.

This prepares for .toml modularization #8490

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-12 23:50:40 +02: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 3b8d872619 xtensa-build-zephyr.py: untabify XCC installation in --help message
This was broken from the start when converting the script from shell
script to Python.

A good reference was left in the non-Zephyr script which is still
active: `./scripts/xtensa-build-all.sh -h`

Fixes initial commit 1de3ef3675 ("Rewritten xtensa-build-zephyr.sh to
python")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-11 12:06:40 +02:00
Marc Herbert 8fa93b1c86 xtensa-build-all.sh: stop copy/paste/diverge set_xtensa_param.sh
... source it instead.

We still have duplication with xtensa-build-zephyr.py for now but this
gets at least rid of bash duplication.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-05 17:29:37 +02:00
Marc Herbert 44d9acb72d set_xtensa_params.sh: add missing LNL, ACP_6_3 and vangogh
This adds support for:

   ./scripts/rebuild-testbench.sh -p lnl

Also clean-up, re-order and add comments to set_xtensa_params.sh

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-05 17:29:37 +02:00
Marc Herbert 330d73eec1 cmake: a few new add_local_sources[_ifdef]() compatibility macros
For reducing CMake duplication and centralization, see #8260

Not used yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-11-29 14:52:36 +00:00
Marc Herbert 7737efadf4 xtensa-build-zephyr.py: remove imx8ulp from --all
As of today's Zephyr commit 92fb8b223825, imx8ulp does not compile.

Do not remove any of its data from `xtensa-build-zephyr.py` but exclude
it from --all

Fixes:
```
scripts/xtensa-build-zephyr.py --all

-- Board: nxp_adsp_imx8ulp
No board named 'nxp_adsp_imx8ulp' found.

CMake Error at zephyr/cmake/modules/boards.cmake:167 (message):
  Invalid BOARD; see above.
Call Stack (most recent call first):
  cmake/modules/zephyr_default.cmake:129 (include)
  share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:5 (find_package)
```

Fixes 61ccb4c8da ("scripts: zephyr: Add support to build sof for
imx8ulp")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-11-20 10:57:34 +02:00
Marc Herbert ef563ebfe3 cmake/zephyr: decentralize src/init/
Adding all source files in a single, giant zephyr/CMakeLists.txt is
inconvenient and does not scale.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-11-08 16:53:28 +00:00
Seppo Ingalsuo 2006297ee2 Scripts: Testbench: Add xt-testbench build for MTL with xt-clang
Build for MTL needs other compiler xt-clang, so the COMPILER is
set by default to xt-xcc and changed for MTL in set_xtensa_params.sh
where also core and tools version is defined.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-11-08 16:39:29 +00:00
Zhang Peng 61ccb4c8da scripts: zephyr: Add support to build sof for imx8ulp
Add support to build sof for imx8ulp

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2023-11-06 09:34:37 +01:00
Marc Herbert 6458f48471 scripts/fuzz.sh: fix multiple issues with "stub" overlays
Fixes commit deed9a8808 ("scripts: fuzz: add support for build and
overlays")

The main issue was the way fuzz.sh was trying to parse the overlay
file. Drop that and just pass it as is to `west` and `cmake` instead,
they know what to do with it.

Also:

- Fix invalid syntax in stub_build_all_ipc4.conf
- Make fuzz.sh shellcheck-clean again. Always use shellcheck.
- Temporarily disable `CONFIG_COMP_SMART_AMP` in
  stub_build_all_ipc3.conf because `smart_amp.c` does not compile (in
  any configuration)

```
sof/src/audio/smart_amp/smart_amp.c:748:9: error:
   no member named 'in_channels' in 'struct smart_amp_data'
   sad->in_channels = audio_stream_get_channels(&source_buffer->stream);
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-31 14:23:26 +00:00
Marc Herbert 59a5bc7448 rebuild-testbench.sh: explain BUILD_TYPE=native in usage()
Explain what happens when running the script without any argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-25 16:09:17 +03:00
Marc Herbert bcdf037d2c rebuild-testbench.sh: drop no-op LDFLAGS=-Wl,-LE
It's not clear why `LDFLAGS=-Wl,-LE` was added in
commit 10d0b3b5e1 ("Scripts: Add xt-run build target for
rebuild-testbench.sh"). Maybe it was supposed to be `-Wl,-EL`?

Either way this flag has always been interpreted as adding the directory
`./E/` to the search library path, which obviously never had any
effect; proof below. So it can safely be removed.

Here's the proof:

```
mv ~/XCC/install/builds/RG-2017.8-linux/cavs2x_LX6HiFi3_2017_8/xtensa-elf/lib/libm.a .

./scripts/rebuild-testbench.sh -p tgl

  # Fails as expected
  # => XCC/install/tools/RG-2017.8-linux/XtensaTools/bin/xt-ld: cannot find -lm

cmake --build tools/testbench/build_xt_testbench/ -- testbench

  # Same again
  # => XCC/install/tools/RG-2017.8-linux/XtensaTools/bin/xt-ld: cannot find -lm

mkdir tools/testbench/build_xt_testbench/E/
cp libm.a  tools/testbench/build_xt_testbench/E/
cmake --build tools/testbench/build_xt_testbench/ -- testbench

  # => now compiles!
```

Remember: the best way to test software is always to break it.

Don't forget to fix XCC:

```
mv libm.a ~/XCC/install/builds/RG-2017.8-linux/cavs2x_LX6HiFi3_2017_8/xtensa-elf/lib/
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-25 16:09:17 +03:00
SaiSurya Ch b593e33af6 scripts: add support for ACP_6_3 platform
Add support for ACP_6_3 in build scripts.

Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
2023-10-19 20:47:38 +03:00
Marc Herbert 98ee39f44c cmake: switch XTOS build to sof/tools/rimage
Switch away from the independent rimage submodule. Long story in
https://github.com/thesofproject/sof/issues/8178 and others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-09 13:06:12 -07:00
Marc Herbert f55338a985 Switch Zephyr build to new sof/tools/rimage location
Switch away from the independent rimage submodule. Long story in
https://github.com/thesofproject/sof/issues/8178 and others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-10-09 13:06:12 -07:00
Chao Song a17c2823d3 xtensa-build-zephyr: remove ipc option
For legacy CAVS platforms (TGL/ADL/EHL), the default
build config is IPC4 now, and the overlay file is
already emptied. Remove the option in this build
script.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-09-21 11:00:12 +03:00
Marc Herbert c0fd911396 xtensa-build-zephyr.py: re-enable sof_ri_info.py on MTL and LNL
Now we can avoid bitrot again thanks to recent rimage fix
https://github.com/thesofproject/rimage/commit/4fb9fe00575bc

Also update outdated comments.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-08-28 16:16:44 +01:00
Seppo Ingalsuo 7b52664a6a Scripts: run-mocks.sh: Change default config to avoid error
The script runs the unit tests natively as gcc compiled.  The
tgph_defconfig is no more available, so use another configuration
that is available in src/arch/xtensa/configs.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-08-25 16:55:18 +01:00
Curtis Malainey deed9a8808 scripts: fuzz: add support for build and overlays
Add support to specify an overlay file to use with the fuzz script and
another flag to build without fuzzing

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2023-07-26 13:31:36 +01:00
SaiSurya, Ch cbee96c9bb scripts: add support for vangogh platform
Add support for Vangogh platform in build scripts.

Signed-off-by: SaiSurya, Ch <saisurya.chakkaveeravenkatanaga@amd.com>
2023-07-25 15:00:03 +01:00
SaiSurya Ch 2475094eef Dockerfile: add AMD/Vangogh gcc toolchain
Add AMD/Vangogh gcc toolchain.

Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
2023-07-14 12:50:49 +01:00
Marc Herbert b8a38072bc xtensa-build-zephyr.py: add support for aliases (ADL-->TGL etc.)
This restores parity with the installer/GNUmakefile in the stable-v2.2
branch and simplifies CI deployment.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-06-29 12:38:42 +03:00
Marc Herbert 5a9dc8a0b5 scripts/fuzz.sh: add -DCONFIG_ZEPHYR_POSIX
Don't rely on some semi-random default value.

The final `zephyr/.config` and binaries are strictly identical.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-06-13 11:11:14 +03:00
Marc Herbert 1621a95f01 scripts/fuzz.sh: cosmetic move list of CONFIG_s to a bash array
This saves a lot of backslashes and is easier to read. Zero change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-06-13 11:11:14 +03:00
Marc Herbert 231c4e36de xtensa-build-zephyr.py: remove `default_rimage_key` dead code
We used to provide the `default_rimage_key` in two places:
1) as a default `RIMAGE_KEY` attribute (newer `otc_private_key_3k`)
2) as an explicit `else` clause that was never run because of 1) (older
   `otc_private_key`)

Remove the redundant `else` clause in 2); it became dead code. This
simplifies the code and makes the script ready for the day when the key
argument will be optional for rimage (more about this in
https://github.com/zephyrproject-rtos/zephyr/pull/58356)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-06-02 13:06:35 +03:00
Marc Herbert c81efcf26a xtensa-build-zephyr.py: resolve relative --key arguments
Fixes commit a769d3941d ("xtensa-build-zephyr.py: stop calling west
sign, rely on west build")

Before that commit, `xtensa-build-zephyr.py` used to invoke `west sign`
directly and in the same current directory. This allowed relative key
paths to just work. Now that `west sign` is indirectly invoked by `west
build`, there is no possible way to make relative key paths work. So we
must resolve them before using them.

Fixes #7718

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-06-02 13:06:35 +03:00
Marc Herbert a769d3941d xtensa-build-zephyr.py: stop calling west sign, rely on west build
Stop invoking west sign manually. Configure rimage using `west config`
and a platform-specific WEST_CONFIG_LOCAL file instead, then rely on
west build to invoke rimage.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-26 10:47:51 +03:00
Marc Herbert 5a82b0ab53 xtensa-build-zephyr.py: add new rimage_west_configuration()
Do not make the switch yet. Make the switch in a smaller commit that can
more easily be reverted in case of a bug or some missed dependency
somewhere.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-26 10:47:51 +03:00
Jaroslaw Stelter 2df3cba533 LNL: Add new platform to RI_INFO_FIXME
The LNL platform added to RI_INFO_FIXME
list in build script.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-05-24 18:52:53 +03:00
Jaroslaw Stelter 02635875fb lnl: Lunarlake configuration
Add initial LNL configuration.
Enable building for xt-clang.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-05-24 18:52:53 +03:00
Marc Herbert 2ac64cf16b xtensa-build-zephyr.py: change rimage_options() to return tuples
Zero functional change. This will allow excluding some options.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-24 18:36:39 +03:00
Marc Herbert fdc05c718f xtensa-build-zephyr.py: extract new function rimage_options()
Unlike rimage_configuration(), rimage_options() will be kept free of
side-effect.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-24 18:36:39 +03:00
Marc Herbert 3ac849eac5 xtensa-build-zephyr.py: stop passing `--tool-data rimage/config/`
We used to use `-- -c rimage/config/platf.toml` for the IPC4 overlay and
the older `--tool-data rimage/config/` for the rest. This was confusing,
inconsistent and used to print this warning:

```
WARNING: --tool-data /var/home/mherber2/SOF/sof/rimage/config ignored,
         overridden by: -- -c ...
```

`--tool-data` was always a bad idea. It looks generic but it's not; it
allows changing only a config directory that is always in the same
location.

Copy what `west sign` does with `--tool-data`, drop it and use `-- -c`
always.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-24 18:36:39 +03:00
Marc Herbert 9bbbac778a xtensa-build-zephyr.py: call rimage_configuration() before building
This makes no difference now because it has no side-effect yet but it
will make a difference once it starts using `west config`.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-24 18:36:39 +03:00
Marc Herbert 51fddc64a3 xtensa-build-zephyr.py: extract new function rimage_configuration()
Zero functional change, pure clean-up.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-24 18:36:39 +03:00
Marc Herbert 463e8bd152 xtensa-build-zephyr.py: add a new line after logging the environment
In some cases it was difficult to separate the command's output from the
extra environment it ran in.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-24 18:36:39 +03:00
Marc Herbert 494d174b6e xtensa-build-zephyr.py: parse new versions.json instead of generated .h
For rimage parameters, parse new, static versions.json file instead of
generated sof_versions.h file. This will make possible to configure
rimage before west build.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-24 18:36:39 +03:00
Marc Herbert 2d3c7eae4f xtensa-build-zephyr.py: don't extract SOF_BUILD from generated .h file
This replaces and simplifies commit a823958a8d ("xtensa-build-zephyr:
pass sof build version to rimage") with a constant 1.

That commit was submitted to avoid a test failure in a broken, internal
test looking for an SOF_BUILD value... hardcoded to 1! (internal FW issue
257, test TestLoadFwExtended::()::test_00_01_load_fw_and_check_version")

The final goal is for this script to stop extracting anything from
`generated/sof_versions.h` so rimage can be configured _before_ the build
has started. Other commits will deal with other parts of sof_versions.h

SOF_BUILD can be replaced by a constant because it has always been one
when building with Zephyr. The optional BLD_COUNTERS feature - disabled
by default in XTOS since commit 9f8cce1522 ("Disable __TIME__ and the
non-reproducible build counter by default") for build reproducibility
reasons - has never worked with Zephyr for the following reasons:

- The sof_add_build_counter_rule() invocation is located in the
top-level sof/CMakeLists.txt file which has never been used by the
Zephyr build.

- sof_add_build_counter_rule() registers a POST_BUILD command for the
top-level "sof" CMake target but there is no "sof" build target in the
Zephyr build.

- Variables like VERSION_BUILD_COUNTER_CMAKE_PATH are not defined in the
Zephyr build for some unknown reason.

- Probably others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-19 10:02:03 +03:00
Marc Herbert c1ae62e32b rebuild-testbench.sh: add -j jobs option
This is required to investigate build failures. Because of the way the
build is split, a failure in one component can become totally drown in
the long build logs of another component.

Example: with -j2 the `parser_ep` build failure below is completely
drown by the long (and successful!) build logs of `sof_ep`:

```
./scripts/rebuild-testbench.sh -j 1 -p tgl

sof/tools/testbench/build_xt_testbench/sof_parser/build/include/alsa/
sound/asoc.h:196: error: expected specifier-qualifier-list before ‘__le32’
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:58:39 +03:00
Marc Herbert 565a252c1d rebuild-testbench.sh: add missing shellcheck source=
Fixes last shellcheck -x warning

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:58:39 +03:00
Marc Herbert f0d1d4918f rebuild-testbench.sh: testbench_usage(): add missing ;;
Also: don't fail silently.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-17 12:58:39 +03:00
Marc Herbert ce0dd67bb7 sof_builder/Dockerfile: restore deleted toolchains
Building a Docker image takes several hours. To reduce costs and save
time we don't want to maintain a different Docker image for the
stable-v2.2 branch. Restore toolchains that were accidentally removed
from the Dockerfile because this will unnecessarily paint red every PR
submitted to the stable-v2.2 branch, example:

https://github.com/thesofproject/sof/actions/runs/4867162042/jobs/8679468096

If we want to stop supporting something then let's keep things simple
and remove it only where it actually gets in the way and where it
actually becomes a problem. No need to search and scrub every reference
to it from the face of the planet and accidentally make our life harder
on release branches, create pointless git conflicts and _increase_
maintenance costs when trying to reduce them!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-15 11:17:40 +03:00
Guennadi Liakhovetski a4c8d4ef79 Intel: remove XTOS support
XTOS isn't supported any more for Intel platforms, remove support for
it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-05-11 19:17:17 +03:00
Marc Herbert bc0b868ffd fuzz.sh: update comments for IPC4. No functional change.
Update comments for brand new IPC4 support. No functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-11 11:43:07 +03:00
Marc Herbert a4ece86d4d xtensa-build-zephyr.py: drop intermediate build-$platf/sof-$platf.ri
Remove one intermediate and unnecessary .ri file. Simplify the code and
the build directory. Example below with `sof-mtl.ri` for better
readability but this applies the same to `sof-imx8.ri` and every other
`sof-$platf.ri` file.

There were 3 .ri copies before this commit:

```
                build-mtl/zephyr/zephyr.ri
copied to  ->   build-mtl/zephyr/sof-mtl.ri
copied to  ->   build-sof-staging/___/sof-mtl.ri
```

Only 2 left after dropping the second and pointless copy:

```
                build-mtl/zephyr/zephyr.ri
copied to  ->   build-sof-staging/___/sof-mtl.ri
```

Fewer copies means less wondering about what is what, two identical
files in the same directory is at best pointless and at worst misleading.

The `build-mtl/` directory belongs to the zephyr build system
exclusively, this wrapper script has no business interfering with
`build-mtl`. `build-mtl/zephyr/sof-mtl.ri can even be dangerous because
it does not get cleaned. Demonstration:

```
 # Compile successfully
 $ ./scripts/xtensa-build-zephyr.py mtl

 # Write some code and make a mistake.
 # Fail to compile.
 $ echo BROKEN >> ../zephyr/kernel/sched.c
 $ ./scripts/xtensa-build-zephyr.py mtl

 # Obsolete .ri files are still there
 $ find ../build-mtl/ -name *.ri
  ../build-mtl/zephyr/zephyr.ri
  ../build-mtl/zephyr/sof-mtl.ri

 $ ninja -C ../build-mtl clean

 # Obsolete sof-mtl.ri is still there!
 $ find ../build-mtl/ -name *.ri
  ../build-mtl/zephyr/sof-mtl.ri

```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-05 19:40:58 +03:00
Seppo Ingalsuo 10d0b3b5e1 Scripts: Add xt-run build target for rebuild-testbench.sh
This patch adds to rebuild-testbench option -x <platform> that
can be used to build testbench for xt-run execution. The enhanced
script reuses native testbench build but with CC, LD, LDFLAGS,
etc. defines to use the xt-xcc compiler for build.

Currently TGL (HiFi3) is the only supported platform. More will
be added later.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-04 18:07:52 +03:00