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>
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>
_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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This patch fixes the ZeroDivisionError which can
occur during percantage of test execution reporting.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>