Commit Graph

54 Commits

Author SHA1 Message Date
Andrey Borisovich ce3264a507 platform: Move configuration from Zephyr to SOF
Move software configuration from Zephyr samples directory
to SOF platforms directory using Zephyr overlay mechanism.
How it works:
1. Gets zephyr board defconfig values
2. Applies Zephyr samples prj.conf values on top of it
3. Then applies our new overlay.conf on top of it
4. Final "summary" of Kconfig settings is written to autoconf.h header

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-03-18 16:14:19 +00:00
Kai Vehmanen 8f3a78dc6a xtensa-build-zephyr.sh: fix shellsheck warning
In scripts/xtensa-build-zephyr.sh line 199:

  if test $platform = tgl-h ; then
           ^-------^ SC2086: Double quote to prevent globbing
			     and word splitting.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-14 11:43:32 +00:00
Kai Vehmanen 6d0ecc37cc xtensa-build-all: add a separate target for JSL
Use intel_adsp_cavs20_jsl Zephyr board when building for
Intel Jasper Lake.

BugLink: https://github.com/thesofproject/sof/issues/4539
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-14 11:35:35 +00:00
Marc Herbert 177e18f701 xtensa-build-zephyr.sh: add new -u zephyr_remote option
Same -u option as the new Python script.

We need this for the new sof/stable-v2.1 branch on
https://github.com/thesofproject/zephyr while our CI has not entirely
switched to the python script yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-14 11:32:59 +00:00
Kai Vehmanen 26e08d4d55 xtensa-build-zephyr: use separate Zephyr config for TGPH builds
Zephyr recently added support for separate configs for 2-core and 4-core
variants of cAVS2.5. Use the new "tgph" configuration for when building
SOF for TigerLake-H variant.

BugLink: https://github.com/thesofproject/sof/issues/5018
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:49:36 +00:00
Marc Herbert 805e57b28f xtensa-build-zephyr: include DEFAULT_PLATFORMS in SUPPORTED_PLATFORMS
Include DEFAULT_PLATFORMS in SUPPORTED_PLATFORMS instead of the other
way round. SUPPORTED_PLATFORMS will always be bigger than
DEFAULT_PLATFORMS and it's easier to add a platform than remove one.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:57:35 +00:00
Marc Herbert ac1a09afdb xtensa-build-zephyr: de-dup. first vs incremental west invocation
Passing spurious --board and source directory arguments to an already
build directory does not help but it does not hurt either and it
simplifies the code. It also provides a more consistent west command in
the set -x "logs", one that can be re-used in any circumstance.

The only restriction is to make sure CMAKE_ARGS is empty on all but the
first invocation but that's not new and unchanged here.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:57:35 +00:00
Kai Vehmanen b95d995bd2 xtensa-build-zephyr: add -v option for verbose build
Align with xtensa-build-all.sh and add a "-v" option to toggle
verbose build log ("west -v build").

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-01-05 13:23:00 +00:00
Marc Herbert f45f5dffec xtensa-build-zephyr.sh: remove x-prefix in comparisons
Fixes new shellcheck 0.8.0 warning:

SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a
purpose.

This script requires bash anyway.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-04 11:55:21 +02:00
Marc Herbert 0d39ff6b91 xtensa-build-zephyr.sh: add missing "${SOF_TOP}" quotes
Fixes commit a8c333b606 ("xtensa-build-zephyr: add deterministic
sha256sum of final .ri file")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-04 11:55:21 +02:00
Marc Herbert a8c333b606 xtensa-build-zephyr: add deterministic sha256sum of final .ri file
Checksumming the final binary is useful to compare before/after some
configuration change or to compare builds across different people /
systems.

Because rimage is not deterministic, ask sof_ri_info to do this.

Sample output:

Firmware file size 0x55000 page count 79
 pkcs_v1_5_sign_man_v1_8: signing with key
               'modules/audio/sof/keys/otc_private_key.pem'
 pkcs: RSA private key is valid.
 pkcs: digest for manifest is 5b52ac0b8809503c817a96dac7c5124dba5a90d...
Firmware manifest and signing completed !
Extended manifest found module, type: 0x0001 size: 0x01A0 ( 416) offset:
Extended manifest found module, type: 0x0005 size: 0x0020 (  32) offset:
Extended manifest found module, type: 0x0004 size: 0x0020 (  32) offset:
Extended manifest found module, type: 0x0003 size: 0x0030 (  48) offset:
Extended manifest found module, type: 0x0002 size: 0x0070 ( 112) offset:
Extended manifest found module, type: 0x0000 size: 0x0050 (  80) offset:
Extended manifest saved zephyr/zephyr.ri.xman size 0x02E0 (736) bytes

SOF Binary build-apl/zephyr/zephyr.ri size 0x4f2e0

  Extended Manifest ver 1.0.0 length 736

  cavs0015 (ADSP Manifest) file offset 0x22e0 name ADSPFW build ver
             0.0.0.0 feature mask 0xffff image flags 0x0
    HW buffers base address 0x0 length 0x0
    Load offset 0x2000

sha256sum build-apl/zephyr/reproducible.ri
46f3404e3b674ed....120c2173d6050bde35b build-apl/zephyr/reproducible.ri

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-20 22:35:09 +00:00
Marc Herbert ae36fa5c91 xtensa-build-zephyr: build ICL by default again
ICL linking overlap issue has been fixed by
https://github.com/zephyrproject-rtos/zephyr/pull/39603

This is a logical revert of commit d4b8a01f20 ("xtensa-build-zephyr:
temporarily exclude ICL")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-25 09:59:56 +00:00
Marc Herbert 9f13849fa3 xtensa-build-zephyr: fix error message "not a zephyr project"
Echo the user argument instead of $WEST_TOP which is typically empty at
this point.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-25 09:59:56 +00:00
Marc Herbert 4c6ecb2172 xtensa-build-zephyr: guess CMake successes and failures better
Recent commit b9fcc4156e ("xtensa-build-zephyr: fix incremental build,
pass CMAKE_ARGS only once") fixed incremental builds. For this it first
needs to guess whether the most recent CMake configuration step failed
or succeeded so it knows what is the current "checkpoint" and what is
the next west command to run. Merely testing whether the build directory
already exists is a very bad guess because that directory could have
been created by some other person or script, or - much worse - it could
have been created by a failed CMake configuration step!

The latter situation makes debugging CMake failures very tedious because
it requires manually deleting the build directory after each CMake
configuration failure.

Fix this by not merely looking for a build directory but by looking
whether there is either a build.ninja or a Makefile is found in that
directory. This is a much better indication that the CMake configuration
succeeded.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-21 22:35:22 +00:00
Marc Herbert b9fcc4156e xtensa-build-zephyr: fix incremental build, pass CMAKE_ARGS only once
As documented in
https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
and accidentally found when testing rimage cleanup
https://github.com/zephyrproject-rtos/zephyr/pull/40431

Fixes commit 88327f618c ("xtensa-build-zephyr: support passing through
CMake arguments"); ccache is too good and hid this regression from me.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:29:16 +00:00
Marc Herbert d4b8a01f20 xtensa-build-zephyr: temporarily exclude ICL
Because ICL fails to build, .noinit/.cached section overlap since
revert https://github.com/zephyrproject-rtos/zephyr/pull/40319

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:27:46 +00:00
Marc Herbert bccbfcc404 xtensa-build-zephyr: add new DEFAULT_PLATFORMS variable for -a
Sometimes we don't want to build all SUPPORTED_PLATFORMS by default.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:27:46 +00:00
Marc Herbert d1b264c3f0 xtensa-build-zephyr: add new -z option to clone any Zephyr version
Default behavior is still to clone the default Zephyr branch (main) but
this could be changed with just one line.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-11 10:33:18 +00:00
Marc Herbert fa0888991c xtensa-build-zephyr: cosmetic rename of two functions
Zero functional change.

Rename clone() to west_init_update() and build_all() to
build_platforms(). Also expand description of the west_init_update()
feature in the usage message and add a direct SHA1 fetch example.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-11 10:33:18 +00:00
Iuliana Prodan 71e4500349 xtensa-build-zephyr: add imx8m as supported platform
Add imx8m platform to be tested with Zephyr.
imx8m refers to i.MX8MP target.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-11-02 22:34:21 +00:00
Marc Herbert 33c13e8c17 xtensa-build-zephyr: download rimage later, just before needed
This helps catch hidden rimage dependencies.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-10-15 12:22:00 +01:00
Marc Herbert 7c0f032266 xtensa-build-zephyr: extract new download_missing_submodules() function
This makes testing submodule issues easier.

Absolutely zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-10-15 12:22:00 +01:00
Guennadi Liakhovetski 6ce3237509 zephyr: apl: re-enable building with XCC
Zephyr XCC builds for Apollolake can be re-enabled now after the RAM
footprint has been reduced.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-10-14 14:01:57 +01:00
Marc Herbert 868e00bdd0 xtensa-build-zephyr: download rimage whether we clone zephyr or not
... because there's no reason to make one depend on the other.

Same for the opportunistic creation of the sof symbolic link.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-29 17:00:49 +01:00
Marc Herbert d80d70bf47 xtensa-build-zephyr: fix submodules download hack when starting from west
By adding the missing remote to thesofproject

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-29 17:00:49 +01:00
Marc Herbert a0793de4be xtensa-build-zephry: add more WEST_TOP asserts and heuristics
Do not define a default WEST_TOP at the very start because we may not
have one. Define WEST_TOP only when the user gives one or when we
actually find one. And search harder.

Do not trust optional WEST_TOP user input blindly either. This was
leading mkdir -p to create a bogus modules/audio/ directory.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-29 17:00:49 +01:00
Iuliana Prodan 4b80be18e5 xtensa-build-zephyr: add imx8x as supported platform
Add imx8x platform to be tested with Zephyr.
imx8x refers to i.MX8QXP target.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-09-29 17:50:15 +03:00
Marc Herbert e3494f5662 xtensa-build-zephyr: make "tree" optional
"tree" is very useful but it's not critical, not worth failing the build
for.

Also remove a single quote from the help message as it breaks parsing
in one simple editor I use (jed) and possibly others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-13 22:28:09 +01:00
Marc Herbert 9452af0a5e xtensa-build-zephyr: add zephyr_fetch_and_switch() example
Add example that shows how to submit any Zephyr commit to SOF PR
testing.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-10 13:35:36 +01:00
Marc Herbert 4d3192c266 xtensa-build-zephyr: add option to stop after cloning Zephyr
This is needed by CI to clone only once and then take control of the
iteration over platform builds. CI already does all that but by
copy/paste/diverge of this clone() function.

Once cloning Zephyr in CI code is de-duplicated and uses this new
clone-only feature instead, it will be possible to submit any Zephyr
commit to SOF testing.  In other words it will make failed attempt
https://github.com/thesofproject/sof/pull/4728 possible

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-10 13:35:36 +01:00
Marc Herbert 88327f618c xtensa-build-zephyr: support passing through CMake arguments
Like this:

  xtensa-build-zephyr.sh -a -- -DEXTRA_CFLAGS='-Werror -Wextra'

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-09 15:48:18 +01:00
Marc Herbert aec08eaf7e xtensa-build-zephyr: extract new parse_args() function from main()
main() was growing too big. Zero functional change.

Also rename the too generic "build()" to build_all()

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-09 15:48:18 +01:00
Kai Vehmanen d3faab3d16 xtensa-build-zephyr: re-enable XCC build for Intel cAVS hw
The regression in Zephyr mainline is fixed with
https://github.com/zephyrproject-rtos/zephyr/pull/38374 , so
the XCC build can be renabled for cAVS targets.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-09-08 18:35:05 +01:00
Marc Herbert 6bedd8e742 xtensa-build-zephyr: fix RIMAGE_KEY when building multiple platforms
RIMAGE_KEY was global and leaking from one platform to the next

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-07 20:22:39 +01:00
Kai Vehmanen e963aa0e4a xtensa-build-zephyr: disable XCC build for Intel cAVS hw
Recently merged rework of multicore support in Zephyr has
broken builds with XCC. Disable XCC based builds in CI until
issue is resolved in Zephyr mainline. Issue tracked as:
https://github.com/zephyrproject-rtos/zephyr/issues/38349

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-09-06 22:55:12 +01:00
Marc Herbert c5ac4a44b9 xtensa-build-zephyr: add tgl
Almost no difference with tgl-h for now but will grow later.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-03 11:25:53 +03:00
Marc Herbert d910206bcf xtensa-build-zephyr: split SUPPORTED_PLATFORMS on multiple lines
... to minimize future conflicts.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-03 11:25:53 +03:00
Iuliana Prodan 6b650bd95f xtensa-build-zephyr: add imx8 as supported platform
Add imx8 platform to be tested with Zephyr.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-08-30 13:22:33 +01:00
Marc Herbert 4d4fd8c426 xtensa-build-zephyr.sh: build rimage later, just before it's needed.
We care about other build errors more.

This also makes it easier to test locally that "west build" does not
depend on rimage to create zephyr.elf

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-08-26 09:46:28 +03:00
Kai Vehmanen 0d9a0c112c xtensa-build-zephyr: disable XCC build for Intel APL
The BSS usage exceeds available memory when building for
APL/cavs15 hardware with XCC, so disable it for now. Issue
tracked as https://github.com/thesofproject/sof/issues/4645

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-18 13:54:17 +01:00
Kai Vehmanen 997972c558 xtensa-build-zephyr: clean up XTENSA_TOOLS_ROOT parsing
Remove the unnecessary assumption that Xtensa tools are installed under
'XtDevTools'.

Align indentation to use tabs as is used elsewhere in this file.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-17 08:57:43 +01:00
Kai Vehmanen 4b86f2429b xtensa-build-zephyr: add support to build with xtensa XCC
Add support to build with XCC compiler by setting XTENSA_TOOLS_ROOT
env variable. The interface follows xtensa-build-all.sh, so existing
CI scripts for SOF builds can easily update to build with XCC.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-16 09:25:32 +01:00
Iuliana Prodan 6556933e83 xtensa-build-zephyr: add imx8 platform
Add imx8 platform for local testing.

TODO: Update xtensa-build-zephyr.sh when Zephyr repo
is updated with imx8 support.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-27 14:43:44 +01:00
Marc Herbert 8059b8f9fd xtensa-build-zephyr: better help and error message when -p is required
-p is required when the real (not symbolic) directories are not nested
in one another.

The documentation gap was clearly demonstrated by me getting confused
even though _I_ implemented this logic some time back.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-22 17:01:19 +01:00
Marc Herbert bdae0ee127 xtensa-build-zephyr: run smex and install to new staging area
Ready to be transferred to the remote system. Sample output:

build-sof-staging
├── sof
│   ├── community
│   │   ├── sof-apl.ri
│   │   └── sof-tgl-h.ri
│   ├── sof-apl.ldc
│   └── sof-tgl-h.ldc
└── tools
    └── sof-logger

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-07-13 15:56:49 +01:00
Zhang Keqiao d750055a69 zephyr: switch to use 3k private key for tgl-h
TGL-H should be used the 3k otc private key for build.

Signed-off-by: Zhang Keqiao <keqiao.zhang@intel.com>
2021-06-25 11:10:33 +01:00
Marc Herbert 9c1d103520 xtensa-build-zephyr.sh: remove west --pristine option
Zephyr's incremental build works and saves time. I have been using it
with SOF for a long time. Slowly rebuilding from scratch is as simple as
deleting the build-$platform/ build directory. Quickly building not from
scratch is not possible without this commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 12:29:03 +01:00
Marc Herbert 7d37ca6fa1 xtensa-build-zephyr.sh: use west long options
Zero functional change.

Makes the code and the build logs clearer, especially for SOF people new
to west. Short options are for saving repetitive typing; no reason to
use them in a script.

Also show the real /bin/pwd which can help when west gets lost in
complex symbolic link situations.
https://github.com/zephyrproject-rtos/west/issues/419

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 12:29:03 +01:00
Marc Herbert 55e292ee85 xtensa-build-zephyr: add mkdir -p modules/audio
More robust support for "manual" installations.

Also rephrase usage string to remove a single quote breaking
the shell parser in one editor I use (sorry).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-06 14:36:25 +01:00
Marc Herbert 0f989b10e9 xtensa-build-zephyr.sh: show zephyr short git log / version after clone
By default, the Zephyr build does not log its version. The fix has
already been submitted at
https://github.com/zephyrproject-rtos/zephyr/pull/34842 however:

- 34842 may take some time. Zephyr reviewers are even busier than the
  SOF reviewer.
- 34842 could even be rejected
- 34842 will at best log the SHA1 and no context. This is more verbose
  and future-proof because it supports more complex situations like
  testing a pull/12345/merge

As seen in (unrelated) PR #4123, we need Zephyr git versions NOW.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-05 09:45:55 +01:00