Commit graph

2587 commits

Author SHA1 Message Date
Aastha Grover
6f0a0926e3 scripts: tests: sanitycheck: Add testcases for schema validation.
test_sanitycheck.py: Add testcases for correct & incorrect
testcase/platform yaml schemas.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2020-05-20 10:35:35 +02:00
Aastha Grover
5948ab6cf1 sanitycheck: add testcases for add_testcases function of testsuite class
test_testsuite_class.py: Add testcases for add_testcases function
of testsuite class in sanitycheck.
test_data/testcases/tests & /samples : Testcase root directory
to add all the testcases & to test add_testcases function.
conftest.py: Module for common pytest fixtures, also used for
passing data from one testcase to another.
Note: conftest.py has a class_testsuite fixture where board_root is
defined as the directory which will be added in a separate PR.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2020-05-20 10:35:35 +02:00
Wentong Wu
2593a919ee scripts: add DW_AT_abstract_origin check
According to below rule which's from DWARF5 sepc, if the
attribute can't be founded in given DIE, check more entry
associated by DW_AT_abstract_origin.

For the purposes of determining whether a debugging information
entry has a particular attribute (such as DW_AT_name), if
debugging information entry A has a DW_AT_specification or
DW_AT_abstract_origin attribute pointing to another debugging
information entry B, any attributes of B are considered to be
part of A.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-20 10:33:14 +02:00
Aastha Grover
a0ae53410e sanitylib: Remove hardcoded sample.yaml & testcase.yaml in TestSuite class
This fix creates class variables SAMPLE_FILENAME & TESTCASE_FILENAME
in Class TestSuite and remove the hardcoded sample.yaml & testcase.yaml
from add_testcases function. This makes testing for sanitylib script
easier so that shippable do not detect the test_data for sanitylib
as actual zephyr testcases.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2020-05-14 22:48:09 +02:00
Wentong Wu
0d619aefd8 sanitycheck: Add cpu time for QEMUHandler
Add cpu time for QEMUHandler because the guest virtual time
in QEMU icount mode isn't host time and it's maintained by
counting guest instructions, we use QEMU process CPU time to
mostly simulate the time of guest OS.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-14 13:52:07 +02:00
Wentong Wu
7ec57b4666 scripts: sanitylib.py: enhancement for QEMUHandler
Sometimes QEMU can't handle SIGTERM signal correctly and just
run as normal, in that case kill -9 QEMU process directly and
leave sanitycheck judge the testing result by console output.

For failures caused by other reasons, terminate all releated
processes to avoid CI waits 2 hours and reports timeout.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-14 13:52:07 +02:00
Kumar Gala
bd97378870 devicetree: Add support for fixed-partitions
Add DT_NODE_BY_FIXED_PARTITION_LABEL that given a "label" in any
fixed-partitions map will return the node_id for that partition node.

Add DT_NODE_HAS_FIXED_PARTITION_LABEL that will test if a given
fixed-partitions "label" is valid.

Add DT_FIXED_PARTITION_ID that will return an unique ordinal value for
the partition give a node_id to the partition.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Kumar Gala
4a5a90aef8 gen_defines: Rework implementation of write_child_functions
Rework how write_child_functions to match how we do the code for
DT_FOREACH_OKAY_INST.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Kumar Gala
3a68566d40 edtlib: add a flag for old fixed-partitions behavior
allow the old generator to act as it did.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Kumar Gala
058842b353 edtlib: handle match of fixed-partition on any bus
If we have a fixed-partition on a flash device that is for example on
a spi controller we will not get a binding match currently.  This is
because we expect a match between both the compatible and the fact that
fixed-partition node is a decendant of the spi bus.

To address this we treat fixed-partitions as if they are on no bus.
This has the effect of causing a binding match as well as ensuring that
when we process the fixed-partition node we will do anything special to
it because of the bus it happens to be under (for example SPI CS_GPIO
processing).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Kumar Gala
06edcb11db edtlib: Initialize node.compats earlier
Setup node.compats right after we create the Node.  This allows access
to the compats information in _bus_node.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Peter Bigot
49e8c7080f scripts/coccinelle: add script to preserve const qualifier on config_info
Drivers cast the device config_info pointer to a driver-specific
structure.  The referenced object is const-qualified; make sure the
cast doesn't inadvertently remove that qualifier.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-13 18:21:52 +02:00
Anas Nashif
44f7ba0781 sanitycheck: detect wrongly named tests and fail
Tests should always start with test_. If not, they will not be in the
report.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-13 18:16:07 +02:00
Anas Nashif
4258d8d34b sanitycheck: give summary about built vs executed
It is important to see that some tests are only building and not
executing...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Anas Nashif
91fd68dbbf sanitycheck: also look for cpp files when scanning
look for *.c* instead of just *.c files when scanning or testcases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Anas Nashif
bb28035a82 sanitycheck: support exporting instances
Enable exporting tests per platform.

sanitycheck --export-tests out.txt  -p qemu_x86 -T tests/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Anas Nashif
1a5defa924 sanitycheck: support --force-platform
This option allows running tests on platforms that would be excluded
based on the test definition.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Anas Nashif
60ae507783 sanitycheck: move export-tests handling and deduplicate code
Reuse the same code used for other options.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-11 17:00:26 +02:00
Martí Bolívar
0b5c58fcab scripts: runners: handle uninstalled dependencies
Catch ImportError whenever a non-standard module import fails from any
runners that do one. Complain at runtime about it if the user actually
needs the runner.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-09 13:05:48 +02:00
Christopher Friedt
2c0eecaa5e posix arch: build on aarch64 / allow host-specific cmake includes
This change enables specific compiler and linker options to be used in
the case that an arch/posix/os.arch.cmake file exists.

Note: os and arch in the above case are evaluations of
CMAKE_HOST_SYSTEM_NAME and CMAKE_HOST_SYSTEM_PROCESSOR.

Otherwise, the existing "generic" compiler and linker flags in
arch/posix/CMakeLists.txt are used.

Additional flags and checks are provided in
arch/posix/Linux.aarch64.cmake.

Added scripts/user_wordsize.py to detect if userspace is 64-bit or
32-bit, which should be consistent with the value of CONFIG_64BIT
for Aarch64 on Linux.

Fixes #24842

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-09 12:17:24 +02:00
Kumar Gala
6a2cb94f6f sanitycheck: suppress warnings from EDT
We don't need sanitycheck's use of EDT to report warnings, we'll get
them from the build system.  So the warnings are just duplication and
noise, thus lets always suppress them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 21:54:02 -04:00
Martí Bolívar
7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Martí Bolívar
e96ca54fd8 gen_defines: play tricks to benefit DT_INST users
Even though it is about to be done for sound technical reasons, a
subsequent patch adding access to all device nodes at the last minute
in the 2.3 release is going to be playing a bit of a fast one on
the Zephyr community, especially users of DT_INST APIs.

In particular, instance numbers are currently allocated only to
enabled nodes, but that will not be true soon: *every* node of a
compatible will be allocated an instance number, even disabled ones.

This is especially unfortunate for drivers and applications that
expect singletons of their compatibles, and use DT_INST(0, ...) to
mean "the one enabled instance of my compatible".

To avoid gratuitous breakage, let's prepare for that by sorting each
edt.compat2nodes sub-list so that enabled instances always come before
disabled ones.

This doesn't break any API guarantees, because there basically *are*
no ordering guarantees, in part precisely to give us the flexibility
to do things like this. And it does help patterns that use instances 0
through N-1, including the important singleton case.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Tomasz Bursztyka
1eedd5eb64 scripts: Fix gen_kobject_list.py to fit with device refactoring
device_api attribute is not at offset 4 but 8 now as name and
config_info has been directly imported into struct device.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
7544263050 scripts: Fix documunt referenc for coccicheck
s/applications/guides

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 17:44:44 +02:00
Henrik Brix Andersen
3c2984d4a9 scripts: west: add CANopen flash runner
Add west flash runner for program download via CANopen.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-08 10:53:42 +02:00
Dominik Ermel
ba8b74d801 devicetree: Add DT_FOREACH_CHILD macro
The macro iterates through the list of child nodes and invokes provided
macro for each node.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 21:42:58 -05:00
Kumar Gala
0a7d4e2135 devicetree: Change DT_FOREACH_IMPL_ to not insert semicolon
Remove semicolon between instance invocations of DT_FOREACH_IMPL_ and
thus DT_INST_FOREACH.  This provides more flexibility to the user.  This
requires we fixup in tree users to add semicolon where needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 20:03:56 -05:00
Anas Nashif
61c6e2b172 sanitycheck: raise exception on bad exclusion in ztest
Abort if we find tests that are being skipped incorrectly. Tests should
be skipped using ztest_test_skip().

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:24:02 -04:00
Anas Nashif
7a69125fbf sanitycheck: raise exceptions on bad test names
Raise exception on bad test names such as 'test' or 'sample'.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:23:45 -04:00
Peter Bigot
f77e03bb44 scripts/coccinelle: rename and extend ms to timeout conversion script
Originally this only dealt with constant timeouts.  Add the ability to
recognize integer parameters and convert them as well.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 19:46:03 +02:00
Martí Bolívar
eac56e4fb6 edtlib: add EDT.compat2nodes, EDT.compat2okay
These look up tables generalize the compat2enabled map in a way we
will need to make the API more flexible in Zephyr.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-07 08:12:49 -05:00
Martí Bolívar
bd0ecc83fb edtlib: add Node.status accessor
Let's get the actual node status, instead of relying on enabled.
Leave enabled in place for gen_legacy_defines.py's sake.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-07 08:12:49 -05:00
Kumar Gala
bc48f1ce45 edtlib: allow default property types for nodes without bindings
If a devicetree node doesn't have a matching binding we will at least
populate a common standard set of properties for that node.  The list of
standard properties is:
	compatible
	status
	reg
	reg-names
	label
	interrupt
	interrupts-extended
	interrupt-names
	interrupt-controller
This allows us to handle cases like memory nodes that don't have any
compatible property, we can still generate the reg values.
We limit this to known properties as for any other property we can not
fully determine the property type without a binding and thus we can't
ensure the generation for that property is correct or may not change.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-07 08:12:49 -05:00
Ruslan Mstoi
f699ab4ee6 sanitycheck: fix enable_coverage argument name typo
Argument name is --enable-coverage, whereas attribute name is
enable_coverage

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2020-05-06 12:03:15 -05:00
Anas Nashif
7ee9a0328b ci: changes to python requirements should not trigger sanitycheck
Those have no impact on code and should not trigger full sanitycheck
run.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-06 11:07:22 -05:00
Anas Nashif
2601c2e54b requirements: add psutil, needed by sanitycheck
Needed for tracking cpu time in sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-06 11:07:22 -05:00
Stephanos Ioannidis
95c6da0c82 scripts: checkpatch: Revert dt-binding vendor prefix check regex change
This commit reverts the device tree binding vendor prefix check regular
expression change that was introduced by the following commit:
5b10fac97e

The changed regular expression fails to detect the correctly specified
vendor prefixes in the `vendor-prefixes.txt`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-06 12:40:35 +02:00
Anas Nashif
aff616de20 sanitycheck: fix initial types in classes and minor cleanup
While testing sanitycheck classes, found some wrongly initialisized
variables which caused issues, fixed those..

All Test* classes should now be ignored by pytest and should not be
treated as pytest code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-05 16:32:25 -04:00
Henrik Brix Andersen
359fd044d3 scripts: dts: gen_legacy_defines: handle bus nodes without regs
Correctly handle parent bus nodes without regs properties.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 10:17:23 -05:00
Anas Nashif
43275c8eff sanitycheck: raise exception on harness without a config
console harness without a harness_config is not allowed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-05 06:16:50 -04:00
Peter Bigot
15ed58652e scripts/cocci: add Zephyr macro file
Zephyr uses some defines to provide additional information about the
item being declared.  When unrecognized these can confuse the
Coccinelle parser so that it does not apply semantic patches in
situations where they should be applied.

Add a macro file that extends the Coccinelle builtin macro file with
some identifiers that are specific to Zephyr.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-05 06:15:04 -04:00
Anas Nashif
19ad25fc9b ci: fix whatchanged script matching
When files were added, matching did not work and we were counting added
files twice. Use sets to make sure we have a unique list of files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-04 09:07:00 -05:00
Peter Bigot
afe8a3777a scripts: modify checkpatch to respect Zephyr for_each spelling
Linux uses for_each in macros that produce loops; Zephyr uses
FOR_EACH.  Update the corresponding checks to match Zephyr's spelling.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-02 11:23:13 -04:00
Peter Bigot
5b10fac97e scripts: update checkpatch to latest from the linux kernel
This takes the linux diffs between
a8c964eacb21288b2dbfa9d80cee5968a3b8fb21 and
16fbf79b0f83bc752cee8589279f1ebfe57b3b6e and applies them to the
Zephyr copy.  Three changes did not apply cleanly:

* linux added a comment to the line that enables C99 comments;
  Zephyr disallows them.
* linux uses vendor-prefixes.yaml; zephyr uses the older .txt file
* manual addition of colon in a check before BRACKET_SPACE error

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-02 11:23:13 -04:00
Peter Bigot
1f228da658 scripts/coccinelle: add script to convert legacy timeout values
Some API that takes timeouts represented by integral milliseconds
recommended using the K_NO_WAIT and K_FOREVER constants, which are no
longer integers.  This script replaces the incorrect arguments with
the corresponding legacy integral value.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-30 18:26:26 +02:00
Brendon Le Comte
cddea0a7c8 Runners: Add Bossac Runner OSX compatibility
OSX compatibility added bossac runner.
Linux behvaiour is unchanged.
Window is now explicity mentioned as incompatible

Signed-off-by: Brendon Le Comte <brendon.lecomte@gmail.com>
2020-04-30 18:12:27 +02:00
Anas Nashif
051602f4f3 sanitycheck: support coverage with unit tests
Fix setting coverage for unit tests and link against gcov when coverage
is enabled.

Fixes #24674

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-29 09:01:06 -04:00
Martí Bolívar
7ff3ebcbb9 kconfig: add dt_chosen_path() helper
This helper allows setting default Kconfig values based on devicetree
node properties without giving the full path to the node.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-28 12:11:14 -05:00
Martí Bolívar
1fff2358db kconfig: add dt_nodelabel_path() helper
This helper allows setting default Kconfig values based on devicetree
node properties without giving the full path to the node.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-28 12:11:14 -05:00
Martí Bolívar
0682c46fb9 kconfig: helper function optimizations
Use the compat2enabled and label2node maps in the global edt object to
speed up some functions.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-28 12:11:14 -05:00
Martí Bolívar
2707d2a785 edtlib: add EDT.label2node
It's a common operation to want to find a node based on its label. Add
a lookup table to make this easier.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-28 12:11:14 -05:00
Anas Nashif
9ace63e6f0 sanitycheck: keep recording.csv with -M option
Do not delete recordings when invoking sanitycheck with
--runtime-artifact-cleanup

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-28 11:41:08 -04:00
Anas Nashif
227392c732 sanitycheck: kill if terminate does not work
In some cases terminate (SIGTERM) is not enough and we have to kill the
proces (SIGKILL), otherwise the process is stuck forever and taking
hours to complete and finally timeout in CI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-28 11:41:08 -04:00
Anas Nashif
b802af8350 sanitycheck: set reason to Failed
In some cases we were missing the reason and reporting 'Unknown',
check for failure and set the reason.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-28 11:41:08 -04:00
Patrik Flykt
190705960d scripts: net: Add SOCKS 5 to MQTT TLS sample test
Start SOCKS5 proxy in the net-tools Docker image and run MQTT TLS
tests with SOCKS enabled. Since the MQTT TLS server is already
running as of the previous test, start only the danted daemon.

Rely on mosquitto MQTT port being handled by the Docker image
configuration file instead of specifying it on the command line.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-04-28 10:29:17 +03:00
Peter A. Bigot
fd14c743c1 scripts: gen_cfb_font_header: extend to additional representations
The default vertical tiling is designed for displays that are rotated 90
or 270 degrees from normal orientation.  Devices where pixel data
advances first horizontally then vertically requires horizontally-tiled
data.

Similarly when generating upright text on a row-major-order monochrome
display the most significant bit may encode the pixel at the lowest
horizontal position.

Add options to control horizontal vs vertical tiling, and msb vs lsb
pixel order.

The commit also generates the representation of the glyph in comments at
each row.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-04-27 13:27:03 +02:00
Anas Nashif
45a1d8aca9 kernel: rename initializers to be internal
Rename internal macros to use Z_ prefix instead of _K..

Those macros were missed when we did the global renaming activities.

Fixes #24645

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-24 22:27:08 +02:00
Alexey Brodkin
0d5416acc4 runners: openocd: Reset target before running Elf
In case of flashing (which is typically used with OpenOCD)
we do reset of the target after programming application binary
in the non-volatile memory.

In case of Elf execution we need to reset the target before
loading Elf sections so that we might be sure our target
is in sane & expected state before we start execution.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-04-24 19:35:25 +02:00
Anas Nashif
6915adf899 sanitycheck: add option for report suffix
Add option --report-suffix to append custom string to all generated
files. This is going to be useful for generating results for a specific
version, i.e. --report-suffix zephyr-v2.2.0-1814-ge737761d23

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-22 14:21:05 -04:00
Torsten Rasmussen
2cf53b69bd python: subfolder_list.py now generates shorter link names
Fixes: #24576

The name of the symbolic link would be constructed using the full path
name to the target folder.

This is not needed and caused the issue raised in #24576.

This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-04-22 17:24:04 +02:00
Anas Nashif
56aac64bae boards: nsim: for smp testing, using mdb
This board require a special setup and does not work with standalone
nsim.

Fixes #24363

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-20 17:59:38 -04:00
Kumar Gala
ce4e3b5c7c scripts: dts: gen_legacy_defines: mark DT_*_BUS_<BUS> macros deprecated
Add a __WARN("Macro is deprecated") to all DT_<COMPAT>_BUS_<BUS> macros
now that all in tree users should have been converted to the new macros.

This is intended to make sure any PRs don't introduce new usages of
these macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 17:48:39 +02:00
Kumar Gala
3802bf54ac scripts: dts: gen_legacy_defines: mark DT_INST macros deprecated
Add a __WARN("Macro is deprecated") to all DT_INST macros now that all
in tree users should have been converted to the new macros.

This is intended to make sure any PRs don't introduce new usages of
these macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 17:48:39 +02:00
Julien D'Ascenzio
fb2421441d west: zcmake.py: manage STATIC type of CMakeCache.txt file
The variables with the STATIC type aren't read.
The commit 877fc59e30 introduce the read of CMAKE_PROJECT_NAME
which could be defined in CMakeCache.txt file like that:

CMAKE_PROJECT_NAME:STATIC=MyProject

If STATIC type is not managed, the CMAKE_PROJECT_NAME isn't set and
CMake is always force to run again

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-04-20 15:44:09 +02:00
Martí Bolívar
07dce820d5 sanitycheck: add --persistent-hardware-map
This option prefers serial device names which are stable
across device plug/un-plug on platforms that support it (currently
just Linux, via /dev/serial/by-id).

This feature is opt-in as not all manufacturers include the
appropriate metadata for udev to generate unique names for their
devices.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-17 18:31:28 +02:00
Jukka Rissanen
420b195b5e drivers: console: uart_mux: Initial UART muxing support
Create support for muxed UARTs which are attached to a real
UART and which use GSM 07.10 muxing protocol to create virtual
channels that can be run on top of the real UART.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Martí Bolívar
d6f5f51f37 scripts: fix west zephyr-export error handling
Fix two issues:

1. The script assumes the default CMake generator build tool
   platform is installed. On Linux at least, that's Make instead
   of Ninja, but Make might not be installed since Zephyr recommends
   Ninja. On Windows, that might be VS Code or nmake.

   Calling `cmake -P pristine` instead of `cmake --build <path>
   --target pristine` has the benefit of removing the dependency on a
   build command, and hence the default generator is not relevant.

2. It also assumes run_cmake() returns control, and therefore pristine
   can be run.

   However, if the cmake command fails hard (say, due to issue #1
   before this patch), run_cmake() throws an exception instead.

   Fix that by trying to run the pristine target in a finally block
   instead, and adding some manual cleanup steps in case the build
   system is in a bad state and pristine fails too.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
2020-04-16 07:46:18 -04:00
Kumar Gala
9aefdaff2e cmake: kconfig: pass EXTRA_DTC_FLAGS to kconfig for EDT init
Pass EXTRA_DTC_FLAGS to kconfig so the EDT object we have in
kconfigfunctions can use that to set warn_reg_unit_address_mismatch
properly.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-16 06:07:24 -05:00
Martí Bolívar
4fad53522c sanitycheck: infer ZEPHYR_BASE if unset
Now that the main Zephyr build system (and the documentation's) no
longer require ZEPHYR_BASE in the environment, the sanitycheck
script's continuing to require this makes less sense.

We can easily find ZEPHYR_BASE starting from a given sanitycheck
script, so let's just do that. Preserve the ability for a user to
override the ZEPHYR_BASE location in the environment as usual for
compatibility.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-15 14:42:21 -04:00
Peter Bigot
c661caf531 scripts/coccinelle: fix int_literal_to_timeout for K_THREAD_DEFINE
The patch specification should not be conditional on failing to match
an identifier, as some replaced values are identifiers.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-15 08:28:57 -05:00
Kumar Gala
e75ac55d23 edtlib: handle include in child-binding
Support the ability for there to be an include in a child-binding
section.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 08:27:42 -05:00
Martí Bolívar
6e27343e7b devicetree: add DT_PARENT()
This macro takes a node identifier, and returns the parent node's
identifier.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-15 08:27:18 -05:00
Martí Bolívar
b6e6ba0429 devicetree: gen_defines: adjust node comments
Always generate the comment text specifying a node's path identifier.
Add the DT_ prefix so it matches the actual macro usable from C. This
will make a following patch which adds support for accessing a node's
parent result in a generated header file which is easier to read.

Put the node's path right after "Devicetree node:" in the comment.
This makes the section for that node easier to grep for.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-15 08:27:18 -05:00
Martí Bolívar
186bacee43 devicetree: gen_defines: adjust z_path_id for /
The root node's z_path_id value for the duration of this script
doesn't match the value DT_ROOT is defined to in devicetree.h.

I didn't notice this because the root node's compatible doesn't have a
matching binding in practice, so no macros are generated for it, but
we're about to start looking at node parents explicitly and this is an
issue for that. Fix it so the root node's z_path_id is "N", since
DT_ROOT is the token "DT_N".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-15 08:27:18 -05:00
Kumar Gala
4e2ad00496 scripts/dts: gen_defines: Generates _EXISTS for reg & irq macros
Add generation of the following macros:

DT_N_<node-id>_REG_IDX_<idx>_EXISTS 1
DT_N_<node-id>_IRQ_IDX_<idx>_EXISTS 1

This will allow us to use IS_ENABLED() in DT_REG_HAS_IDX and
DT_IRQ_HAS_IDX which matches behavior of other DT_*_HAS_* macros as
well as lets use these with COND_CODE_1.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-14 17:45:19 -05:00
Anas Nashif
904155021a sanitycheck: update old reports when called with --only-failed
When retrying failed tests, make sure we keep old results and only
update those tests that were retried.

Also, remove duplication of code for creating the reports and make the
report function a bit more generic.

sanitycheck.xml is now listing or tests, not only the test application.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-14 12:50:41 -04:00
Martí Bolívar
3cd4f6c224 scripts: kconfig: add dt_compat_on_bus() helper
This can be used from Kconfig to detect if any enabled nodes of a
compatible are on a bus. This can be useful if a compatible might
appear on multiple buses, to enable them by default from application
code without having to change prj.conf settings depending on what's in
the devicetree.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-14 10:38:10 -05:00
Erwan Gouriou
6c8617a5ed scripts/dts: gen_defines: Generates _EXISTS for names and index macros
Add generation of the following macros:
DT_N_<node-id>_P_<prop-id>_NAME_<NAME>_EXISTS
DT_N_<node-id>_P_<prop-id>_IDX_<idx>_EXISTS
This will be useful to check availability of named or indexed
property like dmas/dma-names.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-13 07:37:11 -05:00
Anas Nashif
47f1665e78 sanitycheck: match results with extra logging output
renode has extra output that was preventing detection of passing tests
for reporting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-12 18:42:46 -04:00
Kumar Gala
86887dafde dts: Remove conf file generation support
The last user of the .conf file format DTS data has been removed.  We
can now remove the generation and associated support for the .conf file.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-12 09:49:16 -05:00
Martí Bolívar
877fc59e30 scripts: west build: handle missing CMAKE_PROJECT_NAME
If there is an error in the CMake configuration phase (this can happen
if a script run using execute_process() fails, for instance), the
build system is incompletely generated and future attempts to run
'west build' will fail. This manifests in the following error:

    Error: could not find CMAKE_PROJECT_NAME in Cache

Whenever we see that the cache exists but this variable is missing,
let's just force CMake to run again. This avoids the error in my
testing and is a bit more user friendly. I've seen multiple users
asking what to do in this situation; the answer is always "just build
it again", so we might as well do it for them.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-11 15:04:04 -04:00
Anas Nashif
337e8e6361 ci: if we are only changing doc/ files, no sanitycheck run
If we are only changing files in doc/*, there is no need to run full
sanitycheck...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-11 08:40:54 -04:00
Martí Bolívar
63d5529a0d devicetree: re-work DT_INST_FOREACH()
Due to the use of UTIL_EVAL*() macros, the UTIL_LISTIFY() macro used
by DT_INST_FOREACH(foo) can cause long build errors when there is a
build error in the expansion for "foo". More than a thousand lines of
build error output have been observed for an error in a single line of
faulty C.

To improve the situation, re-work the implementation details so the
errors are a bit shorter and easier to read. The use of COND_CODE_1
still makes the error messages quite long, due to GCC generating notes
for various intermediate expansions (__DEBRACKET,
__GET_ARG_2_DEBRACKET, __COND_CODE, Z_COND_CODE_1, COND_CODE1), but
it's better than the long list of UTIL_EVAL notes.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-08 09:00:38 -05:00
Anas Nashif
295572a5b1 ci: do not use latest breathe release for docs
breathe v4.15.0 was just released and fixes some compatibility issues
with latest sphinx, the combo works, however with many warnings that we
still need to either fix or whitelist. This is temporary until we are
able to use those new versions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-07 18:51:13 -04:00
Anas Nashif
b06a5b5707 sanitycheck: fix coverage capturing
We got the gcov with the coverage tool (lcov vs gcovr) confused..

Fixes #24003

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-07 14:53:20 -04:00
Kumar Gala
7b3ae9915d kconfig: Remove deprecated functions from kconfigfunctions.py
dt_int_val, dt_hex_val, and dt_str_val have been deprecated for two
releases and thus are meant to be removed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-07 13:05:59 -05:00
Kumar Gala
338b431912 kconfig: Add dt_node_int_prop_{int,hex}
Add kconfigfunctions that given the property name to an integer type
property will return its value as either an string int or string hex
value.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-07 08:21:04 -05:00
Carles Cufi
6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Anas Nashif
6cfa11c013 doc: lock sphinx version to a compatible one
Version 3.0.0 release recently break doc build, lock version of sphinx
to something compatible while we upgrade dependencies...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-05 19:10:43 -04:00
Andrzej Głąbek
3331a2080a scripts: kconfigfunctions: Add dt_nodelabel_has_compat function
This function takes a 'label' and returns "y" if an "enabled" node with
such label can be found in the EDT and that node is compatible with the
provided 'compat', otherwise it returns "n".

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-03 14:47:32 +02:00
Peter Bigot
d4bb09c083 scripts/coccinelle: improve int_literal_to_timeout
Replace timeout parameters that are multiples of MSEC_PER_SEC, or such
a value passed through K_MSEC, with the normalized timeout expression
using whole seconds.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-02 19:47:51 +03:00
Peter Bigot
9d29e1c48c scripts/coccinelle: update int_literal_to_timeout for thread defines
Recent timeout rework reverted the interpretation of the delay
parameter to K_THREAD_DEFINE from a timeout to a count in
milliseconds, although the corresponding parameter in the
k_thread_create() function remains a timeout.  Convert timeout
expressions to millisecond durations where necessary.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-02 19:47:51 +03:00
Anas Nashif
29c0c08fd4 ci: do full sanitycheck if not a PR
Cover the cases where we run sanitycheck on a merged PR.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-01 17:20:56 -04:00
Anas Nashif
270165428c ci: do not run full sanitycheck if not needed...
if we are changing a test or a sample, there is not need to run
everything, it is enough to just build/run the changed test/sample.

Also, some files have impact on the code and if they are being changed,
do not run fully sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-01 14:00:57 -04:00
Anas Nashif
0e558059d1 ci: detect what changed in a PR and if full sanitycheck is needed.
Script to detect if full sanitycheck should run or if we can skip it and
just run the code that actuallt changed (in samples/tests).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-01 14:00:57 -04:00
Jukka Rissanen
02fe85d5e0 net: Remove leftovers for obsolete net stacks shell command
The "net stacks" shell command support was just removed, but
the net_stacks linker section was left around.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-01 10:41:58 -04:00
Martí Bolívar
a3fae2f153 devicetree: add DT_COMPAT_ON_BUS()
And implement DT_ANY_INST_ON_BUS() in terms of it.

This makes some error messages quite a bit shorter by avoiding
UTIL_LISTIFY(), which has a nasty temper and tends to explode if not
treated gently.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-31 21:11:13 -05:00
Anas Nashif
c11f8acbb3 sanitycheck: fix setting of west_flash/runner
We are not propagting those options all the way to the device handler
now, fix this by using the suite member in the handler which has those
already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-31 17:21:43 +03:00
Torsten Rasmussen
3074a7a498 cmake: Relocating Zephyr Unittest CMake package.
Fixes: #23872

Relocating Zephyr Unittest CMake package to ensure that
HINTS ${ZEPHYR_BASE} in
find_package(ZephyrUnittest HINTS ${ZEPHYR_BASE}) works correctly when
the package has not been exported to CMake user package registry.

This ensure that the new package functionality is fully backwards
compatible on systems where the package is not exported and ZEPHYR_BASE
is set.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-31 10:00:15 -04:00