Commit graph

196 commits

Author SHA1 Message Date
Jamie McCrae
6d73a9c45a scripts: ci: check_compliance: Add support for modules for Kconfig
Adds support for checking modules for disallow Kconfig's in boards
and SoCs, which have been defined in a Zephyr module file

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-06-20 14:41:20 -05:00
Pieter De Gendt
e454aaa6b6 scripts: ci: check_compliance: Pass path representation to magic
On windows the Magic.from_file method fails to convert a PathLike to its
representation.
Pass using os.fspath.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-20 13:25:45 -04:00
Benjamin Cabé
ba56cd1020 scripts: ci: disable trailing-whitespace check in SphinxLint
SphinxLint doesn't need to report trailing whitespace errors as it's
already checked by checkpatch.pl.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-20 13:21:13 -04:00
Benjamin Cabé
043bb58488 doc: ci: Zephyr now requires Python 3.12 or higher
Update getting started guide, release notes, CI actions and
Python version compliance check to use Python 3.12 as
minimum supported version.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-19 13:56:59 +02:00
James Roy
4240853a06 scripts: ci: Add CI bindings style checker
Implement a check in the CI pipeline to enforce
that property names in device tree bindings do
not contain underscores.

Signed-off-by: James Roy <rruuaanng@outlook.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2025-06-17 16:03:54 +02:00
Jason Yu
c387d9c73d modules: hal_nxp: mcux-sdk-ng: Fix LPC55S16 build error
Fix build error when CONFIG_MCUX_COMPONENT_driver.fro_calib is set.
Error message:

modules/hal/nxp/mcux/mcux-sdk-ng/cmake/extension/function.cmake:2084 (if)
  if given arguments:

    "IN_LIST" "NEED_WRAP_TOOLCHAINS"

The error is because, mcux sdk ng cmake functions `mcux_add_xxx` support
add content based on toolchains. CMake should set current toolchain in
CMake Variable `CONFIG_TOOLCHAIN` to use this feature.

Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
2025-06-16 14:15:12 -04:00
Maureen Helm
29ca4bdfd2 scripts: ci: check_compliance: Ignore additional mcuboot Kconfigs
Adds BOOT_IMAGE_EXECUTABLE_RAM_START and BOOT_IMAGE_EXECUTABLE_RAM_SIZE
to the list of mcuboot symbols ignored by the compliance checking
script.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2025-06-13 10:29:20 -04:00
Jacob Wienecke
0c7fbd164e scripts: ci: check_compliance.py: Fix check_disallowed_defconfigs: Windows
#78615 Added a check for disallowed Kconfigs which does not work
on Windows machines. Windows machines seem to behave differently when
faced with the \b word boundary marker. I have removed the \b word
boundary marker from the grep commands when os.name=='nt'.
The script performs the same as before for any other os.

Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
2025-06-12 11:35:07 +02:00
Benjamin Cabé
17ab862169 scripts: ci: add vermin (min python version check)
Add a compliance check that allows to flag when a given file requires a
Python version higher than 3.10 (minimum supported version in Zephyr at
the time of writing) since not all Python scripts are tested against
3.10 in CI and we want to avoid introducing changes that could break
users.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-06 08:45:13 +02:00
Chris Friedt
c32488f97b cmake: kconfig: auto-generate boolean board revision option
Automatically generate a boolean CONFIG_BOARD_REVISION_FOO=y Kconfig
option based on e.g. CONFIG_BOARD_REVISION="foo".

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-05-16 16:11:48 +02:00
Jason Yu
c488c652cd modules: hal_nxp: Unified to use SDK NG driver
Some NXP boards are using legacy SDK driver, such as S32K, K64, MIMX8Q,
and so on. The legacy SDK driver will not be updated, migrate to use
SDK NG driver.

Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
2025-05-15 19:32:19 +02:00
Carles Cufi
9f7b786a35 scripts: compliance: Avoid exception when commit message body is empty
Avoid the following exception in the Identity test when the commit body
is empty:

Traceback (most recent call last):
  File "zephyr/scripts/ci/check_compliance.py", line 2053, in main
    n_fails = _main(args)
              ^^^^^^^^^^^
  File "zephyr/scripts/ci/check_compliance.py", line 1988, in _main
    test.run()
  File "zephyr/scripts/ci/check_compliance.py", line 1459, in run
    auth_name, auth_email, body = git(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 2)

This is triggered because ``%b`` represents the body of the commit
message, which can be empty if there's a single line in it, because the
first line is considered the title.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-05-15 19:31:47 +02:00
Mirai SHINJO
e4650bc349 scripts: ci: check_compliance: fix identity check for multiple DCOs
The current implementation of the identity check fails if multiple DCO
signoff lines are present and the first instance of the signoff line
does not belong to the author of the commit. This patch proposes a solution
that allows patches with multiple DCO signoff lines to pass the identity
check, regardless of the order of the signoff lines.

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
2025-05-13 17:46:01 +02:00
Robin Kastberg
5a92e46c92 iar: toolchain: Implement IAR static init routine
This will implement a way of doing static initialization
the "IAR" way. This is done by calling __iar_data_init3
which handles all static initialization that is mentioned
in the linker file "initialize by copy".

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-05-12 19:18:56 +02:00
Jamie McCrae
4876ff4b42 scripts: ci: check_compliance: Add Kconfig to allow list
Adds a Kconfig used in MCUboot to the allow list

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-04-25 14:03:34 +02:00
Chris Friedt
5fb47cd97f scripts: check_compliance: un-ignore diff and patch for CheckPatch
Un-ignore diff and patch files for CheckPatch.

This was originally added to avoid throwing false-positives when diff
and patch files were actually in the repo, since it would incorrectly
try to perform code-formatting checks on those files instead of on
the content of the commit.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-22 13:14:30 -04:00
Chris Friedt
b032304bbe scripts: ci: check_compliance: use git-top to check modules
BoardYml, DeviceTreeBindings, Kconfig, and KconfigBasic checks
can be run with a decentralized west manifest.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-11 06:32:31 +02:00
Chris Friedt
07a023d779 scripts: ci: check_compliance: GIT_TOP and ZEPHYR_BASE as paths
Use pathlib.Path objects for GIT_TOP and ZEPHYR_BASE instead of
strings.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-11 06:32:31 +02:00
Chris Friedt
af342e5205 scripts: ci: check_compliance: allow mcuboot log level dbg
Currently, only MCUBOOT_LOG_LEVEL_INF and MCUBOOT_LOG_LEVEL_WRN
are allowed in UNDEF_KCONFIG_ALLOWLIST. Let's allow
MCUBOOT_LOG_LEVEL_DBG as well, since some use cases may require
this level of scrutiny.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-11 06:32:31 +02:00
Chris Friedt
305e648d63 scripts: ci: check_compliance: ignore patch and diff files
Was getting several false positives about whitespace at line
endings with check_compliance.py because it was analyzing
.patch and .diff files as source.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-11 06:32:31 +02:00
Ederson de Souza
e420b21834 share/sysbuild: Support single app slot RAM load mode
Adds a new Kconfig to support MCUboot single application slot RAM load
mode.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2025-04-08 16:12:33 +02:00
Jamie McCrae
2f55dc8add scripts: ci: check_compliance: Disallow board hooks in defconfigs
Adds board hooks to the disallowed defconfig symbol list as
these should be selected, not put in a defconfig

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-04-04 12:06:38 +02:00
Pieter De Gendt
b2c37e00fc scripts: ci: compliance: Check .pyi files with ruff
Add pyi stub files to be checked by the ruff CI compliance rule.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-04-03 00:07:03 +02: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
Jamie McCrae
0035449137 scripts: ci: check_compliance: Add sysbuild Kconfig exclusions
Adds some Kconfigs to the allow list which are used for
demonstration purposes in sysbuild documentation

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-03-05 09:58:26 +00:00
Benjamin Cabé
f7c9200cc7 scripts: ci: check_compliance: inclusive language fix
use allowlist terminology

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-19 18:48:15 +01:00
Jamie McCrae
5e1aaa5395 scripts: ci: check_compliance: Fix paths for disallowed Kconfigs
Fixes using the wrong path for checking if disallowed Kconfigs
are present, to use the zephyr base instead of the git top level
folder which caused issues for downstream manifests

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-14 19:13:39 +00:00
Robin Kastberg
9ab06ec667 toolchain: iar: Add experimental IAR support
This adds experimental support for the IAR toolchain.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-02-14 19:12:44 +00:00
Dominik Kilian
0e4efdb2a6 tests: ipc_service: Test restarting session in different scenarios
This commit adds a test that checks if disconnecting
and restarting the IPC session works correctly. The
test is also focused on the "unbound" callback.

Signed-off-by: Dominik Kilian <Dominik.Kilian@nordicsemi.no>
Co-authored-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2025-02-14 13:34:49 +01:00
Jamie McCrae
9b8b418a2c scripts: ci: check_compliance: Add Kconfig to allow list
Adds a Kconfig used for configuring MCUboot to the allow list

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-10 19:05:25 +01:00
Jamie McCrae
f8a5ebfd20 scripts: ci: check_compliance: Add check for disallowed Kconfigs
Adds a check for Kconfig settings that are disallowed from being
used in defconfig files (because it is the complete wrong place
for them), with the default entry being PINCTRL

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Co-authored-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-05 17:49:27 +01:00
Jacob Wienecke
8e778d86f7 scripts: ci: check_compliance.py: Fix perl script running on windows
Add an if clause to the CheckPatch Class that checks for windows os.
If windows os, check for perl installation.
If no perl installation present. Fail the check.
Without this change, CheckPatch can fail silently on windows,
as windows does not have a way to run perl scripts.

Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
2025-02-01 11:27:28 +01:00
Grzegorz Swiderski
7ce6ac225e scripts: ci: check_compliance: Add sysbuild Kconfig checks
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>
2025-01-17 16:35:53 +01:00
Grzegorz Swiderski
37bce60188 scripts: ci: check_compliance: Inline creation of HWMv2 temp dirs
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>
2025-01-17 16:35:53 +01:00
Grzegorz Swiderski
c0d5e853a1 scripts: ci: check_compliance: Remove HWMv1 dead code
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>
2025-01-17 16:35:53 +01:00
Grzegorz Swiderski
50d9ed5ce1 scripts: ci: check_compliance: Update KconfigCheck subclassing
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>
2025-01-17 16:35:53 +01:00
Benjamin Cabé
bc42004d1b scripts: ci: check_compliance: do not use git mailmap
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>
2025-01-07 11:53:20 +01:00
Benjamin Cabé
029f807689 CODEOWNERS: drop CODEOWNERS file as it's not used anymore
There's no need for the CODEOWNERS file anymore as figuring out
maintainership and performing reviewer assignment is done via the
MAINTAINERS file now

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-12-03 04:01:27 +01:00
Tomasz Chyrowicz
811ff1f209 compliance: Remove SUIT MPI symbols
Remove SUIT MPI symbols from compliance exclusion list.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2024-12-02 22:05:27 +00:00
Grzegorz Swiderski
f76c7e3a9a scripts: ci: check_compliance: Account for board & SoC extensions
When a given board or SoC is extended, it has more than one directory
associated with it, where the build system can look for Kconfig files.
Make sure all of them are also included for Kconfig compliance checks.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-12-02 22:05:10 +00:00
Josuah Demangeon
d6b8912ad9 scripts: ci: check_compliance: ruff: avoid mixing stdout and stderr
The python subprocess call had a stdout=subprocess.PIPE parameter that
redirects standard output to a pipe, and a stderr=subprocess.STDOUT
parameter that redirected stderr to the pipe. This mixed JSON and
non-JSON output together, and issued an exception. Fixing with
stderr=subprocess.DEVNULL to ignore standard error and only keep the
JSON output.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2024-11-23 02:01:28 +01:00
Pieter De Gendt
1be5c157d9 scripts: ci: check_compliance: Add python lint/format check
Add a compliance test using ruff, for both linting and formatting of
newly added python files.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-19 18:36:54 -05:00
Pieter De Gendt
05c6517fc9 scripts: ci: check_compliance: Add support for end line and column
Reporting or annotating issues can be done on a range rather than a
single line.

Add support for end line and end column.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-19 18:36:54 -05:00
Pieter De Gendt
794dd05459 scripts: ci: check_compliance: Keep UNDEF list sorted
Keep the UNDEF_KCONFIG_ALLOWLIST list sorted, as mentioned in the
comment.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-16 15:20:03 -05:00
Pieter De Gendt
5d49d5c00c scripts: ci: check_compliancy: Add zephyr-keep-sorted regex support
To support checking for sorted blocks of multi-line text add
an optional regex pattern for the KeepSorted compliance check.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-16 15:20:03 -05:00
Pieter De Gendt
2ee5a24417 scripts: ci: check_compliance: Simplify line number in loop
Use the builtin enumerate function rather than a manual variable.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-16 14:06:12 -05:00
Torsten Rasmussen
536d34fa7a cmake: scripts: support board extension
Fixes: #69548

Support extending an existing board with new board variants.

This commit introduces the following changes to allow a board to be
extended out-of-tree.

The board yaml schema is extended to support an extend field which
will be used to identify the board to be extended.

A board 'plank' can be extended like this:
> board:
>   extend: plank
>   variants:
>     - name: ext
>       qualifier: soc1

For the rest of the build system this means that there is no longer a
single board directory.
The existing CMake variable BOARD_DIR is kept and reference the
directory which defines the board.
A new CMake variable BOARD_DIRECTORIES provides a list of all
directories which defines board targets for the board.
This means the directory which defines the board as well as all
directories that extends the board.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-10-26 17:14:06 +02:00
Pieter De Gendt
95195b5574 scripts: ci: check_compliance: Add text encoding check
Add a check for text files to make sure these are encoded in ascii
or utf-8.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-17 10:49:08 -04:00
Pieter De Gendt
f7e130f982 scripts: ci: check_compliance: Order list alphabetically
Print the compliance checks alphabetically by default.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-15 19:08:20 -04:00
Johan Hedberg
db88324f26 scripts: check_compliance: Fix incorrect soc root lookup
The script was only looking at the Zephyr base repository and failing to
look for soc roots e.g. in other modules.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-09-18 15:29:32 +02:00