Commit graph

2587 commits

Author SHA1 Message Date
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
Andrzej Puzdrowski
ad6215dcf7 manifest: upgrade mcuboot
Include build assert macros rework.
Update pip requirements by cbor package required by MCUBoot since
https://github.com/JuulLabs-OSS/mcuboot/pull/674 was merge.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-03-31 07:18:06 +02:00
Anas Nashif
f6462a3a8c sanitycheck: get rid of global VERBOSE
Do not declare VERBOSE as global, instead pass verbosity as argument.
Also get rid of options as global and fix coverage class to not use
global option variable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
13d0c03761 sanitycheck: remove unused arg files
We do not use those arg files anymore, so remove them to avoid
confusion and for the sake of cleanup.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
017ce9fa2e sanitycheck: fix testsuite
Import sanitycheck classes from new module.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
b366949498 sanitycheck: fix issue with generator setting
Do not set generator on None handler.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
ce2b418027 sanitycheck: split main script into an exe and classes
Move most of the classes to sanitycheck.py under sanity_check directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
1f6cdbe70a sanitycheck: fix scope and cleanup
Reorder classes to be on top of loose functions. Move a few globals into
the related classes where they are being used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
507e75b9b5 sanitycheck: remove more global usage of arg options
This will make it easier for us to test classes and functions without
having arg options in the middle.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
64a6c9e3df sanitycheck: use cmake_only from class
Do not use option from args, use class settings instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 09:59:42 -04:00
Anas Nashif
6667dc35e7 sanitycheck: catch build failures
CMake is not returning any error codes on build failures so those go
undetected in some cases. Handle the case where we get no output at all
from cmake and deal with that as a failure.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-30 10:33:21 +02:00
Torsten Rasmussen
e819fa46cd scripts: west-commands: Updates needed when removing ZEPHYR_BASE env
This commit includes the following fixes in order to remove environment
setting of ZEPHYR_BASE is west extension commands.

- Build command
  west build --pristine will now use the ZEPHYR_BASE variable found
  in CMakeCache.txt in the build folder.

  This ensures that the pristine command is executed from the same
  Zephyr that was used for compilation.

- Board command
  The west boards command no longer sets Zephyr base before invoking
  cmake -P cmake/boards.cmake

  Instead boards.cmake uses find_package(Zephyr) to ensure consistent
  behavior with Zephyr samples, so that the detection of Zephyr base is
  uniform across CMake commands.

  It also changes BOARD_ROOT_SPACE_SEPARATED to BOARD_ROOT in order to
  be consistent with existing user documentation.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Torsten Rasmussen
e85cfe4554 cmake: West extension command for Zephyr config package registration
This command make it possible to use west for first time registration
of a Zephyr config package in CMake.

To register Zephyr as a CMake config package, invoke:
west zephyr-export

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Torsten Rasmussen
39cd4c8f52 cmake: propagating zephyr base to west
West utilizes Zephyr base when invoked out-of-tree in order to determine
west topdir.

This commit ensures that zephyr base when invoking west from CMake is
set to current zephyr base.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Torsten Rasmussen
d7862cf776 cmake: using ${ZEPHYR_BASE} instead of $ENV{ZEPHYR_BASE}
With the introduction of ZephyrConfig.cmake all parts of CMake code
should rely on the CMake ZEPHYR_BASE variable instead of the environment
setting.

This ensures that after the first CMake invocation, then all subsequent
invocation in same build folder will use same zephyr base.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Kumar Gala
299bfd0553 scripts: dts: gen_defines: Fix issue if there are no compats
We get the following error:

  ValueError: max() arg is an empty sequence

if the compatiable section of the device tree is empty or doesn't exist.
Fix this by havingin max_len get a default value of 0.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:22:49 -05:00
Martí Bolívar
a5268773a6 scripts: run_common: don't dump stack on unavailable runner
Originally reported in #23539 (though that seems to have been another
problem), west flash and friends are dumping stack when used with an
unconfigured runner.

Let's just promote the warning about this to an error. The idea that
this ever could have worked without explicit support has not worked
out in practice, to my knowledge.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-25 19:43:30 +01:00
Patrik Flykt
c99392f2d6 scripts: net: Add TLS test for mqtt_publisher
In addition to the existing plain TCP MQTT test, add the same test
with TLS applied. Robert Lubos provided the updated test_cert.h, which
contains the same certificate as in the echo samples.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-25 08:39:39 +02:00
Aastha Grover
e27cf15763 scripts: tests: sanitycheck: Add basic foundation for sanitycheck testsuite
This commit adds basic testcases for sanitycheck tool using pytest.
Coverage for the sanitycheck tool is obtained using coverage tool.
Instructions are included in the README.md in
scripts/tests/sanitycheck directory.

Signed-off-by: Aastha Grover <aastha.grover@intel.com>
2020-03-24 22:32:26 -04:00
Anas Nashif
56993fb9ab sanitycheck: remove confusing message when loading files
This message was intended for retries only, not every time we loaded a
file with a test manifest.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-24 12:15:36 -04:00
Anas Nashif
c7092a1c4d ci: when merging files, keep one header row
When merging files, make sure to remove header rows from each file and
just keep one header. This will stop us from parsing header rows as
tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-24 12:15:36 -04:00
Anas Nashif
923b3bf0ae sanitycheck: Add named exceptions
Add named exceptions instead of a generic one. Should help point to the
right issue when something goes wrong.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-24 12:15:36 -04:00
Martí Bolívar
dc85edd2e9 scripts: dts: write new gen_defines.py
This is joint work with Kumar Gala (see signed-off-by).

This supports a new devicetree macro syntax coming. It's not really
worth mixing up the old and the new generation scripts into one file,
because:

- we aim to remove support for the old macros at some point, so it
  will be cleaner to start fresh with a new script based on the old one
  that only generates the new syntax

- it will avoid regressions to leave the existing code alone while
  we're moving users to the new names

Keep the existing script by moving it to gen_legacy_defines.py and
changing a few comments and strings around. It's responsible for
generating:

- devicetree.conf: only needed by deprecated kconfigfunctions
- devicetree_legacy_unfixed.h: "old" devicetree_unfixed.h macros

Put a new gen_defines.py in its place. It generates:

- zephyr.dts
- devicetree_unfixed.h in the new syntax

Include devicetree_legacy_unfixed.h from devicetree.h so no DT users
are affected by this change.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00
Kumar Gala
8af311ab3b edtlib: allow register addr / size to be None
If the #address-cells property for a register is 0 than we set the addr
value of the reg to None.  Similar, if #size-cells is 0 than we set the
size value to None for the reg.

Fixup kconfigfunctions.py to handle reg.size and reg.addr being None.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00
Kumar Gala
c7f2c89783 gen_defines.py: rename gen_defines.py to gen_legacy_defines.py
This rename is mostly to easy git managment and review so any changes or
the addition of the new gen_defines.py doesn't look like a diff against
the old code if you look at just that commit.

We keep changes to a minimum to just keep things building with the
renamed gen_legacy_defines.py.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00
Martí Bolívar
0de9a08e94 scripts: dts: edtlib: add EDT.chosen_nodes property
This returns the entire logical {name: Node} dictionary which is
currently being accessed element by element via chosen_node(name).

It will be used in a new gen_defines.py for moving the handling of
chosen nodes into C from Python.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-24 10:11:20 -05:00
Anas Nashif
2f7c187d77 sanitycheck: cleanup loading of previous results
Merge two functions loading previous results into one and support
filtering based on status.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-24 08:11:07 -04:00
Anas Nashif
a45c1da6d7 sanitycheck: use status column for status
We used the column 'passed' as a boolean to signify pass or fail,
however we do have other states that need to be tracked.
Remove the boolean and use a text field instead that has the status as a
string.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-24 08:11:07 -04:00
Anas Nashif
49f6d5a6c6 sanitycheck: fix counting when using --test option
When running 1 specific test, counting was off. Combine functions adding
tests into one and optimize filtering.

Fixes #22270

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-24 08:10:44 -04:00
Ioannis Glaropoulos
f3807f19dc boards: arm: nrf51_pca10028: rename board to nrf51dk_nrf51422
We rename the nRF51 Dev Kit board target (nrf51_pca10028)
to nrf51dk_nrf51422. We update all associated references
in the supportive documentation and all nRF51-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-24 11:45:27 +01:00
Emil Hammarstrom
9ec8da2363 scripts: Bump west version
Default to west >= 0.7.2

Signed-off-by: Emil Hammarstrom <emil.a.hammarstrom@gmail.com>
2020-03-23 17:55:14 +01:00
Kumar Gala
a457681b1c scripts/requirements: Split & document requirement.txt
Split up requirements.txt into several files so that CI tools can
utilize/reference the specific requirements-<FOO>.txt they may need
while keep things in sync with the development.  This is to reduce
both time and amount of work CI actions due to python package install.

Create the following groupings:

1. BASE - needed to build or create zephyr images
2. BUILD-TEST - need to run compile/build tests
3. DOC - need to build the docs
4. RUN-TEST - need for runtime testing
5. EXTRAS - optional or useful for development/developers workflow

Also tried to add a comment about what or why a given package is being
pulled in for.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-19 15:41:08 +01:00
Andrew Boie
b42fe9c764 scripts: gen_kobject_list.py cleanup
Un-do the changes made to the code when this was separated out
to elf_helper.py.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-17 20:11:27 +02:00
Andrew Boie
fc2f7c3a55 scripts: merge elf_helper into gen_kobject_list
No need for this to be separated out any more.
Minimal changes made to get it to still work.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-17 20:11:27 +02:00
Andrew Boie
28be793cb6 kernel: delete separate logic for priv stacks
This never needed to be put in a separate gperf table.
Privilege mode stacks can be generated by the main
gen_kobject_list.py logic, which we do here.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-17 20:11:27 +02:00
Andrew Boie
ae8acffaa6 doc: fix some missed renames
These were renamed to z_ prefix some time ago, but not updated
in these places.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-17 20:11:27 +02:00
Andrew Boie
2dc2ecfb60 kernel: rename struct _k_object
Private type, internal to the kernel, not directly associated
with any k_object_* APIs. Is the return value of z_object_find().
Rename to struct z_object.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-17 20:11:27 +02:00
Andrew Boie
4bad34e749 kernel: rename _k_thread_stack_element
Private data type, prefix with z_.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-17 20:11:27 +02:00
Andrew Boie
f2734ab022 kernel: use a union for kobject data values
Rather than stuffing various values in a uintptr_t based on
type using casts, use a union for this instead.

No functional difference, but the semantics of the data member
are now much clearer to the casual observer since it is now
formally defined by this union.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-17 20:11:27 +02:00
peng1 chen
921226493b sanitycheck: delete the '\r' char in front of serial output
add lstrip function to delete the '\r' char in front of the
serial output from serail readline, because this '\r'
will influence the result match function in harness.py.

Signed-off-by: peng1 chen <peng1.chen@intel.com>
2020-03-17 12:34:21 -04:00
Patrik Flykt
c9ad901fb7 scripts: net: Clarify and add documentation to README
The README file was in need of clarification how to set up the
net-tools Docker image and how the IP addresses were assigned.
mqtt_publisher is also mentioned.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-17 13:14:41 +02:00
Patrik Flykt
2b42e1274e scripts: net: Support testing of mqtt_publisher
With net-tools and the mqtt_publisher sample updated, add support
for running the sample with the network sample test script.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-17 13:14:41 +02:00
Patrik Flykt
26685b727b scripts: net: Properly return Zephyr exit code to script
Save the exit code from 'wait' so that it is not lost when PID
is set to zero.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-17 13:14:41 +02:00
Kumar Gala
9b9436dfbe Revert "scripts: gen_defines: augment edtlib nodes"
This reverts commit dd1d58cad6.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
6b97a220b4 Revert "scripts: gen_defines: re-work write_regs() with augmented nodes"
This reverts commit ba1c8b523c.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
c6a7ecda93 Revert "scripts: gen_defines: re-work write_irqs() with augmented nodes"
This reverts commit f68da76d36.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
6499addb84 Revert "scripts: gen_defines: re-work write_clocks() with augmented nodes"
This reverts commit c048f872d7.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
1ebe6f2bdd Revert "scripts: gen_defines: re-work write_props() with augmented nodes"
This reverts commit 86645aafdf.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
a3049ad801 Revert "scripts: gen_defines: re-work write_spi_dev() with augmented nodes"
This reverts commit 0471199e63.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
98ae26f689 Revert "scripts: gen_defines: re-work write_bus() with augmented nodes"
This reverts commit 3939556fc3.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
22342bec9d Revert "scripts: gen_defines: remove out()'s aliases kwarg"
This reverts commit 47073fd11c.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Kumar Gala
b379e4547f Revert "scripts: gen_defines: tweak out_define() whitespace"
This reverts commit 3b7ddc83d1.

Reverted as the changes to gen_defines.py break things.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-14 10:38:52 -06:00
Corey Wharton
86bfc489f4 scripts: Replace hard-coded subsystem list with __subsystem annotations.
This change removes the hardcoded subsystem list in gen_kobject_list.py
favor of marking the relevant driver API structs with the _subsystem
sentinel.

Signed-off-by: Corey Wharton <coreyw7@fb.com>
2020-03-11 17:13:39 +02:00
Corey Wharton
ccd15df510 scripts: Dynamically add driver subsystems to subsystems list
This change extends the parse_syscalls.py script to scan for a
__subsystem sentinal added to driver api declarations. It thens
generates a list that is passed into gen_kobject_list.py to extend
the subsystems list. This allows subsystems to be declared in the
code instead of a separate python list and provides a mechanism for
defining out-of-tree subsystems.

Signed-off-by: Corey Wharton <coreyw7@fb.com>
2020-03-11 17:13:39 +02:00
Kumar Gala
0353d22202 kconfig: Add dt_nodelabel_enabled function
Add a function takes a 'label' and returns "y" if we find an
"enabled" node that has a 'nodelabel' of 'label' in the EDT
otherwise we return "n"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Martí Bolívar
7846fd103d edtlib: add 'labels' attribute to Node class
This corresponds to the attribute by the same name in dtlib.Node.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
3b7ddc83d1 scripts: gen_defines: tweak out_define() whitespace
Pad node identifiers to 60 characters. This results in better
alignment in practice than the current value of 40, which is a bit
low.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
47073fd11c scripts: gen_defines: remove out()'s aliases kwarg
Write the same results explicitly in its only remaining caller.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
3939556fc3 scripts: gen_defines: re-work write_bus() with augmented nodes
This too is an attempt to reimplement the previous behavior exactly,
modulo the order in which things are defined.

This is the last function which is calling into the previous
implementation's out_node and node_*_alias() functions, so these can
be removed now.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
0471199e63 scripts: gen_defines: re-work write_spi_dev() with augmented nodes
This uses augmented nodes in the same way as done previously.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
86645aafdf scripts: gen_defines: re-work write_props() with augmented nodes
This is similar to the work already done for regs.

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

We're intentionally leaving some of the helpers in module scope here
to use some of the subroutines elsewhere later on when reworking
write_spi_dev().

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
c048f872d7 scripts: gen_defines: re-work write_clocks() with augmented nodes
Mirror the change already done to write_regs().

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
f68da76d36 scripts: gen_defines: re-work write_irqs() with augmented nodes
Use augmented nodes to print macros grouped by namespace.

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
ba1c8b523c scripts: gen_defines: re-work write_regs() with augmented nodes
Group the macros together by namespace rather than putting all the
BASE_ADDRESS macros together and all the SIZE macros together. E.g.,
all the DT_INST_<x> namespace macros for each node now appear
consecutively.

Add a comment making it clear that this output comes from "regs",
since "BASE_ADDRESS" and "SIZE" are not property names.

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
dd1d58cad6 scripts: gen_defines: augment edtlib nodes
Add additional attributes to each edtlib.Node we process, before
calling into the write_foo() routines.

This includes the identifier returned by node_ident(), which is used
as the primary identifier for the node, as well as lists for instance
and aliases nodes, and a catchall list that contains all the other
identifiers in addition to the primary one.

Use this information in a new for_each_ident(node, ident) def that
will be put to use in the various write_foo() routines.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Ulf Magnusson
8cacb9fd8c dts: edtlib: Turn global spi_dev_cs_gpio() into Node.spi_cs_gpio
spi_dev_cs_gpio() takes a Node and returns the chip select GPIO for it.
Having that information available directly from Node is neater, so turn
it into a Node.spi_cs_gpio property instead.

That gets rid of the only public global function in edtlib, which might
make the API design clearer too.

Tested with the sensortile_box board, which uses SPI chip select.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Ulf Magnusson
35166c45d9 dts: edtlib/gen_defines: Fix API design re. dtc flags
It's better to allow per-instance EDT configuration than to set a global
variable on the edtlib module. Enable/disable the warning for reg/unit
address mismatches via a flag to EDT.__init__(), instead of via a global
variable. That makes it consistent too.

Another option would be to pass the 'dtc' flags to EDT.__init__(), but
it makes the interface a bit ugly. Maybe if it needs to emulate lots of
other flags later.

Clarify that edtlib itself isn't meant to have any state in the comment
at the top of the module.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Patrik Flykt
cbef6760c1 scripts: net: Enhance error reporting
Enhance error reporting by returning immediately when the calling
function reports an error.

Signed-off-by: Andrei Laperie <andrei.laperie@intel.com>
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Patrik Flykt
3401192e7f scripts: net: Add option to keep container after test
Add '--keep' option to leave Docker container and network running
after the test.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Patrik Flykt
ad1b38bebe scripts: net: Return final return value from Docker test
Return the final return value from Docker script when running echo
client in the container, first for UDP and then TCP, for both IPv4
and IPv6.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Patrik Flykt
8f451b7338 scripts: net: Add overlay file to sample script
Add an '--overlay' command line option in order to use an overlay
file when compiling Zephyr.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-10 16:43:10 +02:00
Martí Bolívar
34a59168d5 build: clean up west build
The header printed at the beginning of every west build is kind of
annoying. Let's remove it and just print the application source
directory at cmake time instead. The build directory and board are
already printed there, anyway, and that's all IDE users will see.

Let's clean up the BOARD to make it say "board" instead. That matches
the west build --board option name a bit more closely and is still
legible.

Likewise, let's not print any west build messages if we're just
incrementally recompiling. That's noisy.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-10 14:53:28 +02:00
Mikkel Jakobsen
98eb316bdf scripts: build.py: make _sanity_check() case insensitive on windows
When checking build directory against cache on windows, certain
corner cases can end up failing the comparison because of case
difference on an otherwise identical path. This can be avoided
by ignoring case on windows.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2020-03-10 12:19:35 +02:00
Anas Nashif
497fe4267a release: update sanitycheck footprint file
Update for latest release.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-09 23:40:45 +02:00
Martí Bolívar
67d8f755e2 runners: misc-flasher: hotfix
The 'command' command line argument for this flasher is now being
overridden by common code, which attaches the west subcommand name to
this.

Let's just hotfix this by renaming the argument in misc-flasher.
We can revisit the boundary between run_common.py arguments and
runners package arguments after the release.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-04 21:48:09 +02:00
Martí Bolívar
24ce05c841 doc: improve west flash help for dfu-util
Try to make it clearer what's going on here.

Suggested-by: Lucian Copeland <hierophect@gmail.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-03 09:30:32 +02:00
Martí Bolívar
dc0948424e scripts: run_common: fix command line --hex-file and friends
This is yet another bug introduced by the move to runners.yaml.
Sigh. I should have tested this better.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-29 19:38:49 +02:00
Martí Bolívar
f8cb3d4d53 scripts: run_common: rename 'args' to 'user_args'
This will also make the reason for a following bug fix easier to see.

Update a comment block to include all the work that needs doing.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-29 19:38:49 +02:00
Martí Bolívar
97dbda2088 scripts: run_common: rename unknown_args to user_runner_args
This makes its true value clearer, and will make a later bug fix patch
easier to understand.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-29 19:38:49 +02:00
Martí Bolívar
6dab163cad scripts: fix west sign when ZEPHYR_BASE is unset
Due to cleanups in west targeted at getting rid of zephyr-specific
code, extension commands can no longer rely on ZEPHYR_BASE being set
in the calling environment at import time (it's still set at run()
time for now, though, to keep west build working).

Add a new helper to make dealing with this easier from west sign.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-20 09:06:09 +02:00
Martí Bolívar
eb95bed552 scripts: west_commands: fix argument handling with runners.yaml
Refactor the code to support the new runners.yaml file created by the
build system.

Compared to fishing around in the CMake cache, this makes it trivial
to put all the command line arguments to a runner-based command on
equal footing, regardless of if they're defined in the runners package
proper or defined in run_common.py.

This allows board.cmake files to do things like this:

   board_set_runner_args(foo
     --bin-file=${PROJECT_BINARY_DIR}/my-signed.bin)

While at it, make some other cleanups:

- Stop using the obsolete and deprecated west.cmake module while we're
  here in favor of the zcmake.py module which was added to Zephyr a long
  time ago. Yikes. I had forgotten this was still here.

- Stop using west.util's wrap function in favor of raw use of
  textwrap. The west function splits on hyphens, which is breaking
  runner names like "em-starterkit".

- Clean up the --context output a bit

Fixes: #22563
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-20 09:06:09 +02:00
Stephanos Ioannidis
354f2bbf1e sanitycheck: Update section names for memory size calculation
This commit updates the section names for memory size calculation in
the sanitycheck script as follows:

1. Remove `_TEXT_SECTION_NAME_2` section, which no longer exists, from
  the `rw_sections`.

2. Add `rom_start` section, which mostly contains read-only data such
  as the exception vector table, to the `ro_sections`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-02-18 12:59:25 -05:00
Alexey Brodkin
5bd2857c73 board: arc: Switch to generic OpenOCD runner
We used to use "em-starterkit" runner for ARC which is
basically heavy-modified "openocd" runner tweaked to
use GDB for loading and starting Elf files.

Now when loading and running Elf files is possible with generic
"openocd" runner we may us it. So we switch and get rid of
"em-starterkit" as well since we no longer need it.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-02-13 10:45:44 +02:00
Alexey Brodkin
83b346edef runners: opeocd: Allow loading Elf-files
In some cases especially for on-going development & debugging of real
application it might be useful to load and run not from flash but
from RAM in that case there's one catch: we cannot reset the board
after loading memory with our app.

That's because:
 a) RAM we use might be either cleared on reset or might enter
    unpredictable state with portion of previously loaded data
    being corrupted.
 b) Reset vector most probably still point to ROM/flash and so
    our current application won't be executed on reset.

So instead of "run reset" command of OpenOCD we'll use
"resume 0x12345678". Where 0x12345678 is our application's
entry-point (which BTW may very well not match beginning of
the .text section or link base).

Now to extract the entry-point we need our application's zephyr.elf
and since we already have a requirement for Elf we may use it for
loading because OpenOCD does it perfectly fine moreover automatically
detecting loaded image type (binary, hex, Elf etc).

And to use that nice feature just add "--use-elf" to west's
command-line for boards that use "openocd" runner. Like that:
----------->8--------------
west flash --use-elf
----------->8--------------

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-02-13 10:45:44 +02:00
Alexey Brodkin
5a4237ed3b west: openocd: Allow to specify FTDI instance by its serial number
To be used in setups with multiple boards attached to the same one
host we need to have an ability to specify precisely which JTAG probe
to use for a particular board.

This is done by passing "ftdi_serial XXX" command to OpenOCD.
And the serial ("XXX") is supposed to be passed from higher level,
typically via west's options. And exactly for that we add another
"openocd" runner option "--serial=XXX" which sets
a Tcl's "_ZEPHYR_BOARD_SERIAL" variable that later gets passed
to OpenOCD's "ftdi_serial" command.

See more discussions on the matter here:
https://github.com/zephyrproject-rtos/zephyr/issues/22543

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-02-13 10:45:44 +02:00
Kumar Gala
0ce53610f8 scripts/requirements: Remove unused packages
Remove 'git-spindle' as there are not users in any scripts or build
system and not references in any of our docs.

Remove 'wheel' as nothing seems to use or need it directly.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-12 10:30:56 -06:00
Martí Bolívar
dc1edb946f scripts: zephyr_module: hack to match west 0.7 output
The west command line output is not stable and has changed for 0.7.
Match it in zephyr_module.py's check for whether we are in a
workspace.

The real fix is to start using 'west topdir' whenever the west version
is at least 0.7.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-12 11:37:52 +01:00
Andy Ross
7353c7f95d kernel/userspace: Move syscall_frame field to thread struct
The syscall exception frame was stored on the CPU struct during
syscall execution, but that's not right.  System calls might "feel
like" exceptions, but they're actually perfectly normal kernel mode
code and can be preempted and migrated between CPUs at any time.

Put the field on the thread struct.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-08 08:51:04 -05:00
Kumar Gala
b81eec951b sanitycheck: make pyserial optional
We only need pyserial python module if we are doing device testing.
Treat it similar to how we treat tabulate module.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-07 19:48:24 -06:00
Anas Nashif
a9f2fcb64a requirements: require gcovr >= 4.2
This is the version needed to generate coverage using sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:14:24 -05:00
Anas Nashif
323161dfcd sanitycheck: point to correct gcov path
The SDK has a new path for x86 gcov, point to the new binary. Also, do
not clean artifacts when running coverage.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:14:24 -05:00
Martí Bolívar
cea6e3f17a scripts: west_commands: fix help text for flash
The 'command' variable points at a python command object, not a
string. Take its name so the help text for west flash -h correctly
says 'flash' instead of 'debug'.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-06 23:06:04 -05:00
Ulf Magnusson
fad697aed9 scripts: gen_defines.py: Add out_dev() flag for deprecated macros
Add a 'deprecation_msg' string/flag to out_dev(). When 'deprecation_msg'
is passed, all generated macros include

    __WARN(<deprecation_msg>)

which prints a custom warning if the macro is used.

Meant to be used when improving the output format.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-06 17:27:49 -06:00
Kumar Gala
2fd7876aa7 ci: github: west: Add a GH workflow to run the west command tests
Replace running west command tests in run_ci.sh with a github workflow.
This provides some benefits in that we can run the west command tests on
multiple python versions and host OSes (linux, mac and windows).

Also have the benefit that the tests are only run on modifications to
files in scripts/west_commands/ or scripts/west-commands.yml.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-06 08:34:43 -06:00
Martí Bolívar
1c80d79fdd scripts: west_commands: skip bossac tests unless on linux
That's the only platform the tool is available.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-06 08:34:43 -06:00
Wentong Wu
c35fa6caa6 scripts: add script for usb backend to receive tracing data
Add script for usb backend to receive tracing stream data. This
script, trace_capture_usb.py, is based on pyusb, so install it
correctly before using the script.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-02-05 23:54:26 -05:00
Wentong Wu
b4449a0c2c scripts: add script to capture tracing data with UART backend
Add script to capture tracing stream data with UART backend. This
script is developed based on pyserial, so install it correctly
before using the script.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-02-05 23:54:26 -05:00
Kumar Gala
de70e9c5ba scripts/sanitycheck: be more fair with dividing subsets
Since we do interger division to determine how many items are in each
set, its possible we can have bad rounding error and the last set having
a much larger amount of items compared to all other sets.

For example, total = 3740, sets = 300:
	per_set = 3740 / 300 = 12.466 = 12
	last_set = 3740 - 299 * 12 = 152

So instead of doing simple division, we add on extra item to the early
sets and we've exhausted the rounding error:

	num_extra_sets = total - per_set * sets
		   140 = 3740 - 12 * 300

So the first 140 subsets will have 13 per_set, and the last 160 will
have 12 per_set.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-05 18:57:49 -05:00
Andrei Gansari
e87fec1554 scripts: simple-bus warning suppression
Single-bus warning in python parsing of device tree is suppressed if
this is also suppresed in the device tree compiler.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-02-05 13:04:44 -06:00
Andrei Emeltchenko
d44d986a03 west: Add signing support using the rimage tool from SOF
This way "west sign" can be used for signing images.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-02-05 10:43:25 -05:00
Martí Bolívar
54ddd514ae scripts: grutils: tweak sort keys to group siblings
Change the key function used to sort nodes so that unit addresses, if
present, break ties between sibling nodes. This orders siblings in
increasing order by unit-address in any gen_defines output that is
sorted by ordinal.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-02-04 07:28:45 -06:00