Add devicetree .overlay to support sample apps for Renesas RA
SAU UART drivers:
- samples/drivers/uart/passthrough
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Add SAU UART devicetree node support for Renesas RA0 series SoCs
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Initial SAU UART driver support for Renesas RA0 series
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Add support for Renesas RA fpb_ra0e1 board
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Add config SOC_RA_DYNAMIC_INTERRUPT_NUMBER to indicate the SoC
support the dynamic interrupt number assignment feature.
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
- Update Renesas RA GPIO driver to support Renesas RA0 series
- Add macro to disable port external interrupt the the compatible
nodes `renesas,ra-external-interrupt` are not enabled.
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Added sam_e54_xpro.overlay files for rtc
Added sam_e54_xpro platform allow in testcase.yaml.
Added board support in main.c
Added an extra scenario to testcase.yaml
Signed-off-by: Muhammed Asif <muhammed.asif@microchip.com>
Reduce the complexity of the set-alarm and set-top functions.
Improve the error handling.
Replace IRQ macros with static inline functions to centralize GIC/NVIC
conditional handling.
Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
Boards based on Nordic Semiconductor's nRF53 and nRF54H
series enable the Bluetooth HCI IPC driver whenever BT is
set, even though the original BT_HCI_IPC symbol depends
also on BT_HCI.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
Without the special CAN transceiver node to the MCP25625 Click, the STBY
pin will be pulled high from the internal pull-up resistor in the MCP2562
CAN transceiver, causing the CAN transceiver to stay in stand-by mode,
preventing any CAN bus traffic from taking place.
Signed-off-by: Stephan Linz <linz@li-pro.net>
Rearrange the devicetree overlays for the MikroElektronika MCP251x
shields to better align with node and property order used in the
rest of the tree.
Use "can" as devicetree node name as recommended in the Devicetree
specification.
Signed-off-by: Stephan Linz <linz@li-pro.net>
Move the non-RGB mapping code into an update function.
This creates simpler functions and makes implementation of LED strip API's
update_channels function simpler.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Add pic32cm_jh01_cpro.overlay files to the chan_blen_transfer
and loop_transfer test projects to enable DMA twister
testing on this board.
Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
Update pic32cm_jh01_cpro.yml to include DMA in the supported
features list.
Also enable the DMA controller node in pic32cm_jh01_cpro.dts.
Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
Add DT helper file for PIC32CM-JH family devices to support
SoC-specific device tree definitions and utilities.
Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
Introduce the microchip,dmac-g2-dma.yaml devicetree binding file.
Add the DMA node definition for PIC32CM-JH family devices.
Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
The qemu_leon3 DTS declares 1GB of SRAM (reg = <0x40000000 0x40000000>)
but the QEMU command line never specified a -m option, so QEMU used its
default of 128MB. This mismatch was silently tolerated until now because
nothing validated the heap's end marker beyond physical RAM.
When CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 (the default), the malloc
heap claims the entire declared SRAM (~1GB). The heap end marker chunk
is written at ~1GB offset from the heap base, well beyond QEMU's 128MB
of physical RAM. Those writes are silently lost, leaving the end
marker's LEFT_SIZE field as zero.
Commit bec6349cc7 ("lib: heap: introduce SYS_HEAP_HARDENING tiered
Kconfig") made bidirectional size round-trip checks the default when
CONFIG_ASSERT=y (MODERATE level). The check left_chunk(right_chunk(c))
reads back the end marker's LEFT_SIZE and detects the zero value,
triggering "heap corruption (free chunk linkage)" across many unrelated
tests on this board.
Add -m 1G to the QEMU flags so the emulated RAM matches the declared
DTS size, consistent with how other QEMU boards (arc, riscv32, x86)
already specify their memory.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Commit 518d8420c9 ("lib: heap: compute Z_HEAP_MIN_SIZE from actual
struct layouts") added heap_constants.c to the offsets library, but
did not add the prohibit_lto compile option that offsets.c has.
When LTO is enabled, the compiler optimizes away the absolute symbols
emitted by GEN_ABSOLUTE_SYM, causing them to be missing from the
generated offsets.h. This breaks builds that use Z_HEAP_MIN_SIZE
(via kernel/mempool.c) with LTO-enabled configurations.
Fix by adding heap_constants.c to the same set_source_files_properties
call that disables LTO for offsets.c.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Commit 7839d958ac ("tests: drivers: dma: cyclic: check rx buf
overflow") added a 16-byte guard region at the end of rx_data,
initialized to 0xA5 before the test starts, with overflow checks
after each cycle.
Between cycle 1 and cycle 2, the test resets the receive buffer with
memset(rx_data, 0, sizeof(rx_data)). Since rx_data was enlarged to
CONFIG_DMA_CYCLIC_XFER_SIZE + GUARD_BUF_SIZE, this zeros the guard
region along with the transfer area. The second cycle's guard check
then finds 0x00 instead of 0xA5 and fails, even though the DMA never
wrote past the buffer.
Fix by re-initializing the guard to 0xA5 immediately after the
inter-cycle memset.
Signed-off-by: Braeden Lane <Braeden.Lane@infineon.com>
Some MAX32 targets may fail to raise TX half/almost empty interrupts,
so add an optional workaround for those scenarios to ensure no missed
TX completion when using the interrupt API.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
Align the net_if_ipv6_router_add() behavior with its IPv4 counterpart,
where it is possible to specify whether the router is a default one
instead of making assumptions based on the lifetime value.
The current behavior was likely inspired by the Neighbor Discovery RFC,
where the lifetime parameter of 0 received in the Router Advertisement
message indicates that the router should not be treated as a default
router, however this is an implementation detail of the Neighbor
Discovery protocol and does not need to be enforced at the router API
level, as this can be used outside of this protocol (for example when
router is added manually from the application).
Therefore, allow to specify the "is_default" parameter separately just
like in the IPv4 case.The Router Advertisement handling routine will
just specify the "is_default" value based on the received lifetime
value.
Also, clarify in the function documentation what does it mean to specify
lifetime to 0 (which means the router never expires according to current
implementation).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Update SSD1306 display controller compatible string from solomon,ssd1306fb
to solomon,ssd1306 to align with the Zephyr 4.4.0 display controller
naming convention.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Simplify the design by removing the `detected` attribute from
HardwareMap class and DUT storage from ProjectBuilder class.
Instead of storing detected DUTs as instance attributes, pass
them as method parameters where needed.
This eliminates data duplication since ProjectBuilder can access DUTs
directly from the environment object, and HardwareMap doesn't need to
maintain its own copy of detected DUTs. The refactoring makes the code
cleaner and reduces the risk of inconsistent state between different
objects storing the same DUT information.
Signed-off-by: Grzegorz Chwierut <grzegorz.chwierut@nordicsemi.no>
The nrf52840dk ram_load variant is very tight on RAM. The MCUboot
RAM_LOAD padding section rounds the image size up to the next
power-of-2 boundary, so even a small increase in code or rodata
can double the padding and overflow the RAM region.
The sys_heap hardening code pushes the image just over the 128KB
boundary, causing padding to jump from 128KB to 256KB and
overflowing RAM by ~55KB.
Disable heap hardening for this build. Since CONFIG_ASSERT is off,
the previous __ASSERT-gated heap checks were inactive anyway, so
HARDENING_NONE preserves the same level of validation.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Several test SMC callback handlers request only 1 byte via
OPTEE_SMC_RPC_FUNC_ALLOC but subsequently write a full
struct optee_msg_arg (with params) into the allocated buffer.
This is a heap buffer overflow: struct optee_msg_arg alone is
larger than 1 byte, and the params array extends it further.
For example, cmd_gettime_call case 0 requests 1 byte, then case 1
casts the buffer to struct optee_msg_arg and writes cmd, num_params,
and params[0] — roughly 72 bytes into a 1-byte allocation.
This went unnoticed because nothing validated the heap metadata
after the overflow. The corruption was detected by the new
SYS_HEAP_HARDENING_MODERATE free-list linkage checks introduced in
the sys_heap hardening series: the overflow from the undersized
RPC buffer corrupts adjacent heap chunk headers, which the
allocator now catches at free() time with:
"heap corruption (free list linkage)"
Fix all 6 affected callbacks to request the correct size using
OPTEE_MSG_GET_ARG_SIZE(num_params):
cmd_alloc_free_call: OPTEE_MSG_GET_ARG_SIZE(1) — 1 param used
cmd_rpc_call: OPTEE_MSG_GET_ARG_SIZE(2) — 2 params used
cmd_shm_alloc_appl: OPTEE_MSG_GET_ARG_SIZE(1) — 1 param used
cmd_gettime_call: OPTEE_MSG_GET_ARG_SIZE(1) — 1 param used
cmd_suspend_call: OPTEE_MSG_GET_ARG_SIZE(1) — 1 param used
cmd_notify_alloc_call: OPTEE_MSG_GET_ARG_SIZE(1) — 1 param used
The normal_call callback is not affected: it only performs ALLOC
then FREE without writing any optee_msg_arg into the buffer.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
At FULL hardening, trailer canaries on used chunks implicitly guard
adjacent free chunk headers: a sequential buffer overflow must corrupt
the used chunk's trailer before reaching the next header. However,
when a free neighbor's metadata is needed for merging during free(),
the neighbor's header could already have been corrupted by an overflow
from its left used chunk that hasn't been freed yet. For example:
[hdr_U1] [data_U1] [trailer_U1] [hdr_F] [...] [hdr_U2] [trailer_U2]
If data_U1 overflows past trailer_U1 and corrupts hdr_F, freeing U2
would use hdr_F's corrupted size and free-list pointers for merging,
potentially leading to heap structure corruption or arbitrary writes.
Additionally, a corrupted LEFT_SIZE in a used chunk being freed can
point to a fake header crafted inside the left neighbor's data area:
[hdr_U1] [data_U1 ..fake_hdr.. trailer_U1'] [hdr_U2'] [data_U2] ...
| corrupted LEFT_SIZE points
| by overflow to fake_hdr
+<--------------------------+
A determined attacker can make fake_hdr's size field self-consistent
with the corrupted LEFT_SIZE so that the structural round-trip checks
pass. If fake_hdr is marked "used", free_chunk() skips the left
merge and the corruption goes undetected. If marked "free", it
triggers a bogus merge with attacker-controlled free-list pointers.
Both cases are caught by verifying the left used neighbor's canary:
any overflow from the left must pass through trailer_U1 to reach
hdr_U2's LEFT_SIZE field, so the corrupted canary acts as a tripwire
regardless of whether the resulting fake header is marked used or free.
Address this by introducing free_chunk_check() which validates a free
chunk's structural integrity before trusting its header fields. It
consolidates the existing MODERATE-level structural checks (chunk
linkage, used-bit consistency) with a new FULL-level canary
verification of the left used neighbor. Factoring these checks into
a dedicated function lets callers specify @left_trusted according to
context (e.g. the chunk being freed is the left neighbor of the right
merge candidate, so its canary need not be rechecked).
In inplace_realloc()'s shrink path, the freed suffix's left neighbor
is always the chunk being reallocated (used, just validated). This
path inlines only the right merge to avoid the unnecessary left canary
check.
The check is called before every free list removal: in free_chunk()
for left/right merge candidates, in alloc_chunk() when pulling from
a bucket, and in inplace_realloc() before consuming the right
neighbor.
Also give chunk0 a canary trailer so that the left-neighbor canary
check works uniformly for the first free chunk in the heap.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Replace canary-specific test variants with hardening level variants:
- hardening_none: verifies zero-overhead path
- hardening_full: exercises canary + all lower-level checks
No extreme variant is added as the tests already perform explicit
heap validation after each operation.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Replace the standalone SYS_HEAP_CANARIES bool with a tiered
SYS_HEAP_HARDENING choice controlling runtime validation:
NONE (0) - no checks
BASIC (1) - double-free and overflow detection in free/realloc
MODERATE (2) - free list and neighbor consistency checks
FULL (3) - trailer canary on every allocation
EXTREME (4) - exhaustive heap validation on every operation
Default is MODERATE when ASSERT is enabled, BASIC otherwise.
Hardening checks are independent of CONFIG_ASSERT: they use
LOG_ERR + k_panic() instead of __ASSERT so the configured level
is always honored regardless of assertion settings.
Also adds heap logging via LOG_MODULE_REGISTER. This paves the way for
eventual permanent debugging instrumentation.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Factor out the core heap validation logic into z_heap_full_check()
which takes a struct z_heap pointer directly. This allows internal
callers (e.g. alloc_chunk) to validate the heap without needing
the public struct sys_heap wrapper.
sys_heap_validate() becomes a thin wrapper that calls
z_heap_full_check() and then validates runtime stats.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add canary-enabled test variants to the heap, heap_align, and heap_min
test suites to exercise the heap canary corruption detection feature.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>