Since 7235648f39
check_compliance LicenseAndCopyrightCheck needs reuse's custom_properties
API, which is not yet in a released package. Install it from the
reuse-tool repo as a temporary measure until a new release makes it to
PyPi.
Without this users who follow our getting started guide, or in general
install from this requirement file or with
`west packages pip --install`
won't be able to run this check locally, as
scripts/ci/check_compliance.py -m LicenseAndCopyrightCheck would fail with
AttributeError: 'AnnotationsItem' object has no attribute
'custom_properties'
error.
Users who already had installed reuse, will need to remove it first with
`pip uninstall -y reuse`
as both the previous official version and this new version report the same
version (6.2.0).
Note this commit is just pointing to the same version which other
requirement files modified in PR 113130 already point to.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
A sidecar could only discover a missing host tool in setup(), just
before executing the test image. The virtiofs sidecar then skipped
the instance at run time and logged a warning on every host without
a virtiofsd binary, which is noise on CI runners where the daemon is
simply not installed.
Introduce Sidecar.host_ready(), consulted from check_runnable() on a
configured sidecar at test-plan time. When the host lacks what the
sidecar needs, the instance is demoted to build-only, exactly like a
platform whose simulator executable is not installed, instead of the
gap surfacing as a late skip plus a warning. The virtiofs sidecar
implements the hook by checking that a virtiofsd binary was resolved;
the setup() guard remains as a safety net for forced runs.
Document the new lifecycle step and add unit tests for host_ready()
and for its wiring in check_runnable().
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Zephyr modules declare their binary blobs in module.yml, including the
blob's download URL, version, description and expected sha256. Surface
that provenance in the SBOM for blob files picked up during the walk:
as a FileComment in SPDX 2.3 output and as comment/description on the
software_File in SPDX 3.0 output.
Also cross-check the computed sha256 against the declared one while
scanning, warning when a linked blob does not match what its module
declares.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Vendor blobs (e.g. the STM32WBA BLE controller libraries or the ESP32
Wi-Fi/BT libraries) never appeared in the generated SBOM: the CMake
codemodel only expresses libraries built by other targets, and prebuilt
libraries only show up on the final link command line.
Resolve each linked target's link command fragments instead: path
fragments are used directly (libraries linked as imported targets, as
hal_stm32 does) and -lNAME flags are resolved against the -L search
directories (as hal_espressif does). Resolved libraries outside the
build directory are attributed to their owning component and get a
STATIC_LINK relationship from the target's build product.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Align with native_simulator's upstream main
38c1844c820760503463e63214b3a39783543243
Which includes:
38c1844 native irq_ctrl: Add is_pending API
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The JSON schema that validates zephyr/module.yml was a 130-line YAML
string embedded in zephyr_module.py, where it is easy to miss and reads
without highlighting or yamllint.
Move it to scripts/schemas/module-schema.yaml, next to the board, soc
and shield schemas, and load it the way list_boards.py loads its own.
The validation content is unchanged; the file gains the $id, title and
description that the sibling schemas carry, and is listed under the same
maintainer area as the module code that reads it.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The ZephyrUnittest package has printed a deprecation warning since
Zephyr 3.1, when it was replaced by the unittest component of the
Zephyr package: find_package(Zephyr COMPONENTS unittest). Remove the
package files, stop registering the package in west zephyr-export, and
drop the compatibility branch from ZephyrConfig.cmake.
Stale ZephyrUnittest entries in the CMake user package registry are
harmless: find_package(ZephyrUnittest) now simply fails to locate a
usable package instead of loading the compatibility shim.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Align with native_simulator's upstream main
eff1949a87a312928903b533e367bf7b62d382ec
Which includes:
eff1949 native: hw_timer: Add one shot API for the ticker
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
BoilerplateFilter uses a partial regular expression match when
classifying changed lines. This can cause substantive lines beginning
with comment delimiter characters, such as #define directives, to be
classified as boilerplate and consumed.
Match the complete changed line instead, while preserving support for
comment-prefixed SPDX and copyright lines.
Add regression coverage for delimiter-prefixed substantive changes and
verify that such files are not consumed.
Assisted-by: ChatGPT:GPT-5.6 Sol
Signed-off-by: Jeewoong Kim <dnd414@gmail.com>
Run the compliance checks in parallel by default, one worker per CPU.
Pass -p 1 to get the old sequential behavior.
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
A server can answer a blob download with a success status but a bogus
payload, for example redirecting a raw file request for a missing
repository to its sign-in page with a 200 status. Such a download passed
the fetch step and made 'west blobs fetch' stop at the first URL,
only to fail the checksum verification afterwards, without ever trying
the remaining fallback URLs.
Verify the SHA-256 digest of each download inside the URL loop and
treat a mismatch like a failed download, so the next URL is tried.
Success and failures are reported where they happen, returning early
on the first verified download. If every URL yields a mismatch the
last download is kept, preserving the detailed error message of the
final verification step.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Twister builds every test in its own directory, and ccache keys on that
directory: it appears in the compiler command line, and in the hash that
keeps debug info apart because Zephyr always builds with -g. An object
compiled for one test is therefore never reused by another.
Set base_dir and hash_dir for the builds twister spawns. Building 121
qemu_x86 configurations from an empty cache, cache hits go from 1.5% to
70% and wall time from 727 s to 488 s. The gain grows with the number of
tests built, as more of them find an object a sibling already compiled.
Anything already set in the environment is left alone. A reused object
records the build directory it was first compiled in, so its debug info
points there; Zephyr passes absolute source paths, so in practice only
files generated into the build directory are affected.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The KconfigHWMv2 check loads only the board and SoC Kconfig trees, so
references to symbols defined elsewhere in Zephyr surface as bare
kconfiglib "undefined symbol" warnings, which do not make the root
cause (a misplaced symbol reference) clear to developers.
Append probable causes and a fix suggestion to the failure message of
that check, and link its documentation to the board porting guide.
Fixes: #69838
Assisted-by: Claude:claude-fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Keep the generated licensing page complete: a non-Apache-2.0 file added to
the main tree without a documented exception (a REUSE.toml annotation with
a Zephyr-Description key) is now flagged. CC-BY-4.0 is accepted without an
exception on .rst sources only, per the project charter.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-4.8
Spotting a file that carries a license other than the project defaults
(Apache-2.0, or CC-BY-4.0 for docs) and is not yet described in REUSE.toml
meant eyeballing raw "reuse lint" output. Add a small helper, built on the
reuse library, that reports exactly those files, as a CLI and as an
importable function reused by the docs licensing page and the CI compliance
check.
Identifiers that reuse extracts from tooling source or malformed comment
banners but that SPDX does not recognize are ignored, so the report only
lists real licenses.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-4.8
The zephyr.licensing docs extension needs reuse's custom_properties API,
which is not yet in a released reuse. Install it from the reuse-tool repo
as a temporary measure until a new release makes it to PyPi.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-4.8
Expect that string provided in platform argument is part of the
target platform instead of an exact name match. This relaxed setting
allows to handle cases like:
- unify argument for multiple boards with the same SoC
- handle multiple versions of the same board
It also matches handling in the west build command implementation.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The path to STM32_Programmer_CLI inside the STM32CubeProgrammer macOS
app has changed between versions. Remove the architecture
based guess and instead check both subdirectories for existence.
Update the test accordingly.
Link: 21d3ec1106
Link: d8d90c087b
Signed-off-by: Mayank Chadha <mayankchadha1998@gmail.com>
gen_kobject_list.py aborts with "'ConstType' object has no attribute
'size'" when a kernel object is an array of const-qualified objects,
such as "const struct device dummy_devs[N]" in the I3C mem_slab driver.
ArrayType.get_kobjects() locates each element at addr + i * mt.size,
where mt is the array's element type. When the element is const, mt is
a ConstType, which delegated has_kobject() and get_kobjects() to its
child type but never exposed size, so accessing mt.size raised
AttributeError and stopped the build under CONFIG_USERSPACE.
Add a size property to ConstType that delegates to the underlying
type, mirroring the existing has_kobject()/get_kobjects() delegation.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Update regular expression in str2ident to replace percent sign (%)
character when creating identifiers.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Let downstream projects point the CMAKE_STYLE_MIXED_CASE_FILE
environment variable at an extra mixed-case command allow-list file,
forwarded to cmake_style.py as --mixed-case-file, mirroring the
UNDEF_KCONFIG_OUTSIDE_ALLOWLIST_FILE mechanism.
Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Replace the hardcoded MIXED_CASE_COMMANDS set with an allow-list file
shipped next to the script, and add a repeatable --mixed-case-file
argument that appends extra files to it. This gives downstream projects
a way to extend the lowercase-rule exceptions with their own mixed-case
commands.
Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
CONFIG_BT_FIXED_PASSKEY, bt_passkey_set() and BT_PASSKEY_INVALID were
deprecated in commit 82cfb5a056 ("Bluetooth: Host: Deprecate
BT_FIXED_PASSKEY"), released in Zephyr 4.3, in favour of the app_passkey
callback gated on CONFIG_BT_APP_PASSKEY. Two releases have passed, so
remove them.
The replacement covers what the option did: an application that returns a
constant from bt_conn_auth_cb.app_passkey gets a fixed passkey, and one
that returns BT_PASSKEY_RAND gets a Host generated one, which is what
BT_PASSKEY_INVALID was used to fall back to.
DISPLAY_FIXED() could only ever be true with a fixed passkey configured,
so the four conditions using it reduce to the JUST_WORKS test they were
already OR'd with. Likewise the two branches in get_io_capa() that
upgraded the reported capability when a fixed passkey was set collapse to
the values they already returned otherwise; the CONFIG_BT_APP_PASSKEY
block above them covers that case for the replacement API. Behaviour is
therefore unchanged for anyone not enabling the removed option.
Drop the accompanying build warning and the hardened.csv entry, both of
which existed only to steer users away from the option.
Fixes: #36005
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Assisted-by: Claude:claude-opus-5
Add gen defines and bnf for DT_BINDING_COMPAT_*, which allows
for getting a node's compatible string at compile time. Adds
DT_BINDING_COMPAT_TOKEN, DT_BINDING_COMPAT_UPPER_TOKEN, and
DT_BINDING_COMPAT_UNQUOTED.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
Nothing needs to call "west spdx --init" any more: a build with
CONFIG_BUILD_OUTPUT_META asks CMake for the file-based API object model
itself, so the build directory no longer has to be prepared before it is
configured.
Warn when it is used and note it in the docs, release notes and
migration guide. The option still works, so existing scripts and CI keep
running until it is removed.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
"west spdx" reads CMake's file-based API object model -- the codemodel
and toolchains replies -- to work out what went into a build. A file API
query has to exist in the build directory before CMake starts, so it
could not be created from the build system itself. Hence "west spdx
--init": a separate pass, run once per build directory before
configuring, easy to forget and recoverable only by reconfiguring.
CMake 3.27 added cmake_file_api(), which registers a query for the
current invocation and has the reply written at generation time. Zephyr
required CMake 3.20 until the floor was raised to 3.28, so the build can
now ask for its own object model and the pre-configure step goes away.
Tie it to CONFIG_BUILD_OUTPUT_META, which "west spdx" already requires:
it reads the zephyr.meta that option emits and bails without it. Builds
that are not producing an SBOM pay nothing.
This also covers sysbuild, where the query had to be created in each
domain's build directory -- one that does not exist until sysbuild has
configured it. Each domain is an ordinary Zephyr build, so each now
requests its own reply.
Cost, measured on hello_world and an LVGL sample for qemu_x86 with the
same tree and a warm ccache, varying only whether the query is present:
no measurable configure time (-0.02 s and +0.04 s median of 6 runs, both
inside run-to-run spread; CMake's generate phase does not move) and no
change to no-op rebuilds. The reply costs 1.1-1.4 MB of build-directory
disk. Without CONFIG_BUILD_OUTPUT_META no reply is written at all.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Align with native_simulator's upstream main
0d3eafc13a7bf37ef146da540986f99356ac48bd
Which includes:
0d3eafc native: hw_timer: split real time pacing from tick logic
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Cover the quoted-string exemption (single and double quotes) and that
comments and 'help' body text stay subject to the limit, with a macro
in help text still exempt. Keep the '$(...)' case on an unquoted line
so it exercises the macro branch independently of the quote branch.
Assisted-by: Claude Code:claude-opus-4.8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
A long quoted value (e.g. a path) or '$(...)' macro cannot be brought
under the 100-column limit: kconfiglib joins backslash continuations by
raw concatenation, so splitting the value injects the continuation's
leading whitespace into it. Exempt lines containing a quoted string
(single or double) too, not just macros. Comments and 'help' text are
re-wrappable prose and stay subject to the limit (a macro cited in help
text stays exempt, as it still cannot be split).
Assisted-by: Claude Code:claude-opus-4.8
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
dt_*_has_prop() functions from kconfigfunctions.py always the same
value ("y", aside dt_compat_any_not_has_prop() that always return "n")
when used with a boolean property defined the node DT bindings
since such property is always found whatever it is set to True or False.
Using such functions on boolean properties is not accurate and could
corrupt the target configuration.
When testing a DT boolean property, one should:
- use dt_node_bool_prop() instead of dt_node_has_prop(),
- use dt_nodelabel_bool_prop() instead of dt_nodelabel_has_prop(),
- use dt_compat_all_has_prop() with valid value parameter,
- use dt_compat_any_has_prop() with valid value parameter,
- not use dt_compat_any_not_has_prop().
This change makes configuration build stage to emit a warning message
upon such a wrong usage of these helper functions.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Stop glob-expanding the entries of a zephyr_code_relocate(FILES ...)
list. Expanding a pattern to several files has been deprecated since
Zephyr 4.2; the supported way is to expand it in CMake with
file(GLOB ...) and pass the resulting file names.
A pattern is now rejected with a named error instead of being silently
accepted, so the failure cannot go unnoticed. Entries without pattern
characters keep their current behaviour, including the "Not found"
warning for a missing file. All in-tree callers already pass explicit
file names.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
The backport issue check ran on pull_request_target purely so that it
could be granted pull-requests: write and post a comment telling the
contributor to add a "Fixes #<issue>" line. Nothing else in the job
needs the elevated trigger: it only reads the pull request body and
resolves the referenced issue, which a read-only token can do.
Switch the workflow to pull_request. GitHub only downgrades GITHUB_TOKEN
to read-only for pull requests coming from a fork, so pull requests from
a branch of this repository -- which is where the automated backports
opened by backport.yml come from -- still get a token that can comment.
The workflow now passes the new --comment flag to list_backports.py only
in that case, and for fork pull requests the check reports the same
guidance through an ::error:: annotation and the job summary instead.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
On long runs the scrolling console output makes it hard to tell what
twister is actually doing: what is queued, which pipeline stage every
job is in, and which tests already failed and why. Add a
--console-monitor option that replaces the normal output with a live,
top-style full-screen dashboard for the duration of the run.
The monitoring core (twisterlib/runmonitor.py) is transport-free: the
worker processes emit one plain-dict event per pipeline op
start/completion over a multiprocessing.Queue (put_nowait, dropped on
any error, so monitoring can never stall or fail the pipeline), and a
drain thread in the main process folds them into a thread-safe state
model with one row per test instance, initialized from the test plan
so statically filtered instances are visible too. The curses UI
(twisterlib/consolemonitor.py) runs in a thread of the main process
and reads that state in-process; other frontends (e.g. a web view)
can be layered on the same core later.
The dashboard shows overall progress with counters and an ETA, the
in-flight jobs with their current pipeline stage, and a scrollable
instance table with filter tabs. f jumps to the failures view, /
starts an incremental search over instance names and failure reasons,
and arrows or j/k plus Enter open a per-instance detail view: the
pipeline stage timeline, the failing test cases with their reasons,
and scrollable log tails (l switches between the available logs).
While the UI owns the terminal, console log handlers are detached
(everything still lands in twister.log) and restored when it exits;
the workers' single-line progress ticker is skipped; the handlers'
`stty sane` reset after local runs is suppressed and simulator
processes get /dev/null as stdin so nothing can knock the terminal
out of curses mode - the UI also re-asserts its terminal modes on
every poll tick as a backstop. These worker-side accommodations are
keyed to a shared UI-active flag (a module-level multiprocessing
Value inherited by the forked workers - deliberately not an options
attribute, since options travels inside pickled TestInstance objects
through the manager queues where a Value cannot go), so they all
revert the moment the UI exits.
Leaving the dashboard always hands the terminal back cleanly: q
mid-run resumes the normal console output (including the progress
ticker) while the run continues; when the run finishes the dashboard
stays up for inspecting failures and q then writes the reports and
exits as usual; Ctrl-C aborts the run, shuts the dashboard down
without waiting for a keypress, and skips any retry iterations. The
option requires an interactive terminal and curses, and is ignored
with a warning otherwise (e.g. in CI).
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The pyocd runner no longer reads the PYOCD_DAPARG environment variable
as a fallback for an unset --daparg. Pass --daparg on the command line
instead.
Deprecated in Zephyr 4.2 or earlier.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
Remove the --skip-rebuild option shared by the west commands that invoke
a runner (flash, debug, debugserver, attach, rtt, reset, robot and
simulate), along with its handling in skip_rebuild(). Use --no-rebuild,
the negative half of the --rebuild option, instead.
With --skip-rebuild gone, --rebuild is the only remaining member of its
mutually exclusive group, so the group is dropped and the option is
added directly to the enclosing argument group; help output and
behaviour are unchanged.
Deprecated in Zephyr 4.3.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
Remove the UART dictionary log parser shim, which since its deprecation
has only translated its arguments and handed over to live_log_parser.py.
Use live_log_parser.py directly, passing the port and baud rate after a
"serial" sub-command.
The 4.3 migration guide entry now spells the script as plain literal
text, as :zephyr_file: only resolves for files still in the tree.
Deprecated in Zephyr 4.3.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
extract_string_variables() rendered each const-char variable's location
expression to text and matched it against a "(DW_OP_addr: <hex>)" regex.
DWARF 5 expresses a static address as DW_OP_addrx - an index into
.debug_addr - which pyelftools renders as "(<unknown DW_OP_addrx>)", so
the regex missed it and the string was dropped from the dictionary
database. That corrupts %s output in dictionary-based logging.
GCC still emits DW_OP_addr regardless of DWARF version, so GCC builds are
unaffected; Clang emits DW_OP_addrx under DWARF 5, so its builds regress
the moment -gdwarf-4 is dropped, the same way gen_kobject_list did.
Parse the expression's leading opcode directly with DWARFExprParser
instead of scraping its text form: read the inline address for
DW_OP_addr, and resolve the index through DWARFInfo.get_addr() for
DW_OP_addrx. The text form of addrx never carried the address anyway.
Verified with arm-none-eabi Clang -gdwarf-4 and -gdwarf-5: both recover
the same string addresses; before, the v5 build recovered none.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
analyze_die_array() read an array's element count from the subrange's
DW_AT_upper_bound / DW_AT_count only when the attribute used a
DW_FORM_dataN form, and skipped the subrange otherwise. DWARF v5 GCC
encodes a constant upper bound as DW_FORM_implicit_const, which was
therefore dropped: the array looked unbounded and a stack array
collapsed to a single element via the STACK_TYPE fallback.
For userspace that is silent corruption. A K_THREAD_STACK_ARRAY_DEFINE
of N stacks registered only its first element as a kernel object, so
threads using the other stacks were denied at the MPU boundary and the
image faulted at boot. kernel.memory_protection.sys_sem crashed on
every GCC target once -gdwarf-4 was dropped; LLVM was unaffected because
it still emits DW_FORM_dataN here.
Accept the constant-class forms - implicit_const and the signed/unsigned
LEB forms alongside dataN - via a small helper, and keep skipping
non-constant forms (an exprloc/block dynamic bound is not a count).
Verified on mps2/an385: the DWARF v5 GCC build of that test found 46
kernel objects (was 44 - the two missing array stacks) and now boots and
passes 14/14 cases.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The variable scan accepted only DW_OP_addr, where the address is
inline in the expression. DWARF v5 added DW_OP_addrx, which carries a
ULEB128 index into .debug_addr instead, and Clang emits it for static
storage. Every kernel object then hit the "unexpected exprloc opcode"
path and was dropped, leaving an empty kobject_prebuilt_hash.gperf and
failing the build outright:
WARNING: zero kobject found in [...]
kobject_prebuilt_hash.gperf: No keywords in input file!
GCC does not reach this: it emits DW_OP_addr regardless of -gdwarf-N.
So this is invisible until an LLVM build meets DWARF v5, which is why
it surfaces with the -gdwarf-4 removal rather than before it.
Resolve the index through pyelftools' DWARFInfo.get_addr(). The
DW_OP_plus_uconst that may follow is handled as before, the ULEB128
decoder already returning the offset just past the operand.
Verified with arm-none-eabi Clang -gdwarf-4 and -gdwarf-5: both now
resolve the same addresses for extern and static objects.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Two defects in the same three lines:
- The directory table was indexed as includes[dir_index - 1] with no
case for dir_index == 0. Up to DWARF v4 index 0 means "the
compilation directory" and is not in the table, so this wraps to
includes[-1] - the last unrelated directory - or raises IndexError
outright on the empty table GCC commonly emits. debug_die() therefore
throws today on ordinary GCC output.
- The file table was assumed 1-based. DWARF v5 made it 0-based, so
every index is off by one there.
Both only affect debug/warning text, not generated output, which is why
this has gone unnoticed. Branch on the line program version and handle
directory index 0 explicitly.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
get_die_filename() resolved DW_AT_decl_file against the pre-v5 layout
unconditionally: a 1-based file table, with directory index 0 meaning
"the compilation directory" rather than a table entry.
DWARF v5 renumbered both tables to be 0-based and made directory 0 an
explicit entry holding the compilation directory. Against a v5 line
program every index is therefore off by one and each symbol is
attributed to the neighbouring source file - main() gets reported as
living in the header it includes. Nothing raises; the ROM/RAM report is
simply wrong.
Zephyr does not hit this today only because -gdwarf-4 is forced. Note
that GCC is insulated twice over: it emits .loc directives and leaves
the line table to GAS, which still defaults to v3 regardless of
-gdwarf-N. Clang uses its integrated assembler and emits v5 line tables
directly, so LLVM builds regress the moment the forced flag is dropped.
Branch on the line program's own header version.
Verified with arm-none-eabi Clang and Zephyr SDK arm-zephyr-eabi GCC
14.3 across -gdwarf-4, -gdwarf-5 and -Wa,--gdwarf-5 (line programs
v3/v4/v5): all five now attribute identically and correctly.
Assisted-by: Claude:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
k_sleep(), k_msleep() and k_usleep() are declared in kernel.h today.
Later commits grow that API with a tick based primitive plus inline unit
conversions, which is more than kernel.h ought to carry for a single
service.
Move the three declarations verbatim into a new include/zephyr/sleep.h
and have kernel.h include it, so existing users need no change. The new
header has to be registered with zephyr_syscall_header(), otherwise the
marshalling stubs for k_sleep() and k_usleep() stop being generated and
CONFIG_USERSPACE builds fail to find k_sleep_mrsh.c.
The unit_testing platform fabricates empty stand ins for the generated
syscall headers rather than running the generator, so sleep.h has to be
added to that list too. Without it any unit test reaching kernel.h fails
to find zephyr/syscalls/sleep.h.
The sleep syscalls also have to be excluded from the automatic syscall
tracing in gen_syscalls.py, as kernel.h already is. They carry hand
written trace points in kernel/sleep.c, and without the exclusion the
generated wrapper would wrap every call in a second set.
No functional change. A test application built for nucleo_f030r8 comes
out byte identical, at 10952 bytes of FLASH before and after.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add a sample implementing the vendor request protocol of the
I2C-Tiny-USB project on top of the new USB device stack and the I2C
driver API. It makes a Zephyr board enumerate as a USB to I2C adapter
that works out of the box with the Linux i2c-tiny-usb bus driver, so
the I2C bus of the board can be accessed from the host with the
i2c-dev interface and the usual i2c-tools.
Commands addressed to the interface are handled by a minimal USB
function with a vendor specific interface without endpoints, while the
I2C transfer commands, which carry the target address in wIndex, are
handled with device vendor request nodes. Messages belonging to the
same I2C transaction are collected and executed in a single I2C
transfer to preserve repeated start conditions.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Align with native_simulator's upstream main
3f81511a813ca38e9afac430f15a19ee53c9f407
Which includes:
3f81511 native: timer_model: Improvements
bc98cfe nsi_errno: Fix typo in comment
8961d7a nsi_scheduler: Terminate gracefully at end of time if no end of
time set
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
find_owning_component() returned the application component as soon as a
source file lived under the application source directory, before zephyr
and module components were considered. A module nested under the
application (or under the zephyr tree) was therefore mis-attributed to
the app package instead of its own module package.
Fold the app component into the same deepest-base_dir selection already
used for the zephyr and module components, so each file is assigned to
its most specific (true) owner regardless of check order.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:sonnet-5
get_expression_data() reimplemented, with a cruder regex, what REUSE's
own reuse_info_of() already does: parse the in-file
SPDX-License-Identifier tag and apply precedence against REUSE.toml.
Drop get_expression_data(), parse_line_for_expression(), and the now
unused num_lines_scanned option; rely solely on get_reuse_info().
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:sonnet-5
get_copyright_info() built its REUSE Project with the bare Project()
constructor, which never loads REUSE.toml - only
Project.from_directory() does, so bulk licensing data was never read.
Build one Project.from_directory(component.base_dir) per component.
Rename get_copyright_info() to get_reuse_info(), also returning
license expressions used in scan_sbom_graph() when a file has no
in-file SPDX-License-Identifier tag, and quiet the reuse library's
logger to avoid noise from newly-surfaced compliance warnings.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:sonnet-5
Update the allowed upper version limit to 3.3. This removes
the warning about outdated gperf version.
Skimming through the changelog from v3.1 to v3.3 and most of
the changes are doc and tool related.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>