Commit graph

5615 commits

Author SHA1 Message Date
Andy Ross
60fb850713 scripts/west_commands: Don't demand non-empty output formats
It's not clear why this error is here.  The "formats" array seems to
be limited to "bin" and "hex" only, but every signing tool is going to
have its own idea of what format to emit and what ingredients need to
be used to do that.

In particular, rimage (used for the Intel Audio DSPs) doesn't use nor
generate zephyr.bin (it's very large), so it trips over this failure.

Just present the possibly-empty list of output formats to the Signer
object and let it make the decision about whether an empty formats
list is an error.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-10-23 22:22:52 -04:00
Anas Nashif
3ac163eae6 boards: rename up_squared_adsp intel_adsp_cavs15
The Audio DSP is not specific to up_squared, so make it more generic.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-23 12:56:03 +02:00
Erwan Gouriou
48b786b159 scripts: series-push-hook: Fix behavior after rebase
Avoids parsing the whole "before to now" commits after rebase.
Now, we just parse all commits since first commit of the branch
compared to master, each timer either at first push, forced push,
forced push after rebase.

Fixes #28509

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-21 07:16:54 -05:00
Kumar Gala
fc8c0c073c scripts: edt: Fix comment in _prop_val
_prop_val comment referred to one of the arguments called "optional"
however the code has changed to call that argument "required" now.  Fix
up the comment block to use the correct argument name and semantics of
that argument.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-21 06:44:32 -05:00
Kumar Gala
83be5cb9b3 scripts: edtlib: cleanup required arg to _check_prop_type_and_default
_check_prop_type_and_default doesn't use the required argument so remove
passing it to the function.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-21 06:44:32 -05:00
Kumar Gala
c7baf2f663 scripts: edtlib: Remove deprecated "category" support
"category" support has been deprecated for over 2 releases.  Removing
support for the keyword.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-21 06:44:32 -05:00
Martí Bolívar
876b961a71 scripts: edtlib: cosmetic variable name change
Change "elm" to "elem" for readability.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-21 06:44:32 -05:00
Martí Bolívar
7165b77a81 scripts: edtlib: refactor for first class bindings
Add two new types: Binding and PropertySpec.

- Binding is a first-class abstraction for a devicetree binding
  file as defined by a YAML file in the Zephyr syntax.

- PropertySpec is a helper type which represents a property
  definition within a Binding.

Make the Binding constructor a new entry point to the library. This
enables users to deal with bindings as standalone entities, apart from
how they characterize a particular devicetree.

Rework the EDT and Node internals that deal with bindings as dict
values to use the Binding type instead. To make this less ambiguous,
use the variable name 'raw' when we're dealing with a binding as it's
parsed from YAML, and 'binding' when we're dealing with a Python
Binding object.

This commit drops support for the following legacy bindings keys

- '#cells': use '*-cells' instead (e.g. 'gpio-cells', 'pwm-cells')
- "child-bus: foo" and "child: bus: foo": use "bus:" instead
- "parent-bus" and "parent: bus: ": use "on-bus:" instead

Officially, legacy bindings have been gone since
6bf761fc0a ("dts: Remove support for deprecated DTS binding
syntax"), so this is vestigial code, and I couldn't find any in-tree
users.

It also drops the convention in this file that ""-strings are
preferred.

I honestly don't understand why this was ever enforced; the file
itself admits single quotes are common in Python and we use them
elsewhere in Zephyr's Python code.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-21 06:44:32 -05:00
Martí Bolívar
8640a8d666 scripts: edtlib: tweak module docstring
Add a bit more information and clarification.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-21 06:44:32 -05:00
Anas Nashif
f751dd46b2 west: commands: sign: Add signing support for other CAVS targets
Sign for CAVS15, CAVS18, CAVS20 and CAVS25 SOCs

Originally-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-21 06:38:53 -04:00
Kumar Gala
eb2e89aecf sanitycheck: Fix bug with -M option
If we get a build failure with the -M option we get the following:

TypeError: 'NoneType' object is not iterable

This was due to having the default value of additional_keep in
cleanup_artifacts being None instead of an empty array.

Fixes #29376

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-20 19:30:43 -05:00
Kumar Gala
b2c07e439e sanitycheck: sanitize paths for device testing artifacts
To make the artifacts we keep around for --device-testing -M re-usable
we need to sanitize any aboslute build paths that might exist in
CMakeCache.txt or zephyr/runners.yaml.

This allows us to build the tests to run on one CI system and run the
tests on another system that has the board(s) connected to it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-20 07:24:30 -05:00
Kumar Gala
1285c1f80a sanitycheck: make artifact cleanup for device-testing usable
If we specify --device-testing and -M make it so that the resulting
artifacts are usable to run with device-testing again.  This means
keeping around the zephyr binary images (zephyr.{bin, hex, elf}) and
a few files so 'west' can function for flashing (CMakeCache.txt and
zephyr/runners.yaml).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-20 07:24:30 -05:00
Kumar Gala
037e1274d0 sanitycheck: qualify device testing output
If --device-testing and --build-only are specified surpress some board
related output

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-20 07:24:30 -05:00
Eugeniy Paltsev
ea11784919 sanitycheck: actually allow empty west-flash without parameter
According to west-flash option description it's allowed to use
west-flash without parameter:
> There are three ways this option is used.
> 1) bare: --west-flash
> 2) with a value: --west-flash="--board-id=42"
> 3) Multiple values: --west-flash="--board-id=42,--erase"

However, we don't allow to west-flash to be without parameter
when we verify sanitycheck arguments. Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-10-16 06:26:21 -04:00
Torsten Rasmussen
fef7879583 scripts: ensuring posix path on module defined roots.
Fixes: #29235

This commit ensures that roots are being converted to posix paths.
This fixes the issue where windows style path (containing `\`) would
result in DTS dependency file to contain mixed style path separator and
thus causing Ninja to re-invoke CMake in an endless loop.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-10-15 22:07:11 -04:00
Martí Bolívar
305379e944 devicetree: add first round of dependency ordinal info
Add the first API functions that directly deal with node dependency
ordinals as determined by edtlib:

- DT_DEP_ORD(node_id): node_id's ordinal
- DT_REQUIRES_DEP_ORDS(node_id): list of dep ordinals for node_id's
  direct dependencies
- DT_SUPPORTS_DEP_ORDS(node_id): list of dep ordinals for nodes
  depending directly on node_id
- DT_INST_ equivalents

This is not meant to be an exhaustive set of macros related to
dependency ordinals; rather, it's a starting out point meant to enable
initial struct device dependency tracking work. We can add more if
needed.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-14 13:18:44 -05:00
Martí Bolívar
f752c5eeec west build: fix --pristine on early build system failure
The west build command has historically tried not to rm -rf
directories that don't look like zephyr build directories. The way it
does this is by checking for the presence of a CMake cache
with a Zephyr-specific variable (ZEPHYR_TOOLCHAIN_VARIANT) in it.

The problem with this approach is that if the build system fails
before this cache variable is set, the directory doesn't look like a
zephyr build directory, and therefore west build won't make it
pristine even with --pristine=always, even though build directories
resulting from failed runs like that are almost certainly
irrecoverably broken and need to be made pristine before anything will
work.

This leads to users having to rm -rf their directories manually, which
is not so nice.

To avoid this from happening, just check for ZEPHYR_BASE, which is
set early on in ZephyrConfig.cmake in 'modern' zephyr build systems.
Keep the ZEPHYR_TOOLCHAIN_VARIANT check in place for compatibility.

We could consider being less selective and just using shutil.rmtree()
whenever we have --pristine=always, but that would be a bigger
behavioral change than I'm comfortable doing without a good reason.

Fixes: #28876
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-14 07:22:32 -05:00
Kumar Gala
659b24bdcf sanitycheck: Fix results for --cmake-only
If we run with --cmake-only we get the following:

`ERROR   - Unknown status None`

Fix this by treating no status set as "passed" for the --cmake-only
case.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-13 13:13:21 +02:00
Martí Bolívar
8165008f44 dts: remove legacy macro support
The legacy macros were first deprecated in Zephyr v2.3. Now that
Zephyr v2.4 has been released, that makes two releases where these
macros have been deprecated, so it's OK to remove them.

This leaves support for legacy binding syntax in place. Removing that
is left to future work.

We need to update various pieces of documentation related to flash
partitions that never got updated when the new API was introduced.
Consolidate this information in the flash_map.h API reference page,
since that's really where users will run into it. This also gives us
the opportunity to improve this documentation.

Adjust a couple of kconfigfunctions.py and sanitycheck bits to use
non-legacy edtlib APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-09 08:45:38 -05:00
bf04c29c26 runners: bossac: handle --help on the current git version of BOSSA
BOSSA 1.9.1 and before an errror on `--help`, but the current git
version returns 0.  Handle both cases.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-10-09 08:22:38 -05:00
c0055ed392 runners: bossac: calculate the offset instead of absolute address
BOSSA takes the offset within flash memory, not the absolute address.
This doesn't matter on most boards as the flash starts at zero but
does matter on the Due as the flash starts at +512 KiB.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-10-09 08:22:38 -05:00
Martí Bolívar
1ea7bf0db0 scripts: dts: fix handling for phandle-arrays with *-cells=0
Each controller node in a phandle-array may set the number of cells in
a specifier as any nonnegative integer. Currently, we don't allow
this in edtlib in the case where there are multiple controllers in a
phandle-array property all of which have 0 cells in the relevant
specifier, which is not correct. Fix this, add a regression test, and
improve the error message while we are here.

Fixes: #28709
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-06 12:05:37 -05:00
Peter Bigot
44394e3d8e edtlib: add EDT.dep_ord2node
Add a lookup table for finding a node by its dependency ordinal.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-06 09:50:39 -05:00
Martí Bolívar
b6db2019dd edtlib: propertize EDT.scc_order, set up graph earlier
Make the scc_order method a property instead. This is in keeping with
the "General biased advice" at the top of file.

The actual order is therefore lazily initialized in this commit and
the order is not computed by the time __init__() returns. The next
commit will invoke scc_order by the time the constructor returns.

This is preparation work for adding a lookup table from dependency
ordinals to nodes. The combination of these two changes will make
intializing that lookup table a bit easier.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-06 09:50:39 -05:00
Martí Bolívar
3a2dc77743 dts: break cycles in test scripts
We don't want to support cyclic dependency structures, because it
means that Node objects cannot have dep_ordinal attributes as they are
currently documented to possess unconditionally.

Nevertheless, we have some in our tests. Remove them by extracting the
/props/ctrl-X nodes to the same level as the /props nodes. This breaks
a cycle caused by:

- /props/ctrl-X nodes depend on /props because of the parent/child
  relationship
- /props depends on /props/ctrl-X because it refers to them by phandle

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-06 09:50:39 -05:00
Martí Bolívar
09b8db4088 nrfjprog.py: handle ImportError
We need to handle ImportErrors on all non-stdlib imports in the
runners package.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-06 07:38:58 -04:00
Maciej Perkowski
2ec5ec2153 sanitycheck: Fix ZeroDivisionError during reporting
This patch fixes the ZeroDivisionError which can
occur during percantage of test execution reporting.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-10-02 07:56:17 -04:00
Martí Bolívar
a6856811a3 scripts: dts: pass tests on windows
Doing this just requires a bit of os.fspath()-ery.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-02 11:51:15 +02:00
Martí Bolívar
a8612f75c5 scripts: dts: convert test suites to pytest
Use the pytest test framework in the dtlib.py and edtlib.py test
suites (testdtlib.py and testedtlib.py respectively).

The goal here is not to change what is being tested. The existing test
suite is excellent and very thorough.

However, it is made up of executable scripts where all of the tests
are run using a hand-rolled framework in a single function per file.
This is a bit all-or-nothing and prevents various nice features
available in the de-facto standard pytest test framework from being
used.

In particular, pytest can:

- drop into a debugger (pdb) when there is a problem
- accept a pattern which specifies a subset of tests to run
- print very detailed error messages about the actual and expected
  results in various traceback formats from brief to very verbose
- gather coverage data for the python scripts being tested (via plugin)
- run tests in parallel (via plugin)
- It's easy in pytest to run tests with temporary directories
  using the tmp_path and other fixtures. This us avoid
  temporarily dirtying the working tree as is done now.

Moving to pytest lets us leverage all of these things without any loss
in ease of use (in fact, some things are nicer in pytest):

- Any function that starts with "test_" is automatically picked up and
  run. No need for rolling up lists of functions into a test suite.
- Tests are written using ordinary Python 'assert'
  statements.
- Pytest magic unpacks the AST of failed asserts to print details on
  what went wrong in really nice ways. For example, it will show you
  exactly what parts of two strings that are expected to be equal
  differ.

For the most part, this is a pretty mechanical conversion:

- extract helpers and test cases into separate functions
- insert temporary paths and adjust tests accordingly to not match
  file names exactly
- use 'assert CONDITION' instead of 'if not CONDITION: fail()'

There are a few cases where making this happen required slightly
larger changes than that, but they are limited.

Move the checks from check_compliance.py to a new GitHub workflow,
removing hacks that are no longer needed.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-10-02 11:51:15 +02:00
Marcin Niestroj
fc67409291 sanitycheck: ignore coverage directories by matching any in path hierarchy
So far 'tests' and 'samples' directories were matched only when they
were first directories in path hierarchy. This doesn't work when running
sanitycheck from directory other than Zephyr source code root.

Match any directory in path hierarchy, similar how file is matched
currently. That way sanitycheck can be executed from outside of Zephyr
source code directory.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-01 17:11:34 -04:00
Marcin Niestroj
b536fc416a sanitycheck: add optional --coverage-basedir argument
Add '--coverage-basedir BASEDIR' argument, which can be used to specify
source code base directory other than default Zephyr root directory.

This is mainly useful for projects built on top of Zephyr, where
sanitycheck is used for unit testing application code.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-01 17:11:34 -04:00
Anas Nashif
994bd5b876 sanitycheck: tests: adapt testsuite to new filter
Make testsuite pass with new changes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-01 07:28:01 -05:00
Anas Nashif
405f1b62f3 sanitycheck: support --filter to limit number of tests built
Use --filter=runnable for example to limit the tests being built to
those which actually can run on a device or a emulation platform.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-01 07:28:01 -05:00
Anas Nashif
9603fe40bd sanitycheck: adapt testsuite for build_only cleanup
Change tests to sync with changes in the library.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-01 07:28:01 -05:00
Anas Nashif
4ca0b95956 sanitycheck: build_only ambiguity cleanup
build_only was being used in different contexts and was confusing, so
clean this up and in some places just set if a test is runnable, a
testcase should always be buildable if the filters are matching.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-01 07:28:01 -05:00
Hake Huang
aea9486e87 documents: update the pyocd required version
pyocd 0.28 can support rt1xxx series board well

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-09-29 13:37:53 -05:00
Øyvind Rønningstad
d6c30eead0 nrfjprog.py: Fail if hex file has UICR data and no --erase
Inspect the hex file with intelhex, and fail if the hex file has any
contents in the UICR area(s).
family == 'NRF52' still always does --sectoranduicrerase, but this
option is not available on other families.
Add --force command line option to proceed with flashing instead of
failing.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-09-28 14:09:14 -05:00
Kumar Gala
51d6931b16 sanitycheck: Only create testcase_extra.conf if needed
Only create the dir and file if we have actual "content" that will
exist in testcase_extra.conf.  This is to reduce a bit of
noise/footprint in the sanitycheck output dir.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-28 12:10:34 +02:00
Anas Nashif
c1c10993c7 sanitycheck: comment cleanup and style fixes
Minor comment and style fixes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-18 13:24:36 -05:00
Anas Nashif
fdc02b651c sanitycheck: capture timeout as reason in cases we kill qemu
If we kill qemu because of a timeout, capture this as the reason instead
of reporting the exit code.

Fixes #28040

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-18 13:24:36 -05:00
Anas Nashif
61c4a511ac sanitycheck: error on duplicate board identifier
Error when we have duplicate identifiers in board definition files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-15 13:17:08 -04:00
Fabio Utzig
054d89feaf doc: bump breathe>=4.21.0
Breathe 4.21.0 brings a few interesting features that improve the
generated documentation:

* A new `separate_member_pages` config option that patches issues in the
  Doxygen XML generated when SEPARATE_MEMBER_PAGES option is YES.
* A new rST verbatim mode that allows producing inline elements.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-09-15 15:25:01 +02:00
Kumar Gala
05ee0a16c9 sanitycheck: sort tests by platform when subsetting
This undo's commit dd65f7c38a that changed how we sorted tests to get
better distribution from a qemu running point of view.  However we now
have some tests that take a long time to build and we end up loading
build machines we all the long running tests.

Lets try going back to sorting by platform and see how that behaves with
the new CI environment.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-09 12:42:15 -04:00
Martí Bolívar
1eef1e3c12 scripts: runners: fix openocd on Windows
Commit 3124c02 ("cmake: flash/debug: refactor runner configuration")
changed the way the hex_file and elf_file inputs in the RunnerConfig
object are created. In particular, they are now host-style paths.

This breaks flashing with openocd on Windows, which doesn't handle that
properly. Fix that by "casting" the internal hex_file and elf_file
attributes to POSIX paths.

Fixes: #28138
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-09 10:51:29 +02:00
Anas Nashif
6e27478c3d benchmarking: remove execution benchmarking code
This code had one purpose only, feed timing information into a test and
was not used by anything else. The custom trace points unfortunatly were
not accurate and this test was delivering informatin that conflicted
with other tests we have due to placement of such trace points in the
architecture and kernel code.

For such measurements we are planning to use the tracing functionality
in a special mode that would be used for metrics without polluting the
architecture and kernel code with additional tracing and timing code.

Furthermore, much of the assembly code used had issues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-05 13:28:38 -05:00
Eugeniy Paltsev
0a7b65ef5e linker: tweak section naming to feet all linkers
MWDT toolchain adds additional suffix to sections name in case of
ffunction-sections / fdata-sections are enabled.

As proposed by Andy Ross let's pick a single set of rules
and syntax that work.

Suggested-by: Andy Ross <andy@plausible.org>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-05 10:22:56 -05:00
Martí Bolívar
c505ca38cf scripts: west build: default build.pristine to auto
I've repeatedly seen that people are not aware of the existence of
this configuration option.

I've been using build.pristine=auto daily for years and never had any
problems. I've also asked around on Slack a couple of times over
various points to see if anybody objects to making this change. Nobody
has, so let's just turn it on by default.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-05 11:06:39 +02:00
Peter Bigot
932532eb0f gen_defines: infer bindings for /zephyr,user
Tell the EDT instance that properties of the /zephyr,user node should
be generated based on the binding types inferred from the property
content.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-04 07:41:19 -05:00
Peter Bigot
32e6159f01 edtlib: support inferring binding from node content
Clean up of devicetree tooling removed generation of information
present in devicetree in nodes that have no compatible, or for extra
properties not defined by a binding.  Discussion proposed that these
properties should be allowed, but only in a defined node /zephyr,user.
For that node infer bindings based on the presence of properties.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-04 07:41:19 -05:00