Drop the unnecessary _ri_ptr NULL check, as multi-instance resources
always provide a valid instance array when _ri_count > 0. This
simplifies the initialization logic and prevents compile time warrning
messages/noice.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Besides a custom range to run the compliance checks, allow to run on all
commits to HEAD.
This is useful when testing locally, to verify existing files in tree.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
On a cache incoherent system, we need to make sure the caching
of stack space is properly flushed to memory when creating new
threads. This is especially important if the thread starts
running on the CPU other than the one initializing the thread.
Without flushing, the other CPU would not have the up-to-date
data to correctly start the thread.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Add a DeviceMmioCheck to check_compliance.py that flags driver files
casting DT_REG_ADDR() or DT_INST_REG_ADDR() to a pointer without
using the device MMIO API.
.base = (SomeType *)DT_INST_REG_ADDR(n),
This stores the raw physical address and dereferences it directly. On
systems with an MMU, the physical address has no page table entry and
the access will fault unless someone else has created an identity
mapping (typically via mmu_regions.c).
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
The syslib delay function are implemented in an assembly file.
Even with the relocation done in CMakeLists.txt this file does not
properly get copied because gen_relocate_app.py does not keep
in consideration plain regions (e.g. just .text rather than .text.xyz).
Therefore force the relocation using the ramfunc and itcm linker
section for cm33 and cm55 respectively.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
The linker region rwdata was including sections ramfunc
and itcm which should instead be placed in a code region.
Created itcm_mem.ld and ramfunc_mem.ld for cm55 and
cm33 respectfully to place the section accordingly.
Added the linker sources in cmakelists.txt
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
Now that the cores have dedicated executable regions
for the code relocation, give executable permissions only
to those rather than the entire RAM region.
Additionally, removed the rwdata exception for the assembly
file given that it now gets properly placed in the correct region
by the relocate script.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
Rathenr that use the general RAM region for relocating
code use the dedicated memory region for each individual
core/partition.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
Added designation of RAM regions for code execution on
cm33 cores so that they can be properly used for relocation
and have specific executable flag in the MPU initialization.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
ethernet_update_tx_stats checks the multicast address first and then the
broadcast which causes the broadcast address to be treated as multicast
and not counted correctly.Fix this by checking broadcast address first,
followed by the multicast address.
Signed-off-by: Taha Benderli <taha.benderli@analog.com>
Change 'select ARM_MPU' to 'imply ARM_MPU' so that tests and
applications can override it with CONFIG_ARM_MPU=n. The previous
'select' caused a prefetch abort in the LLEXT module_build sample,
which disables MPU to allow execution from heap-allocated memory.
Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
Update filter so non-concerned platforms can't execute the test.
With theses changes, board like b_l072z_lrwan1 with "semtech,sx1276"
compatible can't run these tests.
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
Workq optionally yield after every work handler to avoid starving
other threads.
When current workq is empty after this work handler, current thread
will go to sleep in next loop. So no need to yield, bringing one more
schedule cost.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
There are several areas in the networking stack where this is missing.
So make sure we add it.
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
`net_calc_chksum` is designed to return uint16_t checksum.
Its current behavior is to return 0 checksum on error
(or on an empty payload) and a valid non zero checksum for non empty
payloads. 0 could be a valid checksum for empty payload.
So update the `net_calc_chksum` and its wrapper's definition to
return error codes.
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
that can never succeed because it is not in the com port filter list.
This would trigger every time that a combination of --flash-before and
--serial-pty is used.
The list of monitored serial ports - at least on linux - does not contain
/dev/pts but that list is constantly checked if the /dev/pts/X device might
magically appear some day.
This is the proper fix instead of adding /dev/pts/* to the monitor list
because the reason why we need to wait is because in the codepath without
serial_pty, we might be resetting the target device, causing the dev node
to disappear/reappear. This is not the case for the virtual ports created
for serial_pty.
Signed-off-by: Lucas Romero <lucas.romero@a-labs.io>
tcp_options_len calculation in tcp_data_len can underflow
if th_off(th) is less than 5. This can lead to a huge
tcp_options_len value and subsequently a wrong data length calculation.
Add the checks in tcp_recv() which is a top API, so that the checks
are covered at the entry point.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/106657
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
Between the points in time when sys_clock_announce() calls the
timeout handler for delayable work and when that handler wins
the work queue spinlock another thread or ISR could have called
k_work_reschedule_for_queue(). Should this occur, the timeout
that the handler is trying to process becomes stale and the
handler should not proceed any further with it.
As the workqueue spinlock is the controlling lock (it is always
held before either aborting or adding a timeout), it is safe
for the handler to call z_is_timeout_handler_canceled() once
it holds the workqueue spinlock.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
The workqueue work timeout feature is supposed to abort the work
queue thread if the time to execute a work item exceeds the work
queue's configured threshold. The work thread may race against the
timeout handler responsible for aborting the thread when the two
are running on separate CPUs--particularly since the timeout handler
only locks the workqueue spinlock for part of its duration.
To get around this, two separate flags must be checked a 'finished'
flag to indicate that the thread has finished processing the work
item and the timeout's flag indicating if it has been removed while
processing its timeout handler. Should either be found to be true
within in the timeout handler, the thread is deemed to have completed
in time and the timeout handler proceeds no further.
Otherwise the timeout handler is deemed to have won the race and the
workqueue thread is aborted. Should the workqueue thread detect this,
it goes to sleep until it can be aborted to prevent it from handling
any more work items.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
The routine sys_clock_announce() removes the timeout from the timeout
list and unlocks the timeout spinlock before invoking the timeout's
handler. This creates a window where another ISR (or a thread running
on another CPU) can abort or reuse the timeout before the handler
executes. When this happens, the timeout handler should bail early.
Use the dticks field to carry this state: set it to
TIMEOUT_DTICKS_ANNOUNCING after remove_timeout() (which needs
dticks = 0 to propagate remaining ticks) and before calling the
handler. In z_abort_timeout(), set TIMEOUT_DTICKS_ABORTED when the
timeout is either linked (existing behavior) or in the announcing
state (new). The z_add_timeout() path naturally overwrites dticks
with a real tick value, so re-use is also detected.
Provide z_is_timeout_handler_canceled() for handlers to check if
they should bail. This avoids adding a flags field to struct _timeout,
keeping the struct size unchanged.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
arch/riscv/core/thread.c does not use any stdio symbols.
Therefore, remove the unused include.
No functional change.
Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
The result property getter rebuilds the list from XML children every
access, and the setter removes all existing results then re-appends them
all. So self.case.result += [res] is O(n²) over time.
self.case.append(res) directly appends to the underlying XML element in
O(1), bypassing the expensive property entirely.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
STM32WB0 watchdog does not support disable the Debug
module during STANDBY mode once the DBGMCU
clock is enabled.
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
Add an initialisation time check for stream flash that the requested
offset and size does not overflow `size_t`. This in turn ensures that
`inspect_device` doesn't erroneously return `0` if the addition would
have overflowed.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The SPI SRAM memory test runs on the entire mapped PSRAM
region during boot. At lower clock speeds (e.g. 40MHz),
this can take over 10 seconds for a 4MB device, delaying
startup significantly.
Remove the default y so the memtest is opt-in. Users can
still enable it with CONFIG_ESP_SPIRAM_MEMTEST=y when
needed for hardware validation.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
The SPIRAM heap address was set from the linker symbol
_ext_ram_heap_start, which may not match the actual MMU
mapping at runtime. On SoCs with unified cache (C5, C6,
H2), the virtual address depends on MMU page allocation
and can differ from the linker estimate.
Use esp_psram_get_mapped_region() to obtain the actual
mapped address and size at runtime.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
The ext_dram_seg was placed at DROM_SEG_ORG + DROM_SEG_LEN
(0x43000000), but the MMU maps PSRAM into the first free
pages in the unified cache address space (0x42000000+).
This mismatch caused the SPIRAM heap to point to unmapped
memory, resulting in data corruption and crashes.
Move ext_dram_seg origin to IROM_SEG_ORG and add an
.ext_ram.dummy section that skips past both IROM and DROM
MMU page reservations, matching the runtime behavior of
esp_mmu_map_reserve_block_with_caps().
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Removes information that is duplicated and should have been removed
a year prior as this information is now automatically generated by
the documentation build and is always updated, rather than
referencing the same copy and pasted block that was out of date
years ago
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
If building mbox driver for ESP32-C5, it fails due to
invalid headers. Add needed guard for that SoC.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
On real hardware, the main stack seems to be ever so slightly too small,
so increase it based on observed actual usage on FRDM-MCXN947.
main : STACK: unused 7016 usage 1176 / 8192 (14 %); CPU: 4 %
: Total CPU cycles used: 81758333
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Return 0 from clock_control_esp32_on() when the peripheral clock is
already on, matching clock_control_on() success semantics.
Signed-off-by: Anand Kumar <anandvtu16158@gmail.com>
Second clock_control_on() may return 0 or -EALREADY when the clock is
already on; assert it stays ON. Prepares for ESP32 clock_control
returning success when already enabled.
Signed-off-by: Anand Kumar <anandvtu16158@gmail.com>
soc_random_enable() was called inside hardware_init() which
only runs for CONFIG_MCUBOOT and CONFIG_ESP_SIMPLE_BOOT. For
MCUboot-loaded apps (CONFIG_BOOTLOADER_MCUBOOT), hardware_init
is skipped, so soc_random_enable() never ran. However,
soc_random_disable() was called unconditionally in loader.c,
causing periph_module_disable() to decrement the peripheral
clock reference counter below zero. This prevented
periph_module_enable() from actually enabling the hardware
clock for any peripheral touched by soc_random_disable(),
such as I2S0 on ESP32, breaking drivers that depend on it.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
NRFS initialization must happen after the IPC service. Setting
the same priority may lead to locking if NRFS initialization
happens before the IPC.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Move to the post kernel. Set priority which is higher than the
IPC service and NRFS.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Since `a78cd34` the ADC driver did not correctly configure
its internal divisor. The responsibility was moved from the
clock control driver to the ADC driver and the `init` function
of the ADC driver was updated accordingly. But the driver
continued calling the clock control API from the `configure`
function, leading to `-EINVAL` being returned.
Correctly configure the internal divisor in the ADC driver by
calling the HAL API directly.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The twt_capable field in wifi status earlier was hardcoded to true. It
seems better to set it to true only when the link mode is 802.11ax or
higher.
Signed-off-by: Muzaffar Ahmed <muzaffar.ahmed@silabs.com>
Fix alphabetically sorting for binding types as it was previously
putting abbreviation (for which "raw" text started with ':abbr:...') as
first in the list.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>