Commit graph

1120 commits

Author SHA1 Message Date
Torsten Rasmussen fe3efbc6a2 cmake: BOARD_REVISION_CONFIG setting for Kconfig revision fragments
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>
2023-01-11 08:10:45 -08:00
Marti Bolivar 951664749b cmake: fix and clean up some module doc comments
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>
2023-01-11 09:40:14 +01:00
Yasushi SHOJI 4f7e2bb658 cmake: Fix typo by replacing zephyr_library_add_sources
There is no function called zephyr_library_add_sources().  This must be
zephyr_library_sources().

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-01-09 19:20:56 +01:00
Ambroise Vincent 562069d4ed cmake: armfvp: allow for extra arguments
Taking example on the qemu cmake file.

Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2022-12-29 10:12:33 +01:00
Jamie McCrae d7557102c0 mgmt: mcumgr: Add iterable section to register MCUmgr handlers
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>
2022-12-22 11:03:04 +01:00
Marc Herbert 3ec1bb2776 cmake: log ${CMAKE_VERSION}
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>
2022-12-22 10:55:28 +01:00
Ming Shao 632972459a cmake: fix a typo in zephyr_linker_arg_val_list() macro
The CMake list delimiter is ";" rather than ":".

Signed-off-by: Ming Shao <smrtos@163.com>
2022-12-21 16:24:37 +01:00
Martí Bolívar ba059ff9b5 cmake: shields: documentation fixes
- 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>
2022-12-19 11:54:25 +01:00
Martí Bolívar 23b947532c cmake: modules: extensions: fix a section header
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>
2022-12-19 11:54:25 +01:00
Martí Bolívar 9812447449 cmake: extensions: clarify zephyr_file() behavior
"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>
2022-12-19 11:54:25 +01:00
Torsten Rasmussen 0b845cd28c cmake: update FindDeprecated for SOURCES
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>
2022-12-05 11:03:02 +01:00
Madhurima Paruchuri fa738b0f74 usb-c: Generate USB-C connector VIF policies XML file
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>
2022-12-02 08:46:04 -06:00
Evgeniy Paltsev ae79de1930 ARC: MWDT add TLS support
Add thread local storage support for ARC MWDT toolchain.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-11-29 09:48:23 +01:00
Evgeniy Paltsev 619c21ecfe ARC: MWDT: bump toolchain version
Bump minimal ARC MWDT version to 2022.09

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-11-29 09:48:16 +01:00
Evgeniy Paltsev 94b87c6422 ARC: arcmwdt: fix & rework inclusion of C/C++ headers
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>
2022-11-29 09:48:08 +01:00
Yuval Peress 49ca6f8f7d unittest: add support for coverage
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>
2022-11-28 16:26:02 -05:00
Christian Taedcke 1fde62ef35 cmake: linker: lld: add missing -no-pie flag
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>
2022-11-22 13:02:44 +09:00
Yuval Peress fae9923ff2 unittest: update coverage library non gcc toolchains
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>
2022-11-21 16:09:46 -05:00
Nikolay Agishev 9f33342602 compiler: arcmwdt: Remove unsupported compile flags (-fno-pic, -fno-pie)
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>
2022-11-17 19:21:23 +09:00
Stephanos Ioannidis a9d85ae472 cmake: Deprecate 'xtools' toolchain variant
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>
2022-11-17 15:42:48 +09:00
Tom Burdick e3d877f811 rtio: Userspace support
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>
2022-11-08 10:44:03 +01:00
Henrik Brix Andersen b3b64e9ede cmake: emu: qemu: do not enable CAN bus on NIOS2 and LEON3
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>
2022-11-02 22:10:05 +09:00
Torsten Rasmussen e0fb04458f cmake: sysbuild: import image kconfig settings to image target
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>
2022-11-02 15:42:23 +09:00
Torsten Rasmussen 430370c4e4 cmake: fix <keys> argument in import_kconfig()
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>
2022-11-02 15:42:23 +09:00
Henrik Brix Andersen abf82013ac drivers: can: add support for configuring CAN emulation in QEMU
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>
2022-11-01 15:22:31 -04:00
Torsten Rasmussen 1ee86a883d cmake: lookup strip tool and set CMAKE_STRIP for host-gnu target
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>
2022-11-01 11:59:19 +01:00
Yuval Peress ffb861d1a3 unittest: warn users of deprecated SOURCES
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>
2022-10-31 17:01:59 +01:00
Yuval Peress 9cebf732ee unittest: Only add main.c if it exists
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>
2022-10-31 17:01:59 +01:00
Keith Packard 62bc9bf3e5 cmake: Allow selection of libc API overflow detection mode
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>
2022-10-31 23:23:27 +09:00
Maureen Helm eee3d8f566 drivers: sensor: Add sensor info iterable section
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>
2022-10-31 11:21:37 +01:00
Keith Packard b3073f0099 gcc/picolibc: Disable -fprintf-return-value when printf is not complete
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>
2022-10-31 17:17:42 +09:00
Nikolay Agishev 75bb8ce382 compiler: arcmwdt: Fix ccac version checking
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>
2022-10-28 22:06:49 +09:00
Keith Packard 57bb7d86a8 cmake/target_arm: Use NO_SPLIT for TOOLCHAIN_LD_FLAGS
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>
2022-10-27 15:38:41 +02:00
Daniel DeGrasse a13e5d0a2d cmake: emu: ensure that QEMU_PIPE is set when using sysbuild
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>
2022-10-26 08:48:37 -04:00
Keith Packard fc3f1480c5 arch/arc: Add -mcpu flag to TOOLCHAIN_LD_FLAGS
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>
2022-10-25 10:51:46 +02:00
Kumar Gala 2f031efea8 cmake: sim: Update simulator related cmake to use CONFIG_MP_MAX_NUM_CPUS
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>
2022-10-19 16:01:10 +02:00
Stephanos Ioannidis 9f652ea04a cmake: gcc: Fix Cortex-R52 FPU type
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>
2022-10-19 00:28:33 +09:00
Torsten Rasmussen d79d80518b cmake: test_sysbuild() function
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>
2022-10-18 14:13:27 +02:00
Torsten Rasmussen 303c1eb60c sysbuild: support sample configuration of extra images
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>
2022-10-18 14:13:27 +02:00
Gregory Shue cfcf630184 build: Overlay build vars expand ${ZEPHYR_<module>_MODULE_DIR}
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>
2022-10-13 12:04:38 +02:00
Gerard Marull-Paretas e42f58ec94 init: s/ARCH/EARLY, call it just before arch kernel init
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>
2022-10-12 17:16:27 +09:00
Anas Nashif e8395351e6 kernel: init: introduce a new init level: ARCH
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>
2022-10-11 08:28:25 -04:00
Stephanos Ioannidis 0a63ca6131 cmake: clang: Disable deprecated non-prototype warning
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>
2022-10-03 17:56:26 +09:00
Peter Marheine 5eb75b81f7 arm: rename default RAM region from 'SRAM' to 'RAM'
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>
2022-10-03 10:09:53 +02:00
Stephanos Ioannidis ed13880f1d linker: Remove k_mem_pool section
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>
2022-09-28 14:24:34 +00:00
Torsten Rasmussen 4ced8de50c cmake: propagate endianess to CMake CMAKE_<lang>_BYTE_ORDER setting
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>
2022-09-26 15:09:38 +00:00
Torsten Rasmussen fd9e5429a3 cmake: detect sysroot for cross-compile toolchains
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>
2022-09-23 16:37:44 +02:00
Torsten Rasmussen af4a87af8e cmake: support relocating of a board folder
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>
2022-09-22 17:14:20 +02:00
Marc Herbert 3ebb18b882 cmake: fix utterly cryptic error handling in the -DSPARSE=y build
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>
2022-09-22 15:12:22 +00:00
Nikolay Agishev df7beca2eb compiler: arcmwdt: Add ccac version checking
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>
2022-09-20 09:02:38 +00:00