PR#51049 deprecated SOURCES but placed it below the
Deprecated_FIND_COMPONENTS check causing following message to be printed
when building for the unit_testing board:
-- The following deprecated component(s) could not be found: SOURCES
Fix this by placing the deprecated SOURCES handling at proper location
and append SOURCES to Deprecated_FIND_COMPONENTS list.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Generates XML file containing VIF policies by reading the device tree
using EDT.pickle generated during build
This script writes a subset of general and sink-pdo VIF policies in
output file
This script gets invoked during build if enabled through kconfig
The generated XML containing USB-C VIF policies could be used by
USB PD/Type-C analysers/testers to understand USB-C properties and
perform tests accordingly
Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
Currently we try to manually specify C/C++ headers locations
with -isystem flag which lead to issues with "include_next"
directive which is used in C/C++ headers. As advised by MWDT
R&D team let's rely on the default C/C++ include locations
which are provided by MWDT if we do build with MW C / C++
libraries. For that case we still need to manually specify
header directory to ASM builds which bay use 'stdbool.h'
In case of building with minimal libc (provided by Zephyr)
we rely on minimal libc headers and manually specify
toolchain's C header directory (as minimal libc still uses some
toolchain's C headers.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Some missing features for getting coverage data for unit tests:
- Setting the unit_testing board to have coverage support and native
application.
- Fixing the CONFIG_COVERAGE check
Signed-off-by: Yuval Peress <peress@google.com>
See also
https://github.com/zephyrproject-rtos/zephyr/pull/38903
This is required when building tests for native_posix on ubuntu 22.04 using
clang-14 from the normal deb repository.
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
When building with clang, the unittests were giving us an error:
```
error: undefined symbol: llvm_gcda_start_file
```
This seems to be from linking in `gcov` regardless of the toolchain.
It appears that clang doesn't need any special library for coverage.
With this change the following now produce identical coverage reports:
```
$ ZEPHYR_TOOLCHAIN_VARIANT=zephyr ./scripts/twister -p unit_testing \
--coverage -i -T tests/unit/intmath/
$ ZEPHYR_TOOLCHAIN_VARIANT=host ./scripts/twister -p unit_testing \
--coverage -i -T tests/unit/intmath/
$ ZEPHYR_TOOLCHAIN_VARIANT=llvm ./scripts/twister -p unit_testing \
--coverage -i --coverage-tool lcov \
--gcov-tool $(pwd)/scripts/utils/llvm-gcov.sh \
-T tests/unit/intmath/
```
Signed-off-by: Yuval Peress <peress@google.com>
Clang version used by ARCMWDT does not support -fno-pic and -fno-pie
flags.
Flags were added into arcmwdt branch by
commit 8259931fce ("xcc-clang: Do not used unavailable options").
Initially they were set in common CMakeLists.txt via
zephyr_cc_option() function, which filtered them out, and they
did not used in builing process.
Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
The `xtools` toolchain variant (aka. Crosstool-NG) was originally
introduced to be used with the Crosstool-NG-based Zephyr SDK
toolchains (i.e. sdk-ng).
This is no longer necessary because the current Zephyr SDK (sdk-ng)
already has its own `zephyr` toolchain variant, which fully replaces
the `xtools` toolchain variant, and the `xtools` toolchain variant
serves no purpose at all.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Add support for userspace with RTIO by making rtio and rtio_iodev
k_objects. As well as adding three syscalls for copying in submissions,
copying out completions, and starting tasks with submit.
For the small devices Zephyr typically runs on one of the most important
attributes tends to be low memory usage. To maintain the low footprint of
RTIO and its current executor implementations the rings are not shared with
userspace. Sharing the rings it turns out would require copying submissions
before working with them to avoid TOCTOU issues.
The API could still support shared rings in the future so that a
kernel thread could directly poll, copy, verify, and start the submitted
work. This would require a third executor implementation that maintains its
own copy of submissions similiar to how io_uring in Linux works.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
QEMU for NIOS2 and LEON3 do not provide support for the "can-bus" object
type. Skip configuring CAN bus command line arguments for these.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Load image kconfig setting into image target properties.
This allows sysbuild to evaluate and check image configuration as part
of CMake invocation.
sysbuild_get() is updated to support reading of CMake cache or Kconfig
settings for an image.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The signature of import_kconfig() take two mandatory arguments and one
optional:
> import_kconfig(<prefix> <kconfig_fragment> [<keys>])
but has been implemented in such a way that it loops all arguments after
the two mandatory args and sets the same list on those.
Fix this error by only setting the created variables on the third and
optional argument if it exists.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add support for configuring CAN emulation support in QEMU. For now, the
only supported CAN controller is the single-channel Kvaser PCIcan PCI card.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Fixes: #51821
Set CMAKE_STRIP using `find_program(CMAKE_STRIP strip)` to support
strip when building on native posix.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
If users set SOURCES before find_package for unit tests, we'll warn them
that this code path will no longer be supported and provide the correct
way of doing things moving forward.
Signed-off-by: Yuval Peress <peress@google.com>
Downstream it's easier to write tests that use target_sources after
including the unittest package instead of specifying a list of sources
before. But if we do that, currently, main.c is added and the build
breaks because it doesn't exist.
Signed-off-by: Yuval Peress <peress@google.com>
This adds a choice of three different libc API buffer overflow detection
modes:
* None
* Compile-time
* Compile-time and Run-time
These correspond with the clang/gcc _FORTIFY_SOURCE modes (0/1/2).
_FORTIFY_SOURCE depends on compiler optimizations and require libc support
which the minimal C library doesn't include, so _FORTIFY_SOURCE is disabled
by default in those cases. Native tooling might also enable
_FORTIFY_SOURCE, so don't enable it by default in that case either.
Signed-off-by: Keith Packard <keithp@keithp.com>
Adds an iterable section in ROM to hold constant information, such as
vendor and model name, for all enabled sensor driver instances. This
will be used by the future sensor subsystem to enumerate all available
sensors in the system.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
GCC will compute expected sprintf (et al) return values internally and use
them in place of the actual return value. When the printf implementation
has reduced functionality, gcc may compute a different value.
For picolibc, this means disabling the optimization unless floating point
output is enabled.
Signed-off-by: Keith Packard <keithp@keithp.com>
Regexp suggested in #50173 PR is too strictly and
needs to be corrected. Previous regexp declines
engineering MWDT versions
(pattern ENG-2022.12-D1039-C39098348").
Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
The whole set of architecture flags must be specified together as
they might not make sense in isolation, e.g. -mfloat-abi=hard requires
a -mcpu value that might have an FPU. Use the NO_SPLIT feature to
bind all of the linker options together so that the linker can
compute the correct linker paths for toolchain-provided libraries like
libc and libgcc.
Signed-off-by: Keith Packard <keithp@keithp.com>
Ensure that QEMU_PIPE variable is set when using sysbuild. This is required
because twister will use the "main" sysbuild application as the target for
"ninja run" when testing QEMU targets, which means that the "main" build
must be aware of any QEMU_PIPE setting passed by twister at build time.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Make sure the linker knows what the target is, in case it needs to find
additional target-specific libraries (like picolibc).
Signed-off-by: Keith Packard <keithp@keithp.com>
Update cmake related files that are used by simulators to use
CONFIG_MP_MAX_NUM_CPUS instead of CONFIG_MP_NUM_CPUS as we work to
phase out CONFIG_MP_NUM_CPUS.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
The commit f10fa0dea8 mapped the
Cortex-R52 processor type to use the "VFPv3" FPU type, but the
toolchain requires the "FPv5" FPU type and refuses to assemble
floating-point instructions when the "VFPv3" FPU type is specified.
This commit updates the build script to specify the FPU type of
`fpv5-sp-d16` when the processor is configured with a single-precision
FPU, and `neon-fp-armv8` when the processor is configured with a
double-precision + Advanced SIMD-capable FPU.
Note that the `fp-armv8` FPU type is an alias for double-precision FPv5
with 32 double-precision registers (refer to the GCC
`gcc/config/arm/arm-cpus.in` for more details); NEON is always
specified in case of a double-precision configuration because the
Cortex-R52 can only be configured as such.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Introduce a `test_sysbuild()` function.
This function is intended to be used by samples that are dependent on
sysbuild. This function allows such samples to test if sysbuild was used
in the build process, and when sysbuild is not used, then print a
warning to the user, or even fail the build.
This is useful for samples that have two parts to function properly, for
example samples that needs to be build and flash on two or more cores.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit introduces the possibility of a sample to locate
configuration files for extra images that are used when building with
MCUboot.
This allows use-cases where a sample, A, want to include MCUboot but has
adjustments to the default MCUboot configuration.
By adding a Kconfig fragment `<sample>/sysbuild/mcuboot.conf`, then that
fragment will be used together with the default configuration for
MCUboot.
It is also possible to completely replace the MCUboot configuration.
This is done by creating `<sample>/sysbuild/mcuboot/` folder.
This folder will then be used as the `APPLICATION_CONFIG_DIR` when
building MCUboot.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Support referencing module directories by name in CONF_FILE,
OVERLAY_CONFIG, and DTC_OVERLAY_FILE so that projects can reference
overlay files in arbitrary modules.
Verified by passing all the following tests:
./scripts/twister -T tests/cmake/overlays/
Fixes#41830
Signed-off-by: Gregory Shue <gregory.shue@legrand.us>
The `ARCH` init level was added to solve a specific problem, call init
code (SYS_INIT/devices) before `z_cstart` in the `intel_adsp` platform.
The documentation claims it runs before `z_cstart`, but this is only
true if the SoC/arch takes care of calling:
```c
z_sys_init_run_level(_SYS_INIT_LEVEL_ARCH);
```
Which is only true for `intel_adsp` nowadays. So in practice, we now
have a platform specific init level. This patch proposes to do things in
a slightly different way. First, level name is renamed to `EARLY`, to
emphasize it runs in the early stage of the boot process. Then, it is
handled by the Kernel (inside `z_cstart()` before calling
`arch_kernel_init()`). This means that any platform can now use this
level. For `intel_adsp`, there should be no changes, other than
`gcov_static_init()` will be called before (I assume this will allow to
obtain coverage for code called in EARLY?).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
We have cases where some devices needs to be initialized very early and
before c_start is call, i.e. to setup very early console or to setup
memory. Traditionally this would be hardcoded as part of the soc layer
and not using device model or the init levels.
This patch adds a new level ARCH, which will be called in early
architecture code and before we jump to the kernel code.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Clang 15 added a new warning type `-Wdeprecated-non-prototype` that
warns about the functions without prototypes, which have been
deprecated since the C89 and will not work in the upcoming C2x.
This commit disables the warning because Zephyr deliberately makes use
of the functions without prototypes to allow the use of a "generic"
function pointer (notoriously in the cbprintf implementation) and
Zephyr will not move to the C2x in the foreseeable future.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
It's useful for RAMABLE_REGION to have a uniform name when
CODE_DATA_RELOCATION is supported, because otherwise the build system
needs to be aware of how the region name differs between architectures.
Since architectures tend to prefer one of 'SRAM' or 'RAM' for that
region, prefer to use 'RAM' as the more general term.
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
This commit removes the `k_mem_pool` section for the memory pool API,
which was removed in the v2.5.0 release.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Fixes: #45270
Zephyr Kconfig defines the settings BIG_ENDIAN.
Propagate this setting to the corresponding CMAKE_C_BYTE_ORDER and
CMAKE_CXX_BYTE_ORDER variables.
This also ensures that the CMake function 'is_big_endian()' reports the
correct endianess.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #49587
Try to detect sysroot for cross-compile toolchain if not specified by
the user with `-DSYSROOT_DIR=<path>`.
First, the C compiler is asked if it knows its sysroot, some C compilers
are able to return the sysroot, as an example:
> $ arm-none-eabi-gcc -print-sysroot
> <path>/bin/../arm-none-eabi
> $
but majority of gcc-based C compilers seems to return empty string:
> $ arm-zephyr-eabi-gcc --print-sysroot
> $
in such cases, the cross-compiler target CMake file will try to discover
the sysroot by searching for libc.a, starting one level up from the
compiler location.
If no sysroot candidate is found, a warning will be printed to the user.
If a single sysroot candidate is found, this candidate will be selected.
If multiply sysroot candidates are found, a warning is printed, and the
first candiate in the list is selected. User may select another
candidate with `-DSYSROOT_DIR=<use-this>`.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #49116
During development of out-of-tree boards and applications it is not
uncommon to refactor / restructure code.
To allow developers more freedom, let's check that board's defconfig
still exists during a CMake re-run.
If the defconfig no longer exists, either because it's been moved or
deleted, then warn the user and set BOARD_DIR to NOTFOUND.
The NOTFOUND will request CMake to search for the new location in all
board roots. If the board has not been found, as example it's deleted,
then the existing error is printed later.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes commit 7a85ff7683 ("add sparse support")
The sparse build needs (at least) two things:
1. sparse to be in the PATH
2. the environment variable REAL_CC to be defined and to match the
value expected by CMake
Fix error messages when either condition is wrong.
- New error message when 1. is not satisfied:
```
CMake Error at zephyr/cmake/compiler/gcc/target.cmake:12 (find_program):
Could not find CMAKE_C_COMPILER using the following names: cgcc
```
- Previous error "message" when 1. is not satisfied:
```
CMake Error at zephyr/cmake/compiler/gcc/target.cmake:17 (message):
C compiler
ZSDK/xtensa-intel_s1000_zephyr-elf/bin/xtensa-intel_s1000_zephyr-elf-gcc
not found - Please check your toolchain installation
```
Note the "not found" cross-compiler actually exists!
- New error message when 2. is not satisfied:
```
Kconfig header saved to 'ws/build-tgl/zephyr/include/generated/autoconf.h'
-- Found sparse: /home/user/sparse/cgcc
CMake Error at ws/zephyr/cmake/compiler/gcc/target.cmake:25 (message):
The only way to override its 'cc' default when cross-compiling with
sparse is unfortunately an environment variable. So you _must_ set
REAL_CC at both configuration time and build time to:
$ZSDK/xtensa-intel_s1000_zephyr-elf/bin/xtensa-intel_s1000_zephyr-elf-gcc
```
- Previous error "message" when 2. is not satisfied:
```
modules/hal/xtensa/include/xtensa/config/core.h:54:10:
error:unable to open 'core-isa.h'`
```
Also: stop using the same name REAL_CC for both the internal CMake
variable and the external sparse parameter; they're two different
things so name them differently. Environment variable messes are
complicated enough.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
After recent changes Zephyr became incompatible with old
MWDT versions (older than 2022.06).
Version checking may help to avoid build errors
related this incompatibility.
Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
Fixes: #47588
Use `check_set_compiler_property(... "SHELL:-Wformat -W<format-option>")`
to ensure that compiler options requiring `-Wformat` to work properly
are tested with said option.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #47588
Kitware decided to fail compiler tests of single options if the
compiler reported only a warning and not an error:
github.com/Kitware/CMake/commit/f745e0497ee71d35fd1b3524b1636a72da76c266
which affects CMake 3.23.0 and 3.23.1
This change was later reverted in CMake >=3.23.2 and >=3.24.0
github.com/Kitware/CMake/commit/4941887d7defecb3016d2bd94d3a45754251ca56
Although the immediate issue is related to CMake, and has been fixed
reverted in later releases, then it still makes sense to be able to
group compiler options together that generally are depending on each
other to function correctly.
This commit introduces the possibility to group compiler options which
must be tested together.
It uses same approach as
> add_compile_options("SHELL:<option1> <option2> ...")
Usage:
> check_set_compiler_property(PROPERTY <property>
> "SHELL:<option1> <option2> ..."
> )
Will test the option together.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
As the TF-A was integrated into zephyr as a module. This adds necessary
CMake scripts to load BL1 and FIP binary built from TF-A.
Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
Creating a test_interface allows more complex unittest projects to
create additional libraries, for example mock libs, that can be re-used
between test projects.
To support the possibility of such libs to build with same flags as the
testbinary the test_interface is now populated with the public compile
and include flags from testbinary.
testbinary has been updated to use test_interface.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add a user-settable configuration value indicating whether the toolchain
selected by the cross-compile variant supports thread local storage, using
the default 'n' value to preserve compatibility with existing uses.
Signed-off-by: Keith Packard <keithp@keithp.com>
The Zephyr cross tools configuration which the 'xtools' variant supports
enables TLS, so set TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE when using it.
Signed-off-by: Keith Packard <keithp@keithp.com>
ARC processors are highly configurable, so ARC toolchain supports
big amount of mcpu options for all that HW configurations.
As difference in many configurations among the same processor
family usually doesn't affect Zephyr code we don't want
to create Kconfig option for each possible CPU configuration
(just to map Kconfig option to correspondent mcpu value
in 'cmake/gcc-m-cpu.cmake').
Instead we prefer being able to set proper mcpu value
individually for any ARC SoC and using 'cmake/gcc-m-cpu.cmake'
just for reasonable defaults.
To apply SoC-related changes for build-options on early stages of building
'tune_build_ops.cmake' should be created in appropriate SoC directory.
Example:
./soc/arc/snps_qemu/tune_build_ops.cmake
File content:
set(GCC_ARC_TUNED_CPU hs4xd)
Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
The current deprecation warning could give the impression that
CROSS_COMPILE is deprecated, which is not the case.
Instead it is the behavior of defaulting to `cross-compile` when
setting CROSS_COMPILE in environment without setting
ZEPHYR_TOOLCHAIN_VARIANT that is deprecated.
Not the use of `CROSS_COMPILE` setting itself.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The commit c2419fc006 introduced a change
to the CMake toolchain detection routine in which it attempts to use
the distro-provided `gdb-multiarch` GDB executable when the target-
specific GDB executable cannot be found (i.e. fallback to
`gdb-multiarch`).
This can cause many problems for the Zephyr users because the distro-
provided GDB does not contain any Zephyr-specific patches and it may
misbehave under various conditions (e.g. negative tid/pid being
displayed, Xtensa debugging mysteriously failing, ARC debugging not
working).
This commit removes the fallback mechanism to the distro-provided
`gdb-multiarch` because it is better to display an error message saying
GDB is not found than to use a wrong GDB that can give out very
confusing and misleading error messages to users.
Moreover, this fallback mechanism is no longer necessary because the
Zephyr SDK is now available on all major host operating systems and it
provides the target-specific custom GDB that contains all Zephyr-
specific patches.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>