Add the option to flash a bin file if one is available from the board's
cmake configuration.
Use of elf has prio over this, and bin has prio over hex which remains
the default option.
Also add a parameter to stm32cubeprogrammer runner to specify the download
address.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
The src-module argument can be used to select the module in which west
patch searches for patch definitions. This commit also allows the use of
module names instead of the path.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
Read and convert binary data in chunks of 1024 bytes, instead of 8 bytes.
This significantly reduces the conversion time. The improvement increases
with increasing file sizes but saturates to around 60-61% as file size
approaches 64MiB, and beyond.
The existing generated output format of eight byte-values per line is still
preserved.
Signed-off-by: Irfan Ahmad <irfan.ahmad@siemens.com>
Instead of pre-generating the JSON batch to then execute it, use
command-line arguments and --x-append-batch to generate the JSON file
tht will then be passed to x-execute-batch.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add 'images' as valid list in build info schema.
This allow sysbuild and regular Zephyr images to populate build_info.yml
with images included in the build.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The ELF format allows for multiple string and symbol tables with
complex references between them. This is especially evident when
debugging information is included.
This patch fixes the issues that have been identified with multiple
string tables to allow LLEXT to properly parse those files:
* The symbol table used by LLEXT (LLEXT_MEM_SYMTAB) is now chosen
depending on the loaded file type, and other tables are ignored.
This change is also applied to the SLID injection script.
* The LLEXT string table (LLEXT_MEM_SYMTAB) is now correctly identified
by the symbol table reference, instead of picking the first one.
* VMA range checks only make sense for allocated sections.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Updated the code to use the font_color property, which
is the correct attribute for setting the text color in
recent versions of xlsxwriter (3.2.1).
Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
Refactor Reporting to use custom ReportingJSONEncoder and encode
all pathlib.Path derived instances there which are possible
e.g. in 'environment.options' received from command line.
Fixes: #83823
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
The exception stack frame type `z_arch_esf_t` had been deprecated
since #73593 for 2 releases, it is not used in the kernel since, and
applications/drivers should have been updated to use the
`struct arch_esf` now, remove it.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Add a new "hash" attribute to all Devicetree EDT nodes. The hash is
calculated on the full path of the node; this means that its value
remains stable across rebuilds.
The hash is checked for uniqueness among nodes in the same EDT.
This computed token is then added to `devicetree_generated.h` and made
accessible to Zephyr code via a new DT_NODE_HASH(node_id) macro.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add support for the `--erase` option on `west flash`, for boards that
specify at least one `--cmd-erase` option.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add a gh-fetch subcommand to the west patch extension to download a patch
file from Github and generate the patch meta data.
The patch info is appended to the patches.yml file.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The motivation for this patch was to improve the script's performance,
but some stylistic changes and cleanups are included as well.
The main optimization concerns the use of PyYAML, as it offers multiple
functions for interpreting YAML. The commonly used `load`/`safe_load`
converts a YAML stream to a dictionary. There are also `scan`, `parse`,
and `compose`, which return intermediate representations, the last one
being a graph. [1]
Since `gen_driver_kconfig_dts` scans DT bindings for compatible strings,
it only needs to look through top level keys in YAML. The intermediate
PyYAML graph is sufficient for this, and using it reduces the script's
execution time by about 30%, without making the code too complicated.
[1] - https://pyyaml.org/wiki/PyYAMLDocumentation
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
Introduce sysbuild-specific variants of existing Kconfig checks:
* SysbuildKconfig
* SysbuildKconfigBasic
* SysbuildKconfigBasicNoModules
This involves a few additions to the base `KconfigCheck` class:
* Supporting a variable symbol prefix, to handle `SB_CONFIG_`.
* Generating extra files, including `Kconfig.sysbuild.modules`.
Although these are never sourced outside of sysbuild Kconfig,
they're still generated for every regular Zephyr build, so it's
natural to let all Kconfig checks follow this behavior.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
The KCONFIG_BINARY_DIR/{boards,soc,arch}/ directories are only relevant
for `KconfigCheck.get_v2_model()`, so generate them within this method.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
HWMv1-specific Kconfig checks were meant to be removed before HWMv2 was
merged into `main` (see `collab-hwm` history), but some traces remained.
Do another round of cleanup.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
So far, the behavior of different Kconfig checks has been parametrized
using the `run()` method, and every new check has introduced with it a
new argument to that method.
It's possible to replace each `run()` argument by way of overriding
different class methods and making better use of inheritance:
free=False Stub check_no_undef_outside_kconfig()
no_modules=True Stub get_modules()
filename Introduce class member FILENAME
hwm (unused)
This should establish a more scalable and straightforward pattern for
adding future Kconfig checks. It also favors composability, which will
come in handy when implementing checks for sysbuild Kconfig.
Additionally, avoid duplicating `doc` and `path_hint` in every subclass.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
Device adapter strips all whitespace from output lines causing test
failures when matching default shell prompt "uart:~$ " with trailing
space. Update _handle_device_output to only strip line endings (\r\n)
while preserving whitespace required for prompt detection.
A testcase sample.pytest.shell.no_vt100 was added to verify prompt
matching works with CONFIG_SHELL_VT100_COLORS disabled.
Signed-off-by: Thomas Günther <thomas.guenther@limatica.com>
This commit removes all references to the `xtools` toolchain variant in the
twister scripts.
Note that the `xtools` toolchain variant has been deprecated since Zephyr
v3.3.0 and now removed.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Extend Twister Harness 'recording' feature to allow multiple
regular expression patterns to extract different types of records
from test output.
Add 'merge' recording mode to collect all extracted data fields
into a single record object of the test instance.
Export to CSV file now takes all field names occurred in the collected
records, sort it alphabetically, and then use it for columns instead of
using only the first record's fields. This is done to address possible
situation when records have different set of fields.
Adjust Twister documentation and test suite to the above changes.
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Make scripts with an interpreter line executable so that they can be
invoked directly.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
JLink refuses new RTT telnet connections for a few moments after a socket
closes. This causes an issue when using `nc` as the telnet viewer, since
JLink would deny the connection. To resolve this, keep the "ping" socket
we use to determine if the RTT viewer is active connected, and use that
socket for RTT communication.
Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
Add an argument `--esp-encrypt` to flash an ESP32 series chip with
encrypted flash.
The content of the binary is encrypted on the fly by the chip. It is
not required to know the encryption key. However, the fuses that
disable encrypted flash download must be kept enabled for this to work.
Signed-off-by: Martin Jäger <martin@libre.solar>
Mostly a revert of commit b1def7145f ("arch: deprecate `_current`").
This commit was part of PR #80716 whose initial purpose was about providing
an architecture specific optimization for _current. The actual deprecation
was sneaked in later on without proper discussion.
The Zephyr core always used _current before and that was fine. It is quite
prevalent as well and the alternative is proving rather verbose.
Furthermore, as a concept, the "current thread" is not something that is
necessarily architecture specific. Therefore the primary abstraction
should not carry the arch_ prefix.
Hence this revert.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
not force host variant if environment is setting something different in
the case of posix arch.
Fixes#83766
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The Espressif branch of OpenOCD uses the version string "v0.12.0" instead
of "0.12.0" causing the version regex match to fail.
Add an optional 'v' prefix to avoid the failure.
Fixes: #83373
Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
Add a series of unit tests which try to cover somewhat systematically
the possible inputs and what we finally get at the exit
of the Binding constructor.
Running the assumption that any (valid) YAML binding file is
something we can make a Binding instance with:
- check which properties are defined at which level (binding,
child-binding, grandchild-binding, etc) and their specifications
once the binding is initialized
- check how including bindings are permitted to specialize
the specifications of inherited properties
- check the rules applied when overwriting a binding's description
or compatible string (at the binding, child-binding, etc, levels)
Some tests covering known issues are disabled by default:
- this permits to document these issues
- while not causing CI errors (when running the python-devicetree
unit tests)
- enabling these tests without causing errors should allow us
to consider the related issues are fixed
Signed-off-by: Christophe Dufaza <chris@openmarl.org>
Add runners entry to the module schema and import the file specified.
Every class that inherits from ZephyrBinaryRunner will be discovered and
added to runners list.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Added integration_toolchains to allow building/testing with multiple
toolchains available in the environment.
This changes the output structure and adds another level in the path
under twister_out signifying the toolchain used. The toolchain used
(variant) is also part of the json output now.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Since "JLink.exe" is also an executable distributed with JDK's, do an
explicit search on the standard SEGGER install directories for a JTAG
"JLink.exe" before falling back to whatever is first on PATH.
Fixes#51825.
Signed-off-by: Jordan Yates <jordan@embeint.com>
DIR is a POSIX type defined via the dirent.h header.
In Zephyr, we define it as `typedef void DIR`, since it is only
ever described via a pointer (much like `FILE`).
However, in checkpatch.pl, functions that return DIR* or accept
a DIR* argument are met with an error of the form below:
```
ERROR:SPACING: need consistent spacing around '*' (ctx:WxV)
```
Examples that trigger this false positive are, for example
```cpp
int dirfd(DIR *dirp);
DIR *fdopendir(int fd);
```
Include `DIR` as a class of specific POSIX types that should be
matched as types rather than other tokens.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
When looking at git author in a commit range using git log, explicitly
indicate we don't want to use the mailmap file (default git client
behavior is to use it), so that the "actual" author info from the commit
is used to perform the compliance check, and not whatever identity the
author may have mapped to in the mailmap file (ex. their "main" email
address might be different from the one they used to commit).
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The cleanup pass (336c7da) to address long lines accidentally
removed a needed comma in the jlink runner.
Fixes#83605
Signed-off-by: David Leach <david.leach@nxp.com>
Using `west patch` with the `--patch-base`, `--patch-yaml` or
`--west-workspace` option results in an unhandled AttributeError in
filter_args() because the function expects these args to be of type
path. Adding the type to the argument definition forces argparse to
create variables of type path.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
scripts/checkpatch.pl was written originally for the Linux kernel, and
its code reflects the kernel's coding style. In particular, it has
checks for unneeded braces around single-statement if/else/for/while
conditions. In Zephyr however, braces are always required, and so the
checks needed modifying to verify the opposite condition.
In order to enable the now-compatible checks, we also remove the
--ignore BRACES statement in .checkpatch.conf.
Limitations: the current code works well if there are not conditional
statements (e.g. #if, #ifdef or #endif) next to the if/else/for/while
conditions. This is rarely the case, but triggers with the Bluetooth
controller in code like this:
```
#if defined(CONFIG_BT_PERIPHERAL)
if (!lll->is_hdcd)
#endif /* CONFIG_BT_PERIPHERAL */
{
```
```
} else
#endif /* CONFIG_BT_CTLR_PRIVACY */
{
```
```
#if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
if (lll->cte_started) {
radio_switch_complete(phy_s, 0, phy_s, 0);
} else
#endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
{
```
```
#ifdef DUAL_BANK
while ((FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW) ||
(FLASH_STM32_REGS(dev)->SR2 & FLASH_SR_QW))
#else
while (FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW)
#endif
{
```
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add support for .cold and .coldrodata sections, used to implement
a cold module. Assigning code and read-only data to those sections
makes them suitable for use in a cold module, stored and executed in
slow memory.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Adds support for sysbuild loading snippets, these can be included
by using e.g.: cmake ... -DSB_SNIPPET=blah for sysbuild
directly or can be used with an application and sysbuild using
-DSNIPPET. Snippets for sysbuild can use SB_EXTRA_CONF_FILE in the
snippet file to specify an extra Kconfig fragment for sysbuild
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
In smaller projects and organizations, forking Zephyr is usually
a tenable solution for development continuity, in the case that
bug-fixes or enhancements need to be applied to Zephyr to
unblock development.
In larger organizations, perhaps in the absence of healthy patch
management, technical debt management, and open-source policies,
forking and in-tree changes can quickly get out of hand.
In other organizations, it may simply be preferable to have a
zero-forking / upstream-first policy.
Regardless of the reason, this change adds a `west patch`
command that enables users to manage patches locally in their
modules, under version control, with complete transparence.
The format of the YAML file (detailed in a previous comit)
includes fields for filename, checksum, author, email, dates,
along with pr and issue links. There are fields indicating
whether the patch is upstreamble or whether it has been merged
upstream already. There is a custom field that is not validated
and can be used for any purpose.
Workflows can be created to notify maintainers when a merged
patch may be discarded after a version or a commit bump.
In Zephyr modules, the file resides conventionally under
`zephyr/patches.yml`, and patch files reside under
`zephyr/patches/`.
Sample usage applying patches (the `-v` argument for additional
detail):
```shell
west -v patch apply
reading patch file zephyr/run-tests-with-rtt-console.patch
checking patch integrity... OK
patching zephyr... OK
reading patch file zephyr/twister-rtt-support.patch
checking patch integrity... OK
patching zephyr... OK
reading patch file zephyr/multiple_icntl.patch
checking patch integrity... OK
patching zephyr... OK
reading patch file zephyr/move-bss-to-end.patch
checking patch integrity... OK
patching zephyr... OK
4 patches applied successfully \o/
```
Cleaning previously applied patches
```shell
west patch clean
```
After manually corrupting a patch file (the `-r` option will
automatically roll-back all changes if one patch fails)
```shell
west -v patch apply -r
reading patch file zephyr/run-tests-with-rtt-console.patch
checking patch integrity... OK
patching zephyr... OK
reading patch file zephyr/twister-rtt-support.patch
checking patch integrity... OK
patching zephyr... OK
reading patch file zephyr/multiple_icntl.patch
checking patch integrity... OK
patching zephyr... OK
reading patch file zephyr/move-bss-to-end.patch
checking patch integrity... FAIL
ERROR: sha256 mismatch for zephyr/move-bss-to-end.patch:
expect: 00e42e5d89f68f8b07e355821cfcf492faa2f96b506bbe87a9b35a823fd719cb
actual: b9900e0c9472a0aaae975370b478bb26945c068497fa63ff409b21d677e5b89f
Cleaning zephyr
FATAL ERROR: failed to apply patch zephyr/move-bss-to-end.patch
```
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>