Fix devicetree coding style regarding whitespaces through the tree.
This affects code snippets inside documentation, comments, error messages
as to encourage a style that passes CI. Follow-up of #101619
Signed-off-by: Josuah Demangeon <me@josuah.net>
Updates the gen_kobject_list.py build script to mark both
the first and last of the K_OBJ_DRIVER_xxx entries. This
sets the stage to allow for driver object checking.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Replace the direct subprocess.run() call with run_cmake() from zcmake.py,
which is the standard cmake wrapper used by other west commands. This adds
cmake version validation and consistent error reporting.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
The GIC register banks are now mapped by the arm64 arch core
(arch/arm64/core/mmu.c), so a hand-written GIC entry in an arm64
mmu_regions.c is redundant. Flag those entries, detected via the arm64
arm_mmu.h include, while leaving aarch32 -- which still maps the GIC in
the SoC -- and the GICv3 ITS -- a separate node the arch core does not
map -- untouched.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Parametrize the OpenOCD RTOS gate tests over debugserver and debug so
both command paths that emit the optional Zephyr RTOS awareness command
are covered.
Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
OpenOCD's Zephyr RTOS awareness ('$_TARGETNAME configure -rtos Zephyr')
is only implemented for the cortex_m, cortex_r4, hla_target and arcv2
target architectures. supports_thread_info() only checked the OpenOCD
version, so with CONFIG_DEBUG_THREAD_INFO=y the runner appended the
command unconditionally. On other architectures (e.g. RISC-V, Xtensa)
OpenOCD then aborts with "Could not find target in Zephyr compatibility
list", which 'west debug' surfaces as a silent timeout.
Add target_supports_rtos(), which checks the build configuration for
CONFIG_CPU_CORTEX_M, CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_ISA_ARCV2,
and only append the -rtos command when the architecture supports it.
print_gdbserver_message() now reports that thread info is unavailable on
the architecture instead of implying it is enabled.
Add tests covering the arch gate and the existing version gate.
Fixes: #108804
Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
scripts/west_commands/build_helpers.py used `logging.getLogger(__name__)`,
which resolves to the bare string 'build_helpers' since the module is
loaded as a top-level script. That name collides with
scripts/pylib/build_helpers/domains.py, which grabs the same logger at
import time and attaches its own StreamHandler -- defeating the
hasHandlers() guard in forward_logging_to_west and causing
domains.py's handler to print records on our behalf, in its format.
Use an explicit flat name 'zephyr_build_helpers', exposed as a
BUILD_HELPERS_LOGGER constant so the three forward_logging_to_west
callers in build.py, run_common.py and sign.py share a single source
of truth. The name deliberately stays out of the 'west.*' namespace,
whose NullHandler would also defeat hasHandlers().
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add a logging bridge in build_helpers.py: WestLogHandler forwards
Python logging records to a WestCommand's inf/wrn/err/dbg methods,
and forward_logging_to_west(command, names) attaches one to the named
module loggers. Convert build_helpers / zcmake / run_common's
remaining log.X calls to the equivalent _logger methods, and have
each west command that calls into these helpers (build, export, sdk,
sign, run_common's entry points) call forward_logging_to_west on
entry so the records obey `west -v` / `west -vv`.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
In run_common.py and zcmake.py helpers without a WestCommand in scope,
swap `log.die(msg)` for `sys.exit(msg)` -- same
observable behavior (message to stderr, exit) without needing a
command instance.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Swap log.{die,err,wrn,inf,dbg} in run_common.py for the equivalent
methods on the invoking WestCommand. Translate the associated constants:
log.VERBOSE_VERY becomes Verbosity.DBG_MORE.
Pass the command instance the functions to dump.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The build command does not declare a `--verbose` argument of its own;
`self.args.verbose` only ever appears when west's top-level parser
injects it, which is not a stable contract. Use `self.verbosity`
(the WestCommand's own level) to decide whether to forward verbose
flags to the underlying build system.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add a script that looks at areas and identify test identifier per area.
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Temporarily disable qemu with robot. Some qemu jobs are not being
terminated correctly slowing CI execution.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Rename nrf5340_cpunet_iso to extra-iso so that the
configurations is reusable across nRF SoCs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Having an interface library named "mbedTLS" and the real library named
"mbedtls" (as provided by the Mbed TLS module) is misleading.
This commit replaces:
- mbedTLS -> mbedtls_iface for the CMake library. "mbedTLS" is still
available as alias to "mbedtls_iface" for backward
compatibility, but this should be removed in the future.
- mbedTLS -> Mbed TLS in comments and documentation.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Add a "west snippets" command to list available snippets, similar to
"west boards" and "west shields". Default display shows the snippets
along with their description. The "--format" parameter as used by
"west shields" is supported for user-controlled formatting.
Shell completion scripts for bash, zsh, and powershell are also
updated to support completion for snippet names.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Add a "description" property to the snippet YAML schema to allow
developers and scripts to understand the purpose. Populate existing
snippets with descriptions pulled from the rst documentation.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Now we are able to run tests using the Robot framework with Qemu.
Assisted-by: GitHub Copilot:claude-opus-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
os.path.commonpath will raise ValueError for paths with different
drives on Windows
Added new is_subpath method which handles ValueError and returns
False since it can't be a sub path. Replaces all 3 occurrences of
os.path.commonpath in walker.py.
Fixes#109641
Signed-off-by: Sebastian Modersohn <im24@msohn.de>
QEMUHandler.handle() reads the qemu pid file at the end of a run and
then unlinks it:
if os.path.exists(self.pid_fn):
with open(self.pid_fn) as pid_file:
qemu_pid = int(pid_file.read())
os.unlink(self.pid_fn)
The existence check, the open(), and the unlink() are not atomic.
When qemu exits on its own (slow benchmark hitting a harness
timeout, hostshutdown issued via the monitor, qemu killed by an
external signal, ...) it removes its own pid file. If that removal
lands between the os.path.exists() check and the read+unlink,
either open() or os.unlink() raises FileNotFoundError. The
exception escapes handle(), is caught in runner.py pipeline_mgr,
and the worker process exits, aborting the whole twister run.
Other tests that had not yet been scheduled never get to run, and
tests still in flight on other DUTs are abandoned.
Keep the existence check as the happy-path guard (so the no-pid-file
case still logs qemu_pid=None as before), and wrap the read+unlink
in a try/except FileNotFoundError to close the race window. A
missing pid file at cleanup time is not an error -- by definition
the qemu process is gone, which is exactly the post-condition the
cleanup is trying to reach.
Reproduced with a long-running benchmark in qemu where the guest
hit its harness eof and exited a few ms before twister got around
to the unlink. With this fix the failing test is marked FAILED and
the run continues; without it the pipeline aborts on the
FileNotFoundError.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Remove SOC_NORDIC_BSP_PATH_OVERRIDE from list of undefined Kconfigs,
as it's no longer used.
Signed-off-by: Magdalena Pastula <magdalena.pastula@nordicsemi.no>
This workflow has been running for a while, but it is dated, obsolete
and based on a very old action that is not being maintained anymore.
Most importantly, nobody actually looks at the output of that script.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Commit bfa00dcd1f ("cmake: pass Python information from west build to
CMake") changed WEST_TOPDIR from being obtained via
execute_process(COMMAND ${WEST} topdir) to being passed directly from
Python via -DWEST_TOPDIR=.
The west topdir CLI returns POSIX paths (C:/...) but the Python API
west_topdir() returns native Windows paths (C:\...). When this path
reaches check_c_compiler_flag via:
zephyr_cc_option(-fmacro-prefix-map=${WEST_TOPDIR}=WEST_TOPDIR)
CMake interprets \U (from \Users) as an invalid escape sequence,
breaking all Windows builds.
Use pathlib.Path.as_posix() to normalize the path, consistent with how
WEST_PYTHON is already handled on the same line.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Add to the valgrind suppression file a rule to waive the warning
about the hash_map code using realloc() with size 0 as free().
Valgrind warns because this is not standard behaviour, but
a (common) extension:
https://en.cppreference.com/c/memory/realloc
But this is the behaviour the API requires from a realloc used
with this component:
https://github.com/zephyrproject-rtos/zephyr/blob/main/include/zephyr/sys/hash_map_api.h#L76
As a freebie, add a license and copyright line to silence the CI check
warning
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Extend test_check_build_or_run() to verify both existing and
non-existing QEMU_BIN_PATH values.
The previous test used an empty QEMU_BIN_PATH value, which only
covered the falsy branch and did not exercise os.path.exists().
Add explicit checks for valid and invalid non-empty paths to
improve coverage of the QEMU_BIN_PATH validation logic.
Signed-off-by: Gobi M <gobi@aerlync.com>
QEMU_BIN_PATH is currently treated as a mandatory requirement for
QEMU-based tests on Windows.
Treat QEMU_BIN_PATH as an optional override and validate it only when
explicitly provided. This allows Twister to run QEMU tests using SDK or
other discovery mechanisms without requiring QEMU_BIN_PATH to be set.
Validation:
- QEMU_BIN_PATH unset -> qemu_x86 PASSED
- Invalid QEMU_BIN_PATH -> NOT RUN
- Valid QEMU_BIN_PATH -> qemu_x86 PASSED
Fixes#109332
Signed-off-by: Gobi M <gobi@aerlync.com>
Add a new testsuite YAML option `build` that allows a test
scenario to skip its own build step and instead use the build
artifacts from the first entry in `required_applications`.
Default is true; to skip building, set `build: false`.
This is useful for test scenarios that only run a harness (e.g.,
pytest, bsim) against an image built by another scenario, without
needing their own compiled binary.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
Add a compliance check that flags non-GIC MMU region entries in
mmu_regions.c files. Only lines added in the current changeset are
checked, so pre-existing entries do not block unrelated changes.
The check has three tiers:
- MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY: always flagged, these are
driver compat entries that should use DEVICE_MMIO.
- MMU_REGION_FLAT_ENTRY with MT_DEVICE: flagged unless GIC-related.
This catches blanket I/O aperture mappings and per-peripheral
entries like UART0 that should use DEVICE_MMIO. SoC infrastructure
entries (CCM, IOMUXC) are also flagged but the warning message asks
for a justifying comment.
- MMU_REGION_FLAT_ENTRY with MT_NORMAL or similar: flagged, these
memory regions (DRAM, SRAM) should use the zephyr,memory-attr
devicetree property instead.
GIC entries are always excluded as the interrupt controller cannot use
the device MMIO API.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Add the `DT_NODELABEL_C_TOKEN` and
`DT_NODELABEL_C_TOKEN_BY_IDX` macros to retrieve
the C symbolic name of a node.
Signed-off-by: James Roy <rruuaanng@outlook.com>
Add a parametrized pytest in scripts/tests/twister/ that exercises
apply_filters() for a testsuite whose integration_platforms list mixes
default and non-default platforms, asserting the documented platform
scope under both -G (integration mode) and the default mode.
The non-default path (no -G) silently regressed once in #32835 by
dropping integration_platforms from the per-testsuite scope; this test
pins both branches so a similar regression is caught in CI.
The fixture testsuite lives in a separate testsuites_integration/ tree
so that the shared all_testsuites_dict fixture, which calls
add_testsuites() before platforms are loaded, is not affected by the
new fixture's verify_platforms_existence() requirement.
Fixes#33247
Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
As twister already discovers failure reason,
only get additional information from build log.
Get info about oveflow details:
- build step
- memory kind
Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
Remove unnecessary second recovery call from nRF92,
as nRF92 is running Ironside SE, which already
performs a full erase of MRAM on recovery.
Signed-off-by: Ville Kujala <ville.kujala@nordicsemi.no>
This helps to diagnose issues when sys.exit is called with a string
as a parameter (as done e.g. in scripts/list_hardware.py).
Signed-off-by: Martin Jäger <martin@libre.solar>
Add documentation on the data-sources used the script to the
docstring. This helps users understand where the information
is coming from and how to update, for example, the per-region
memory reports.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Add a memory report tab for each memory region defined in
devicetree with compatible "zephyr,memory-region" that contains
at least one ELF section. This is helpful for viewing TCM memory
allocations for example.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Add a --filter-address-range START LENGTH argument that restricts the
report to ELF sections whose address range overlaps [START, START+LENGTH).
Sections outside the range are skipped entirely, so the generated tree
reflects only the memory region of interest.
This can be used to generate a TCM memory report for example.
Two related fixes are included:
- Symbols that fall outside all known sections are no longer added to
the unassigned bucket when a filter is active, eliminating spurious
"WARN: Symbol x is not in RAM or ROM" messages for every out-of-range
symbol.
- The (hidden) node size is clamped to zero to avoid a negative value
when a symbol's st_size extends past the boundary of its section (e.g.
due to alignment padding absorbed by an adjacent section that the
filter excludes).
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
This commit optimizes Python and west implementation and version
handling in Zephyr CMake when west is used for build invocation.
Following information are now passed from west build to CMake when
invoking CMake:
- Python properties as CMake list, this list follows the structure
of CMake's Python module INTERPRETER_PROPERTIES setting.
- West version information
- West topdir information
This removes the need for several execute_process invocation of Python
from within CMake itself.
If any setting is unknown or the list size changes, then Zephyr CMake
will automatically fallback to the generic implementation.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Replace the bare 'pytest' string in the Pytest harness command
with sys.executable and '-m' so the subprocess always uses the
same Python interpreter that runs twister. This avoids a
FileNotFoundError when pytest is not on PATH, which happens
e.g. when launching twister from a VS Code debug configuration
that does not activate the virtual environment.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
When added maintainers or collaborators lack the required GitHub access
level, emit GitHub Actions workflow-command annotations (::warning)
instead of failing the check, so it is purely informational and does
not block merging.
The canonical file path MAINTAINERS.yml (derived from the base-file
argument) is used as the annotation file= value. Previously the temp
file pr_MAINTAINERS.yml was used, which GitHub could not match to any
path in the PR diff, so no inline annotations were shown.
Update assigner.yml to use python3 and drop the now-unneeded --pr
argument.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Update the const value validation, to also include falsy constants, and
check for plain integer types in case of int/array property type.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
If the binding has a default property that is an int or an array of
integers, we verify for plain ints.
As bool is a subclass of int in Python we should check for non boolean
values.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>