Add specific enum generation support related to usb 'maximum-speed'
property. This will generate a define with _ENUM with the integer
value of the enum as its ordered in the YAML. The assumption right
now is that there's a matching enum in the code.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Allows specifying the 'overlap' argument in IntelHex::merge().
This is identical to the --overlap argument in hexmerge.py, which
is bundled with IntelHex.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
Let's not mess with CommandContextError here, as the APIs have gotten
messed around a bit in various versions. Just use log.die() as that
will work with current and future west versions, and is clearer anyway.
Fixes west 247.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Add a completion command that dumps the contents of a shell
completion file present in the zephyr repository.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This file was previously located in the west repository, under scripts/.
Since it now includes knowledge about specific behavior ef zephyr
extension commands, we move it here after overhauling it completely.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fix issue where sanitycheck wrongly assumed tests inside ZEPHYR_BASE
to be outside ZEPHYR_BASE and dropped the prefix in their name. This
happened when:
- ZEPHYR_BASE contains symbolic link(s), and
- relative --testcase-root argument(s) are passed
To generate unique names, TestCase.get_unique(testcase_root) first
checks whether "testcase_root" starts with ZEPHYR_BASE. Either may or
may not include symbolic links so both must be canonicalized before
comparison. While fixing this method, replace explicit forward slash
"/" and string replace with os.path.relpath() and make a couple other
simplifications and minor pydoc fixes.
Add new canonical_zephyr_base = os.path.realpath(ZEPHYR_BASE) constant
and corresponding comments and guidelines.
The most visible effect of this mismatch was sanitycheck dropping the
--testcase-root prefix from the unique name of tests inside
ZEPHYR_BASE. This means some test names could be not unique anymore
and silently overwrite each other's results, example:
bash# cd zephyr_dir_with_symlink; export ZEPHYR_BASE=$(pwd)
./scripts/sanitycheck -T samples/portability/cmsis_rtos_v1 \
-T samples/portability/cmsis_rtos_v2
The more systematic and practical consequence (and how I actually
found this) was test outputs landing in unexpected locations.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Allow a device tree node to be child on one bus and parent on another
bus (e.g. an I2C slave device with multiple sub-devices).
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
gpio-map is a property of "nexus node", defined in dts v0.3.
It allows to describe a pin connector so it can be referenced
through phandles and hence used in expansion device nodes like a
shield header (typically implemented through overlays).
This change implements gpio controller resolution through these maps.
Few assumptions were taken in order to simplify the implementation.
These assumptions bring some limitations to the use of gpio-map
but my understanding is that this should still allow to cover most
use cases.
Assumptions:
-gpio-size is the same for all gpio-controllers referenced in a map
-optional properties gpio-map-mask and gpio-map-pass-thru are
supposed to be omitted
The understanding of this last assumption is that flags provided in
the expansion device node will overwrite the connector flags.
In a latter stage, when need happen, these limitations can be
revisited to unlock fully fledged gpio-map usage.
Fixes#15637
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
When run as "west -v build", make sure that the underlying build tool
is run in verbose mode as well (if the generator is known to support
it, which is the case for Unix Makefiles and Ninja based generators).
The per-generator hacks here are needed to support CMake 3.13. If we
move to CMake 3.14 or later, we can just run "cmake --build BUILD -v"
and be done with it.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Making a clean slate for a pylint test in CI.
'_' is a common name for non-problematic unused variables in Python.
pylint knows not to flag it.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The west build --help output no longer fits in a single page. Move
details and examples into the documentation, so the -h output doesn't
require scrolling around.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Analogously to the Make options with the same names, these print the
commands which would have run without running them.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Adjust them so "west build -v" prints ZEPHYR_BASE and any CMake
commands, but none of the other more esoteric bits of information.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
This can be used to override the default CMake generator
permanently. Its values are the same as those acceptable to cmake's -G
option.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
- Respect the BOARD environment setting.
- Don't require --force if the board can't be figured out: it might be
set in CMakeLists.txt, for example. Instead, downgrade to a warning
which can be disabled with "west config build.board_warn false".
- Add a build.board configuration option used as a final BOARD fallback
after CACHED_BOARD (in the CMake cache), --board (command line), and
BOARD (environment).
- Keep the config docs up to date.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
- This script didn't get fixed when cmake.py was renamed zcmake, so it
won't run; fix that.
- Change the default format string to '{name}' to keep things simple
- Flake8 lint
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Adds a new argument to the openocd runner to optionally specify the
config file. Updates the rv32m1_vega board to use different openocd
config files for the ri5cy and zero-riscy cores.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Notably fix the wrong comment I added in commit 6f011c95c4: when
testing with QEmu sanitycheck does _not_ spawn QEmu; it relies on "make
run" instead.
Searching the code for "Spawning" now cycles directly to all the places
starting processes and threads.
- Sample -v -v verbose output (lines wrapped for commit message check)
Spawning QEMUHandler Thread for \
qemu_x86/samples/hello_world/sample.helloworld 'make run'
- native_posix example:
Spawning process /home/.../sanity-out/native_posix/\
/samples/hello_world/sample.helloworld/zephyr/zephyr.exe
Spawning BinaryHandler Thread for native_posix/\
samples/hello_world/sample.helloworld
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Since west's main.py relies on the args tuple with the returncode
and the cmd, create the CalledProcessError using the correct
positional args.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add a new "boards" command that is able to list all the boards in the
upstream tree. There is currently no support for out-of-tree boards.
The command executes cmake to use the built-in CMake script,
boards.cmake, to list the boards, and then stores the information
retrieved and allows the user to present it in a user-definable format.
Fixes https://github.com/zephyrproject-rtos/west/issues/53
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Move the existing CMake and build functionality from the west repository
to zephyr. The rationale behind this move is that it's very tightly
coupled with the Zephyr build system and is only used by the extension
commands implemented in the zephyr tree.
If additional extension commands in third-party repos want to use the
functionality they can add $ZEPHYR_BASE/scripts/west_commands to the
Python system path.
The implmentations in the west repo will be deprecated.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
On some systems where you don't have access to `PATH` and you can't
set the `ENV{PATH}` variable. You need to be able to pass the path
to the west executable down to the python script so it is better
for it to be set explicitly than assuming that it exsists as a
part of the PATH/executables in the shell being called.
Signed-off-by: Sigvart M. Hovland <sigvart.hovland@nordicsemi.no>
Adds a check in the jlink runner to look for the jlink executables and
print a more useful error message if they are not found.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This reintroduces support for static service in the form of a new API,
BT_GATT_SERVICE_DEFINE, and changes the internal services (GAP/GATT)
to be defined as const as they are never register/unregistered.
Internal service needed to be renamed in order to keep the same order
as before since the section elements are sorted by name.
The result is the following (make ram_report):
before:
gatt.c 572 0.66%
cf_cfg 32 0.04%
db 8 0.01%
db_hash 16 0.02%
db_hash_work 32 0.04%
gap_attrs 180 0.21%
gap_svc 12 0.01%
gatt_attrs 160 0.18%
gatt_sc 80 0.09%
gatt_svc 12 0.01%
sc_ccc_cfg 32 0.04%
subscriptions 8 0.01%
after:
gatt.c 210 0.24%
cf_cfg 32 0.04%
db 8 0.01%
db_hash 16 0.02%
db_hash_work 32 0.04%
gatt_sc 80 0.09%
last_static_handle 2 0.00%
sc_ccc_cfg 32 0.04%
subscriptions 8 0.01%
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The function error expects only one parameter. The excpetion handler in
scan_path was calling this function with multiple parameters instead of
formatting the string.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Fixes: #15664
This commit improve error messaging in case `west` list fails.
Previously any error messages and stack trace reported by `west` will
was thrown away by zephyr_module.py.
Now the error, as well as any stack traces, printed by `west` will be
re-printed to the user.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
- The script can but does not always generate five files, in fact the
current build invokes it at least three times requesting different
outputs every time.
- --kobj-types-output produces a code fragment; not a standalone/usable
header file. It outputs enum constants for a single enum type and not
several enum types.
- Some outputs include driver instances and others not: clarify which.
- There's an entire and great section in the documentation that took
me ages to find because it's not referenced anywhere in the --help
or code. Fixed.
- Highlight the massive duplication in the CMakeLists.txt to save
déjà vu confusion and minimize future divergence.
- Other minor tweaks.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
When making a build folder pristine until now we were running the
'pristine' build target. The issue with that is that ninja/make or
whatever build tool is being used might decide to re-run CMake itself if
some of the dependencies have changes. This might trigger an error that
is unfriendly and unnecessary, since the user is explicitly asking for
the build folder to be wiped before starting a fresh build.
To avoid this issue restor to running directly the CMake script that the
'pristine' build target itself uses, so as to make sure that the build
folder is wiped unconditionally regardless of changes made to the tree.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Using the new option --timestamps, any output from sanitycheck will have
a timestamp to help identify bottle necks and monitor execution time.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When detecting changes to boards, make sure we test all board
configurations available in that board directory, not only the main one.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a simple Coccinelle script that counts identifier lengths and
prints out a warning if it is longer than 31 characters.
The script can be run with:
spatch -D report --very-quiet \
--include-headers --recursive-includes \
--cocci-file $ZEPHYR_BASE/scripts/coccinelle/identifier_length.cocci \
--dir $ZEPHYR_BASE \
kernel/
Where '--include-headers' and '--recursive-includes' can be omitted
if neede.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
The Harness handlers for tests were parsing the realtime stream out of
qemu pipes by recompiling and executing every regex for every line (!)
of output from the simulator. That's a significant CPU load, and it's
(1) in a separate thread not tracked by the JOBS limit and (2)
happening at the worst possible time and contending with the qemu
process for host CPU cycles that it needs to hit its (real world)
timer targets on time.
Compile them just once, please.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Splitting a string like 'foo="bar=baz"' on '=' will give ['foo', '"bar',
'baz"'] instead of the intended ['foo', '"bar=baz"']. split() with
maxsplit=1 to avoid potential issues.
Not seen in practice. Just some future safety.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Update Kconfiglib and menuconfig to upstream revision 90c5573c19, to get
these commits in:
Warn for unquoted argument to 'source', etc.
Print a warning suggesting to add quotes for things like
source foo/bar/Kconfig
menu title
prompt unquoted
Example warning:
Kconfig:32: warning: style: quotes recommended around
'lib/Kconfig.debug' in 'source lib/Kconfig.debug'
That quoteless syntax is supported for compatibility with old
versions of the C tools. It only works for a single word.
==================================================================
menuconfig: Include all parents in menu paths
Previously, symbols not defined with 'menuconfig' with children
weren't listed in the children's menu paths. It was deliberate, but
it's probably an anti-feature in retrospect, because it can make it
harder to find stuff by following the menu path.
Don't try to be clever and just list all the parent nodes in the
menu path.
==================================================================
menuconfig: Fix display issue for optional-prompt menuconfigs
_shown_nodes() needs to check whether invisible 'menuconfig' symbols
with optional prompts have visible children, so that they can be
shown outside show-all mode. Previously, only 'config' symbols were
checked.
==================================================================
menuconfig: Remember last saved/loaded path and improve
_conf_changed
Remember the last path that was manually saved/loaded instead of
reverting back to standard_config_filename() (e.g. .config).
Remember the path to the last saved minimal configuration separately
as well.
Also improve the _conf_changed behavior when loading a .config
within the interface. Instead of always treating it as needing to be
saved, check if it's outdated, like for the .config file loaded on
startup.
Also make the exit message ("No changes to save", etc.) always
include the target .config file, which is helpful. Previously, only
the save message did.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add a new command-line and build config option, `pristine`, that the
user can pass to `west build` or set in its configuration file(s) in
order to automatically trigger a pristine build on every build or
whenever west considers it required.
The option can take the following values:
- never: Never run the target
- always: Always run the pristine target before building
- auto: Run the pristine target when required
With `auto`, the pristine target will be run when running
west with an existing build folder containing a build system and:
- Selecting a different board from the one currently in the build system
- Selecting a different application from the one currently in the build
system
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>