Commit graph

1497 commits

Author SHA1 Message Date
Jordan Yates e82e358ed4 cmake: version.cmake: cleanup docs
Cleanup the documentation to fix indentation and remove leading zeros.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-24 08:28:54 -04:00
Jordan Yates 20348d6b71 cmake: version: enforce single byte limits
Enforce the single byte size limits on the numeric fields in `VERSION`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-24 08:28:54 -04:00
Jordan Yates 07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Nikolay Agishev 2d75d7b2d3 ARCMWDT: Remove workaround with stripping DWARF info
Remove obsolete workaround with conditional turning off "-g"
flag when Thread Local Storage used.

Recent versions of MetaWare have no issue with linking files with
TSL-related data.

Moreover, pointed workaround breaks userspace for recently added
ARC-V platforms, as they use both TLS and DWARF info while compilation
process.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/29920

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-06-21 10:10:24 +02:00
Pierrick Guillaume 3500a6133d cmake: modules: fix FindThreads use of deprecated PTHREAD config
With the update of the Kconfig symbols to new naming scheme,
CONFIG_PTHREAD does not exist anymore.
Use the new CONFIG_POSIX_THREADS instead

Follow-up: #73047
Signed-off-by: Pierrick Guillaume <pierguill@gmail.com>
2024-06-20 17:03:57 -04:00
Pieter De Gendt 99366dd2be linker: Add ROM_SECTIONS location
Currently iterable sections as per the documentation are added with
zephyr_linker_sources(SECTIONS ...) after bss/noinit.
This commit allows putting sections after common-rom.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-06-20 12:08:58 -04:00
Noah Pendleton f61950a782 cmake: sca: Enable CodeChecker error exit status
Normally the return code of `CodeChecker analyze` and `CodeChecker parse`
is suppressed, so all the enabled commands can execute instead of
crashing the build.

Add a new option, `CODECHECKER_PARSE_EXIT_STATUS`, to permit failing the
build if `CodeChecker parse` returns non-zero.

Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
2024-06-15 05:14:48 -04:00
Jonathon Penix d6041d62b3 cmake: kconfig: Add new abstraction for -Oz optimization level
Both Clang [1] and (recently) GCC [2] support this flag to enable
additional codesize optimizations beyond -Os, possibly at the expense of
performance.

This tradeoff is worthwhile for some (and, Clang's -Oz seems to be
closer to GCC's -Os currently), so add a new abstraction for this flag
so users can select it as appropriate.

[1] https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-O0
[2] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-Oz

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-06-14 19:05:50 -04:00
Nikolay Agishev efedf1cff3 ARCMWDT: Add compiler support for nSIM RMX platform
Add MetaWare compiller support for nSIM RMX platform

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-06-14 19:01:06 -04:00
Luca Burelli baa3b6a5ba llext: disable LL_EXTENSION_SYMBOL when not building an llext
The LL_EXTENSION_SYMBOL macro is used to export a symbol to the base
image. When CONFIG_LLEXT is not defined, or the file is being compiled
outside of an llext, the macro is not useful and would leave orphan
sections in the final image instead.

This patch adds the LL_EXTENSION_BUILD definition to the llext build
process, and uses it to stub out the symbol-defining macro when not
building an llext.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-14 19:24:51 +02:00
Jonathon Penix 97a734aa01 cmake: llvm: arm64: Set arm64 flags when building with clang
Ensure --target and -mcpu/-mfpu/-mtune are set appropriately when building
with clang targeting arm64/aarch64.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-06-13 17:58:04 +02:00
Jonathon Penix fb98adc323 kconfig: llvm: arm64: Advertise TLS support when using llvm for arm64
clang and lld both support TLS for arm64/aarch64, so advertise this
support in Kconfig.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-06-13 17:58:04 +02:00
Torsten Rasmussen 087dd96a34 cmake: use SOC_ROOT for SoCs instead of BOARD_ROOT
kconfig_soc_root was mistakenly set to value of BOARD_ROOT.
Fix this by correctly set kconfig_soc_root to the value of SOC_ROOT.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-06-13 05:33:38 -04:00
Jamie McCrae 0a590e62e5 cmake: kconfig: Treat Kconfig source paths as UTF-8
These may reside on systems that have unicode characters in the
filenames, treat them as such

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-06-13 05:31:50 -04:00
Jamie McCrae 4fcde701ec sysbuild: Use UTF-8 encoding for cache
Fixes an issue whereby strings are placed in UTF-8 format but the
application doesn't read them in when configured using sysbuild
and another issue whereby sysbuild then reads the application's
cache and did not treat them as UTF-8

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-06-13 05:31:50 -04:00
Torsten Rasmussen 0d51cb08c4 cmake: remove dead 'soc_legacy' folder handling
During HWMv2 migration, non-ported SoCs were placed in a 'soc_legacy'
folder and sourced from there instead of 'soc' folder.

Remove the no-longer needed soc_legacy folder.

CMake oot SoCs in old hardware model are sourced from
'<soc-root>/soc/<arch>/<soc-path>' which has always been the case, also
before HWMv2.

Remove the 'osource "soc/soc_legacy/...' generation in Kconfig, because
the source is relative to Zephyr base.
All SoCs in Zephyr repository has been ported to the new hardware model
and therefore there is no need for this line.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-06-12 17:15:28 -05:00
Ederson de Souza ba0eef375c cmake: Flag for EDK Makefile.flags was being used on cmake.flags
Another case of subtle typo.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-06-11 19:46:42 -04:00
Ederson de Souza 3caaa19c4b cmake: Remove dead code from EDK generation
This code was supposed to be gone on the patch that handled imacros, but
it was forgotten.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-06-11 19:46:42 -04:00
Ederson de Souza a7ac049406 cmake: Pass path list in a Windows friendly way
When invoking cmake/llext-edk.cmake, CMakeLists.txt was sending the list
of includes as a colon separated list. On Windows, this list was
actually a single item, so it wasn't being parsed properly.

This patch sends the list as a cmake list and uses separate_arguments()
on the receiving side to fix it.

Fixes #73069

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-06-11 19:46:42 -04:00
Ederson de Souza bc9a1be976 cmake: Fix variable casing mixup
A variable called llext_cflags was mixed up with another called
LLEXT_CFLAGS, and that caused some host directories to end up leaking
unnecessarily into the EDK.

Fix by using only the lower case version.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-06-11 19:46:42 -04:00
Johan Hedberg c68770eda8 qemu: Use BT_UART instead of BT_NO_DRIVER to enable serial port
The CONFIG_BT_NO_DRIVER option will be going away. Use the
CONFIG_BT_UART option instead (selected by UART HCI drivers) to
determine whether to enable the qemu serial port for Bluetooth.

Signed-off-by: Johan Hedberg <johan.hedberg@gmail.com>
2024-06-11 19:42:49 -04:00
Eve Redero 65154e644b doc: cmake: fix cmake config documentation
In new hardware model, the arch subfolder is no more: updating cmake config
documentation to reflect this change

Signed-off-by: Eve Redero <eve.redero@gmail.com>
2024-06-10 00:59:50 -07:00
Chris Friedt 4a5c4e5f73 posix: timers: deprecate CONFIG_POSIX_CLOCK and TIMER
The POSIX_CLOCK option does not correspond to any standard
option. It was used to active features of several distinct
POSIX Options and Option Groups, which complicated API and
application configuration as a result.

POSIX_CLOCK is being deprecated in order to ensure that Zephyr's
POSIX Kconfig variables correspond to those defined in the
specification, as of IEEE 1003.1-2017.

Additionally, CONFIG_TIMER is being deprecated because it does
not match the corresponding POSIX Option (_POSIX_TIMERS).

With this deprecation, we introduce the following Kconfig
options that map directly to standard POSIX Option Groups by
simply removing "CONFIG_":

* CONFIG_POSIX_TIMERS

Similarly, we introduce the following Kconfig options that
map directly to standard POSIX Options by simply removing
"CONFIG":

* CONFIG_POSIX_CLOCK_SELECTION
* CONFIG_POSIX_CPUTIME
* CONFIG_POSIX_DELAYTIMER_MAX
* CONFIG_POSIX_MONOTONIC_CLOCK
* CONFIG_POSIX_TIMEOUTS
* CONFIG_POSIX_TIMER_MAX

In order to maintain parity with the current feature set, we
introduce the following Kconfig options that map directly to
standard POSIX Option Groups by simply removing "CONFIG_":

* CONFIG_POSIX_MULTI_PROCESS - sleep()

Similarly, in order to maintain parity with the current feature
set, we introduce the following additional Kconfig options that
map directly to standard POSIX Options by simply removing
"CONFIG":

* CONFIG_XSI_SINGLE_PROCESS - gettimeofday()

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-04 16:27:12 -05:00
Mathieu Choplain 8aa6ae43ce llext: add support for SLID-based linking
This commit introduces support for an alternate linking method in the
LLEXT subsystem, called "SLID" (short for Symbol Link Identifier),
enabled by the CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID Kconfig option.

SLID-based linking uses a unique identifier (integer) to identify
exported symbols, instead of using the symbol name as done currently.
This approach provides several benefits:
 * linking is faster because the comparison operation to determine
   whether we found the correct symbol in the export table is now an
   integer compare, instead of a string compare
 * binary size is reduced as symbol names can be dropped from the binary
 * confidentiality is improved as a side-effect, as symbol names are no
   longer present in the binary

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-06-03 15:29:34 -04:00
Tomasz Moń 8d344cc9d8 usb: device_next: Rename usbd_contex to usbd_context
Add the missing "t" to struct usbd_contex. No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-06-03 06:43:20 -07:00
Yong Cong Sin 13a5c8aad7 debug: symtab: fix linking issue due to variable redefinition
Employs the same linkonce magic of sw_isr_table to fix the
multiple definition of the symtab variables issue that I
get in my application build that doesn't use `west`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-30 16:52:01 -05:00
Torsten Rasmussen 24acc7d43d sysbuild: introduce sysbuild_root for root adjustment
Fixes: #73066

Introduce sysbuild_root CMake module similar to the Zephyr root CMake
module. The sysbuild_root CMake module works similar to existing root
module, but with the difference that root paths are adjusted relative to
APP_DIR which is the main image, instead of relative to sysbuild.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-30 11:55:01 +01:00
Torsten Rasmussen 8b3d4c6f0d cmake: update zephyr_file to use cmake_path()
Since the introduction of zephyr_file() then the minimum required CMake
version has become 3.20.
Update zephyr_file() to use cmake_path insteasd of set().
This allows us to normalize the path and thereby also remove duplicates
in the list as paths are normalized.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-30 11:55:01 +01:00
Torsten Rasmussen f7d2cc2d43 cmake: use zephyr_get() and zephyr_file() for APPLICATION_CONFIG_DIR
Fixes: #73065

Update APPLICATION_CONFIG_DIR is Zephyr CMake and sysbuild to follow
the common principle in Zephyr for relative paths.

This means that relative paths are taken from the application source
directory when specified on command line, and require local scoped
defined APPLICATION_CONFIG_DIR to be given as absolute, for example by
using CMAKE_CURRENT_LIST_DIR.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-30 08:59:25 +02:00
Guennadi Liakhovetski 024bd41efb llext: xtensa: add support for the xt-clang toolchain
To build LLEXT images using the xt-clang toolchain from Cadence
linker flags have to be set similar to other toolchains. Add the
missing cmake files.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-29 10:49:40 -07:00
Bjarki Arge Andreasen 79640aea09 drivers: console: remove uart_mux and gsm_mux
Remove the deprecated uart_mux and gsm_mux modules and all of
their configurations/dependencies across zephyr.

Optimally uart_mux and gsm_mux would be removed in their own
respective PRs, but the two modules are directly coupled, so
to preserve bisectability, they must be removed together.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-29 10:49:08 -07:00
Yong Cong Sin 0dac6c132b build: namespace autoconf.h with zephyr/
Namespace the generated `autoconf.h` file with `zephyr/`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Yong Cong Sin bbe5e1e6eb build: namespace the generated headers with zephyr/
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.

Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.

Updated the includes path of in-tree sources accordingly.

Most of the changes here are scripted, check the PR for more
info.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Michał Szprejda 7c084b6649 West: Add west robot command
Introduce `robot` command for running Robot Framework test suites.
Initial implementation consists of one runner dedicated for renode-test,
which is a Renode wrapper for running Robot tests.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda 80900cbc3b West: Add west simulate command
Introduce `simulate `command for running samples on a simulator of
choice. Initial implementation consists of one runner, dedicated for
Renode.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda 959ea1a172 resc: cmake: robot: Rename Renode variable
Rename Renode variable used to store the .elf file path from `bin` to
`elf` for consistency.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda 7bc9a98a70 Twister: Rework integration with renode-test
Initial integration with renode-test was introduced in commit bdf02ff,
which added support for calling the `renode-test` command from both west
and twister.

This commit removes the custom run_renode_test target used for running
Robot tests with the `west build` command and makes twister call
`renode-test` directly instead.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Yong Cong Sin c5f5b964c1 arch: sw_isr: revamp multi-level interrupt architecture
Previously the multi-level irq lookup table is generated by
looping through the devicetree nodes using macros & Kconfig,
which is hard to read and flimsy.

This PR shifts the heavy lifting to devicetree & DT macros such
that an interrupt controller driver, which has its info in the
devicetree, can register itself directly with the multi-level
interrupt architecture, which is more straightforward.

The previous auto-generated look up table with macros is now
moved in a file of its own. A new compatibility Kconfig:
`CONFIG_LEGACY_MULTI_LEVEL_TABLE_GENERATION` is added and
enabled by default to compile the legacy look up table for
interrupt controller drivers that aren't updated to support the
new architecture yet.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Torsten Rasmussen 207da52e8e cmake: find python path adjustment
Fixes: #70258

Specify NO_CMAKE_PATH to prevent CMake find_program from having a
preference for searching CMAKE_PREFIX_PATH.

Some tool like NixOS / Nix package manager sets this variable
to point inside the nix store, like this:
CMAKE_PREFIX_PATH=/nix/store/gpvnsgf8zhqjjgk63dd...-python3-3.11.6-env

thus causing `find_program()` to prefer this over the tool in the
default path.

Support Nix environments by specifying NO_CMAKE_PATH and in addition
support `VIRTUAL_ENV` environment setting for search path when set by
the virtual environment.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-05-24 18:04:28 -04:00
Pieter De Gendt 4cc7753cad cmake: modules: extensions: Check for missing blobs in zephyr_blobs_verify
Add a separate warning/error message if a blob is missing.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-23 07:48:42 -04:00
Nikolay Agishev 3ccbef2d55 ARCMWDT: Turn off picolibc support
MetaWare toolchain doesn't support building Zephyr with
Picolibc module. This PR fixes biuld process by turning off
picolibc support on compiler side.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-05-18 15:54:05 +03:00
Ederson de Souza a0ee472a6f tests/misc: Add llext EDK test
This test uses pytest to generate an EDK from a simple Zephyr
application, and uses this EDK to build a simple extension, to ensure
that EDK generation is sane.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza 4e9a2a7c33 cmake: Handle imacros from flags
Instead of hardcoding `autoconf.h` imacro, get the list of imacros from
the llext flags. As those come in the form of absolute paths, they also
need to be massaged to point from the EDK directory without revealing
host complete paths.

Also, the EDK now keeps the imacros on a different flag,
`LLEXT_GENERATED_IMACROS_CFLAGS`, to keep it similar to other generated
includes.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza cd535b75aa cmake: Reuse llext flags for EDK
Some flags are common between in tree extensions and out of tree
supported by the EDK. Instead of duplicating those flags, the EDK reuses
the llext ones.

However, as the EDK has its own needs, two new lists,
`LLEXT_EDK_APPEND_FLAGS` and `LLEXT_EDK_REMOVE_FLAGS` are defined to
allow EDK to append or remove flags as needed.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza dc8d7ada19 cmake/modules: Extract flags filtering code to a function
This way they can be reused by the LLEXT EDK.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza 2f41060fbd cmake/llext-edk: Generate more granular CFLAGS
Besides the LLEXT_CFLAGS, which have all that is needed to compile,
generate more granular ones, LLEXT_INCLUDE_CFLAGS,
LLEXT_ALL_INCLUDE_CFLAGS, LLEXT_GENERATED_INCLUDE_CFLAGS and
LLEXT_BASE_CFLAGS. These are done for convenience, as they can help on
different setups, such as unit testing.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza 967168a536 subsys/llext: Generate syscalls stubs for EDK exclusively for userspace
A new Kconfig option which generates syscall stubs assuming that
extensions will always run on userspace, thus simplifying linking
them, as there's no need for z_impl_ stubs (used for direct syscalls),
CONFIG_LLEXT_EDK_USERSPACE_ONLY.

While defining __ZEPHYR_USER__ could have the same effect for optmised
builds, people building extensions on debug environments - thus
non-optimised - would suffer, as they'd need to somehow make the stubs
available (by either exporting the symbol or implementing dummy stubs).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza d156a03074 cmake: New target which generates a sort of development kit for llext
Loadable extensions need access to Zephyr (and Zephyr application)
includes and some CFLAGS to be properly built. This patch adds a new
target, `llext-edk`, which generates a tar file with those includes and
flags that can be loaded from cmake and make files.

A Zephyr application willing to expose some API to extensions it loads
only need to add the include directories describing such APIs to the
Zephyr ones via zephyr_include_directories() CMake call.

A new Kconfig option, CONFIG_LLEXT_EDK_NAME allows one to control some
aspects of the generated file, which enables some customization - think
of an application called ACME, willing to have a ACME_EXTENSION_KIT or
something.

All EDK Kconfig options are behind CONFIG_LLEXT_EDK, which doesn't
depend on LLEXT directly - so that EDK features can be leveraged by
downstream variations of loadable extensions.

Also, each arch may need different compiler flags for extensions: those
are handled by the `LLEXT_CFLAGS` cmake flag. An example is set for GCC
ARM.

Finally, EDK throughout this patch means Extension Development Kit,
which is a bad name, but at least doesn't conflict with SDK.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Evgeniy Paltsev 47b334c619 ARC: nSIM: cmake: launch cores in direct order for simulation run
Align cmake launch script with west runners

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-05-17 12:40:52 +02:00
Jonathon Penix 99adbadad5 toolchain: llvm: Allow TLS when using llvm targeting arm
TLS for Arm targets seems to be well supported in clang/lld, so mark it as
supported by the toolchain.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-05-14 09:43:37 +02:00