arm-clang utilizes the gcc fpu flags, however -mfpu=auto is not a
supported option in arm-clang. For arm-clang we can mimic the auto
behavior by just not setting the -mfpu option.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Label espressif, gnuarmemd and xtools toolchains with newlib support using
the Kconfig variable rather than relying on the TOOLCHAIN_HAS_NEWLIB
value.
Signed-off-by: Keith Packard <keithp@keithp.com>
Switch from using a generator expression to computing the value with a
conditional so that it is available during the execution of kconfig instead
of only being available while generating the build script.
Signed-off-by: Keith Packard <keithp@keithp.com>
On mps2_an521 GCC_M_CPU gets set to cortex-m33+nodsp, however that is
not a valid setting for CMAKE_SYSTEM_PROCESSOR. We need to strip the
extra options (+<OPTION>) from GCC_M_CPU so that we get just cortex-m33.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Cleanup linker scripts for net_buf_pool section to use the linker
script related iterable section macros.
Also replace _net_buf_pool_list with macro's instead to complete
iterable section usage.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Due to many layers of indirections (Github Actions, Docker scripts, SOF
build scripts, etc.), thesofproject/sof/pull/7452's first attempt to
turn off VLAs ended up setting `-DSPARSE=gar bage`:
west build ... -- '-DSPARSE=y -DCONFIG_LOG_USE_VLA=n'
Quoting issues are typical when trying to pass parameters through too
many layers of indirections. In this case, the mistake set the $SPARSE
variable to the 'y -DCONFIG_LOG_USE_VLA=n' garbage which printed this
confusing and time-consuming error message:
Setting SPARSE=y -DCONFIG_LOG_USE_VLA=n is deprecated.
Worse: this enabled sparse (!) while silently ignoring the garbage
trailing after "y".
1. Enable sparse only when $SPARSE is equal to "y" and nothing
else. This stops enabling sparse when `-DSPARSE=gar bage` which draws
more attention to the warning and gives a little more incentive to
leave the deprecated option behind. Don't make any difference between
the "n" and "gar bage" values because $SPARSE is deprecated so not
worth that much CMake code.
2. Add quotes in the deprecation message to make garbage values more
obvious, now:
Setting SPARSE='y -DCONFIG_LOG_USE_VLA=n' is deprecated.
Fixes: 60196ca112 ("cmake: sparse: deprecate old sparse support")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The initshell sections in the linker scripts where associated with theo
old shell code. The old shell code has been removed for some time so
remove references to initshell in the linker scripts and size_calc.py
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
We have an entry for shell_root_cmds using zephyr_iterable_section so
remove duplicate handling of shell_root_cmds.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Convert handling of shell_root_cmds, shell_subcmds, and
shell_dynamic_subcmds to use iterable section macros.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This function allows subsystems to define libraries which get added to the
link command after all other libraries and modules. It's useful when using
a toolchain library, like libc or libgcc, as those can get added when
processing the 'lib' directory, before any module libraries and hence might
not get used to resolve symbols from modules.
Signed-off-by: Keith Packard <keithp@keithp.com>
Follow-up fixes to 64c7f50229
("cmake: extensions: fix zephyr_dt_preprocess() CPP handling") that
weren't urgent enough for the hotfix, or didn't get noticed:
- error out on missing CPP argument again (this regression was
introduced in 64c7f50229)
- use a UNIX manpage style argument arity format (formatting issues
were present when the function was introduced)
- fix incorrect signature comment: the CPP arguments are the
preprocessor and its arguments, not CMAKE_DTS_PREPROCESSOR
(this was present when the function was introduced)
Fixes: 64c7f50229
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
These flags were added to avoid warnings when main was declared to return
void. Now that main returns int, those warnings will flag errors.
Signed-off-by: Keith Packard <keithp@keithp.com>
This option argument needs to be able to accept a list of arguments.
One use case is the way CMAKE_DTS_PREPROCESSOR is set in
cmake/compiler/armclang/generic.cmake.
Reported-by: Kumar Gala <kumar.gala@intel.com>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Cache the property GNULD_LINKER_IS_BFD between cmake invocations.
It is observed that, in repeated builds (2nd time and later),
this property becomes true even for non-bfd compatible linker.
So cache it to avoid any surprises.
Fixes#56501
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Tighten up the interface boundaries by adding an extension function
that separates *how* we preprocess the DTS from *what* DTS files we
are preprocessing. This involves a functional change to the pre_dt
module.
This is useful cleanup but is also groundwork for relying on this
helper function when adding system devicetree support.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This list processing procedure will be useful elsewhere, so prep for
not repeating ourselves. Put it in a new zephyr_list() function whose
signature has room to grow if we keep adding list processing
extensions.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
When the build system was being split up into modules under
cmake/modules, most of the resulting cmake modules had their inputs
and outputs documented in top-of-file comments. The dts module is an
exception, which makes it harder to use since its contracts aren't
defined. Fix this by adding a contract.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Create a separate module that sets up all our devicetree handling, by
setting up common variables that would apply to any and all DT
processing. This is then included in the regular dts module that we
include in zephyr_default.cmake.
The separation of this code from dts.cmake is groundwork for enabling
system devicetree in Zephyr, which will need the same definitions
included into its scope.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Due to Hyrum's Law, there are users out in the wild depending on this
directory existing to place their own generated files, so it'd break
things unnecessarily to not do this if we don't have a DTS, as
explained in a source code comment.
However, this doesn't really have anything to do with DTS processing,
so split it into its own module to separate concerns. This isn't
really a CMake module in the usual sense of something that defines
functions you can use, and is therefore a form of technical debt. The
decision was made to accept this because fixing this is a larger task
for the files in cmake/modules/, since there are multiple other
examples of this in here.
This also paves the way for inserting another module in between the
generated_file_directories and dts modules that itself depends on
these directories existing.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The name of each commented section should match the name in the "table
of contents", for consistency and so people can jump from contents to
implementations more easily with their editors' search functions.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
As it is meant to be used on the tests/drivers/disk test case, it will
currently create a dummy 1Mb image on a fixed path to serve as a NVMe
disk.
It could be made of an alternate path and size, if necessary.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
device_extern.h was still generated with an #error directive, not really
useful was it was never designed to be included directly, but via
device.h.
Fixes#56425
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Fixes: #56235
Changes to the Zephyr VERSION file is not picked up by CMake and thus
not picked up by Kconfig which may rely on the KERNELVERSION setting.
Fix this by setting CMAKE_CONFIGURE_DEPENDS on the Zephyr VERSION file.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The log_backed section is now using the iterable section macros so
we should be using zephyr_iterable_section() in common-rom.cmake
so the generation of the linker script is correct for arm clang
compiles.
Fixes#56440
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Add missing users of ITERABLE_SECTION_ROM* macros that should exist
in common-rom.cmake so that linker script generation for arm clang
works for those users.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Add missing users of ITERABLE_SECTION_RAM* macros that should exist
in common-ram.cmake so that linker script generation for arm clang
works for those users.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
For run_qemu and qemu_debugserver, the targets that use QEMU_PIPE,
ensure that the QEMU_PIPE file exists before passing the path to QEMU as
an argument.
Signed-off-by: Abe Levkoy <alevkoy@google.com>
Add a Kconfig option to set the compiler save-temps flag and set the GCC
implementation. This is very useful for troubleshooting macro expansion
issues, having an option allows a user to set it like any other config
option.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Only include crtbegin.o and crtend.o when LIBGCC_DIR is defined.
Since LIBGCC_DIR is not defined when compiling for posix
architecture, crt{begin,end}.o cannot be referred to via
LIBGCC_DIR.
Also note that, when using llvm/clang, crt{begin,end}S.o are
automatically for native_posix which collide with symbols in
crt{begin,end}.o. So there is no point in making LIBGCC_DIR
available for native_posix under llvm/clang.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
GNU ld and LLVM lld both complain under C++:
error: section: init_array is not contiguous with other relro sections
So do not create RELRO program header.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a new linker property specifically for passing
"-no-pie" to linker. Older binutils' LD (<= 2.36) do not
support this flag and will behave erratically if set. It
would parse "-no-pie" separately as "-n" and "-o-pie",
which would result in the output file being "-pie"
instead of "zephyr*.elf". Moreover, LLVM lld does not
support -no-pie but --no-pie (note the extra hyphen).
By having no-pie as a linker property, we can pass
correct no-pie flag to these linkers (or none at all).
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds a new output variable to FindGnuLd.cmake to indicate
if ld.bfd is found. Since we now ask the compilers for their
preferred ld.bfd linker, it may not match using the existing
string equal test to ${CROSS_COMPILE}ld.bfd. So set the new
variable GNULD_LINKER_IS_BFD to true if ld.bfd, and use it to
pass an extra argument to compiler to make it use ld.bfd.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Since kconfigs are not available when generic.cmake is parsed.
Setting the target triple for x86 needs to be deferred to
target.cmake as it needs to know whether CONFIG_64BIT is
enabled. This also moves the ARM triple to target.cmake as
triple is needed for target tools.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This asks the clang if it has its own preference for ld.lld.
This is to mirror what we are doing to find GNU ld, and to
make sure we are using the linker clang is using.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This asks the compiler if it has its own preference for ld.bfd.
This is useful for LLVM (when CONFIG_LLVM_USE_LD=y) so we know
which linker clang is using.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The variable LINKER is dependent on CONFIG_LLVM_USE_LLD
or CONFIG_LLVM_USE_LD, and these kconfigs are not
available when toolchain/llvm/generic.cmake is parsed.
So setting LINKER needs to be deferred to target.cmake
where kconfigs are available.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This introduces a new cmake module FindGnuLd.cmake to do
the work to discover GNU ld (of binutils).
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This moves CONFIG_LLVM_USE_LD into cmake/toolchain/llvm as this
is a toolchain kconfig. Also make it a choice to allow the use
of LLVM's lld as linker.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Some distros may provide config files for clang to change its
default behavior. We need to override that, or else developers
may be using different defaults and we will have confusing
bug reports in the future.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
When checking that modules contain a file `modules/modules.cmake`,
the CMake file only actually checked for the existence of the module
root, not the `modules/modules.cmake` file inside of it.
Signed-off-by: Pete Dietl <pete.dietl@worldcoin.org>
Introduce a place to share implementations of libc functions that
are needed by different libc versions. Place time() in this common
location so it can be shared when building for either minimal libc or
armclang libc.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Add a new script, snippets.py, which is responsible for searching
SNIPPET_ROOT for snippet definitions, validating them, and informing
the build system about what needs doing as a result.
Use this script in snippets.cmake to:
- validate any discovered snippet.yml files
- error out on undefined snippets
- add a 'snippets' build system target that prints all snippet
names (analogous to 'boards' and 'shields' targets)
- handle any specific build system settings properly,
by include()-ing a file it generates
With this patch, you can define or extend a snippet in a snippet.yml
file anywhere underneath a directory in SNIPPET_ROOT. The snippet.yml
file format has a schema whose initial definition is in a new file,
snippet-schema.yml.
This initial snippet.yml file format supports adding .overlay and
.conf files, like this:
name: foo
append:
DTC_OVERLAY_FILE: foo.overlay
OVERLAY_CONFIG: foo.conf
boards:
myboard:
append:
DTC_OVERLAY_FILE: myboard.overlay
OVERLAY_CONFIG: myboard.conf
/my-regular-expression-over-board-names/:
append:
DTC_OVERLAY_FILE: myregexp.overlay
OVERLAY_CONFIG: myregexp.conf
(Note that since the snippet feature is intended to be extensible, the
same snippet name may appear in multiple files throughout any
directory in SNIPPET_ROOT, with each addition augmenting prior ones.)
This initial syntax aligns with the following snippet design goals:
- extensible: you can add board-specific support for an existing
snippet in another module
- able to combine multiple types of configuration: we can now apply a
.overlay and .conf at the same time
- specializable: this allows you to define settings that only apply
to a selectable set of boards (including with regular expression
support for matching against multiple similar boards that follow
a naming convention)
- DRY: you can use regular expressions to apply the same snippet
settings to multiple boards like this: /(board1|board2|...)/
This patch is not trying to design and implement everything up front.
Additional features can and will be added to the snippet.yml format
over time; using YAML as a format allows us to make
backwards-compatible extensions as needed.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Basic things needed to integrate the new 'snippets' feature into the
build system. The main CMake variable which controls snippets is
SNIPPET. It is a whitespace-or-semicolon-separated list of snippet
names.
- Add minimal new cmake module for processing snippets. This just has
basic infrastructure for processing a SNIPPET variable into
SNIPPET_AS_LIST, and warning the user if they try to change it too
late.
- Integrate the new module into the build system, via
zephyr_default.cmake
This is anologous to the shields and boards modules' boilerplate and
input variables.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
The commit adds CONFIG_MCUBOOT_CMAKE_WEST_SIGN_PARAMS Kconfig
option to allow passing arguments to west sign.
The option is used to pass arguments that immediately follow
west sign in cmake invocations and replaces hardcoded
"--quiet" parameter, but defaults to the "--quiet" value to
keep current behaviour.
New Kconfig option allows to pass arguments to west sign
without modifying cmake/mcuboot.cmake.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
When we build for a SoC that has a cortex-m4 w/o a FPU that
utilizes CMSIS headers with armclang (like mec1501modular_assy6885)
we get the following warning:
modules/hal/cmsis/CMSIS/Core/Include/core_cm4.h:93:8: warning:
"Compiler generates FPU instructions for a device without
an FPU (check __FPU_PRESENT)" [-W#warnings]
#warning "Compiler generates FPU instructions for a device
without an FPU (check __FPU_PRESENT)"
Fix the by setting -mfloat-abi=soft for such cases that don't have FPU
enabled.
Fixes#56068
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Moves the deprecation notice for prj_<board>.conf files to the
proper location where other deprecation notices are located.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
_static_thread_data should be in ROM as its static data. So move
it from common-ram.cmake to common-rom.cmake and fix it the params
we call zephyr_iterable_section with.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This now throws an error if there is no prj.conf file located in a
user-specified APPLICATION_CONFIG_DIR, which otherwise would have
used an empty configuration and not included board-specific files.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
When building with C++ the icx compiler will try to utilize optimized
versions of memset/memcpy that are provided as part of libirc. However
libirc also has dependencies on things likes getenv/setenv, etc that
are expect in a linux host environment. So disable use of libirc
via compiler flag -no-intel-lib=libirc.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This commit provides a number of helper macros for verifying arguments
passing to function:
- zephyr_check_flags_required
- zephyr_check_arguments_required
- zephyr_check_arguments_required_all
- zephyr_check_flags_exclusive
- zephyr_check_arguments_exclusive
which facilitates checking whether a required argument or flag has been
given or if mutual exclusive arguments are given.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit extends the Zephyr module yaml scheme with additional
entries for sysbuild in the build section.
This allows for Zephyr modules to extend the sysbuild infrastructure
by providing additional CMake and Kconfig files to be included in
sysbuild.
The new settings are:
build:
sysbuild-cmake: <path>
sysbuild-kconfig: <path>/<file>
sysbuild-ext: <true>|<false>
sysbuild-kconfig-ext: <true>|<false>
those settings follow the same pattern as the equivalent Zephyr build
settings but are processed by sysbuild.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Rename internals variables to lower case to distinguish those
variables from variables intended to be globally available.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Different users of the Zephyr CMake package may have different minimum
required versions of west. One important in-tree example is the
documentation, which must either be built with the latest version of
west, or with no west installed at all.
Make the MIN_WEST_VERSION variable configurable to support use cases
like this.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
CMake versions <3.20.5 contains the following bug:
https://gitlab.kitware.com/cmake/cmake/-/issues/22310
This bug was fixed in CMake 3.20.5:
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6232
Generally Zephyr can build with CMake >=3.20.0, however the
`cmake/package_helper.cmake` is impacted by the above issue.
Therefore, specifically request CMake >=3.20.5 for package helper
and update documentation to recommend CMake version 3.20.5 in order
to minimize risk of users being impacted by this bug.
Users invoking package helper with CMake 3.20.0-3.20.4 will see:
> CMake Error at cmake/package_helper.cmake:45 (cmake_minimum_required):
> CMake 3.20.5 or higher is required. You are running version 3.20.x
Rest of Zephyr still builds with CMake versions >=3.20.0.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #55490
Follow-up: #53124
Prefix local version of the return variable before calling
`zephyr_check_compiler_flag_hardcoded()`.
This ensures that there will never be any naming collision between named
return argument and the variable name used in later functions when
PARENT_SCOPE is used.
The issue #55490 provided description of situation where the double
de-referencing was not working correctly.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
CROSS_COMPILE_TARGET is defined based on CONFIG_SOC selected. So far
'esp32s3' SoC was not taken into account, so building Zephyr with
'espressif' toolchain (the only one supported for now) is was not possible
out of the box.
Add 'CROSS_COMPILE_TARGET_xtensa_esp32s3' CMake variable, same as it is
done for other SoC specific variables. That way toolchain paths are
automatically figured out and building succeeds.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This improves the version checking for the zephyr SDK by searching
for newer versions that the version that was detected. This works
around the issue whereby the versions are contained in files with
MD5 hashes which might be in any order.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Follow-up: #53124
The PR#53124 fixed an issue where the variable `check` was not properly
dereferenced into the correct variable name for return value storage.
This was corrected in 04a27651ea.
However, some code was passing a return argument as:
`zephyr_check_compiler_flag(... ${check})`
but checking the result like:
`if(${check})`
thus relying on a faulty behavior of code updating `check` and not the
`${check}` variable.
Fix this by updating to use `${${check}}` as that will point to the
correct return value.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
New C++ versions have deprecated "register" variables and restricted
"volatile" semantics, so new gcc's will emit warnings when they see
that syntax. Zephyr uses both in our C headers (though we should
probably get rid of register and unify with C++'s volatile model), so
we're disabling the resulting warnings.
But OLD gcc variants (like xcc, sigh) don't understand new -Wvolatile
and -Wregister on the command line, so they get confused. Limit the
uses to the standard versions for which gcc would emit warnigns; xcc
doesn't support those anyway.
Signed-off-by: Andy Ross <andyross@google.com>
Fixes: #53124
Fix de-referencing of check and exists function arguments by correctly
de-referencing the argument references using `${<var>}`.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The toolchain support was developed and tested against arm clang
version 6.17. So add a check to ensure we are utilizing 6.17 or
newer.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Improve comments, rearrange variable definitions to better match the
control flow of the module, and avoid nesting by adding a return()
statement.
No functional changes expected.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The oneApi support has bit rotten since it was first introduced. Update
the support to function with the latest 2023.0.0 release and add a
check to only support that version or newer for now. Versions before
2021.2.0 have linker script failures.
Various fixes made:
* In the 2023.0.0 release, various binaries are in a llvm-bin path so
add support to search in that path. This replaces the python search
path that much older versions needed.
* newlib isn't supported with oneApi so set TOOLCHAIN_HAS_NEWLIB to
OFF to match that.
* 2023.0.0 doesn't back llvm-nm, so use binutils version. This
is expected to be fixed in 2023.1.0 release so add a check to
handle either case.
* Update compiler flag check based on clang to also support
CMAKE_C_COMPILER_ID of "IntelLLVM" as that is how the oneApi toolchain
reports itself.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
Xtensa toolchain has its own linker, xt-ld, which is based on
binutils' ld. There are, of course, Xtensa specific options.
But mostly it is based on old version of ld. It would be
better to detach it from the ld profile to avoid any
incompatible changes there.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Add a new UF2 runner, supporting only the flash capability.
Searches for FAT partitions containing `INFO_UF2.TXT` files,
and can optionally filter on a matching `Board-ID` value in
that file.
Signed-off-by: Peter Johanson <peter@peterjohanson.com>
Unlike gcc, clang splits out the flag controlling warnings about the return
type of `main' from other warnings related to that function. Add the extra
-Wno-main-return-type flag to mask these warnings when building Zephyr
without -ffreestanding, as when using picolibc.
Signed-off-by: Keith Packard <keithp@keithp.com>
This removes the enforced `-s` option and only passes in a `-gdb` only if
CONFIG_QEMU_GDBSERVER_LISTEN_DEV is set. When unset, it allows users to
utilize QEMU_EXTRA_FLAGS from environment preventing a clash that occurs
if `-s` and `-gdb` are both passed to QEMU invocation.
Signed-off-by: Alp Sayin <alpsayin@gmail.com>
Move extra warning option from generic twister script into
compiler-dependent config files.
ARCMWDT compiler doesn't support extra warning options ex.
"-Wl,--fatal-warnings". To avoid build fails flag
"disable_warnings_as_errors" should be passed to twister.
This allows all warning messages and make atomatic test useles.
Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
nostdinc_include flag needs to contain path to llvm libraries
and remove other relative paths. Change compiler flag to add
default C includes on building C++ code using xcc-clang compiler.
Fixes#54730
Signed-off-by: Aastha Grover <aastha.grover@intel.com>
This avoids a cryptic DTC failure when compiling trying to compile
native_posix with a missing gcc or clang.
REQUIRED is available since CMake 3.18
Example with clang, cryptic error without this commit:
```
ZEPHYR_TOOLCHAIN_VARIANT=llvm west build \
-p -b native_posix samples/hello_world/
-- Found toolchain: host (clang/ld) <= this is wrong
-- Found Dtc: /usr/bin/dtc (found suitable version "1.6.1", minimum ...
-- Found BOARD.dts: zephyr/boards/posix/native_posix/native_posix.dts
CMake Error at /zephyr/cmake/modules/dts.cmake:191 (message):
command failed with return code: No such file or directory
Call Stack (most recent call first):
zephyr/cmake/modules/zephyr_default.cmake:113 (include)
zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boil...
CMakeLists.txt:5 (find_package)
```
Well hidden behind the scenes, dts.cmake fails above because it invokes
`CMAKE_C_COMPILER-NOTFOUND`
With this commit:
```
ZEPHYR_TOOLCHAIN_VARIANT=llvm west build \
-p -b native_posix samples/hello_world/
-- Found toolchain: host (clang/ld) <= this is still wrong
CMake Error at zephyr/cmake/compiler/clang/generic.cmake:7 (find_program):
Could not find CMAKE_C_COMPILER using the following names: clang
```
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Clang does not have printf return value optimizations like GCC, so there's
no flag to turn them off when building against a non-standard printf
implementation (e.g., picolibc without float support).
Signed-off-by: Keith Packard <keithp@keithp.com>
Deprecate old sparse support as Zephyr now provides a proper
infrastructure for SCA tools. Set ZEPHYR_SCA_VARIANT to sparse if user
is using deprecated way.
This allows to cleanup sparse code in various places and thus have a
cleaner build system.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Sparse support was original introduced in #43776.
This commit introduces sparse support as part of Zephyr SCA tool
infrastructure.
The implementation in this commit has some benefits over existing
support:
- It does not required users to set `REAL_CC` in environment before
invoking build command.
This reduces risk of user mistakes, such as
- REAL_CC being different from CMAKE_C_COMPILER.
- User running CMake in one terminal / environment where REAL_CC is
defined but invoking the build command in a different terminal /
environment where REAL_CC is not defined or defined differently.
- It improve user experience as the user no longer has to define /
re-define REAL_CC when building for different architecture, like
switching from arm to xtensa, as this is now handled in CMake.
- CMAKE_C_COMPILER is not overwriting, this can be important for other
tools which calls the C compiler for pre-processing purposes, such
as devicetree and linker script generation.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Static code analyser (SCA) tools are important in software development.
CMake offers built-in support for some tools, such as cppcheck and
clang-tidy.
Other tools, such as sparse, are not directly supported.
This commit provides a uniform way for users to specify a supported
SCA using `ZEPHYR_SCA_VARIANT=<tool>` which is consistent with how
toolchains are specified.
ZEPHYR_SCA_VARIANT can be set using `-D` or in environment.
Support for an SCA tool is done in `cmake/sca/<tool>/sca.cmake`.
SCA_ROOT can be used to specify additional search paths when looking up
implementation for a tool. SCA_ROOT can also be specified in
`zephyr/module.yml` as setting. This makes it possible to provide SCA
tool implementation as part of a Zephyr module.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add a compiler option to not merge globals. gen_kobject_list.py
is not capable of distinguish addresses of merged objects. The script
itself does not look wrong. The dward specification says that the
attribute DW_AT_location with opcode DW_OP_addr encodes a machine
address and whose size is the size of an address on the target machine
but for merged objects the address is longer, not clear why.
Disable global merge when userspace is enabled to avoid this problem.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Add support for Renode script overlays allowing
to tune simulation parameters for selected samples/tests.
Signed-off-by: Jan Malek <jmalek@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
When using picolibc from the toolchain, we need to use the standard include
paths to make sure the library headers are found, especially for libstdc++.
Add toolchain picolibc to the list of cases for which this is the case.
Signed-off-by: Keith Packard <keithp@keithp.com>
Update API for zephyr_code_relocate to support cmake generator expressions,
as well as relocating libraries.
zephyr_code_relocate can now accept a target name to the LIBRARY argument,
which will be converted into a set of source files from that
target to relocate.
Alternatively, files can be passed as a space separated list
or CMake generator expression. This allows users more
flexibility when relocating files. Glob matching functionality is still
available, although the preferred method to do this would now be:
file(GLOB relocate_sources "src/*.c")
zephyr_code_relocate(FILES ${relocate_sources} LOCATION <location>)
Note! This commit breaks support for zephyr_code_relocate until in tree
usages of the API are updated to the new format.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
In some architectures the linker performs global optimization relaxing
address modes and changing intructions in the output object file. This
is a problem when userspace is enabled since it assumes that addresses
won't change after certain build stage. In no supported architectures
this option is ignored.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit updates all in-tree code to use `CONFIG_CPP_EXCEPTIONS`
instead of `CONFIG_EXCEPTIONS`, which is now deprecated.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit updates all in-tree code to use `CONFIG_CPP` instead of
`CONFIG_CPLUSPLUS`, which is now deprecated.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Fixes: #53696
Create a BOARD_REVISION_CONFIG setting to be consistent with the
BOARD_DEFCONFIG setting.
This allows systems which re-uses the Kconfig module to overrule the
file to be used as BOARD_REVISION_CONFIG in same way as is done for
the BOARD_DEFCONFIG file.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The boards, shields, and zephyr_module CMake modules have some issues
in their comments that can be trivially fixed up.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
This replaces the requirement for applications to manually
register MCUmgr handlers by having an iterable section which
then automatically registers the handlers at boot time.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Different CMake versions can have very subtle differences, for
instance CMake 3.21 links object files in a different order compared
to CMake 3.20; this produces different binaries.
CMAKE_VERSION is required information to track binary differences
between two build systems.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
- Fix commit b2520b09a7 ("devicetree:
drop support for dts_fixup.h files"), which removed support for
shield-related fixups but forgot to update the module-level
documentation comment.
- Fix commit 61453e4a58 ("cmake: Zephyr
CMake package and CMake modules"), which contained some
BOARD-related copy/paste errors and omitted documentation for
the SHIELD_DIRS output variable (this is used in the dts
cmake module, so it's part of the shield module's contract)
- Add some other clarifying remarks and comments
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The table of contents at the top of the file has 'Devicetree
extensions' as the name of the section containing... those things.
The actual place in the file where they are defined has a different
title, though, defeating searching in the file for that section name.
Fix it.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
"Populate" is ambiguous here: does that mean set, or append? The
answer is "append", so use that to be clearer. Be extra clear where
we're looking in as well.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
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>