Commit graph

1120 commits

Author SHA1 Message Date
Torsten Rasmussen c2974e22d4 cmake: test format options together
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>
2022-09-14 09:37:59 +00:00
Torsten Rasmussen c32e4a71bf cmake: support grouping of compile options for compiler testing
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>
2022-09-14 09:37:59 +00:00
Jeremy Bettis 878edeb6ff cmake: Add -gdwarf-4 at link time for gcc
Add a linker option for gcc to force dwarf symbols to be version 4.

Fixes #50106

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-13 17:05:57 -05:00
Huifeng Zhang dab22aac7a cmake: armfvp: permit run zephyr together with tf-a
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>
2022-09-09 16:36:37 +00:00
Torsten Rasmussen a0a72b9a96 cmake: create test_interface interface library
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>
2022-09-09 10:06:19 +02:00
Keith Packard 1dfc469bd5 toolchain/cross-compile: Allow TLS support selection.
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>
2022-09-08 21:36:37 +00:00
Keith Packard 7052d52b3b toolchain/xtools: Crosstools-ng supports TLS by default
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>
2022-09-08 21:36:37 +00:00
Nikolay Agishev a56777263e compiler: gcc: add support for tuning mcpu option for ARC targets
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>
2022-09-08 10:39:21 +02:00
Torsten Rasmussen a5cd394758 cmake: improve warning deprecation message
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>
2022-09-07 15:38:36 +02:00
Stephanos Ioannidis 9d0ec5dcd6 cmake: bintools: gnu: Do not use gdb-multiarch
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>
2022-09-07 09:27:16 +00:00
Stephanos Ioannidis 3363c64abc cmake: bintools: gnu: Update GDB executable names for Zephyr SDK 0.15
The Zephyr SDK 0.15.0 release has changed the default GDB executable to
be Python-less and introduced an alternate Python-capable variant
called `gdb-py` (note that the Zephyr SDK previously provided
`gdb-no-py` instead).

This commit updates the CMake toolchain detection routine to attempt
using the Python-capable GDB variant (gdb-py) first and, if it is not
available or fails to launch due to a missing libpython dependency,
use the Python-less GDB variant (gdb).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-07 09:27:16 +00:00
Torsten Rasmussen b066ae906b cmake: fix improper use of separate_arguments
The use of `separate_arguments()` in extra_flags.cmake and
unittest.cmake prevents the use of proper CMake lists.

A CMake list can be specified on command line as:
`-DMY_LIST="itemA;itemB;itemC"`

Users are expected to be able to provide extra compile flags using CMake
lists, like `-DEXTRA_CFLAGS="--flag1;--flag2"` but also using space
separated lists, like: `-DEXTRA_CFLAGS="--flag1 --flag2"`.

However, the way FLAGS was passed to separate_arguments() would result
in a list being treated as extra arguments to the function and thus
result in a CMake error.

To allow the use of CMake lists, the length of the argument as a CMake
list is tested. This ensures that when the argument contains a
single `;` then the length is >1 and no conversion is needed.

This allows a user to freely choose between the two forms:
- `-DFLAGS="--flag1 --flag2"`
- `-DFLAGS="--flag1;--flag2"`

or when passing flags which themselves contains spaces, like:
- `-DFLAGS="--flag1 \"val1 val2\""`
- `-DFLAGS="--flag1;val1 val2"`

Note that the extra escaped qouting is no longer needed for proper CMake
lists as the `;` itself informs the system that spaces are to be kept as
spaces.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-05 10:22:05 +02:00
Torsten Rasmussen 88ae9cbb9d cmake: extend zephyr_get() to handle build configurations from sysbuild
Enhance sysbuild controlled configurations.

The current scheme of passing settings using `-D` on the CMake
invocation is vulnerable to quoting and lists.

With `zephyr_get()` in place as a uniform way of handling user
controlled settings (CMake cache / environment / CMake local variable)
we have a mechanism in place for a cleaner handling of sysbuild
controlled settings.

This improves the robustness of variable passing and add the same cleans
up and simplifies the logic in sysbuild.

The Kconfig Zephyr CMake module has been updated accordingly so that
CONFIG settings are taken from the sysbuild shadow cache when sysbuild
is used as higher level build system.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-02 15:16:50 +02:00
Torsten Rasmussen 44a05e4439 cmake: update common Zephyr build settings to use zephyr_get()
Fixes: #40389

This commit aligns the use of the following Zephyr build variables:
- CONF_FILE
- DTC_OVERLAY_FILE
- OVERLAY_CONFIG
- WEST_DIR
- ZEPHYR_BOARD_ALIASES
- ZEPHYR_EXTRA_MODULES
- ZEPHYR_MODULES

so that they can be set in same manner and with same order of
preference.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-02 15:16:50 +02:00
Torsten Rasmussen 6d1f6c2d4e cmake: improved variable handling in zephyr_check_cache()
A cache variable specified by the user as `-DVAR=value` will have the
type UNINITIALIZED in the CMake cache.

Later CMake re-runs will execute the line:
set(${variable} ${CACHED_${variable}} CACHE STRING
    "Selected ${variable_text}" FORCE)

This will update the cache type from UNINITIALIZED to STRING and thus
may be picked up by other tools as a change.

To ensure the type is initialized to string, this is added:
set(${variable} ${${variable}} CACHE STRING "Selected ${variable_text}")

This code will not change the value of an existing CMake cache variable
because there is no FORCE, but what it will do is to update the cache
variable type to STRING.

As part of this, include the existing parent scope setting of variable
inside the `if(DEFINED ...)` as there is no reason to clear a variable
there is not having a value.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-02 15:16:50 +02:00
Torsten Rasmussen 56c827ac2c cmake: use zephyr_get in toolchains to ensure identical behavior.
Fixes: #40389

Update toolchain handling to use zephyr_get() to ensure consistent
handling of CMake cache variables, environment variable, and CMake
local variables.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-02 15:16:50 +02:00
Torsten Rasmussen 9913fd4f42 cmake: remove deprecated GCCARMEMB_TOOLCHAIN_PATH
Remove deprecated GCCARMEMB_TOOLCHAIN_PATH.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-02 15:16:50 +02:00
Torsten Rasmussen 90e236581e cmake: implement zephyr_get(<variable>) function
Fixes: #40389

This commit implements zephyr_get(<variable>).

The purpose of zephyr_get(<variable>) is to ensure a uniform way to
handle variables which can be defined as:
- CMake cache variable, for example `-D<var>=<value>`.
- Environment variable
- Locally in CMakeLists.txt file before `find_package(Zephyr)`

It furthermore ensures that if an environment setting hides a local
setting then a warning is printed.

using
zephyr_get(<var>)

removes the need for constructs like:
set_ifndef(<var> "$ENV{<var>}")
set(<var> ${<var>} CACHE PATH "")

if(NOT DEFINED <var>)
  set(<var> $ENV{<var>})
endif()

if (NOT DEFINED ENV{<var>})
  message(FATAL_ERROR <error>)
endif()

and also ensures identical preference order for variables used in Zephyr
1. cache
2. environment
3. local scope var

It also ensures the variables supported through environment can also be
set using `-D<var>=<value>`

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-02 15:16:50 +02:00
Mateusz Sierszulski 6c888b2db1 soc: telink_b91: Fix ROM region section overlap
Place vector sections after ROM_START sections.
Also add init.ld script that will prevent overlapping .init sections
in telink_b91 SoC.

Fixes #49036.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-09-02 14:19:53 +02:00
Torsten Rasmussen f6979306bc cmake: locate Zephyr SDK before locating other host tools.
Follow-up: #49672

Zephyr SDK and host tools detection was reworked in #49672.

That rework accidentally changed the lookup order from:
- Zephyr SDK
- Other host tools
- Generic (host) C compiler

into
- Other host tools
- Zephyr SDK
- Generic (host) C compiler

this causes host tools shipped with Zephyr SDK, such as openocd to not
be discovered unless in path.

Restore the original order so that Zephyr SDK is located first so that
host tools from the SDK can be found without having them in path.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-02 19:41:15 +09:00
Torsten Rasmussen 980c22c92d cmake: move deprecated code to FindDeprecated.cmake
Move deprecated XCC_USE_CLANG setting to deprecated module.

Deprecated and move the use of CROSS_COMPILE to deprecated module as we
have had ZEPHYR_TOOLCHAIN_VARIANT==cross-compile for a long time.

Deprecated code is now loaded with a single line:
> find_package(Deprecated COMPONENTS XCC_USE_CLANG CROSS_COMPILE)

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-01 15:59:43 +02:00
Torsten Rasmussen 2f1637c4b4 cmake: introduce Deprecated module
The deprecated CMake module allows Zephyr to move deprecated code to a
centralized location from where it's both easy to get an overview of
deprecated code, and remove the code when it has been deprecated long
enough.

It further improve existing code, as the real CMake code now can be
changed from n-lines of deprecated code into a single line of the form:
find_package(Deprecated COMPONENTS <deprecated_name>)

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-01 15:59:43 +02:00
Torsten Rasmussen 7131d02fa4 cmake: rework of target toolchain handling
Follow-up: #41301

This commit is a rework and cleanup of the target toolchain handling in
Zephyr CMake build system.

Instead of directly loading code a CMake modules for target toolchain
lookup, the target toolchain now follows the CMake `find_package()`
pattern for finding the target toolchain.

This makes it more clear which modules are responsible for finding tools
and which modules provides build integration / features.

The following tools can now be found using `find_package()`:
- Target toolchain: find_package(TargetTools)

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-01 15:59:43 +02:00
Torsten Rasmussen 8d2998d4f9 cmake: rework of host tools and generic toolchain handling
Follow-up: #41301

This commit is a rework and cleanup of the tools handling in Zephyr
CMake build system.

Instead of directly loading code a CMake modules for tool lookup, the
host tools now follows the CMake `find_package()` pattern for finding
programs / tools in module mode.

This makes it more clear which modules are responsible for finding tools
and which modules provides build integration / features.

The following tools can now be found using `find_package()`:
- Zephyr-sdk        : find_package(Zephyr-sdk <version>)
- Generic host tools: find_package(HostTools)

This further allows us to decouple the `verify-toolchain` CMake script
part required by `twister` into a tool lookup module and a dedicated
CMake script which utilizes the lookup module.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-01 15:59:43 +02:00
Torsten Rasmussen 2bace34be3 cmake: remove unreachable Zephyr-SDK lookup code
Removing Zephyr-SDK code for searching and printing messages when Zephyr
SDK is not found in the system.

After Zephyr SDK has been made available on all platforms, including
MacOS and Windows, then `find_package(Zephyr-sdk)` is always invoked
and thus either `find_package(Zephyr-sdk)` will fail or
ZEPHYR_TOOLCHAIN_VARIANT will be defined.

Meaning the removed code block in this commit can no longer be reached.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-01 15:59:43 +02:00
Torsten Rasmussen 8f8f6cfde3 cmake: cleanup search for devicetree compiler, dtc
Cleanup CMake code by moving devicetree compiler detection to dedicated
FindDtc.cmake module.

This allows us to re-use existing CMake find_package() functionality in
module mode and thus reduce CMake logic.

It further has the benefit of being able to directly specify dtc version
like this:
> find_package(Dtc 1.4.6)

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-01 15:59:43 +02:00
Torsten Rasmussen 9a12f8b68b cmake: move testing of compile flag in environment to top CMakeLists.txt
This moves the test of compile flags set in environment from generic
toolchain to top-level ${ZEPHYR_BASE}/CMakeLists.txt.

In order to cleanup and make Zephyr CMake modules more generic then
the testing of specific compile flags and warn user is not really a
toolchain module responsible but a implementation detail of the project
itself as to how compile flags should be applied in a project.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-01 15:59:43 +02:00
Stephanos Ioannidis cedaa6a2e5 cmake: Fix Zephyr SDK download URL
This commit fixes the outdated Zephyr SDK download URL in the toolchain
verification script.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-29 16:57:18 +02:00
Stephanos Ioannidis 30af51fc5e cmake: Set minimum required Zephyr SDK version to 0.15
This commit sets the minimum required Zephyr SDK version to 0.15, which
is required to build the current Zephyr codebase due to the following
breaking changes:

* RISC-V ISA spec change to 20191213 requiring the Zicsr and Zifencei
  extensions to be specified to the `-march` flag
* ARC64 output format name change to `elf64-littlearc64`

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-29 16:57:18 +02:00
Carlo Caione 6503795dc1 riscv: Introduce BitManip extensions
Add Zba, Zbb, Zbc and Zbs BitManip extensions.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-08-29 16:57:18 +02:00
Carlo Caione 5fece03d7d riscv: Introduce Zicsr and Zifencei extensions
And enable the new extensions on all the SoCs.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-08-29 16:57:18 +02:00
Kai Vehmanen 99bab75a69 cmake: fix use of unsupported -fno-pie with xcc
The commit 8259931fce ("xcc-clang: Do not used unavailable options")
has a side-effect that builds with xcc default to use -fno-pie. This
is not a supported compiler option for xcc, resulting in failing builds.

Use same configuration for xcc as is in place for xcc-clang, and
do not use -fno-pie.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-29 08:40:29 -04:00
Mahesh Mahadevan c029b081cc cmake: Add support to add symbols to nocache section
This PR allows the user to add symbols to the nocache
section. The use for this could be as follows

zephyr_linker_sources_ifdef(CONFIG_NOCACHE_MEMORY
  NOCACHE_SECTION
  nocache.ld
)

nocache.ld (as shown below) can define additional
symbols to  go into the nocache section

. = ALIGN(4);
KEEP(*(NonCacheable))

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-08-29 11:19:48 +02:00
Torsten Rasmussen 4cb2ef83bf cmake: kconfig: preserved quotes for Kconfig string values
Fixes: #48950

Kconfig requires quoted strings in its configuration files, like this:
> CONFIG_A_STRING="foo bar"

But CMake requires expects that strings are without additional qoutes,
and therefore qoutes are stripped when loading Kconfig config filers
into CMake.

This is particular important when the string in Kconfig is a path to a
file. In this case, not stripping the quotes leads to an error as the
file cannot be found.

When users pass a string to Kconfig through CMake, they are expected to
pass it so that qoutes are correct seen from Kconfig, that is:
> cmake -DCONFIG_A_STRING=\"foo bar\"

In CMake, those qoutes are written as-is to Kconfig extra config file,
and then removed in the CMake cache.
After Kconfig processing, the Kconfig settings are read back to CMake
but without quotes. Settings that was passed through the CMake cache,
for example using `-D` are written back to the cache, but this time
without the qoutes. This results in Kconfig errors on sub-sequent CMake
runs.

Instead of writing the Kconfig value setting back to the CMake cache,
introduce an internal shadow symbol in the cache prefixed with `CLI_`.
This allows the CMake cache to keep the value correctly formatted for
Kconfig extra config creation, while at the same time keep existing
behavior for CONFIG_ symbols read from Kconfig.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-25 17:53:11 -07:00
Carles Cufi 33211b3fb4 cmake: Bump the minimum required Python version to 3.8
Given that 3.6 is now several years old and the current and previous
Ubuntu LTS ship with 3.8 or later, upgrade the minimum required Python
version from 3.6 to 3.8.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-24 18:35:57 +02:00
Peter Marheine d400b8135c arch/riscv: support CONFIG_CODE_DATA_RELOCATION
This implements support for relocating code to chosen memory regions via
the `zephyr_code_relocate` CMake function for RISC-V SoCs. ARM-specific
assumptions that were made by gen_relocate_app.py need to be corrected,
in particular not assuming any particular name for the default RAM
section (which is 'SRAM' for most ARM pltaforms) and not assuming 32-bit
pointers (so the test works on RV64).

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2022-08-24 10:08:06 +02:00
Flavio Ceolin 8259931fce xcc-clang: Do not used unavailable options
xcc-clang in based on clan-10 and does not support -fno-pic and
-fno-pie.

clang-10: warning: argument unused during compilation: '-fno-pic'
[-Wunused-command-line-argument]
[147/148] Linking C executable zephyr/zephyr.elf
clang-10: warning: argument unused during compilation: '-no-pie'
[-Wunused-command-line-argument]

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-08-23 10:13:43 +02:00
Andy Ross 74cc534758 cmake: Update CONFIG_ASAN support
This had bitrotten a bit, and didn't build as shipped.  Current
libasan implementations want -fsanitize=address passed as a linker
argument too.  We have grown a "lld" linker variant that needs the
same cmake treatment as the "ld" binutils one, but never got it.  But
the various flags had been cut/pasted around to different places, with
slightly different forms.  That's really sort of a mess, as sanitizer
support was only ever support with host toolchains for native_posix
(and AFAICT no one anywhere has made this work on cross compilers in
an embedded environment).  And the separate "gcc" vs. "llvm" layers
were silly, as there has only ever been one API for this feature (from
LLVM, then picked up compatibly by gcc).

Pull this stuff out and just do it in one place in the posix arch for
simplicity.

Also recent sanitizers are trying to add instrumentation padding
around data that we use linker trickery to pack tightly
(c.f. SYS_INIT, STRUCT_SECTION_ITERABLE) and we need a way
("__noasan") to turn that off.  Actually for gcc, it was enough to
just make the records const (already true for most of them, except a
native_posix init struct), but clang apparently isn't smart enough.

Finally, add an ASAN_RECOVER kconfig that enables the use of
"halt_on_error=0" in $ASAN_OPTIONS, which continues execution past the
first error.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-19 08:30:01 +02:00
Andy Ross d6297988be cmake/llvm: Improve tool detection
On Debian, llvm-obj{copy,dump} tools are installed with a version
suffix.  Look first for a version that matches our compiler when
probing for tool paths before trying the bare version, or falling back
to GNU binutils.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-19 08:30:01 +02:00
Daniel Leung 1ace8efb8a cmake: extend linker snippets for pinned sections
This extends the linker snippet code to cover pinned
sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-18 17:23:18 +02:00
Torsten Rasmussen 7a65bdbd64 cmake: kconfig: introduce dedicated unit testing board
This commit introduces a dedicated unit testing board.

Today, a dedicated Zephyr unit testing scheme exists but is different
from how a Zephyr build generally works.

For example Kconfig is not possible, resulting on various different
hacks to pass Kconfig settings from test cases / testcase.yaml through
CMake to the code.
Some directly as compile definitions, some as header files with forced
inclusion on sources, some with wrapper flags which again results in
different define being enabled. There is even cases where a second
forced header inclusion undefines previous defines.

Unit test often does a manual check for the right boards, like this:
> if (NOT BOARD STREQUAL unit_testing)
>    message(FATAL_ERROR "This project can only be used with...")
> endif()

Introducing a dedicated unit_testing board under `tests/root` allows
us to use Kconfig in unit test samples, and thus proper `prj.conf` and
extra Kconfig fragments.
Generation of autoconf.h so the overall architecture follows regular
Zephyr builds.

Proper and uniform error messages when invalid board is selected.

The unit_testing board and arch is located under: `subsys/testsuite` so
that it is only available when find_package(Zephyr COMPONENTS unittest)
is used, and not available for regular Zephyr builds.

Kconfig generates autoconf.h which is applied as compile flag to
test binary which means that kconfig defines placed in ztest.h can now
be removed.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen a450c663f2 cmake: define and create KCONFIG_BINARY_DIR if it doesn't exists
The Zephyr CMake module kconfig.cmake will create files inside
KCONFIG_BINARY_DIR.

In a default Zephyr build setup, this directory is created by Zephyr
CMake module zephyr_module.cmake. But Zephyr CMake modules are modular
and thus it must be possible to use kconfig module without
zephyr_module.

Thus kconfig.cmake must set and create KCONFIG_BINARY_DIR if it does not
already exists.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen c3620c8a8e scripts: remove ZEPHYR_BASE as default root for board listing
Remove ZEPHYR_BASE as default root in list_boards.py.

This allows list_boards.py to be used to only print boards at given
root(s) without printing Zephyr default boards.

Secondly it remove the need in list_boards.py to have any knowledge of
ZEPHYR_BASE.

The `west boards` command already has ZEPHYR_BASE knowledge and can
easily add ZEPHYR_BASE to the list of roots it is already constructing,
thus removing the need for knowing that ZEPHYR_BASE is always added.

Update boards.cmake to pass ZEPHYR_BASE as an additional arch root, as
arch.cmake has not yet been processed,which means ZEPHYR_BASE is missing
in ARCH_ROOT list at this point in time.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Abe Levkoy 63d75cc26d cmake: Fix typo in common-rom.cmake
ALIGN_WITH_INPUT is an argument for zephyr_linker_section, not
zephyr_linker_section_configure. Fix the calls for section .emulators
accordingly.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2022-08-17 15:47:52 +00:00
Felipe Neves 6ba5b21337 soc: xtensa: esp32_net: update kconfig
specific of soc to make it compatible to the new toolchain.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Felipe Neves 382b4144e3 soc: xtensa: esp32: fix app cpu boot
procedure by setting its PC to 0 before reset.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Felipe Neves bb6e656ec0 soc: esp32_net: added esp32_net as an option
to use esp32 core 1 as a separate CPU, also
provide infrastructure to load firmware to
that CPU

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Fabio Baltieri 0226e53e23 Restore "cmake: remove device_extern.h logic"
This reverts commit 87c6789355, restoring
commit 3b341085a2.

Restore the original change now that the underlying issue has been fixed
in 6cfb18686e.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-12 07:45:01 +01:00
Fabio Baltieri 87c6789355 Revert "cmake: remove device_extern.h logic"
This reverts commit 3b341085a2.

Seems to be breaking CI for few qemu platforms.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-11 17:21:46 -05:00
Stephanos Ioannidis 4d36e8f693 cmake: compiler: arcmwdt: Add no_strict_aliasing flag
This commit adds the `no_strict_aliasing` flag, which disables
the strict aliasing rule, for the ARC MetaWare compiler.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-11 17:45:58 +02:00
Stephanos Ioannidis 1f2c1c6278 cmake: compiler: gcc: Add no_strict_aliasing flag
This commit adds the `no_strict_aliasing` flag, which disables
the strict aliasing rule, for the GCC compiler and its derivatives.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-11 17:45:58 +02:00
Stephanos Ioannidis 9672858c19 cmake: compiler: Add flag template for disabling strict aliasing rule
This commit adds a template for specifying the C/C++ compiler flag for
disabling the strict aliasing rule.

It also enables this flag globally because the Zephyr codebase does not
strictly adhere to the aliasing rules specified by the C/C++ standards
and the optimisation strategies that assume these rules may end up
generating invalid code.

For instance, GCC 11 and above tend to optimise more aggressively
assuming the strict adherence to the standard aliasing rules and may
generate invalid code, when compiling Zephyr with `-fstrict-aliasing`,
that results in various run-time failures.

Note that the footprint and performance ramifications of disabling the
strict aliasing rule are negligible.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-11 17:45:58 +02:00
Gerard Marull-Paretas d322adc66f devicetree: s/devicetree_unfixed/devicetree_generated
Because the fixup files do not exist anymore, stop using "unfixed"
naming in favor of "generated".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-11 12:17:02 +02:00
Gerard Marull-Paretas b2520b09a7 devicetree: drop support for dts_fixup.h files
Devicetree fixup files existed previous to the current stable Devicetree
API. While they served their purpose, they are no longer necessary nor
used in-tree. This patch drops support for this legacy feature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-11 12:17:02 +02:00
Yuval Peress 84dfb8edf8 ztest: allow asserts anywhere
Updates the ztest_test_fail() function to allow failures in setup.
When executed, a failed assert will fail every test in the suite owning
the setup function. This was verified by adding a suite which asserts
in the setup function and has a test that should pass. During
exeuction, ztest marks the test as failing.

In order to verify exection I also added 2 new APIs:
- ZTEST_EXPECT_FAIL(suite_name, test_name)
- ZTEST_EXPECT_SKIP(suite_name, test_name)

Signed-off-by: Yuval Peress <peress@google.com>
2022-08-09 13:30:15 -04:00
Martí Bolívar 3b341085a2 cmake: remove device_extern.h logic
This file is no longer used by device.h, so let's avoid spending time
generating the content formerly in it.

In order to leave a pointer in place for users who are expecting to
see it or are pulling it into their own builds, however, replace its
contents with an #error directive that tells them what happened. This
can be removed later on when we expect people are used to the
transition.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-08 10:44:41 +02:00
Jeremy Bettis d7727b9415 cmake: Use cmake var not env for sdk
ZEPHYR_SDK_INSTALL_DIR is set from the env if it is not passed
explicitly to cmake, but one usage was reading directly from the env,
not allowing passing the var to cmake instead.

Change find_package of Zephyr-sdk to read from cmake var not env var.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-08-05 14:03:15 +02:00
Dat Nguyen Duy 8e55e59c59 arch: introduce config DCLS
Some processors support Dual-redundant Core Lock-step
DCLS) topology but the processor still can be ran in
split-lock mode (by default or changed at flash time).
So, introduce config DCLS that is enabled by default if
config CPU_HAS_DCLS is set, it should be disabled if
processor is used in split-lock mode.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-08-04 12:51:25 +09:00
Torsten Rasmussen 542aad5ac3 cmake: kconfig: allow to set Kconfig targets externally
This commit allows a project to specify a given set of Kconfig targets
prior to sourcing kconfig.cmake.

This allows for greater flexibility when re-using kconfig.cmake in
other projects.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-03 16:05:07 +02:00
Torsten Rasmussen 796474e366 cmake: kconfig: allow for Kconfig CONFIG namespace
This commit allows for specifying a dedicated Kconfig namespace, for
example: <namespace>_CONFIG

This namespace will then be used for handling loading of configuration
files into CMake configure scope, as well as handling of CMake cache
variables when set using `-D<namespace>_CONFIG_<var>=<value>`.

This allows greater flexibility when re-using the cmake/kconfig.cmake
in other projects.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-03 16:05:07 +02:00
Torsten Rasmussen a3a0112e03 cmake: kconfig: allow build systems to decide defconfig
Allow build system to define an alternative defconfig file.
This allows reusing the existing kconfig.cmake file in other projects,
such as multi image builds.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-03 16:05:07 +02:00
Manuel Arguelles f10fa0dea8 cmake: allow Cortex-R52 to configure VFP
The Cortex-R52 processor supports single-precision
floating-point instructions and can optionally support
the double-precision floating-point instructions.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-07-26 08:48:07 +02:00
Kumar Gala c9aa63c0dc dts: Introduce Kconfig.dts
Introduce a generated Kconfig.dts that sets a Kconfig symbol for
every compatible.

* We set DT_HAS_<compat>_ENABLED if the devicetree has a node with
  <compat> enabled. (status is okay...)

We can then use the Kconfig symbol in driver Kconfig to determine
if the driver should be available, and thus enabled by default.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 09:39:49 -07:00
Evgeniy Paltsev ec075ebf60 ARC: MWDT: add missing options to generate symbol file
Fix for #47353 where we add and enable symbol generation,
but miss to add proper options for ARCMWDT toolchain.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-07-13 12:00:39 -04:00
Anas Nashif 01582f80b7 scripts: move gen_cfb_font_header.py to scripts/build
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-12 10:03:45 +02:00
Anas Nashif 61f672607a scripts: move file2hex.py to scripts/build/file2hex.py
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-12 10:03:45 +02:00
Anas Nashif 967f9b437b scripts: move dir_is_writeable.py to scripts/build
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-12 10:03:45 +02:00
Anas Nashif d589e7f04e scripts: move gen_relocate_app.py to scripts/build
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-12 10:03:45 +02:00
Anas Nashif efbadbb677 scripts: move gen_kobject_list.py to scripts/build/gen_kobject_list.py
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-12 10:03:45 +02:00
Anas Nashif bfb65b054c cmake: binutils: find binutils nm for host compiler
We need this to generate symbols from final binary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-11 11:56:39 +02:00
Anas Nashif 47a673f2f4 build: generate symbols file
Optional way for generating symbols file using binutils. This file will
be generated on demand for tests which will then be parsed by twister to
create an accurate test plan from the listed testcase/suites.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-11 11:56:39 +02:00
Enjia Mai 5d28ee77ef testsuite: ztest: fix the linker generator not working of new ztest
Fix the linking error when CONFIG_CMAKE_LINKER_GENERATOR=y when
applying the new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-08 10:45:59 +02:00
Yuval Peress 10feb693f5 unittest: support ztest_new_api
Add support for the new Ztest API when using unittest.

Fixes #47420

Signed-off-by: Yuval Peress <peress@google.com>
2022-07-07 18:22:14 +02:00
Jaroslaw Stelter 69913adc80 cmake: filter not supported C++ compilation flags
Compilation warnings appears for C++ files, that following
options are not valid:
-ffrestanding,
-Wno-format-zero-length
-Wno-main
-fgnu89-inline
-std-gnu99
Added checks to filter out unsupported flags.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-07 10:26:22 +00:00
Reto Schneider 7a6c5710ff cmake: Update cmake_minimum_required to 3.20.0
As Zephyr currently requires CMake version 3.20.0, update all
occurrences of cmake_minimum_required.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-07-04 10:18:45 +02:00
Yuval Peress a7ceba3710 testing: add zephyr/ prefix to testing include path
Continuation of issue #41543 to add prefix scope for Zephyr's include
files.

Signed-off-by: Yuval Peress <peress@google.com>
2022-06-29 06:04:32 -04:00
Eugene Cohen b84ab912af arch: arm64: define A55 core
Define a CPU_CORTEX_A55 configuration and align the gcc
cpu type accordingly when selected.

Signed-off-by: Eugene Cohen <quic_egmc@quicinc.com>
2022-06-29 10:27:19 +02:00
Jeremy Bettis 6ede43b078 npcx: Set hex_file automatically w/ npcx hex image
When using CONFIG_NPCX_IMAGE_OUTPUT_HEX, set the hex_file
runners_yaml_props_target property, so that west flash will flash the
correct file.

Change the cmake flash rules to populate the hex_file value in the
runners.yaml file if either CONFIG_BUILD_OUTPUT_HEX is enabled or some
cmake file set the runners_yaml_props_target hex_file property.

Update the npcx9m6f_evb instructions now that the filename is implicit.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-06-28 11:09:35 +02:00
Marc Herbert f7414ab859 cmake: dts: resolve symlinks before de-duplicating DTS_ROOT
DTS directories can come from multiple places. Some places like a user's
CMakeLists.txt can preserve symbolic links. Others like
`scripts/zephyr_module.py --settings-out` resolve symbolic
links.

list(REMOVE_DUPLICATES ...) does not know anything about directories;
only about strings. To fix it the de-duplication, resolve all symbolic
links in DTS_ROOT first using file(REAL_PATH ...).

Fixes this somewhat confusing error:
```
-- Found BOARD.dts:    /home/proj/mymodule/boards/myboard/myboard.dts
devicetree error: both /home/proj/mymodule/dts/bindings/intel,stuff.yaml
             and /disk1/home/proj/mymodule/dts/bindings/intel,stuff.yaml
have 'compatible: intel,stuff'
```

Also, print `gen_defines.py` arguments in case of an error so anyone can
see what failed and not just west+CMake experts.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-06-24 20:26:02 +02:00
Keith Packard c034050bba cmake/clang: Disable -Wunused-but-set-variable warnings
Not sure why this is needed for this branch, but it pretty clearly is --
there are hundreds of set-but-unused variables in the codebase.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Nicholas Lowell 3da90ad21f cmake: use all compile options arguments for uniqueness
zephyr_library_compile_options() was attempting to create
unique hashes for compile options in order to prevent creating
them multiple times.  However, it was only using the first
argument to create the hash, so if multiple libraries had
different compile options but the first line was the same,
the second set would be mistaken for the first set and would
actually be passed the first set during compilation instead
of its own set.

The fix should be to use the entire compile options argument
list to create the hash so they should only match if the entire
options list is exactly the same.

This is a continued fix for #43835

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2022-06-08 12:42:28 +02:00
Carlo Caione 673f41e708 riscv: Introduce support for RV32E
Introduce support for RV32E.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-08 18:50:22 +09:00
Carlo Caione 10061efdc4 riscv: Rework and cleanup Kconfig
This patch is doing several things:

- Core ISA and extension Kconfig symbols have now a formalized name
  (CONFIG_RISCV_ISA_* and CONFIG_RISCV_ISA_EXT_*)

- a new Kconfig.isa file was introduced with the full set of extensions
  currently supported by the v2.2 spec

- a new Kconfig.core file was introduced to host all the RISCV cores
  (currently only E31)

- ISA and extensions settings are moved to SoC configuration files

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-05 14:28:42 +02:00
Chen Peng1 d8fa857b19 LLVM: add built-in lld linker support for x86.
add support to use LLVM built-in lld linker to build
zephyr applications for x86 platforms.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2022-06-05 14:10:25 +02:00
Yuval Peress 86cadf9283 ztest: Fix userspace ztests in new API
Update the new API to use K_USER as the flags for both
CONFIG_USERSPACE and CONFIG_TEST_USERSPACE. Also, fix the linker
script to properly include the suites, tests, and rules.

Fixes #44108

Signed-off-by: Yuval Peress <peress@google.com>
2022-05-25 11:20:13 +09:00
Luca Fancellu b3949415d8 cmake: gcc: Use --sysroot with gcc when SYSROOT_DIR is provided
When SYSROOT_DIR is provided, gcc should use it through the --sysroot=
option otherwise some commands won't work as expected.

For example, in the Yocto environment when cross compiling,
--print-libgcc-file-name prints only "libgcc.a" instead of the full
path to it and the subsequent assert_exists(LIBGCC_FILE_NAME) will
fail.

Fixes #45578
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2022-05-23 19:33:33 +09:00
Sylvio Alves c9f6d18dfc soc: esp32: add Espressif HAL config
Current Espressif porting requires standard include as
part of hal implementation. compiler_flags.cmake checks for
variant name to keep those stdinc in build.
Instead of using variant name as check, use this new CONFIG
to make it clear and to allow having toolchain integrated
in zephyr-sdk package.
stdinc dependency in hal_espressif will be worked out and removed
soon.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-05-11 10:47:27 +02:00
Evgeniy Paltsev 48301dde0f ARC: ARCv3: add HS5x support
Add HS5x CPU support - ARCv3 32bit ISA.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-05-10 14:12:25 -04:00
Gerard Marull-Paretas a4eac53b9e ztest: add support for new and legacy include paths
The ztest unittest module relies on some headers that fake the real
ones, e.g. <zephyr/arch/cpu.h>. When new header location was introduced,
their path was not updates. This patch fixes this problem and provides
ztest with both, legacy and new include paths so that it can keep
working on both scenarios.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:03:00 +02:00
Stephanos Ioannidis 18398948db cmake: gcc: target_arm: Force FP hard ABI for DCLS
When Dual-redundant Core Lock-step (DCLS) topology is used, the VFP
registers across the two redundant cores must be manually initialised
and synchronised, and this requires the `-mfloat-abi=hard` option to
be specified.

This commit forces the use of FP "hard" ABI on the VFP-equipped cores
that are configured in DCLS topology.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-05 12:03:27 +09:00
Stephanos Ioannidis 6d4bce81ae cmake: gcc: target_arm: Support advanced floating-point options
This commit updates the Zephyr build system to support specifying
advanced floating-point compilation options derived from the newly
introduced unified floating-point configurations.

The following changes are introduced by this commit:

1. Specify architecture floating-point option to the `-mcpu` flag.
2. Specify floating-point unit (FPU) type using the `-mfpu` flag.

Note that the `-march` flag is not specified separately because the
`-mcpu` flag provides more detailed architecture options and this
makes the `-march` flag redundant.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-05 12:03:27 +09:00
Stephanos Ioannidis e6629abcb0 cmake: Correct PATHS usage
`PATH` is not a valid option for `find_program`; correct all such
usages to `PATHS`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-04-29 08:57:21 +02:00
Guennadi Liakhovetski 7a85ff7683 sparse: add sparse support
With this adding "-DSPARSE=y" to the "west build" command line
performs a sparse check of the project build. So far only gcc-based
builds are supported.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-04-28 08:54:21 -04:00
Keith Packard aeaad1b07d cmake: Add .tdata and .tbss to generated TLS linker sections
The linker_script generating tool needs to ensure that .tdata gets added
to the TLS data section while .tbss is added to the TLS BSS section.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-04-28 11:09:01 +09:00
Keith Packard 2aca7e5e0f ld_script: Add __tbss_align and __tdata_align to generated linker scripts
Scripts generated with ld_script.cmake also need to have the _align
symbols defined so that they work with TLS values.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-04-28 11:09:01 +09:00
Anas Nashif 462b13e16e Revert "ztest: Fix userspace ztests in new API"
This reverts commit 900b6723e7.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-26 18:55:32 -04:00
Yuval Peress 900b6723e7 ztest: Fix userspace ztests in new API
Update the new API to use K_USER as the flags for both
CONFIG_USERSPACE and CONFIG_TEST_USERSPACE. Also, fix the linker
script to properly include the suites, tests, and rules.

Fixes #44108

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-26 14:29:18 -04:00
Anas Nashif 399a0b4b31 debug: generate call graph profile data using gprof
This will generate profile data that can be analyzed using gprof. When
you build the application (currently for native_posix only), after
running the application you will get a file "gmon.out" with the call
graph which can be processed with gprof:

  gprof build/zephyr/zephyr.exe gmon.out > analysis.txt

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-22 16:04:08 -04:00
Jordan Yates 070422db46 arch: common: dedicated SEMIHOST symbol
Control the usage of semihosting with a dedicated symbol, instead of
implying semihosting from the usage of `SEMIHOST_CONSOLE`. This allows
semihosting to be used without the semihost console.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-21 13:04:52 +02:00
Mahesh Mahadevan b2d3fdceff cmake: Add support to add symbols to ramfunc section
This PR allows the user to add symbols to the ramfunc
section. The use for this could be as follows:

zephyr_linker_sources_ifdef(CONFIG_ARCH_HAS_RAMFUNC_SUPPORT
  RAMFUNC_SECTION
  quick_access_code.ld
)

quick_access_code.ld (as shown below) can define additional
symbols to  go into the ramfunc section

. = ALIGN(4);
KEEP(*(CodeQuickAccess))

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-04-18 17:24:12 -07:00