Commit graph

5588 commits

Author SHA1 Message Date
Anas Nashif
a0d204c1f3 actions: add gitpython to requirements-actions.in
Needed for various workflows.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-31 11:29:31 +02:00
Arkadiusz Cholewinski
35b13e1629 Twister: Add power measurements support for Twister.
Add support for powerShield of stm32l562e_dk board.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2025-03-31 08:06:25 +02:00
Anas Nashif
19c6240b68 tests: twister: disable test_inline_logs temporarily
This test fails on older python versions (3.10) and only on CI.
Disabling it while we investigate. The test itself verifies inline logs
options, so the functionality test is not impacted.

Tracked in #87769

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-29 07:44:46 -04:00
Anas Nashif
11ece85d1b ci: workflows: pin python dependencies
Pin python dependencies to hashes and cleanup/unify python setup steps in
various workflows.

We now have one dependency file containing all requirements for github
actions that is managed centrally with hashes. No direct pip installs
are needed in workflow files and everything shall go via the
requirements file.

Pinning to specific version and hashes helps with preventing supply
chain attacks.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-29 07:44:46 -04:00
Galen Krulce
5ae9f44825 code_relocation: Cache list of obj files
As part of relocation, this script matches each source file to its
corresponding object file. This matching is done inside of get_obj_filename
which is called once per source file.

get_obj_filename traverses the entire build directory on every invocation.
This is unnecessary since built object files don't change. On a
sufficiently large project (like mine), this script takes over a minute and
the majority of that time is spent needlessly traversing the build
directory again and again.

Caching the list of object files enables this script to run in less than a
second.

I tested by building my project (which enables the relocation script) and
comparing memory breakdown before / after.

Signed-off-by: Galen Krulce <gkrulce@meta.com>
2025-03-28 16:17:11 +01:00
James Roy
9b795840f9 style: edtlib: Remove the redundant keys() method
Remove the redundant keys method when using the
in statement on a dict to fix the Ruff SIM118
warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
8a2cde9688 style: edtlib: Use from to chain the exception
Use the from keyword to chain exceptions in
order to fix the Ruff B904 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
826ddaed97 style: edtlib: Use the more readable not-equal operator
Replace 'not xx == xx' with 'xx != xx' to
fix the Ruff SIM201 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
b543c26548 style: edtlib: Reorganize the single-line if statement block
Move the statement in the single-line if block
to a new line to fix the Ruff E701 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
8bf5fd9668 style: edtlib: Remove the redundant call arguments
Remove the redundant positional argument in
open function to fix the Ruff UP015 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
7207e91972 style: edtlib: Merge redundant if statements
Merge redundant if statements to fix the Ruff
SIM102 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
20d8a47ad1 style: edtlib: Use a more readable not in statement
Replace 'not xx in xx' with the more readable
'xx not in xx' syntax to fix the Ruff E713 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
8b142ded55 style: edtlib: Sort the import statements
Sort the import statements to fix the
Ruff I001 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
f2eb205d6d style: edtlib: Add an explicit strict argument to the zip
Add an explicit strict parameter to the zip
function to fix the Ruff B905 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
9e46536a1f style: edtlib: Remove deprecated packages
Remove imported deprecated packages and replace
with new packages to fix Ruff UP035 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
James Roy
1425de54e7 style: edtlib: Remove unnecessary quotes
Remove unnecessary quotes from deferred type
annotations to fix the Ruff UP037 warning.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-28 12:22:00 +01:00
Reto Schneider
67834a84c9 twister: Add missing spaces
This adds some missing whitespaces, thus improves the output of `twister
--help`.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2025-03-27 17:18:04 +01:00
Björn Bergman
6c197f8961 scripts: Make gen_app_partitions.py cmake linker generator savvy
Tweak gen_app_partitions.py to be able to generate cmake linker
generator output as well as ld-script fragments.

Signed-off-by: Björn Bergman <bjorn.bergman@iar.com>
2025-03-27 17:17:03 +01:00
Anas Nashif
56c5e93cb7 ci: add empty CODEOWNERS file
Add an empty codeowner file redirecting to MAINTAINERSS.yml file for
clarity and to make some tooling happy.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-27 09:50:45 +01:00
Hake Huang
c5aacbc22a twister: runner: --prep-artifacts-for-testing protection
need add protection when check with sysbuild filter out
application, the domains is NULL

fixes: #87163

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2025-03-27 03:50:04 +01:00
Helmut Lord
1b6feab090 scripts: west: commands: completion: zsh: add "west shields" completion
Adds west shields completion to zsh, matching funtionality found in bash
autocomplete.

Signed-off-by: Helmut Lord <kellyhlord@gmail.com>
2025-03-26 21:56:33 +01:00
Grzegorz Chwierut
5d049b6451 twister: Fix quarantine filtering simulations
Quarantine filter was not correctly identifying the simulator name.
Now it uses the simulator name from the Platform object,
ensuring that quarantined tests are properly excluded or verified

Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
2025-03-24 19:23:31 +01:00
Lukasz Mrugala
6ef4db88dd twister: Remove unrecognised sections test
The section lists that govern whether the ELF
section is recognised or not are out of date.

A programming bug has rendered the unrecognised
section check unrunnable for years.

Thus, the practically dead code of the
unrecognised section check is removed
in this commit.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2025-03-24 07:53:01 +01:00
Anas Nashif
173468ca53 twister: filters: fix processing of platform scope
Optimize code and fix process being killed when llaunched with --all.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-23 10:15:30 -04:00
Anas Nashif
56f7dc4c2e scripts: make sure we do not install vulunerable python packages
Make sure we install packages with no issues, some of the issues being
reporting on packages we might install using pip:

Warn: Project is vulnerable to: PYSEC-2019-41 / GHSA-qfc5-mcwq-26q8
Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc
Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56
Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h
Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg
Warn: Project is vulnerable to: PYSEC-2017-74
Warn: Project is vulnerable to: GHSA-55x5-fj6c-h6m8
Warn: Project is vulnerable to: PYSEC-2014-9 / GHSA-57qw-cc2g-pv5p
Warn: Project is vulnerable to: PYSEC-2021-19 / GHSA-jq4v-f5q6-mjqq
Warn: Project is vulnerable to: GHSA-pgww-xf46-h92r
Warn: Project is vulnerable to: PYSEC-2022-230 / GHSA-wrxv-2j5q-m38w
Warn: Project is vulnerable to: PYSEC-2018-12 / GHSA-xp26-p53h-6h2p
Warn: Project is vulnerable to: PYSEC-2024-4 / GHSA-2mqj-m65w-jghx
Warn: Project is vulnerable to: PYSEC-2023-165 / GHSA-cwvm-v4w8-q58c
Warn: Project is vulnerable to: PYSEC-2022-42992 / GHSA-hcpj-qp55-gfph
Warn: Project is vulnerable to: PYSEC-2023-137 / GHSA-pr76-5cm5-w9cj
Warn: Project is vulnerable to: PYSEC-2023-161 / GHSA-wfm5-v35h-vwf4
Warn: Project is vulnerable to: GHSA-3f63-hfp8-52jq
Warn: Project is vulnerable to: GHSA-44wm-f244-xhp3
Warn: Project is vulnerable to: GHSA-56pw-mpj4-fxww
Warn: Project is vulnerable to: GHSA-j7hp-h8jx-5ppr
Warn: Project is vulnerable to: PYSEC-2023-175
Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h
Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6
Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf
Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc
Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f
Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm
Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52
Warn: Project is vulnerable to: GHSA-c6fm-rgw4-8q73

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-22 14:03:56 -04:00
Lukasz Fundakowski
d45396a6bb twister: Cleanup twister loggers
Removed logger.setLevel(...) from all twister modules, becasue
there should be only one place where twister loggers are configured,
and the log level should be set in that place.
This should be done in twister_main.py in setup_logging function.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-03-19 09:08:00 -04:00
Anas Nashif
b0792bbfa2 twister: config: test on integration plaforms if defined
Add option to force integration mode on a defined list of tests, for
example tests for sample that are identified with 'sample.'.

A sample per definition shall be tested on documented and supported
platforms listed in the sample documentation. Samples shall not be used
as tests to verify functionality of a feature on all available plaforms
in Zephyr.

To still allow testing on platforms not listed in the doc, and when such
platforms are covered by the provided filter, we should still be able to
build/run the tests on those platforms (not directly listed in
integration_platforms).

We detect a sample by its test identifier, i.e., it starts with 'sample.'.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-19 08:51:50 -04:00
Camille BAUD
9ad7f840bf west: runners: Do not ignore --no-reset in command line or arguments
Prevents this code section from enforcing reset even
if --no-reset was passed at some point

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-03-19 01:24:17 +01:00
Carles Cufi
bb1794bf3a west: runners: jlink: Use registry to locate JLink executable
Instead of hardcoding a set of paths and trying to find the JLink
executable in them, use the corresponding Windows registry to locate it:

`HKEY_CURRENT_USER\\Software\\SEGGER\\J-Link`

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-03-18 19:54:14 +01:00
Carles Cufi
4c12a8c782 west: runners: jlink: Avoid running logic when another runner is used
The logic to detect the default JLink location was placed at the top of
the script, executing whenever the script was imported. The west
extension command framework loads all runners when initializing, and so
this logic was being executed even when using another runner.

Move the logic to a function that is only executed when the JLink runner
is selected, to avoid executing it at all times.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-03-18 19:54:14 +01:00
Pete Johanson
1c05f2121c west: runners: openocd: Handle ADI OpenOCD fork version format
The ADI fork of OpenOCD prints a modified version line; adjusting the
regex to account for that different format when checking the OpenOCD
version.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2025-03-17 21:01:41 -04:00
Thomas Gagneret
d6c59f0b4d scripts: zephyr_module: Fix purl regex
Remove root domain from PURL type
Nested PURL namespaces were not correctly detected.

Signed-off-by: Thomas Gagneret <thomas.gagneret@hexploy.com>
2025-03-17 09:32:46 +01:00
Alex Fabre
01b0dec496 west: boards: add board revision support in format string
The following board revision properties can now be used as part
of the format string in the 'west boards -f ...' command.

- board.revisions with format {revisions}
- board.revision_default with format {revision_default}

Signed-off-by: Alex Fabre <alex.fabre@rtone.fr>
2025-03-15 13:07:52 +01:00
John Barbero Unenge
53c5aa3bb0 scripts: ci: check_compliance: Fix signoff check
Use the --format flag in git rather than parsing the output of
the git log. The inspiration for this change was that the previous
implementation breaks if there's a ~/.gitconfig that changes the
git log format.

Signed-off-by: John Barbero Unenge <git@lsrkttn.com>
2025-03-13 16:56:40 +00:00
Lukasz Mrugala
ffe72a49bf scripts: Add invariant log closing
If BB tests failed, crashed, etc., log handles
could linger and crash test cleanup.
Adding log closing to a `finally` section
should prevent those issues.

Loggers should not be set up as globals,
as it makes testing much harder.
Running multiple Twisters may cause for the
logfiles to be still "in use".

When exiting main, close all logfiles
and remove their handlers from all loggers.
Do that for conftest as well.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2025-03-13 16:53:55 +00:00
Chris Friedt
72bc08578b scripts: utils: posix: add dry-run option and improve logging
Add a `--dry-run` (or `-d`) option to the posix kconfig
migration script for deprecated POSIX Kconfigs.

Additionally, add a set of skipped options (e.g. `TIMER`).

The `CONFIG_TIMER` option does not exist in the tree anymore
and was way too generically named previously, so the false
positive rate is astronomical, so it makes sense to skip it.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-03-12 19:03:52 +01:00
Gerard Marull-Paretas
b99ae6c7d9 scripts: kconfig: introduce dt_nodelabel_exists
Add a new function to check if a nodelabel exists in devicetree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2025-03-11 18:54:57 +01:00
Alberto Escolar Piedras
cb53e40ff9 drivers uart_native_posix: rename to native_pty and support N instances
Rename the driver from uart_native_posix to uart_native_pty.
Including renaming the DTS compatible, and kconfig options, deprecating
the old ones.

And refactor the driver, generalizing it, so we can have any number of
instances.
Note that, unfortunately generalizing to N instances cannot be done
without a degree of backwards compatibility breakage: This driver was
born with all its configuration and selection of the instances based on
kconfig.
When the driver was made to use DT, it was done in a way that required
both DT and kconfig needing to manually coherently enable the 2nd UART.
This has now been fixed, which it means only DT is used to decide how
many instances are avaliable, and UART_NATIVE_POSIX_PORT_1_ENABLE is
just ignored.

Including:
* Deprecate UART_NATIVE_WAIT_PTS_READY_ENABLE: the options is always on
  now as it has no practical drawbacks.
* Deprecate UART_NATIVE_POSIX_PORT_1_ENABLE: DTS intanciation defines it
  being available now.
* Rename a few functions and in general shorten pseudo-tty/pseudo-
  terminal to PTY instead of PTTY.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-11 18:54:02 +01:00
Ederson de Souza
70c89811be scripts and soc: Mark MD5 and SHA1 usage as not for security
MD5 and SHA1 are not supposed to be used nowadays on security context.
Some ancillary scripts in tree do use them, but for verification only -
or where externally mandated, such the SPDX tool.

This patch marks those usages as `usedforsecurity=False`, which helps
clarify intent.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-03-11 04:52:15 +01:00
Torsten Rasmussen
63cf79bd99 scripts: support number of jobs and verbosity in west build.
Calling `west build --build-opt="-v" --build-opt="-j=<n>"`
passes the build options to `cmake --build ... -- <build-opt>` which
again is passed to the native build tool, such as ninja or make.

However, when ExternalProjects are used in CMake, such as in TF-M or
sysbuild builds then those extra build options are only passed to the
first image build and not those build as external projects.

CMake supports environment variables for those flags, so translate
verbosity and number of jobs to those environment variables and thereby
support those flags for all images when specified by the user.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-03-10 11:12:07 +01:00
Alberto Escolar Piedras
71b9d16558 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
3ccb09ec00e291f699219c0e3f5b14b6b1c7ceb6

Which includes:
3ccb09e nsi_errno: Add new API to get the current host side errno
32eab87 Makefile: Ser a macro to distinguish build in runner context

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-10 06:52:19 +01:00
Alberto Escolar Piedras
4338122248 drivers entropy: fake_entropy_native_posix rename to _native_sim
Rename the driver files, binding and kconfig options, while deprecating
the old binding and kconfig options.

Uses in tree are replaced.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-08 03:38:13 +01:00
Grant Ramsay
4c5f858869 scripts: footprint: Exclude data section from rom_report if XIP=n
For XIP=n, the data section is only in RAM

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2025-03-08 03:37:27 +01:00
Carles Cufi
c9151be798 west: runners: Add support for multiple device IDs
In order to enable the use case where the underlying flash tool supports
bulk-flashing using multiple device IDs, augment the core runner class
with this new runner capability and implement it in the nrfutil runner,
since the nrfutil tool supports it natively.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-03-07 20:24:23 +01:00
Martí Bolívar
2db0fb60f2 scripts: add "west gtags" command
This is an extension for indexing the source code in the workspace
with GNU Global. See the command line help for more information about
Global.

Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
2025-03-07 19:57:00 +01:00
Alberto Escolar Piedras
83c65e9d07 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
26524aa55198807a37e012e5847f3975750d1716

Which includes:
* 26524aa Add new nsi_errno optional component
* 007a1c8 nsi_utils.h: Add NSI_ARRAY_SIZE() macro

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-07 19:56:30 +01:00
Alberto Escolar Piedras
e23d5ae996 native_simulator: Get latest from upstream
Align with native_simulator's upstream main
20d3b2b76a3bf61d35becbe17928cdf22e885b9f

Which includes:
* 20d3b2b Makefile: Support building C++ files with runner

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-07 19:56:30 +01:00
Irfan Ahmad
8d42cd078b scripts: build: Add optimizations in file2hex.py to gzip path as well
Added recently introduced optimizations - generation in string literal form
and faster generation for hexadecimal initializer list form - to gzip path
as well.

Signed-off-by: Irfan Ahmad <irfan.ahmad@siemens.com>
2025-03-07 19:53:34 +01:00
Lukasz Fundakowski
c5e8664089 twister: Refactor python module to follow PEP8 rules
Incremental refactoring.
Fix PEP8 issues to make ruff green for config_parser.py module.
Add __init__.py to twister directory to make it a proper python package,
and make modules importable.

Signed-off-by: Lukasz Fundakowski <lukasz.fundakowski@nordicsemi.no>
2025-03-07 19:49:42 +01:00
Erwan Gouriou
fb4bb5d768 scripts: west: runners: stm32cubeprogrammer: Fix stm32n6 dfu flashing
Rework of the flashing algorithm broke the STM32N6 dfu flashing.
Add the case of using usb port and download-modifier (new n6 specific
option) as a new case of using the bin file for flashing.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-03-06 17:18:25 +00:00