Commit graph

1436 commits

Author SHA1 Message Date
Jamie McCrae a0267d2f48 west: runners: Add run once commands and deferred reset
This adds supports for flashing images with sysbuild where there
are multiple images per board to prevent using the same command per
image flash which might cause issues if they are not ran just once
per flash per unique board name. A deferred reset feature is also
introduced that prevents a board (or multiple) from being reset if
multiple images are to be flashed until the final one has been
flashed which prevents issues with e.g. security bits being enabled
that then prevent flashing further images.

These options can be set at a board level (in board.yml) or a SoC
level (in soc.yml), if both are present then the board configuration
will be used instead of the SoC, and regex can be used for matching
of partial names which allows for matching specific SoCs or CPU cores
regardless of the board being used

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-29 17:56:19 +01:00
Nicolas Lebedenco 6837ca808b cmake: Revert breaking change to CMAKE_SYSTEM_NAME
This commit reverts a breaking change in CMAKE_SYSTEM_NAME introduced by
"Zephyr" back to "Generic") and removes the file
`cmake/modules/Platform/Zephyr`.

Both changes in the aforementioned PR were only introduced to ultimately
modify the value of the global CMake property TARGET_SUPPORTS_SHARED_LIBS
for the special case of building for Xtensa with LLEXT.

The modification of CMAKE_SYSTEM_NAME is considered a breaking change
because it has the potential to alter the build of any non-trivial project
that previously checked for the "Generic" system identifier as
corresponding to Zephyr - for example by doing
`if (CMAKE_SYSTEM_NAME STREQUAL "Generic")`. Such builds may now break in
many ways including silently when there is no `else()` clause with a
`message()` to alert the user that a whole configuration block had been
skipped.

In essence, that CMAKE_SYSTEM_NAME modification was only introduced in
order to have CMake to load `cmake/modules/Platform/Zephyr.cmake` which in
turn adjusted the value of TARGET_SUPPORTS_SHARED_LIBS.

But the use of a CMake platform file like this is ineffective for
non-trivial projects where one or more top level CMake `project()` calls
may happen before the first call to `find_package(Zephyr)` because in such
cases CMAKE_MODULE_PATH will not have been modified yet to contain the
path to <Zephyr_ROOT>/cmake/modules and thus no platform file will be
include by CMake.

This patch moves the conditional override of TARGET_SUPPORTS_SHARED_LIBS
needed by some archs (e.g. Xtensa) into the `kernel.cmake` module which
is known to be the first call to `project()` that enables any language and
thus the one that must come before any artifact target can be defined.

Note commit 64e7d85 added a Kconfig to specify the object type of llext
being built, so it's not tied to the arch anymore but to the
CONFIG_LLEXT_TYPE_ELF_SHAREDLIB option.

Signed-off-by: Nicolas Lebedenco <nicolas@lebedenco.net>
2024-04-29 16:17:39 +02:00
Jamie McCrae 6ed5ac7111 cmake: modules: configuration_files: Add support for soc overlays
Adds support for SoC overlay files which go in a ``socs`` folder
in application folders and functions similar to the ``boards``
folder, but works for SoCs instead of boards

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-29 15:08:35 +01:00
Jamie McCrae 6f58159a72 cmake: Add support for socs folder and Kconfig fragments
Adds support for a new ``socs`` folder that can be placed in
application folders and functions similar to the ``boards``
folder, but works for SoCs instead of boards

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-29 15:08:35 +01:00
Jamie McCrae 43c323a835 cmake: modules: extensions: Fix documentation for zephyr_build_string
Fixes a missed entry and a wrong named variable in the
documentation for this function

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-29 15:08:35 +01:00
Patryk Duda 144a08c58c cmake: modules: Introduce FindThreads module
Some third-party modules uses 'find_package(Threads REQUIRED)' to check
if threads implementation is supported.

The original implementation tries to find threads library using various
methods (e.g. checking if pthread library is present or compiling
example program to check if the implementation is provided by libc), but
it's not able to detect pthread implementation provided by Zephyr.

Signed-off-by: Patryk Duda <patrykd@google.com>
2024-04-29 15:59:42 +02:00
Jonathon Penix 4d7fe771f1 linker: lld: riscv: Enable gp relaxation for lld
Unlike GNU ld, lld's gp relaxation is disabled by default and must be
explicitly enabled via `--relax-gp`. Pass this flag to enable gp relaxation
for lld when both linker relaxations and gp usage for RISC-V are enabled.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-04-29 15:56:22 +02:00
Pieter De Gendt cb459f12ba arcmwdt: Enable GNU C Extensions
Replace the global CSTD property with a Kconfig symbol selection.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-04-25 09:54:39 +00:00
Pieter De Gendt a599ed13a1 kconfig: Add symbols for GNU C Extensions
Add a symbol to enable GNU C Extensions. And a hidden option for
toolchains to signal GNU Extensions support.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-04-25 09:54:39 +00:00
Jamie McCrae 23551eb05a cmake: boards: Fix missing board name
Fixes an issue whereby the board name was missing

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-24 14:55:18 -04:00
Patryk Duda a8fa0ea938 linker: Add more DWARF 5 debug sections
These sections were reported by 'GNU ld (GNU Binutils) 2.41.0' using
'ld --verbose'.

Signed-off-by: Patryk Duda <patrykd@google.com>
2024-04-22 07:47:52 -07:00
Tomasz Moń 5144d0f65f usb: device_next: Introduce speed specific configurations
USB High-Speed devices must be able to operate at both High-Speed and
Full-Speed. The USB specification allows the device to have different
configurations depending on connection speed. Modify the API to reflect
USB Specification requirements on what can (e.g. configurations) and
what cannot (e.g. VID, PID) be speed dependent.

While the class configurations for different speeds are completely
independent, the actual class instances are shared between operating
speeds (because only one speed can be active at a time). Classes are
free to provide different number of interfaces and/or endpoints for
different speeds. The endpoints are assigned for all operating speeds
during initialization.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Tomasz Moń f411f801fe usb: device_next: Separate endpoint assignment from class data
Introduce usbd_class_iter for keeping endpoint assignment variables
and the single-linked list node. No functional changes right now, but
this paves the way for independent speed specific configurations.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-04-22 06:51:22 -07:00
Nicolas Lebedenco 39cb21dfc0 cmake: Fix invalid calls of set_compiler_property
set_compiler_property does not accept a TARGET argument. Only set_property
does but they are easy to confuse. This patch fixes the wrong instances of
set_compiler_property that should have been set_property.

Signed-off-by: Nicolas Lebedenco <nicolas@lebedenco.net>
2024-04-19 16:40:16 +00:00
Nicolas Lebedenco 4df926b02d cmake: Make enable_language() clear about what it is actually doing
That call to enable_languages() is passed C CXX ASM which misleads the
reader into thinking that the three languages are enabled in that call but
at that point only ASM is actually because C and CXX were already
implicitly enabled by the call to project() above. The suggested change
removes the misleading C CXX arguments but we could as well make it clear
in the project() call by passing LANGUAGES C CXX.

Signed-off-by: Nicolas Lebedenco <nicolas@lebedenco.net>
2024-04-19 16:40:11 +00:00
Luca Burelli ad8b90ad36 cmake: add_llext_target: handle empty LLEXT_REMOVE_FLAGS
When LLEXT_REMOVE_FLAGS is empty, the regular expression that is
constructed to remove flags from the Zephyr flags would match any
string, resulting in all flags being removed. This is not the intended
behavior, so we need to handle this case by setting the regular
expression to a pattern that does not match anything.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-19 10:10:39 +02:00
Luca Burelli 14509a8d7b cmake: add_llext_target: use toolchain-specific partial linking option
The partial linking option depends on the linker used in the build
process, and this flag is already defined by the Zephyr toolchains.
Use the $<TARGET_PROPERTY:linker,partial_linking> generator expression
to retrieve it instead of hardcoding the value for the GNU linker.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-19 10:10:39 +02:00
Jamie McCrae 5841c11cae cmake: modules: extensions: Rename prefix in functions
Renames a prefix in a function to avoid clashes with global variable
that have the same name

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-18 08:51:10 -07:00
Nicolas Lebedenco 6a42ede43b cmake: Normalize GNULD_LINKER variable
Some toolchains may generate convoluted paths when reporting accessory
tools. This is the case with GCC in the Zephyr SDK toolchain. For
example, for a Zephyr SDK installed under `C:\Portable\Zephyr` a call to
`gcc --print-prog-name=ld.bfd` should normally return something like
`c:/portable/zephyr/zephyr-sdk-0.16.5/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe`
but because of how the toolchain was created the path reported gets all
messed up with relative fragments. In above case, the actual path reported
was `c:/portable/zephyr/zephyr-sdk-0.16.5/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe`
One might argue that this should be fixed in the toolchain which could be
possible for the Zephyr SDK but not for other toolchains (definitely not
for proprietary ones).

Signed-off-by: Nicolas Lebedenco <nicolas@lebedenco.net>
2024-04-16 16:38:35 -07:00
Jamie McCrae a2ed8162c8 cmake: modules: boards: Add normalised variables
Adds a new variable NORMALIZED_BOARD_QUALIFIERS which contains
the board qualifiers in file-name format, this allows for
constructing strings in applications (e.g. for folder names) prior
to Zephyr being found for things like APPLICATION_CONFIG_DIR. Also
adds NORMALIZED_BOARD_TARGET.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-15 08:31:55 -07:00
Torsten Rasmussen 4959a0241e cmake: fix issue with parsing version file located in /VERSION
Fixes: #71384

A VERSION file placed in `/` or `<drive>:\` was accidentally being
picked up during `find_package(Zephyr)`.

This happened because Zephyr loads the VERSION file to determine if it
is the correct Zephyr to use.

During initial phase of find_package(), then APPLICATION_SOURCE_DIR is
not defined, causing one version file to be picked up from `/VERSION`
instead of `<app>/VERSION`. `/VERSION` is outside any Zephyr repo, west
workspace, or the application itself and therefore should not be picked
up accidentally.

Fix this be checking that APPLICATION_SOURCE_DIR is defined, and only
when defined, look for a VERSION file there.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-04-15 14:05:38 +02:00
Marek Metelski 1c8ea0a941 cmake: shields: Simplify shield processing, print shields from modules
Fix issue #67244 in which boards from external modules where not
printed in the help message (displayed for `shields` target or
when trying to build with unknown shield). The SHIELD_LIST variable
was reset for each BOARD_ROOT discovered.

Simplify discovery logic. Discover all shields and set relevant
variables (SHIELD_LIST and SHIELD_DIR_${name}) in one step and
process all the expected boards in the next step.

Signed-off-by: Marek Metelski <marek@metelski.dev>
2024-04-12 15:03:29 +02:00
Luca Burelli e24295f0f5 llext: add support for building relocatable ELF files
This commit adds support for building relocatable (partially linked)
ELF files as the binary object type for the llext subsystem.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-11 11:35:24 -05:00
Luca Burelli 162e7c9a7f llext: support multiple source files
This change allows the `add_llext_target` function to accept multiple
source files when building an ELF shared library. The ELF object
target type is still limited to a single source file, since there is no
linking step in that case.

Also fixes a minor typo in another llext function documentation.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-11 11:35:24 -05:00
Luca Burelli 64e7d85ef6 llext: define target binary type
Add a new Kconfig option to select the binary object type for the llext
subsystem. This will allow to fully decouple the architecture type from
the kind of binary object that is expected by the loader.

The defaults have been chosen to match the current behavior of the ARM
and Xtensa architectures, but developers can now more easily experiment
with other object types.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-11 11:35:24 -05:00
Marcin Szymczyk d2b3e3a389 sysbuild: add SoC-specific sysbuild configuration
Sysbuild now supports SoC configuration,
in addition to application and board.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-04-10 17:53:24 +02:00
Torsten Rasmussen 4e3a01df41 cmake: support shortened file names for single SoC boards
This allow developers to create board files without the SoC name when
the board only defines a single SoC.

This means that a board, such as rpi_pico, which defines only a single
SoC, rp2040, and one variant, now allows the following file names:
Board target: rpi_pico/rp2040
- dts: rpi_pico_rp2040.dts, short: rpi_pico.dts
- defconfig: rpi_pico_rp2040_defconfig, short: rpi_pico_defconfig
- overlay: rpi_pico_rp2040.overlay, short: rpi_pico.overlay
- conf:  rpi_pico_rp2040.conf, short: rpi_pico.conf

Board target: rpi_pico/rp2040/w
- dts: rpi_pico_rp2040_w.dts, short: rpi_pico_w.dts
- defconfig: rpi_pico_rp2040_w_defconfig, short: rpi_pico_w_defconfig
- overlay: rpi_pico_rp2040_w.overlay, short: rpi_pico_w.overlay
- conf:  rpi_pico_rp2040_w.conf, short: rpi_pico_w.conf

A multi CPU cluster board, nrf5340dk:
Board target: nrf5340dk/nrf5340/cpunet
- dts: nrf5340dk_nrf5340_cpunet.dts, short: nrf5340dk_cpunet.dts
- defconfig: nrf5340dk_nrf5340_cpunet_defconfig,
             short: nrf5340dk_cpunet_defconfig
- overlay: nrf5340dk_nrf5340_cpunet.overlay,
           short: nrf5340dk_cpunet.overlay
- conf:  nrf5340dk_nrf5340_cpunet.conf, short: nrf5340dk_cpunet.conf

A multi SoC board, nrf5340dk (real: nrf52840, emulated: nrf52811):
Board target: nrf52840dk/nrf52840
- dts: nrf52840dk_nrf52840.dts, short: Not possible
- defconfig: nrf52840dk_nrf52840_defconfig, short: Not possible
- overlay: nrf52840dk_nrf52840.overlay, short: Not possible
- conf:  nrf52840dk_nrf52840.conf, short: Not possible

If two conflicting files are found, for example both
rpi_pico_rp2040.overlay and rpi_pico.overlay, then an error is raised.

If short form is detected for a board target with multiple SoCs, for
example nrf52840dk_nrf52840.overlay and nrf52840dk.overlay, then an
error is raised.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-04-09 23:35:54 +02:00
Jamie McCrae 0be0d2175b cmake: modules: extensions: Revert using common board files
This change reverts a change that was introduced with hwmv2 which
allowed for using common board names for overlays, given the board
target ``nrf9160dk@0.7.0/nrf9160/ns``.

In hwmv1 this would have used:
    ``nrf9160dk_nrf9160_ns.conf``.
    ``nrf9160dk_nrf9160_ns_0_7_0.conf``.

In hwmv2 this would have used:
    ``nrf9160dk_nrf9160_ns.conf``
    ``nrf9160dk_nrf9160_ns_0_7_0.conf``
    ``nrf9160dk_nrf9160.conf``
    ``nrf9160dk_nrf9160_0_7_0.conf``
    ``nrf9160dk.conf``
    ``nrf9160dk_0_7_0.conf``

With these changes, the following are used (which restores the hwmv1
behaviour):
    ``nrf9160dk_nrf9160_ns.conf``
    ``nrf9160dk_nrf9160_ns_0_7_0.conf``

For a board with a default SoC which is not a variant for example
``rpi_pico`` then ``rpi_pico.conf`` will also be used, this file
will not be used for variants e.g. ``rpi_pico/rp2040/w``

This applies to .dts, .conf and .overlay files in the boards
directory, and to .conf and .overlay files in application board
overlay directories.

This revert is needed to avoid issues whereby variants have
incompatible configuration to the parent board target, which has
been affecting samples and tests.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-09 23:35:54 +02:00
Gerard Marull-Paretas 80a6a20628 cmake: extensions: introduce zephyr_syscall_include_directories
Add a new CMake helper to add new include directories to be parsed by
the syscall machinery. This helper complements the existing
zephyr_syscall_header, which works at a header-level.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-04-09 12:04:57 +02:00
Gerard Marull-Paretas ca4e5d9c98 cmake: use INTERFACE_SOURCES in zephyr_syscall_header
Instead of INTERFACE_INCLUDE_DIRECTORIES, because header files are used,
not directories. Headers were added to both, target sources and include
directories.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-04-09 12:04:57 +02:00
Luca Burelli 313c09bffb llext: add support for build time custom commands
This patch adds support for custom commands to be executed during the
build of an llext target. The commands can be executed at different
points in the build process:

 - PRE_BUILD:  Before the llext code is linked.
 - POST_BUILD: After the llext code is built, but before packaging
	       it in an .llext file.
 - POST_PKG:   After the llext file has been created.

Note that PRE_BUILD is not supported for ARM targets, as in that case
object files are used directly and there is no actual linking step.

The commands can be added using the new add_llext_command() function.
An example usage of it, along with some target properties, is added to
the hello_world test case.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-08 09:04:32 +02:00
Luca Burelli f50d476ee6 llext: add llext_* configuration functions
Remove the C_FLAGS argument from add_llext_target() and add a set of
functions to configure the compilation and linking of an llext using
the same API of the target_* functions.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-08 09:04:32 +02:00
Luca Burelli 1e47c64266 llext: use CMake shared library support on Xtensa
This change reworks the Xtensa support in llext to use CMake's native
shared library support, instead of manually running "gcc -shared".

This change minimizes the differences in llext handling by defining
appropriate CMake targets for the different architectures.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-08 09:04:32 +02:00
Luca Burelli f61b003b07 cmake: conditionally enable shared library support
When CONFIG_LLEXT is enabled, the Zephyr platform needs to enable dynamic
library support. This is done by setting the `TARGET_SUPPORTS_SHARED_LIBS`
property to `TRUE` in the global property scope.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-04-08 09:04:32 +02:00
Benedikt Streicher 6f01329e9d cmake: sca: codechecker: search for 'CodeChecker' and 'codechecker'
Let find_program in codechecker/sca.cmake search for both 'CodeChecker'
and 'codechecker'. Before this change, I wasn't able to run CodeChecker
because cmake couldn't find it. (Ubuntu 23.10, CodeChecker 6.21.0 installed
via snap)

Signed-off-by: Benedikt Streicher <streicher.b@posteo.de>
2024-03-28 16:44:13 -04:00
Ederson de Souza 321e395a8f linker: Include libkernel.a in the whole-archive when llext is enabled
Differently from other libraries, which are included whole in the final
Zephyr ELF, libkernel.a itself isn't. Assuming this is intended to
enable optimisations (if it isn't, this patch will break things) - linker
can remove parts of the kernel that are not used by the application.

However, when considering Linkable Loadable Extensions (llext), this
optimisations can be counterproductive: for instance, syscalls that are
not used by the application won't be available for extensions. It won't
matter if someone "EXPORT_SYMBOL" for them, or even try to keep them
using LINKER_KEEP, they'll be gone.

To avoid that, this patches includes, when CONFIG_LLEXT=y, libkernel.a
inside the linker "whole-archive" block. This ends up making it consider
libkernel.a as a library whose all symbols should be kept. Note this
doesn't mean that all symbols will be there - things compiled out via
Kconfig will naturally still be out.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-03-26 19:31:56 -04:00
Grzegorz Swiderski 4acb615c14 cmake: boards: Error out if multiple boards use the same name
Detecting this requires `boards.cmake` being able to handle multi-line
output from `list_boards.py`. Implement a similar line reading loop to
the one used in `hwm_v2.cmake`.

Failing to handle this could result in an incorrectly parsed list of
valid board qualifiers. Here's the expected list for `nrf52_bsim`:

  - "native"

and here's what would happen if two copies of that board were found:

  - "native\nNAME"
  - "nrf52_bsim"
  - "native"

Instead of that, there would now be a proper error message listing all
board directories which contain `nrf52_bsim`.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-03-26 16:20:08 -04:00
Torsten Rasmussen 88d8b23836 scripts: remove board name from the qualifiers in list_boards.py
Fixes: #69329

The board name was printed as part of printing board qualifiers because
those was being concatenated in the `board_v2_qualifiers()` method.

Keep the qualifiers separated from the board name and let the caller
concatenate the strings when required.

Completion scripts are also updated to handle the corrected behaviour.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
(cherry picked from commit 66b475a3aa)
2024-03-26 16:20:08 -04:00
Alberto Escolar Piedras 37a1d28a36 Revert "scripts: remove board name from the qualifiers in list_boards.py"
This reverts commit 66b475a3aa.

This commit has broken CI. Let's revert it.
See https://github.com/zephyrproject-rtos/zephyr/issues/70614

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-22 17:28:23 +01:00
Torsten Rasmussen b29d73fcc4 cmake: add CMake configure dependency to board.yml
Fixes: #69840

Add CMake configure dependency on the board's board.yml file.
This dependency ensures that CMake will re-run and pickup any changes
to the current board's board.yml file.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-22 13:02:00 +00:00
Torsten Rasmussen 66b475a3aa scripts: remove board name from the qualifiers in list_boards.py
Fixes: #69329

The board name was printed as part of printing board qualifiers because
those was being concatenated in the `board_v2_qualifiers()` method.

Keep the qualifiers separated from the board name and let the caller
concatenate the strings when required.

Completion scripts are also updated to handle the corrected behaviour.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-22 12:42:49 +00:00
Grzegorz Swiderski 3cff550180 cmake: configuration_files: Add missing FILE_SUFFIX handling
for Kconfig fragments in the `boards` application subdirectory.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-03-22 12:41:32 +00:00
Grzegorz Swiderski 50f0454fbd cmake: extensions: Change zephyr_file() argument parser prefix
Replace `FILE` with `ZFILE` as the prefix for `cmake_parse_arguments()`.
This is because `zephyr_file()` accepts `SUFFIX` as function argument,
and it should not be accessible as `FILE_SUFFIX` as it would conflict
with the CMake cache variable of the same name. Accessing the argument
as `ZFILE_SUFFIX` prevents the cached value from slipping into the
function scope.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-03-22 12:41:32 +00:00
Grzegorz Swiderski 438c95458f cmake: Fix doubling FILE_SUFFIX on boards/*.overlay files
When building with `-DBOARD=plank -DFILE_SUFFIX=foo`, the build system
could set `DTC_OVERLAY_FILE` to one of:

  - boards/plank_foo_foo.overlay
  - boards/plank_foo.overlay
  - boards/plank.overlay

The first choice is a bug, as the suffix should only be applied once.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-03-22 12:41:32 +00:00
Torsten Rasmussen 1497104de4 unittest: update unittest to hwmv2
Follow-up: fe25709a9c twister: add unit_testing soc and board

Moving the soc.yml and board.yml to subsys/testsuite tree.
Introduce subsys/testsuite/arch/archs.yml with unit_testing arch.

Update the Zephyr CMake module unittest.cmake to include HWMv2 and
reorder includes to follow same order as zephyr_default.cmake.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-22 11:51:58 +01:00
Torsten Rasmussen fd772f8e77 scripts: remove boards_legacy sub-folder from list_boards.py
Fixes: #69785

The boards_legacy sub-folder was temporarily introduce in collab-hwm
branch during porting to HWMv2.

This should have been removed before merging collab-hwm to main as it
prevent looking up boards in oot roots.

Removing the temporary sub-folder for HWMv2.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-22 11:51:58 +01:00
Torsten Rasmussen 732c504e4c terminology: adopt CMake, python, and Kconfig code to use qualifiers
Followup: #69905

Adopting new board terminology for CMake, python, and Kconfig code to
use qualifiers instead of identifiers.

Also adjusted to board target where applicable.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-03-21 15:32:17 +01:00
Alberto Escolar Piedras 996377340a cmake clang/compiler_flags.cmake: Clarify comment for native targets
Correct the comment for native targets.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-20 15:43:05 +01:00
Johan Lafon 69648c17d7 cmake: dts: look for allowed dts overlays file presence in board/
Hardware model v2 allows the usage of <board>_<revision>.overlay and any
valid <board>_<identifier>_<revision>.overlay dts overlays in the board/
directory but CMake was only looking for the most specific
<board>_<identifier>_<revision>.overlay overlay file.

This commit allows CMake to look for the presence of any allowed overlay
file to fix this issue.

Tested by building the hello_world sample with the Olimex board
lora_stm32wl_devkit revision C.

The following line wasn't appearing before in build log and now does:
"-- Found devicetree overlay: <path>/olimex_lora_stm32wl_devkit_C.overlay"

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2024-03-20 07:39:46 -05:00
Alberto Escolar Piedras f0750df3da nrf5_bsim cmake: Check that the simulator version is new enough
Add a cmake check to ensure the simulator is new enough and guide
users to update it and rebuild if it isn't,
so they get a better experience than by just getting a build or
runtime error.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-03-19 21:18:13 -05:00