This commit optimizes Python and west implementation and version
handling in Zephyr CMake when west is used for build invocation.
Following information are now passed from west build to CMake when
invoking CMake:
- Python properties as CMake list, this list follows the structure
of CMake's Python module INTERPRETER_PROPERTIES setting.
- West version information
- West topdir information
This removes the need for several execute_process invocation of Python
from within CMake itself.
If any setting is unknown or the list size changes, then Zephyr CMake
will automatically fallback to the generic implementation.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
When `CONFIG_NULL_POINTER_EXCEPTION_DETECTION_MPU` is enabled,
the null-pointer region `[0x0, PAGE_SIZE)` must not contain
executable code.
The legacy linker flow enforces this via `vector_table_pad.ld`,
but the CMake linker generator does not, allowing `.text` to
start immediately after the vector table (e.g. at `0x3e0`),
inside the protected region. This leads to MPU faults at boot.
Fix by giving `.rom_start` a minimum size up to
`CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE` when the vector table
starts inside the protected null-pointer page, ensuring `.text` starts
outside the reserved region.
Signed-off-by: Sudan Landge <sudan.landge@arm.com>
${board_string} has disappeared from the build system and
we were getting build error. So make our own to avoid
this happening again.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
move qemu network interface selection, because it fits better in
cmake/emu/qemu.cmake than in cmake/modules/kernel.cmake.
It is also put at the end because for usb network cards, the usb bus
must be created before the network interface can be added. Also true
for other network cards on buses. Currently we don't have usb network
cards in zephyr, but it is better to be prepared for that.
Also use the separate netdev and device option.
The combined command line option didn't work for "usb-net" for example.
For the riscv qemu the -nic option is broken acording to the qemu issue
(https://gitlab.com/qemu-project/qemu/-/work_items/691), so we need to
use the -netdev and -device options.
Because of the change to -netdev and -device options, we need a new
Kconfig option to specify the extra arguments for the network device,
so we add NET_QEMU_DEVICE_EXTRA_ARGS option.
this can be used to customise the network device, like the mac address,
or more device specific options like setting f.e. the addresss/slot of
a pci card.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Change DTCM sections from SUBALIGN(4) to ALIGN(4) to allow individual
objects within these sections to maintain their own alignment requirements.
This fixes the DMA TCD pool alignment regression where the 32-byte
aligned dma_tcdpool was being placed at 4-byte aligned addresses,
causing assertion failures in EDMA_TcdSetTransferConfig.
Fixes: #107058
Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
Fix the early TLS initialization sequence on RISC-V to correctly set up
the thread pointer (tp) before any C code runs, and save/restore
callee-saved registers as required by the ABI.
Signed-off-by: Mayur Salve <msalve@qti.qualcomm.com>
This change enables per thread stack canary for RISC-V.
RISC-V GCC accesses the stack canary via a fixed offset from the
thread pointer (tp) when -mstack-protector-guard=tls is used. The
compiler emits code equivalent to:
lw t0, 0(tp) # load canary from tp+0
Additionally, tp is zeroed in arch_kernel_init() when TLS is enabled,
which means any C function called before thread setup completes (such
as z_early_rand_get or data_copy_xip_relocation) would fault trying
to access the canary.
Introduce STACK_CANARIES_TLS_PREPEND, which places the
.stack_chk.guard section at offset 0 of the TLS block, before .tdata
and .tbss. The compiler flags -mstack-protector-guard-reg=tp and
-mstack-protector-guard-offset=0 are passed so GCC generates the
correct canary access.
With STACK_CANARIES_TLS_PREPEND the per-thread TLS block layout is:
tp --> +------------------+ offset 0
| .stack_chk.guard | (__stack_chk_guard)
+------------------+
| .tdata | (initialized TLS data)
+------------------+
| .tbss | (zero-initialized TLS data)
+------------------+
The RISC-V reset path is extended to initialize tp before any C code
runs by allocating a TLS area on the boot stack and calling
arch_riscv_early_tls_stack_update(). Early boot functions that run
before tp is set up (z_early_rand_get, data_copy_xip_relocation) are
marked FUNC_NO_STACK_PROTECTOR to avoid canary access before tp is
valid.
Signed-off-by: Mayur Salve <msalve@qti.qualcomm.com>
Create generate_shell_aliases_inc_file_for_target() function that
can be used to convert shell aliases file to a format that can be
included in the shell to support aliases.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This replaces a workaround in `ExternalZephyrVariantProject_Add()` -
setting KCONFIG_TARGETS-NOTFOUND - which turned out to be incomplete.
For example, it had no way of accounting for EXTRA_KCONFIG_TARGETS
(which could be set on the command line or through something like
`ZephyrBuildConfig.cmake`).
Instead, the creation of `menuconfig` and friends can be gated on
KCONFIG_VARIANT_SOURCE, which is the variable sysbuild uses to forward
the source configuration to the variant image. This way, both lists of
Kconfig targets are excluded reliably.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
Our virtio driver in the zephyr tree only supports
version 2 and not the legacy one, therefore force it
to be used. Needed for the riscv virt target.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Follow the same logic as in dts.cmake, where after:
zephyr_file_copy(file.new file.old ONLY_IF_DIFFERENT)
the .new file is removed.
Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
Add new implementations for entropy driver and random subsystem
based on ARM64 RNDRRS and RNDR instructions.
Signed-off-by: Christoph Busold <cbusold@qti.qualcomm.com>
The current implementation of the LLEXT EDK exports only a partial set
of compiler settings to the EDK build system, specifically only the ones
defined by the Zephyr core (the 'zephyr_interface' target). Extending
this to include application and module-specific settings (from the 'app'
target and its dependencies) is tricky, because:
- while evaluating the main CMakeLists.txt, the 'app' target is not
fully configured yet, and
- using generator expressions is not possible due to CMake not allowing
expansion of $<COMPILE_LANGUAGE:...> outside of a proper compile
context.
To work around this, this change introduces a new CMake subdirectory
(misc/llext_edk) that creates a dummy target which imports the build
configuration from 'app', but overrides the C compile rules to simply
output the resulting properties (defines, include directories, flags)
to text files. The EDK generation script then reads those text files
to get the full set of build properties, and includes them in the EDK
tarball.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This function was introduced when the EDK was first implemented to reuse
the flag filtering code in 'add_llext_target'.
After moving the EDK filtering code to a later stage where simpler regex
eplacements can be used, the helper function is used only in its former
location and is no longer needed. Remove the otherwise-unused public
function to simplify the codebase.
This is a revert of commit dc8d7ada19
("cmake/modules: Extract flags filtering code to a function") with
minimal code style cleanups.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This changes the LLEXT EDK flag filtering to be done after the main
Zephyr build is completed. Instead of filtering the flags via genexes,
the full set is passed to the script along with the set of filters to be
applied, and the filter is applied later.
No functional change is intended.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Using package helper for running CMake for Zephyr.
This commit provides to option to also print the value of a Zephyr CMake
variable when Zephyr modules have been loaded.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Adds variant image handling CMake code which re-uses parts of the
original dts CMake module code but applies variant-specific parts
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Export the resolved K_HEAP_MEM_POOL_SIZE value to the
linker generator and evaluate it while generating the
IAR command file.
Fixes: #107234
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
Users may want to use a custom toolchain configuration. Moving this
inclusion to `zephyr_common_config.ecl` allows user-defined rulesets
to control this aspect.
Signed-off-by: Luca Ciucci <luca.ciucci@bugseng.com>
The "used_compiler" variable name was erroneously used as a pattern
instead of being expanded and concatenated in the file_tag matcher.
Some configurations were inconsistently matching C99 and C18 standards.
With this change, the generic "c" matcher is used. References to the
standard are updated to C18 ("C_STD").
Signed-off-by: Roberto Bagnara <roberto.bagnara@bugseng.com>
Signed-off-by: Luca Ciucci <luca.ciucci@bugseng.com>
sca_options.cmake defines the ECLAIR-related options, so it should
always be included.
Consistency checks on these options are moved to sca.cmake. This way
they are applied after the conditional inclusion of the
ECLAIR_OPTIONS_FILE.
Signed-off-by: Luca Ciucci <luca.ciucci@bugseng.com>
The analysis directory setup should happen before the project analysis.
This missing dependency would otherwise cause non-deterministic
failures of the analysis, as the directory could be removed while
ECLAIR is producing analysis frame files.
Signed-off-by: Luca Ciucci <luca.ciucci@bugseng.com>
The options set in ECLAIR_OPTIONS_FILE would be overwritten by the
subsequent "set" commands (e.g. `set(ECLAIR_ENV_ADDITIONAL_OPTIONS "")`).
By moving the inclusion of the options file below these commands, we
avoid this unwanted behavior.
Signed-off-by: Luca Ciucci <luca.ciucci@bugseng.com>
ECLAIR_ENV_ADDITIONAL_OPTIONS is a semicolon-separated list. Expanding
the variable directly would produce an invalid option for ECLAIR.
By joining the list with spaces, ECLAIR will receive the arguments
separately as expected.
Signed-off-by: Luca Ciucci <luca.ciucci@bugseng.com>
This change disables ECLAIR's default toolchain aliases and sets them
to the exact toolchain paths that are used in the build.
This also simplifies ECLAIR analyses on MacOS systems, where using
ECLAIR's default path-based trap would require additional setup.
Signed-off-by: Luca Ciucci <luca.ciucci@bugseng.com>
Allows calling an init function/macro inside of zephyr module
files, this allows for making it easier to reuse/override module
CMake code
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The previous webbrowser.open(file_path) approach fails under WSL
because Windows cannot open files via UNC paths. Use a local HTTP
server instead, which works reliably across more platforms.
Also add USES_TERMINAL to the CMake dashboard target so that log
output is visible.
Signed-off-by: Yves Wang <zhengjia.wang@nxp.com>
Don't use COMMAND_EXPAND_LISTS for the targets added for menuconfig,
guiconfig, etc. so the list of shields is properly quoted when including
multiples with a semicolon separator.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
The iar toolchain fails to build after the update to the
1.0.0 Zephyr SDK. The path to the gnu toolchains
was updated to '${ZEPHYR_SDK_INSTALL_DIR}/gnu/'
in order to be compatible with the 1.0.0 SDK.
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
The arcmwdt toolchain fails to build after the update to the
1.0.0 Zephyr SDK. The path to the generic.cmake in the toolchain
was updated to '${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/target.cmake'
in order to be compatible with the 1.0.0 SDK. This commit also
sets the required zephyr SDK to 1.0 as the SDK is no longer backwards
compatible and will fail to build with any version less than 1.0.
Signed-off-by: Christopher Turner <christopher.g.turner@intel.com>
This change adds a script to generate an HTML dashboard, invoked via
west, providing a consolidated and user-friendly view of various build
artifacts and metrics. This includes footprint information (as both
tables and plots), configuration tracing, sys init levels, an interactive
devicetree browser, and more.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
Signed-off-by: Martí Bolívar <mbolivar@oss.qualcomm.com>
This adds the bits to support running whisper as simulator
so that we can do west build with debug and run targets.
The simulator is used for simulating SweRV SoCs.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The Qemu emulator executable for the OpenRISC 1000 (or1k) architecture is
named qemu-or1k. This patch adds this information to the qemu architecture
suffix list.
Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
Add support for producing a zephyr.mem binary in Verilog memory hex dump
output format. This requires binutils v2.40 or newer.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
The driver implements the QEMU ramfb as a framebuffer-based display.
It only implements the basic capabilities necessary (ARGB8888) with
resolution configurable via DTS. For initialization it uses the fwcfg
driver.
Signed-off-by: Maximilian Zimmermann <gitmz@posteo.de>
ZephyrSDK v1.0.0 is updated to support RXv2 and RXv3 instruction
this update the gcc cmake configuration for RX build on Zephyr SDK
for RXv2 and RXv3 MCU
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
The espressif toolchain variant (ZEPHYR_TOOLCHAIN_VARIANT=espressif)
has not been used for years. Espressif targets are now built using the
Zephyr SDK, which bundles the required Xtensa and RISC-V toolchains.
Remove the cmake/toolchain/espressif/ directory containing generic.cmake,
target.cmake, and Kconfig files that implemented this variant. Also
clean up references in the coredump xtensa gdb stubs, removing the
ESPRESSIF toolchain enum value and related handling code.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
This commit updates the minimum required Zephyr SDK version to 1.0.
This is mandated by the new SDK directory layout scheme as well as the dual
(GNU and LLVM) compiler support in the SDK.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Until https://github.com/zephyrproject-rtos/sdk-ng/pull/936 is merged,
SDK 0.18 is incompatible with previous versions as the paths to
find the cmake bits is different.
Deal with that by checking for files in the wrong place as well as the
right one.
Signed-off-by: Keith Packard <keithp@keithp.com>
Support specifying compiler type for Zephyr SDK in the
ZEPHYR_TOOLCHAIN_VARIANT variable.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>