Verify platform extra_args selectors match a default board target alias
and do not apply it to a non-default board revision.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Match platform extra_args selectors against the aliases associated with
a platform. This lets a default board target select its default revision.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Zephyr stores thread priorities as signed values because cooperative
threads use negative priorities. The coredump GDB stub currently uses
the unsigned default of int.from_bytes(), causing negative priorities
to be reported as positive values.
Decode the priority byte as signed so cooperative thread priorities
are reported correctly.
Assisted-by: Codex:gpt-5
Signed-off-by: Hang Song <hang.song@processmission.com>
Add the ability to configure additional runner parameters.
For instance the Raspberry Pi boards require a specific openocd version
with rp2xxx driver support.
Signed-off-by: Joel Guittet <joelguittet@gmail.com>
Sixteen checks in the SPDX application test assert only that the
serializers render a graph correctly: the document header, DESCRIBES
relationships, package ID format, the role comment on a dependency
package, the supplier and purl derived from a remote URL, and the
VARIANT_OF/DEPENDENCY_OF edges between a module's sources and its
dependency. None of them need a build, yet all were gated behind one --
several carried pytest.skip guards precisely because they could not
assume what a build had produced.
Move them to scripts/tests/zspdx, where a fixture drives the walker's
module half directly and each check knows exactly what the graph holds.
Coverage widens on the way: the SPDX 2.x checks now run against 2.2 as
well as 2.3, the document checks gain SPDX 3.x equivalents, and the
supplier mapping is exercised on both of its branches instead of only
the Zephyr namespace.
What stays is what only a build can show: the '-sources' comments come
from setup_zephyr_component(), which needs a west workspace and the
CMake file-API, the utility-target check needs real build targets, and
the tool creator's version is read from the tree.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
zspdx has no unit tests today: everything it emits is only covered by the
SBOM application test, which needs a full Zephyr build to run. Add a
pytest suite that builds an SBOM graph directly and runs the serializers
over it, so serializer behaviour can be covered without a build.
The suite starts with what a module dependency component produces: the
locator classification in the shared model, and the external references
that reach the SPDX 2.x tag-value and SPDX 3.x JSON-LD output. Shared
fixtures serialize a graph and parse every document back, parametrized
over each supported spec version. The SPDX 3.1 leg skips until a
released spdx-python-model carries its bindings, matching the
application test, which does not exercise 3.1 either.
It joins the existing pylib workflow, which already hosts the
scripts/tests suites for code under scripts/pylib. spdx-python-model
moves into the actions requirements, since the SPDX 3.x tests need it.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add tests for _resolve_build_dir(), find_build_dir() and
is_zephyr_build(), including a source directory on another drive.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Egemen Tuncarslan <egementuncarslan@hotmail.com>
With build.dir-fmt set, running west build from a directory on another
drive than the source directory fails with:
ValueError: path is on mount 'D:', start on mount 'C:'
os.path.relpath() cannot relate paths on different drives, so leave
source_dir empty in that case, and document it.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Egemen Tuncarslan <egementuncarslan@hotmail.com>
USERPROFILE is necessary for python to be able to expand
home path on Windows (For example when expanding '~').
Signed-off-by: Antoni Duda <antoni.duda@nordicsemi.no>
Add S3MU_Type and LLC_Type to the typedefs file. The RT266x SoC code
dereferences them as "Type *const", and their typedefs live in HAL headers
outside the tree, so checkpatch reads the '*' as multiplication and reports
a spurious "need consistent spacing" error.
Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
The Kconfig checks only failed on a parser exception, so the
warnings kconfiglib collects were parsed and then dropped. A
symbol left without a type because the definition carrying it
lives in a module went unreported, although the same warning
aborts a real build.
Report them as a failure. The tree parses clean today, with
and without modules, so nothing else is affected.
Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add a sample demonstrating the ZASSERT API.
It shows how to use the ZASSERT macro and easily toggles between ASSERT
levels so the framework can be evaluated in different scenarios.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
Introduce ZASSERT, a self-contained assertion facility configured per
source file through a named module rather than the single global
CONFIG_ASSERT switch.
A file selects its module with ZASSERT_MODULE(); the level is resolved
from CONFIG_ASSERT_MODULE_<MODULE>_LEVEL and may be overridden per file.
Modules are defined with the Kconfig.template.assert template, which takes
module/module-str inputs following the logging template convention.
The four levels are:
- Off (compiled out)
- Terse (check only)
- On (check + location only)
- Verbose (Check, location, condition and message)
Since the level is known at compile time, disabled assertions are folded
away by the compiler, and below Verbose the optional message and its
arguments are as well.
zassert provides a set of __weak overridable hooks:
- zassert_fail() - called when an assertion fails
- zassert_vprint() - called to print the assertion failure message
- zassert_post_action() - the terminal action after an assertion failure
CONFIG_ASSERT remains the master switch. The assert Kconfig moves from
subsys/debug to lib/os/zassert, the legacy CONFIG_ASSERT_* symbols are kept
but deprecated (mapped onto the DEFAULT module), and lib/os/assert.c is
removed. The __ASSERT() family is preserved as a thin compatibility shim
over the DEFAULT module, so existing call sites keep working unchanged.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
Commit e620c22bf7 ("scripts: west_commands: fix run-once board
filtering in run_common") moved the filter_used_cmds(used_cmds,
board_names) call outside the `if len(domains) > 1:` block, but
board_names is only initialized inside that block. For a single-domain
flash (len(domains) == 1) the block is skipped, so board_names is never
defined and every `west flash` fails with:
UnboundLocalError: cannot access local variable 'board_names'
Initialize board_names before the domain-count check so it is always
defined, and add a regression test covering the single-domain path.
Fixes: e620c22bf7
Assisted-by: AI (GitHub Copilot)
Signed-off-by: Bill Waters <bill.waters@infineon.com>
This reverts commit 9fa96059da.
Treating deprecated Kconfig symbols as errors breaks main CI on several
boards, drivers and module tests that still enable them. Revert until
those are migrated.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
When the command line argument for twister is used to treat
warnings as errors, will also set the same option for treating
deprecated Kconfigs as errors, this allows CI compliance to ensure
that the API lifecycle process is followed
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds a new Kconfig to both Zephyr and sysbuild,
``DEPRECATED_KCONFIGS_AS_ERRORS`` which, when enabled, will cause
a build to fail if a deprecated Kconfig is enabled. This is being
introduced to ensure API lifecycle policy is being followed when
features are deprecated
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Apply PEP 604 union syntax (X | Y) for type hints
and isinstance checks to satisfy the Ruff UP007 and UP038 rules.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
The loop reducing run-once commands to the boards being flashed deleted
elements from entry.boards and used_cmds while enumerating them, so the
element following each deleted one was never checked. Unmatched board
patterns and entries were left in the list; a "last" entry whose final
pattern matches no board in the build is never marked as ran and its
command is then passed to every image instead of once.
Rebuild both lists instead, in a helper covered by a unit test.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The pattern "^0|[1-9][0-9]*\.[0-9]+\.[0-9]+$" parses as "^0" or
"[1-9][0-9]*\.[0-9]+\.[0-9]+$", so any revision starting with "0" and
any string ending in x.y.z, such as "0foo" or "abc1.2.3", passes
validation. Group the major number alternatives so the whole value is
anchored, matching the regex board_check_revision() applies in CMake.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The reverse command is distinct from clean in that it only removes changes
that have been applied by a patch. Other changes are left in place. By
contrast, clean removes all changes in the module. Patches are removed in
reverse order of apply, so that if a patch depends on a previous patch, it
will be reversed first.
Additionally, if a patch to be applied/reversed has already been
applied/reversed, skip it rather than fail. This makes it possible to run
apply or reverse multiple times without causing issues. Apply and reverse
are now idempotent like other commands. But, this check only works in the
absence of conflicts. It's up to patch authors to ensure patches are
conflict free.
The logic between the apply and reverse methods are pretty similar so a
minor refactor was done to move the common parts into separate functions.
Signed-off-by: Eric Hay <Eric.Hay@analog.com>
Support for -DKCONFIG_WARNING_AS_ERROR=1 is added, which can be used to
control
that cmake stops in case of any kconfig warning.
Signed-off-by: Thorsten Klein <thorsten.klein@bshg.com>
Before commit bedba6412a ("twister: Add YAML config file support in
pytest-harness"), twister passed --device-id=<probe_id or id> to the
pytest harness. Since then, twister writes the DUT to
twister_pytest_config.yaml and the harness takes the device ID from its
id key only, so the hardware adapter ignores probe_id even when the
hardware map loader provides it.
Use probe_id when it is set. A --device-id given on the pytest command
line still takes precedence.
Checked the flash command generated by a pytest test for a
native_sim/native/64 build with --device-testing and a pyocd hardware
map entry that sets both keys: it now uses probe_id. Not run on
hardware.
Fixes#112600
Signed-off-by: YunHung Hua <oliverhua.us@gmail.com>
A hardware map entry can set probe_id to override the id passed to the
flash runner, for example when the board is flashed through an external
J-Link probe. The schema accepts the key and the device handler uses
hardware.probe_id when it is set, but HardwareMap.load() does not read
the key, so probe_id is always None and the flash runner gets the id.
The key has not been read since the hardware map entries were turned
into objects in commit 531fe89e80 ("sanitycheck: use multiprcoessing
instead of threads").
Read probe_id when loading the hardware map.
Checked the flash command twister generates for a native_sim/native/64
build with --device-testing and a pyocd hardware map entry that sets
both keys: it now uses probe_id. Not run on hardware.
Signed-off-by: YunHung Hua <oliverhua.us@gmail.com>
Adds option to continue instrumentation sample gathering
when buffer fills, by dumping the buffer instead of stopping
instrumentation.
Signed-off-by: Eryk Szpotanski <eszpotanski@antmicro.com>
The system under test is an ordinary publisher: connect, publish to one
topic, keep the connection alive in between, and start again when the
connection goes. Starting again is what lets the test cases stand alone,
each taking a connection of its own.
Nothing in the tree had exercised the client over a network. The in-tree
tests encode and decode messages in process, which cannot show whether
the client waits for the acknowledgement before publishing, whether it
keeps an idle connection alive, or what it does with a connection that
was refused.
The publish interval is longer than the keep alive, so that the
connection is genuinely idle sometimes. A client that published faster
than it pings would never have anything to prove it was alive with, and
the test that waits for a ping would wait for one that was never due.
This is the first conformance suite to work over a connection rather
than over datagrams; the shared TTCN-3 layer grew the listening and
accepting for it in the net-tools repository. The suite is there too,
under ttcn3/suites/mqtt.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The system under test registers one service, listens on the port it
advertises, and waits. The listening socket is not decoration: the
responder checks that a service is bound before advertising it, so a
registration whose port nothing listens on is silently never mentioned,
and a system under test without one would have had the suite watching
for answers that were never going to come.
Nothing in the tree had exercised service discovery over a network. The
in-tree test builds and parses records in process, which cannot show
whether an answer carries what a client needs to act on it without
asking again.
The documented divergence for a legacy unicast query is narrowed by the
same commit. The cache flush bit was recorded as part of it and is not:
the responder keeps it clear on the pointer record, where several
instances share the name, and sets it on the records belonging to one
instance, which is what RFC 6763 12 asks for. What remains is the
identifier, the question and the lifetimes.
The suite is in the net-tools repository, under ttcn3/suites/dnssd.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Neighbour discovery is in every IPv6 build Zephyr ships and nothing has
ever watched what it puts on a wire. The tests under tests/net drive it
in process against a dummy link, which cannot see a frame, an address it
was sent to, or a hop limit.
The system under test is the same shape as the address resolution one a
layer down: it answers for its own addresses, and sends a datagram to a
peer every couple of seconds so that there is an address for the suite to
watch it resolve. Nothing else answers on the link, so an address it
cannot resolve keeps producing solicitations.
The interface is given room for a third address and the group that goes
with it, because an address configured from an advertised prefix needs
both and the defaults leave neither. The neighbour cache is left at its
default size: sending a solicitation takes a cache entry even when the
address being asked about is the interface's own, so a small cache stops
duplicate address detection from being sent at all.
The suite is in the net-tools repository, under ttcn3/suites/ndp.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The mirror image of the DHCPv4 client test: the system under test starts
the server and then does nothing, because everything the suite looks at
is the server answering. The suite is the client.
Nothing in the tree exercised the server over a network before. The
in-tree tests drive it in process against a dummy link, which cannot see
what it puts on the wire or which address it puts there.
The pool is larger than the default. Each test case in the suite appears
as a client of its own so that none depends on what an earlier one left
behind, and the server holds a binding for each of them until the run
ends, so four addresses would not go round.
Writing it turned up the refusal that arrived twice, fixed in the commit
before this one. The suite is in the net-tools repository, under
ttcn3/suites/dhcpv4_server.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The system under test is an ordinary SNTP client: it asks the server for
the time, sets the system clock from the answer, and asks again half a
second later. Nothing in it exists for the test. A client that did not
set the clock would have had no reason to ask, and one that asked once
would leave a suite nothing to look at after the first exchange.
Setting the clock is also what makes the checks the client makes on a
reply visible from outside. sntp_query() stamps a request with the
current real time, so the request that follows a reply carries the time
that was offered if the reply was accepted, and the old time if it was
not. The suite reads the answer off the wire rather than out of the
device.
The tester listens on port 12123 rather than 123, so it needs no
privileges and cannot collide with a time daemon already running on the
host. That is the same reason the DNS suite is not on port 53.
Nothing tested this client before. The suite is in the net-tools
repository, under ttcn3/suites/sntp.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Running a conformance suite by hand takes several steps: fetch the
third party TTCN-3 modules, create one or two tap interfaces, point
TTCN3_DIR at a Titan, work out which suites need root, and give
Twister the right flags. That is a lot to get right for something a
developer wants to run after touching a protocol.
The script does all of it. It finds net-tools the same way the pytest
harness does, reads the same build.conf traits to decide what each
selected suite needs, and runs Twister once.
Once, rather than once per suite, because it has to be. The harness
serialises the tests on a lock named after the effective user id, so a
privileged run and an unprivileged one would take different locks and
then collide on the interface. The script therefore re-executes itself
under sudo when any selected suite needs root, and covers the whole
selection in a single invocation.
A privileged run also used to leave root owned directories behind in
both repositories, which then broke the next unprivileged run, because
build.sh starts by removing the build directory. The script keeps Python
and pytest from writing into the tree at all, and hands back what root
did create.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Allow a hardware-map entry to set run_with_fixture_only.
Such DUTs are excluded from tests that do not request
fixtures, while fixture tests remain eligible when their
requested fixtures match the DUT.
Add schema validation and unit coverage for map loading
and DUT selection.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
checkpatch treated C++ template angle brackets in .h files as comparison
operators, producing false SPACING and CONSTANT_COMPARISON reports.
Skip those checks for high-confidence template lists while leaving
real comparisons diagnosed.
The heuristic is conservative for mixed C/C++ headers. Add regression
tests and run them in the scripts test workflow.
Fixes#54023
Assisted-by: Cursor:gpt-5.6-sol
Signed-off-by: Artem Voinov <voinov.artem.job@gmail.com>
Add a west flash runner that wraps vegadude
(https://github.com/rnayabed/vegadude), an open-source utility that uploads
a raw binary to C-DAC VEGA / THEJAS32 boards such as the ARIES v3.0 over a
serial port using the XMODEM protocol.
The runner is flash-only and uploads zephyr.bin. The board must be in UART
boot mode (BOOT SEL jumper open) and reset so its boot ROM is waiting for a
transfer. Wire the ARIES v3.0 board up to use it as the default flash
runner so that 'west flash' works out of the box.
Signed-off-by: Anuj Deshpande <anuj@makerville.io>
Add tricore to the list of valid architecture values in the
twister platform schema, enabling CI and twister runs for
TriCore-based boards.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Add TriCore to the dictionary logging architecture list so the
parser recognises a CONFIG_TRICORE build.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Add initial support for openFPGALoader to flash FPGA boards.
This is flash support only, no debug support.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Cover relative and absolute paths used to locate runner policy
files from CMake cache directory entries.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Resolve relative SoC and board directories against ZEPHYR_BASE
before loading runner policy files. This lets sysbuild flashing
find policies when CMake cache entries are relative to Zephyr.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Add a $(dt_class_enabled,<class name>) Kconfig preprocessor function
that returns "y" if any status "okay" devicetree node belongs to the
given device class, as declared by the "class" key in bindings. This
is the class-level counterpart of $(dt_compat_enabled,...): it answers
"is hardware of this class present", letting subsystem-level defaults
react to the hardware without a hand-maintained per-driver select
chain.
Exercised end-to-end by the devicetree API test, which derives two
Kconfig symbols from a present and an absent class and checks them
from the test code. Tested with twister on native_sim (108/108
passed).
Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
For each node whose binding declares device class membership through
the "class" binding key, emit a per-node existence macro per class
token, mirroring the per-node bus macros:
#define DT_N_<node>_CLASS_adc 1
and for each class with status "okay" nodes, emit global helpers
mirroring the per-compatible ones:
#define DT_CLASS_HAS_OKAY_adc 1
#define DT_N_CLASS_adc_NUM_OKAY 2
#define DT_FOREACH_OKAY_CLASS_adc(fn) ...
#define DT_FOREACH_OKAY_VARGS_CLASS_adc(fn, ...) ...
Class tokens go through str2ident() like bus and compatible names.
Nothing is emitted for builds where no binding declares a class.
Tested by building tests/lib/devicetree/api for native_sim and
checking that the generated header is unchanged when no binding
declares a class; the macros themselves are exercised by the
devicetree API test suite in a following commit.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Add an optional top-level "class" binding key that declares which
device class(es) nodes matching the binding can be bound as, as a
string or a list of strings. Names are validated: lowercase letters,
digits, '-' and '_', and no duplicates. The key is inherited through
include:, and values from multiple included files are unioned (the
same way "required:" values are ORed) at every binding root, child
bindings included, so that a binding including several class base
bindings belongs to all of their classes. Expose the result as
Binding.classes and Node.classes.
Tested with the python-devicetree test suite (101 passed).
Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Make whisper depend on cmake WHISPER_BIN, so we do not get twister
trying to execute tests with unavailable simulators.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The banner records the absolute path of the input DTS, which lives in the
build directory. Nearly every translation unit includes this header, so
that one line makes the header differ between build directories and
defeats ccache's direct-mode lookup for everything that includes it.
Building the same application in a second build directory drops from
270/271 direct hits to 26/271, the rest falling back to preprocessed
hits that still have to run the preprocessor.
Emit only the file name, the way the neighbouring bindings directories
are already relativised. The header is then byte-identical across build
directories, which is a small reproducibility improvement in its own
right.
Two limits are worth recording. Harvesting the cache reuse also needs
ccache configured for relocation, via base_dir and hash_dir; with stock
settings this makes no measurable difference. And it does not help a
twister run: each test has its own autoconf.h, which every compile
includes and which fails the direct-mode lookup before this header is
reached, leaving direct hits unchanged.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>