Write the empty module environment fragments in the no-west path. This
keeps direct CMake builds from depending on files that are only produced
when west discovers modules.
Signed-off-by: Chao Liu <chao.liu@processmission.com>
gcov belongs in target.cmake and not generic.cmake.
generic.cmake are for generic tools that are needed during build system
generation, before the arch is known, for example for Kconfig
pre-processing.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes this missing output, which helps with repducible build
debugging, to use the zephyr prefix when the bindings are located
there irrespective of if the (long deprecated) environmental value
is set
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add a lean, kernel-only initialization model to replace the kernel's
internal use of SYS_INIT. Kernel init order is fixed at compile time, so
these hooks drop the SYS_INIT level/priority machinery: a subsystem
registers a parameterless init function that the boot path runs at one of
two fixed phases.
K_KERNEL_INIT_PRE(fn) run in z_cstart() before PRE_KERNEL device init
K_KERNEL_INIT_POST(fn) run in bg_thread_main() before POST_KERNEL
device init
Each entry is a single function pointer placed, via an iterable section,
in the registering subsystem's own translation unit. The linker pulls
that unit (and the entry) into the image only when the subsystem is
otherwise referenced, so an init runs only when its subsystem is actually
linked. This preserves the pay-per-use linkage that SYS_INIT provided
while halving the per-entry size (one pointer versus init_entry's two) and
removing the level/priority sort. The boot-path walks reference only the
section bounds, so they never force a subsystem to be linked.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
lld's bare -r (--relocatable) places sections in encounter order without
grouping them by type, so a .TEXT.funcname section from one compilation
unit can end up between .text and .data sections from another unit in the
output file.
The LLEXT loader computes one contiguous file-offset region per
llext_mem type by spanning the min->max offsets of all sections of that
type. Interleaved sections cause two regions' file-offset spans to
overlap, making the loader reject the ELF with -ENOEXEC.
GNU ld's internal default script implicitly groups *(.text .text.*) etc.
together during -r, so this is lld-specific. Fix it by supplying an
explicit grouping linker script (-T) to the partial link step, selected
via the toolchain LINKER variable. The script collects all text, rodata,
data, bss and init-array sections into contiguous output sections;
sections not mentioned (RELA tables, debug info, .riscv.attributes, etc.)
become orphans at the end and are ignored by the loader.
The loader classifies sections into regions by ELF flags rather than by
name, so custom-named sections created via Z_GENERIC_SECTION() must also
be grouped next to the matching type. Sections that the tests inspect by
name (.my_rodata, .detach, .llext.rodata.noreloc) are given their own
output sections adjacent to that type group, so their identity survives
the link while keeping the region file-offset spans contiguous.
Assisted-by: Claude:Claude Opus 4.8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Lightweight write sanitizer for sys_heap. Uses
-fsanitize=kernel-address compiler instrumentation combined with a
per-heap shadow bitarray (one bit per granule) to detect buffer
overflows, underflows, and use-after-free on write accesses.
Ships its own lightweight sanitizer runtime (__asan_store* callbacks);
does not depend on an external ASAN library and supports debugging on
real embedded targets.
Instrumentation is opt-in per CMake target via
zephyr_target_enable_heap_kasan(), or per directory via
zephyr_heap_kasan_enable_directory(). Only writes are checked
(-asan-instrument-reads=0). Bulk-write library calls (memset,
memcpy, str*, printf family) are redirected to checked wrappers at
compile time via -Dfoo=__asan_foo, requiring no source changes in
application code.
Heap tracking is likewise opt-in: register each heap with
SYS_HEAP_KASAN_ENABLE() / K_HEAP_KASAN_ENABLE(), or enable
CONFIG_SYS_HEAP_KASAN_MALLOC / CONFIG_SYS_HEAP_KASAN_SYSTEM for the
common libc malloc and kernel system heaps.
Usage:
CONFIG_SYS_HEAP_KASAN=y
CONFIG_SYS_HEAP_KASAN_MALLOC=y # auto-track malloc/free
CONFIG_SYS_HEAP_KASAN_SYSTEM=y # auto-track k_malloc/k_free
# Instrument all sources of <target> (CMakeLists.txt)
zephyr_target_enable_heap_kasan(app)
# Or instrument sources under <dir>
zephyr_heap_kasan_enable_directory(src/mymodule)
/* Opt-in tracking for a custom heap */
K_HEAP_DEFINE(my_heap, 4096);
K_HEAP_KASAN_ENABLE(my_heap, 4096);
Signed-off-by: Jinming Zhao <jinmzhao@qti.qualcomm.com>
Add RISCV_ISA_EXT_ZK (Scalar Cryptography) and RISCV_ISA_EXT_ZKS
(ShangMi Suite) Kconfig options, and append them to the GCC march
flag when enabled.
Signed-off-by: Liu Qian <liuqian.andy@picoheart.com>
Generates a new file for use by the build system which lists all
the paths to dts bindings used in a build, then from CMake adds a
dependency to these files so that if they are modified, CMake will
re-run.
This has been implemented by adding support to edtlib to output
details on bindings and binding paths inside of the python code
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Generate lowercase aliases for region-derived
symbols when armlink creates names from uppercase
devicetree memory-region identifiers.
This provides symbols such as __itcm_start,
__itcm_load_start, and __itcm_size alongside the
uppercase forms expected by armlink.
Assisted-by: GitHub Copilot:GPT-5.4 [apply_patch] [run_in_terminal]
Signed-off-by: Evan Chen <bugena123@gmail.com>
Add an SCA variant that enables include-what-you-use analysis via
CMake's built-in CMAKE_C_INCLUDE_WHAT_YOU_USE and
CMAKE_CXX_INCLUDE_WHAT_YOU_USE properties. The tool runs alongside the
compiler for each translation unit and reports unused includes and
includes that should be added.
The integration locates the include-what-you-use binary and forwards an
optional IWYU_OPTS list to the tool, prefixing each option with -Xiwyu as
required by the compiler-driven invocation.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
CONFIG_LINKER_USE_PINNED_SECTION is the second half of the selective
kernel-pinning model removed in issue #108773. With the kernel image
now always resident at boot (previous commit), the __pinned_*
attribute family is a no-op: every page they would have segregated is
already pinned by z_mem_manage_init()'s whole-image loop, so the
tagging contract neither adds safety nor remains maintainable.
Drop it.
Mechanical removals:
* All ~219 in-tree uses of __pinned_text, __pinned_rodata,
__pinned_data, __pinned_bss, __pinned_noinit, and __pinned_func
across arch/x86, drivers/interrupt_controller, drivers/timer,
arch/common, kernel, lib/libc, subsys/portability/posix, tests, and
the syscall code generator (scripts/build/gen_syscalls.py).
* The assembly aliases PINNED_TEXT/RODATA/DATA/BSS/NOINIT used in
arch/x86/core/ia32/*.S and drivers/interrupt_controller/
intc_loapic_spurious.S become plain TEXT/RODATA/DATA/BSS/NOINIT.
* K_KERNEL_PINNED_STACK_DEFINE, K_KERNEL_PINNED_STACK_ARRAY_DEFINE,
K_KERNEL_PINNED_STACK_ARRAY_DECLARE, K_THREAD_PINNED_STACK_DEFINE,
and K_THREAD_PINNED_STACK_ARRAY_DEFINE are removed. The few
in-tree callers (kernel/init.c, arch/arm/core/cortex_a_r/smp.c,
arch/arm64/core/fatal.c, arch/rx/core/prep_c.c,
arch/x86/core/prep_c.c, kernel/include/kernel_internal.h,
tests/bluetooth/hci_uart_async) move to the corresponding
non-pinned macros.
Machinery removals:
* Kconfig.zephyr drops CONFIG_LINKER_USE_PINNED_SECTION.
qemu_x86_tiny and qemu_x86_atom_virt drop their =y overrides.
* include/zephyr/linker/section_tags.h drops the __pinned_* macro
definitions (both arms). __isr collapses to an empty macro since
its only purpose was to alias __pinned_func.
* include/zephyr/linker/sections.h drops PINNED_TEXT_SECTION_NAME,
PINNED_BSS_SECTION_NAME, etc. and the bare PINNED_TEXT/RODATA/etc.
forwarders, plus the _APP_SMEM_PINNED_SECTION_NAME constant.
* include/zephyr/linker/linker-defs.h drops the lnkr_pinned_*
externs, the _app_smem_pinned_* externs, and the lnkr_is_pinned()
/ lnkr_is_region_pinned() inline helpers.
* include/zephyr/linker/utils.h drops the lnkr_pinned_rodata branch
in linker_is_in_rodata().
* include/zephyr/linker/app_smem_pinned{,_aligned,_unaligned}.ld
are deleted; cmake/linker/ld/target_configure.cmake stops
configuring them.
* boards/qemu/x86/qemu_x86_tiny.ld and
include/zephyr/arch/x86/ia32/linker.ld drop their pinned-section
blocks and the now-redundant #ifndef CONFIG_LINKER_USE_PINNED_SECTION
conditionals throughout the body. The
LIB_KERNEL_IN_SECT / LIB_ARCH_X86_IN_SECT / LIB_ZEPHYR_IN_SECT /
LIB_C_IN_SECT / LIB_DRIVERS_IN_SECT / LIB_SUBSYS_LOGGING_IN_SECT /
LIB_ZEPHYR_OBJECT_FILE_IN_SECT / ZEPHYR_KERNEL_FUNCS_IN_SECT macros
in qemu_x86_tiny.ld are deleted; they existed only to feed the
pinned text/rodata/data/bss/noinit sections.
* kernel/mmu.c drops the mark_linker_section_pinned(lnkr_pinned_start,
...) call. The mark_linker_section_pinned() helper survives but is
now gated only on CONFIG_LINKER_USE_BOOT_SECTION.
* arch/common/init.c and include/zephyr/arch/common/init.h drop
arch_bss_zero_pinned(); arch/x86/core/ia32/crt0.S drops the call
to it.
* arch/x86/core/userspace.c drops the eager k_mem_page_in() of the
thread's privileged stack on user-mode entry. With the kernel
image fully resident the stack is already mapped.
* arch/x86/gen_mmu.py drops map_region("lnkr_pinned") and the
set_region_perms() calls for lnkr_pinned_text / lnkr_pinned_rodata.
* CMakeLists.txt drops the LINKER_USE_PINNED_SECTION block that
generated APP_SMEM_PINNED_* variables and the
pinned_partitions target property feeding gen_app_partitions.py.
cmake/modules/extensions.cmake removes the PINNED_RODATA /
PINNED_RAM_SECTIONS / PINNED_DATA_SECTIONS zephyr_linker_sources()
location keywords and their snippet files.
scripts/build/gen_app_partitions.py drops --pinoutput /
--pinpartitions arguments and the pinned-output branch.
subsys/testsuite/coverage/CMakeLists.txt drops its
CONFIG_DEMAND_PAGING-conditional fork.
* scripts/build/gen_kobject_list.py drops the
app_smem_pinned_start / _end fallback for kobject placement
validation.
* tests/arch/x86/pagetables and tests/kernel/mem_protect/userspace
drop their lnkr_pinned_text / lnkr_pinned_rodata branches.
* include/zephyr/arch/x86/ia32/arch.h folds IRQSTUBS_TEXT_SECTION
to the unconditional ".text.irqstubs" form.
* tests/subsys/llext/src/syscalls_ext.c drops a stale comment about
syscalls landing in .pinned_text.
Targeted retentions:
* arch/x86/core/bootargs.c keeps multiboot_cmdline and efi_bootargs
in .noinit (was __pinned_noinit, which decayed to __noinit when
LINKER_USE_PINNED_SECTION was unset). The multiboot and zefi loader
paths write these buffers before Zephyr's BSS-zero step, so
zeroing them at boot loses the cmdline.
* arch/x86/core/ia32/fatal.c keeps _df_esf and _df_stack in .noinit.
They are scratch space written by the double-fault handler and have
no zero-init requirement; keeping them in .noinit also preserves
the historical post-noinit alignment that gen_mmu.py relies on
(z_mapped_size is computed before CMake-injected iterable sections
are appended to the linker script, so the post-noinit page padding
is what keeps those sections within the mapped region).
* include/zephyr/arch/x86/ia32/syscall.h and
include/zephyr/arch/x86/arch.h wrap the per-arch
arch_syscall_invoke* / arch_is_user_context / arch_k_cycle_get_*
implementations in @cond INTERNAL_HIDDEN. The public Doxygen
contract lives on the prototypes in
include/zephyr/arch/arch_interface.h; the per-arch implementations
are internal. Without this, removing the __pinned_func attribute
exposes the implementations to the doxygen-coverage delta check
as 10 newly-undocumented APIs.
Documentation updates are deferred to a separate commit.
Issue: #108773
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
As a part of the AIA specification two new extensions were introduced:
Smaia (Supervisor Machine AIA) and Ssaia (Supervisor Software AIA).
Support is added for these 2 extensions
Signed-off-by: Omar Naffaa <onaffaa@qti.qualcomm.com>
Avoid exporting the ARMClang builtin header path ahead of
libc++ for C++ builds, and restrict
_AEABI_PORTABILITY_LEVEL=1 to C and ASM.
This restores the expected C++ standard library include
behavior and avoids applying C-only AEABI portability
handling to libc++.
Assisted-by: GitHub Copilot:GPT-5.4 [apply_patch] [run_in_terminal]
Signed-off-by: Evan Chen <bugena123@gmail.com>
The -mno-global-merge flag is not recognized by Clang. Since GCC also
sets this property to an empty string, update Clang to match for
cross-platform compatibility. This fixes RISC-V builds with Clang.
Fixes build error on qemu_riscv32e with LLVM:
clang: error: argument unused during compilation: '-mno-global-merge'
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The generic armfvp.cmake assembled firmware loading arguments
(bp.secureflashloader, bp.flashloader0, cluster0.cpu0 --data) for
CONFIG_BUILD_WITH_TFA and CONFIG_ARMV8_A_NS that are specific to the
Base FVP model topology. Other FVP models (e.g. Corstone-1000) with
different firmware loading schemes could not use these parameters.
Move these bp.* arguments to fvp_base_revc_2xaem/board.cmake where
they actually apply. The generic runner now only falls back to the
"-a <elf>" application loading when the board hasn't set up its own
firmware arguments via CONFIG_BUILD_WITH_TFA or CONFIG_ARMV8_A_NS.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Use mcuboot,image-ram for the ram load address when the property is
present as a chosen node for a given board.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
Clang doesn't support -mstack-protector-guard flags that are used by
GCC. These flags are particularly problematic on RISC-V where they
cause compilation failures.
Override the security_canaries properties in Clang to only include the
base -fstack-protector variants, removing the unsupported
-mstack-protector-guard flags inherited from GCC.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Introduce a first-class value-parameterized test mechanism (ZTEST_P)
that works like GoogleTest TEST_P / INSTANTIATE_TEST_SUITE_P:
- A test body declared with ZTEST_P is executed once per registered
parameter value; inside the body the current value is obtained
through ztest_get_current_param() / ZTEST_GET_PARAM(type).
- The suite fixture returned by setup() is passed as the 'data'
argument and is completely independent from the parameter; it is
never overwritten (root cause of the previous misuse of ZTEST_P).
New public API in ztest_test.h:
struct ztest_param_values -- describes a typed value array
struct ztest_param_inst -- links a value set to a (suite, test) pair
ZTEST_DEFINE_PARAM_VALUES(name, type, ...)
Declare a static value set from literal values.
ZTEST_DEFINE_PARAM_VALUES_ARRAY(name, array)
Declare a static value set from an existing array.
ZTEST_INSTANTIATE_TEST_SUITE_P(inst, suite, fn, values)
Register a ztest_param_inst entry in the ztest_param_inst
linker section; the runner dispatches once per value.
ztest_get_current_param() const void * current value
ZTEST_GET_PARAM_PTR(type) const type * typed pointer
ZTEST_GET_PARAM(type) type typed value
ztest_get_current_param_index() size_t zero-based index
ztest_get_current_param_size() size_t element size
ztest_has_current_param() bool is a param active?
New internals in ztest.c:
struct z_ztest_param_ctx -- per-invocation parameter context global
z_ztest_find_param_inst() -- O(n) lookup over ztest_param_inst section
z_ztest_run_test_dispatch() -- per-test dispatch; loops over values
The fixture-overwrite path ("if (param != NULL) { data = param; }")
is removed; the legacy 'param' argument of z_ztest_run_test_suite
and related internal functions is kept for ABI compatibility but
marked ARG_UNUSED.
The linker script gains Z_LINK_ITERABLE(ztest_param_inst) so the
start/end symbols required by STRUCT_SECTION_FOREACH are emitted.
Assisted-by: GitHub Copilot:claude-sonnet-4-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
An absolute pointing device makes QEMU hide the host cursor over the
guest display, but the guest does not draw one.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Clang does not support the GCC-specific -flto=auto and -flto=1
flag forms, causing build failures when LTO is enabled with the
LLVM toolchain:
clang: error: unsupported argument '1' to option '-flto='
Override optimization_lto and optimization_lto_st in the Clang
compiler flags to use the Clang-supported equivalents:
- optimization_lto: -flto=thin (parallel, replaces -flto=auto)
- optimization_lto_st: -flto=full (single-threaded, replaces -flto=1)
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Define ARM-specific LLEXT compile flags for the clang toolchain
configuration to match GCC behavior.
This adds long-call code generation for extension objects and disables
unwind table emission in llext builds.
Also strip ARM unwind metadata sections from packaged .llext files so
the loader does not encounter relocations against non-loaded unwind
sections (.ARM.exidx/.ARM.extab and related rel sections).
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Two related problems caused clang/LLVM to disable MVE floating-point
(-mve.fp) when targeting Cortex-M55:
1. cmake/gcc-m-fpu.cmake set FPU_FOR_cortex-m55 to fpv5-sp-d16 (commit
6612580d9e) to allow precision selection via PRECISION_TOKEN. For
GCC this is harmless because GCC derives MVE capability from -march.
For clang, -mfpu=fpv5-sp-d16 explicitly overrides the CPU's default
FPU capabilities, which disables mve.fp:
clang -mcpu=cortex-m55 -mfpu=fpv5-sp-d16 -> +nomve.fp (wrong)
clang -mcpu=cortex-m55 -> +mve.fp (correct)
restore FPU_FOR_cortex-m55 to "auto". The +nomve.fp, +nomve and
+nodsp variants keep fpv5-sp-d16 because they explicitly restrict FPU
capabilities.
2. cmake/compiler/clang/target_arm.cmake unconditionally passed
-mfpu=${GCC_M_FPU} when CONFIG_FPU is set, with no guard for "auto".
The equivalent armclang fix was applied in commit f30235f56a but was
never ported to the standalone clang toolchain path.
add the same NOT "auto" guard as armclang/target.cmake.
Fixes#109009
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
With the Unix Makefiles generator, BYPRODUCTS declared in
add_custom_command(TARGET ... POST_BUILD ...) are not registered as
Make rules. The clang and codechecker SCA targets depended on sentinel
files (clang-sca.ready, codechecker.ready) that were byproducts of the
zephyr ELF POST_BUILD step, causing:
No rule to make target 'sca/clang/clang-sca.ready'
Replace the sentinel file mechanism with cmake_language(DEFER CALL ...)
to add a direct add_dependencies() on logical_target_for_zephyr_elf
after it is defined. This works correctly with both the Ninja and Unix
Makefiles generators and preserves the same ordering guarantee: SCA
analysis runs only after the full ELF build completes.
Fixes#104755
Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move `string(GENEX_STRIP ...)` before the loop.
We want to strip generator expressions from INTERFACE_COMPILE_OPTIONS.
This needs to be done before looping the list so that a compile option
list like this: `--arg1;$<1:--genarg1;--genarg2>;--arg2` are correctly
processed as a list of
- --arg1
- --arg2
and not an invalid list of
- --arg1
- $<1:--genarg1
- --genarg2>
- --arg2
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add FindCcache.cmake.
FindCcache.cmake allows Zephyr to use `find_package(Ccache <version>)`.
This provides a uniform way to lookup ccache and support ccache version
handling.
Minimum required ccache version is set to 4.12, as this version supports
the `--specs` argument properly.
47248c4
As part of this improvement, RULE_LAUNCH_COMPILE/LINK has been replaced
by the corresponding CMAKE_<lang>_COMPILER/LINKER_LAUNCHER.
To support existing system which might be setting CCACHE_IGNOREOPTIONS
in environment, the ccache v4.12 requirement is relaxed when this
environment setting is detected.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add support for the Cortex-A32 processor. The Cortex-A32 processor
is built on the ARMv8-A architecture and supports only the AArch32
execution state.
Signed-off-by: Silesh C V <silesh@alifsemi.com>
LTO changes section names in object files (e.g. .text becomes
.gnu.debuglto_.text), which breaks the section name parsing in
gen_relocate_app.py when CONFIG_CODE_DATA_RELOCATION=y.
Fix this by applying -fno-lto to any source files or libraries
registered via zephyr_code_relocate(), using the existing
compiler prohibit_lto property.
Remove the workaround filter from tests/kernel/common/testcase.yaml
that excluded kernel.common.lto and kernel.common.lto.singlethreaded
when CONFIG_CODE_DATA_RELOCATION was enabled.
Fixes#69730
Signed-off-by: Jjateen Gundesha <jjateen97@gmail.com>
Enable SDL/Cocoa display backend for any CONFIG_DISPLAY target, not
only those using CONFIG_QEMU_RAMFB_DISPLAY. This allows boards with
their own display drivers (e.g. BCM2711 framebuffer) to get a QEMU
GUI window without requiring ramfb, while ramfb-specific flags remain
gated on CONFIG_QEMU_RAMFB_DISPLAY.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
This commit removes an empty elseif() branch from the CMake scripts
for the IAR linker.
The empty branching was generating warnings/noise when building
Zephyr with IAR using the latest CMake.
Signed-off-by: Felipe Torrezan <felipe.torrezan@qt.io>
Picolibc selects printf variants (minimal, integer, long-long, float)
via --defsym linker directives generated by GCC's picolibc.specs file.
Clang does not support specs files, so the -DPICOLIBC_*_PRINTF_SCANF
flags passed at link time were silently ignored, causing vfprintf to
always resolve to the full implementation regardless of configuration.
Signed-off-by: Adarsha Regmi <aregmi@qti.qualcomm.com>
build_info.yml contains valuable information regarding the build.
Make this information available when running package_helper.cmake.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Zephyr computes the runtime lib via --print-libgcc-file-name, but does
not pass the C++ compile flags -fno-exceptions and -fno-rtti causing
the probe to always select the wrong c++ rt.
Signed-off-by: Kenth Eriksson <kenth.eriksson@nokia.com>
Add a "west snippets" command to list available snippets, similar to
"west boards" and "west shields". Default display shows the snippets
along with their description. The "--format" parameter as used by
"west shields" is supported for user-controlled formatting.
Shell completion scripts for bash, zsh, and powershell are also
updated to support completion for snippet names.
Signed-off-by: Graham Roff <grahamr@qti.qualcomm.com>
section_to_string() emits a closing '}' without a matching opening
'{' when a section has NOINPUT=TRUE and no SETTINGS_INDICIES, as the
opening brace is only emitted inside the foreach() over indicies.
Emit the missing ' EMPTY 0x0\n {' header after the loop when 'empty'
is still TRUE, mirroring the offset / sort branches inside the loop.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
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>