Commit graph

4217 commits

Author SHA1 Message Date
Jack Rosenthal f959309fd0 scripts: zephyr_module: Tolerate symlinks
Currently, this script will blow up when given a symlink for a path (e.g.,
to a kconfig file).

This is annoying, as when wrapping the build system in a hermetic build
system like Bazel, Bazel likes to limit the input file set by creating
symlinks.

Resolve the path, if it is a file once resolved, then it's OK.

Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
2023-08-11 12:01:21 +00:00
Joshua Lilly cce530cae4 scripts: build: gen_isr_tables: make bit masks configurable
Some architectures such as RISC-v support more than 255 interrupts
per aggrigator. This diff adds the ability to forgo the aggrigator
pattern and use a configurable number of bits for multilevel
interruts.

Signed-off-by: Joshua Lilly <jgl@meta.com>
2023-08-10 10:55:41 -04:00
Marcin Niestroj f24dc9eab7 snippets: fix example usage of EXTRA_DTC_OVERLAY_FILE
DTC_OVERLAY_FILE was replaced with EXTRA_DTC_OVERLAY_FILE. Adjust example
usage in schema file.

Fixes: 1561a0705f ("snippets: support for EXTRA_DTC_OVERLAY_FILE and
  EXTRA_CONF_FILE")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-08-10 08:15:01 +00:00
Martí Bolívar 3f8d33ee3b scripts: restore utils/migrate_includes.py
Commit 9b30667c77
("build: drop LEGACY_INCLUDE_PATH support")
removed scripts/utils/migrate_includes.py.

This was premature. This script is still useful to users of older
versions of zephyr that are attempting to migrate to current ones.

For example, users of v2.7 LTS who are migrating to v3.4 should
still be able to run the script to migrate their code bases.

Restore it. Maybe after next LTS we can remove it. It costs
basically nothing to keep it in the tree.

Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
2023-08-10 08:05:54 +00:00
Chaitanya Tata 66769cf023 scripts: twister: Fix return value for size
If size is given then twister prnits the size information for the ELF
but returns one which if used in automation fails the command.

Return zero as the command is successful. Also, fix the unit test case.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-08-09 10:29:20 -04:00
Fabian Blatz 29d07d6020 scripts: ci: check_compliance: Replace dead Kconfig doc link
Update the link to the Kconfig documentation page.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-08-09 12:47:12 +00:00
Evgeniy Paltsev 438bd1db3d ARC: scripts: twister: fix toolchain filtering
Let's not provide default toolchains for 'arc' intentionally: some
targets can't be built with GNU toolchain ("zephyr", "cross-compile",
"xtools" options) and for some targets we haven't provided MWDT
compiler / linker options in corresponding SoC file in Zephyr, so
these targets can't be built with ARC MWDT toolchain
("arcmwdt" option) by Zephyr build system.
Instead for 'arc' we rely on 'toolchain' option in board yaml
configuration.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-08-05 09:12:01 -04:00
Dmitry Lukyantsev b2af5e87de scripts: Exclude spelling.txt from spelling check
Do not run spelling check on changes to scripts/spelling.txt.

Signed-off-by: Dmitry Lukyantsev <dmitrylu@google.com>
2023-08-04 21:18:43 +00:00
Dmitry Lukyantsev 34a966f219 doc: Fix a typo
Fix a typo in the spelling of "current".
Add "current" to spelling.txt.

Signed-off-by: Dmitry Lukyantsev <dmitrylu@google.com>
2023-08-04 21:18:43 +00:00
Patryk Duda 4b94fc3da2 llvm: Add support for selecting runtime library
This patch adds Kconfig options to select either GNU libgcc or LLVM
compiler-rt. The 'rtlib' flag is provided in a config file, so this
patch introduces 'clang_libgcc.cfg' and 'clang_compiler_rt.cfg' which
enable appropriate library. The file is selected by concatenating
the 'clang_' prefix with library name.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-08-03 19:35:11 +02:00
Grzegorz Swiderski dcd8d60119 scripts: dts: Support DT_NODE_HAS_PROP(node_id, ranges)
This is a one-line fix for edtlib, which lets gen_defines.py indicate
whether the `ranges` property exists within a given node.

Although address translation through ranges is typically automatic,
users can choose to manually inspect ranges using DT_FOREACH_RANGE(),
DT_NUM_RANGES(), and other DT_RANGES_* macros. These can be used to
implement manual translation at runtime, which is currently done for
PCIe controllers.

The only thing missing is being able to check if a node contains an
empty `ranges;`, which signifies a 1:1 translation to the parent bus.
Checking DT_NUM_RANGES() is insufficient, because it returns zero
whether or not `ranges;` is present.

It should be possible to use DT_NODE_HAS_PROP(), but it was not working,
because edtlib ignores properties which are undeclared in bindings and
don't have a default type. Add a missing PropertySpec for `ranges` with
"compound" type; it can't be "array" because it can be empty-valued.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-02 09:56:01 -07:00
Yong Cong Sin 9239599277 twister: add support for custom emulator in simulator
Enable the possibility for boards to implement a custom `run` target in
its board.cmake to run any arbitrary commands. This is helpful for devs
who would like to add support for proprietary simulator to their boards
that can't be upstreamed.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-08-02 17:35:26 +02:00
Jordan Yates fe498ada60 scripts: snippets: add DTS_EXTRA_CPPFLAGS support
Add an additional option to the `append` schema for appending to the
`DTS_EXTRA_CPPFLAGS` cmake cache variable, enabling finer control over
the content of devicetree files.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-08-02 16:27:11 +02:00
Jordan Yates 999afdc728 scripts: kconfig: size/addr by nodelabel
Add new devicetree kconfig function to get a node size or addr by
nodelabel.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-08-02 10:38:23 +02:00
Carles Cufi 623fb0ee81 build: relocation: Fix long command-line invocations
For applications relocating big parts of the code with many sections,
builds were failing on Windows due to hitting the max command-line
length on that platform.
Fix this by using a file to store the dictionary passed to the python
script.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/60994.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-08-01 09:47:57 -07:00
Yasushi SHOJI fb8f214f46 scripts: gen_defines.py: Update doc reference
interrupts.rst has been moved to doc/kernel/services/.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-08-01 08:20:24 +00:00
Anas Nashif 3191d08130 twister: improve handling of ELF file parsing
We have been dealing with missing and multiple binaries the same way and
both would result in a build error, which is not accurate. multiple
binaries in the build directory are fine, we just need to pick the right
one for parsing.

If we get no binaries, raise an exception and report failure, however,
if we have multiple binaries, filter intermediate artifacts out and
parse what remains.

qemu binaries generated after a run are also being filtered here. Those
are not build artificats and appear only after running in qemu. However
they have been causing issues on retries.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-07-28 14:34:19 +02:00
Maciej Perkowski 3e398cbb0b twister: bugfix: Make BuildError exception cause test to report error
When no/too many elf files are detected after a build a BuildError
exception is raised. However, it was not being counted as an issue
with a test. With the patch satuses of tests' with such exception
are reported as errors. Whithout it, twister finished without
reported errors and was getting green CI checks.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-07-28 06:32:48 -04:00
Alberto Escolar Piedras 85059866d5 native_simulator: Align with upstream latest
Upstream SHA: c8d3e4134ee24f8c3bbc598dfc80520c5a0c46d5

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-28 09:08:07 +02:00
Bruno Mendes 7da7742c66 west debugserver: openocd: configure rtos
This enables thread awareness in the spawned OpenOCD server.

Signed-off-by: Bruno Mendes <bd_mendes@outlook.com>
2023-07-27 15:08:15 -05:00
Fabio Baltieri 68f514fc38 scripts: compliance: always run the MaintainersFormat check
The check currently only runs if the maintainers file itself is changed,
but that means that the check is going to miss every PR that moves
directory or delete files that can potentially trigger an error.

This check is cheap to run, just run it unconditionally.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-25 18:49:34 -04:00
Jordan Yates 50d42dcdb2 scripts: build: check_init_priorities_test: fix
Fix the test script for the changes made to section naming.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 15:58:06 +00:00
Jordan Yates 23280f4a54 scripts: build: check_init_priorities: parse new naming
Update the script to parse the new section naming. The ordering type
is converted from an integer to a tuple, which still compares correctly
due to the elementwise behaviour of tuple comparison.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 15:58:06 +00:00
Jordan Yates b6e03417c7 dts: gen_defines: generate _ORD_STR_SORTABLE
Generate a zero padded variant of `_ORD` that is suitable for use in
linker scripts with the `SORT` property, so that `6` is correctly placed
before `24`, and so on.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 15:58:06 +00:00
Fabio Baltieri 0f23cda744 scripts: drop list_issues.py
This is not used as part for the release process anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-25 16:45:15 +02:00
Jordan Yates f0958c62e4 Revert "dts: gen_defines: generate _ORD_STR_SORTABLE"
This reverts commit 9b77681473.
2023-07-25 14:17:11 +02:00
Jordan Yates 9b77681473 dts: gen_defines: generate _ORD_STR_SORTABLE
Generate a zero padded variant of `_ORD` that is suitable for use in
linker scripts with the `SORT` property, so that `6` is correctly placed
before `24`, and so on.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Nicolas Pitre 52e2f83185 kernel/timeout: introduce the timepoint API
This is meant as a substitute for sys_clock_timeout_end_calc()

Current sys_clock_timeout_end_calc() usage opens up many bug
possibilities due to the actual timeout evaluation's open-coded nature.

Issue ##50611 is one example.

- Some users store the returned value in a signed variable, others in
  an unsigned one, making the comparison with UINT64_MAX (corresponding
  to K_FOREVER) wrong in the signed case.

- Some users compute the difference and store that in a signed variable
  to compare against 0 which still doesn't work with K_FOREVER. And when
  this difference is used as a timeout argument then the K_FOREVER
  nature of the timeout is lost.

- Some users complexify their code by special-casing K_NO_WAIT and
  K_FOREVER inline which is bad for both code readability and binary
  size.

Let's introduce a better abstraction to deal with absolute timepoints
with an opaque type to be used with a well-defined API.
The word "timeout" was avoided in the naming on purpose as the timeout
namespace is quite crowded already and it is preferable to make a
distinction between relative time periods (timeouts) and absolute time
values (timepoints).

A few stacks are also adjusted as they were too tight on X86.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-25 09:12:26 +02:00
Lukasz Mrugala 7dfe0811b5 scripts: tests: twister: CMakeCache test expansion
To enhance out test coverage, this change grants us 100%
coverage on cmakecache.py.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-07-25 09:11:26 +02:00
Fabio Baltieri 6d99e38a84 scripts: check_init_priorities: ignore zephyr,cdc-acm-uart
The new stack zephyr,cdc-acm-uart driver has two separate init path, one
of which kicks in before the USB stack to start buffering log messages.

This generates a false positive in the build time priority checking,
adding a check to ignore that compatible entirely.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-25 09:10:26 +02:00
Anas Nashif 47102de474 west: build: support additional configuration with --test-item
Also support extra_conf_files, extra_overlay_confs, extra_dtc_overlay_files

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-07-24 11:09:12 -04:00
Anas Nashif 6fdfc91a6c west: build: also parse common section in yaml file
Parse common section and append to cmake args if available when using
--test-item option of west build.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-07-24 11:09:12 -04:00
Yves Vandervennet 58e4df6460 west: runner: add support for NXP's linkserver
Linkserver is a utility for launching and managing GDB servers for NXP
debug probes, which also provides a command-line target flash programming
capabilities. Linkserver can be used with NXP MCUXpresso for Visual Studio
Code.

For more information about LinkServer, please visit the LinkServer web
page (link [1] below).

This commit adds a runner to west, supporting debug and flash commands.

Documentation is also added.

[1] - LinkServer web page:
    https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKERSERVER

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2023-07-21 14:57:25 -05:00
Emil Gydesen cab52d23c4 footprint: Add BT TMAP broadcast samples
Add the BT Telephony and Media Audio Profile broadcast samples.
These reflect devices that control telephone and media audio
of LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-21 10:55:03 +00:00
Lukasz Mrugala a9a6df9b50 scripts: tests: Environment tests update
Implemented style changes proposed by gchwier previously.
Tests updated according to fixes in environment.py in
  * PR #60526
  * commit d72c434
  * commit 7afeefd

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-07-20 16:25:31 +02:00
Jamie McCrae d52b634610 doc: mgmt: mcumgr: Add details on making handlers
Adds a guide on how to make out-of-tree MCUmgr function handlers
and groups, with an example showing a test implementation.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 16:22:31 +02:00
Aleksander Wasaznik bb8b515ffa native_posix: Add support for west debug
This change adds the convenience of `west debug` to native builds.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-07-20 12:43:47 +02:00
Jeremy Bettis d72c4344ed twister: Support --coverage-formats on lcov also
When using twister to generate coverage with the coverage tool lcov,
allow using --coverage-formats to pick if you want lcov or html,
defaulting to both. Picking html will also use lcov, since that is
required for geninfo.  This will allow callers to avoid the potentially
slow and disk intensive html reports if they only wanted the lcov info
file.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-07-19 21:00:10 -04:00
Lukasz Mrugala 48fef88038 scripts: pylib: twister: twisterlib: environment: TwisterEnv fixes
Fixes Issue #60522 by guarding member access against None parameters.
Shortens the init by using the if...else assignment.
Fixes two typos.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-07-19 20:47:29 -04:00
Keith Packard 3d94c830a3 scripts/checkpatch: Fix check for libc API defines
Re-ordering the API names moved a trailing '|' causing the pattern to match
*every* #define in the input.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-07-19 08:57:04 +00:00
Maciej Perkowski 93031ad5a0 west_commands: Fix parsing of extra args for test-item
An arg --test-item makes west loading twister's test configurations
form sample/testcase.yaml. It has to mirror twister's behavior.
It was not the case with "extra_args" section. Quotation  marks were
not removed in west as they were in twister. The quotation marks
have to be removed from the extra_args section but left in
extra_configs. The commit adds differentiation for those.

fixes: #60297

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-07-18 21:33:00 -04:00
Yong Cong Sin 335acf817d posix: signal: implement strsignal
Implementation and ztest for strsignal.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Yong Cong Sin 2037362e16 checkpatch: exclude POSIX headers from typedef rule
The `NEW_TYPEDEFS` rule consistently generates false
positives when implementing POSIX standard APIs.

It makes sense to disable this check for the POSIX haders
rather than requiring merge superpowers constantly. That
way, we can merge as per usual after sufficient approvals
rather than waiting for someone with merge superpowers to
override / manually merge.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-07-18 15:35:42 -04:00
Keith Packard b021dece98 scripts/checkpatch: Check for patches adding #defines for libc APIs
All code in the Zephyr core must use only the Zephyr C library API
according to rules A.4 and A.5. Such code is not permitted to request API
extensions from the C library via any of the API request mechanisms.

This addition to checkpatch.pl verifies that patches don't #define
any of these:

	__STRICT_ANSI__
	_POSIX_SOURCE
	_POSIX_C_SOURCE
	_XOPEN_SOURCE
	_ISOC99_SOURCE
	_ISOC11_SOURCE
	_ATFILE_SOURCE
	_GNU_SOURCE
	_BSD_SOURCE
	_SVID_SOURCE
	_DEFAULT_SOURCE

Reference: #49922

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-07-18 19:20:24 +00:00
Lukasz Mrugala d42b2e0a9b scripts: tests: Environment tests update
Implented suggestions proposed by gchwier.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-07-18 16:20:54 +02:00
Lukasz Mrugala 7c270c8488 scripts: tests: Expand environment.py tests
As we aim to enhance our test coverage, environment module
is a target-rich environment. Some errors in the original
module were discovered and tests regarding these cases were
commented out until they are fixed.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-07-18 16:20:54 +02:00
Grzegorz Chwierut 57c27cd736 twister: pytest: Added fixture for mcumgr with unittests
Added mcumgr fixture to pytest-twister-harness. Added unittests for
new fixture.

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2023-07-17 16:23:59 -04:00
Dmitrii Golovanov 7afeefd7dd twister: Fix flashing timeout command line options check
Fix `--device-flash-with-test` command line options check logic
to be effective with `--device-testing`.

Remove `--device-flash-timeout` check for `--device-testing`
presence as marginal.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-07-17 15:57:03 -04:00
Emil Gydesen 8fdb0fb1ca footprint: Add BT TMAP samples
Add the BT Telephony and Media Audio Profile samples.
These reflect devices that control telephone and media audio
of LE Audio.

The central is typically a more resourceful device, and the
peripheral a resource-constrained device.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-17 13:20:54 +00:00
Lukasz Mrugala a36af82f64 scripts: tests: Twister test expansion - quarantine
Here we achieve 100% coverage for the quarantine module,
thanks to unit tests for QuarantineElement and QuarantineData dataclasses.

Implemented PR suggestions of gchwier.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-07-13 14:18:27 +02:00