Commit graph zephyr/soc
Author SHA1 Message Date
Dan Kalowsky
7dab6249ac soc: ambiq: fix SOC include guards
The C language does reserve the following identifiers starting with:

- two underscores
- an underscore followed by an uppercase letter
- a single underscore at the file scope

These are reserved for internal use by the compiler or implementation.
While not likely to ever actually conflict update the include guard macros
to not be in violation of the reserved naming and bring it inline with the
already established pattern for the Zephyr SOC headers.

Signed-off-by: Dan Kalowsky <dkalowsk@qti.qualcomm.com>
2026-10-21 11:58:46 +02:00
Sylvio Alves
6ff552bc23 soc: espressif: pm: fix kernel uptime loss on light sleep wakeup
The light sleep exit hook unmasked interrupts before the kernel
accounted the slept ticks. A wake ISR that armed a timeout could
then preempt the idle-exit announce with a stale alarm and drop
the rest of the sleep from the kernel clock.

Fix it by keeping interrupts masked in the exit hook and no
longer selecting PM_STATE_SET_IRQ_UNLOCKED, so the idle thread
unmasks them after the slept ticks are announced. On Xtensa the
exit hook still restores the INTENABLE register saved before
sleep.

Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-10-21 11:53:02 +02:00
Tiago Medicci
021e0e822e espressif: check CONFIG_ESP_CONSOLE_UART_NUM value before using it
CONFIG_ESP_CONSOLE_UART_NUM default value is `-1`. This value will
not change when USB CDC ACM UART is used, for instance.

Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
2026-10-21 11:48:37 +02:00
Raffael Rostagno
937b32ccbf soc: esp32: pm: Keep one kernel deadline across early timer wakes
An earlier esp_timer alarm is also an RTC timer wake, so closing the
window on every timer wake ends the kernel wait too soon. Keep the
kernel budget from the first fragment, and close on a timer wake only
when that fragment still reaches it.

Assisted-by: Grok:4.7
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-10-21 11:46:59 +02:00
Raffael Rostagno
c33a47866a soc: esp32: pm: Bound light sleep to the next esp_timer alarm
Light sleep takes its duration from the kernel timeout alone, so an
alarm armed by the Bluetooth controller or Wi-Fi can expire while the
CPU is asleep. Limit the sleep to the next esp_timer alarm, and skip
it when that alarm is already due. Idle enters sleep again after the
callback has run.

Use the kernel timeout for the deep sleep wake. The shortened time
would otherwise wake deep sleep at the next esp_timer alarm, or leave
it unable to wake when that alarm is already due.

Snapshot the low-power counter after the alarm lookup, so that time
is not counted as missed sleep. If the alarm is too short to sleep,
wait for it instead of retrying suspend.

Assisted-by: Grok:4.7
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-10-21 11:46:59 +02:00
Fin Maaß
0bd4d0d205 soc: sifive: fe310: fix SYS_CLOCK_HW_CYCLES_PER_SEC
the riscv mashine timer inside this SoC is normally driven by a
external 32768 Hz watch crystal oscillator. All in-tree
boards have that external oscillator and it is also
the value that qemu assumes for the sifive_e board.

Before 07e4ba4240
32768 already was the default value, but got changed there
without reason.

In the manual of the SoC, in the chapter describing the RTC,
it is recommended to use an external 32768 Hz watch crystal oscillator
for the low-frequency clock source. And as the machine timer is driven
by the same clock, it makes sense to set SYS_CLOCK_HW_CYCLES_PER_SEC
accordingly. When the external oscillator not present a internal
oscillator is used instead, which target frequency is ~ 32kHz.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-10-20 17:41:56 +02:00
Martin Hoff
3b8ef62abe soc: silabs: s2: fix Kconfig guards for uart interrupt select
PM selected UART_INTERRUPT_DRIVEN unconditionally, so disabling serial
creates Kconfig errors because that symbol depends on
SERIAL_SUPPORT_INTERRUPT.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2026-10-20 17:37:39 +02:00
Zayne Stites
65a66b2087 soc: infineon: cat1a: add soc.yml entries for 21 PSoC 6 parts
Updating soc.yml to include new psoc6 devices added in the
previous commit.  Build tested each with Hello World.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Zayne Stites <Zayne.Stites@infineon.com>
2026-10-20 17:36:21 +02:00
Holt Sun
12dc05a4a0 soc: nxp: ke1xz: trim LPFLL against SOSC crystal
The ke1xz core and bus clocks derive from the LPFLL, which was left
free-running (trimConfig = NULL). A free-running LPFLL only has a
few-percent accuracy, so any clock derived from it is off by that
much. On frdm_ke17z512 this surfaced as a PWM capture failure: the
PWT capture timer is clocked from the LPFLL-derived bus clock while
the FTM generates its waveform from the 8 MHz crystal (SOSC), so the
tests/drivers/pwm/pwm_loopback accuracy subtests measured the period
~2.9% off and exceeded their +/-1% tolerance. The 96 MHz LPFLL range
used by ke17z512 is where the error is largest; the other ke1xz
boards run the 72 MHz range and happen to stay within tolerance, but
the inaccuracy is latent on all of them.

Trim (closed-loop lock) the LPFLL against the SOSC crystal whenever
the SOSC is enabled, so the LPFLL and every clock derived from it
become as accurate as the crystal. The trim reference is predivided
to 2 MHz as the hardware requires. When no SOSC is present the LPFLL
stays free-running exactly as before.

Verified on frdm_ke17z512 (J-Link, PTB14/J3-11 -> PTE11/J2-11
loopback): tests/drivers/pwm/pwm_loopback now reports SUITE PASS
100% (pass=6, fail=0, skip=3) across 6 consecutive runs. frdm_ke17z
and the other SOSC-enabled ke1xz boards build clean.

Assisted-by: Vero-Coder:claude-opus-4-8
Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-10-20 17:31:11 +02:00
YunHung Hua
0e2db1921c soc: st: stm32f4: avoid missed wake-ups from Standby
If a wake-up source is high while z_sys_poweroff() clears WUF, it can
mask later wake-up events, and the MCU may never leave Standby (ES0206
2.2.4). Clear WUF with the WKUP pins disabled, as the erratum
workaround describes. A WKUP pin that is still high then sets WUF again
when it is re-enabled, so the device leaves Standby at once instead.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: YunHung Hua <oliverhua.us@gmail.com>
2026-10-19 16:28:00 +02:00
Jimmy Zheng
94bf4f365e arch: riscv: make vectored mode optional with IRQ vector table
Default RISCV_VECTORED_MODE to enabled when GEN_IRQ_VECTOR_TABLE is
enabled, rather than selecting it.

This allows platforms with a custom vectored interrupt implementation to
disable the standard RISC-V mtvec optional vectored mode while keeping
the existing behavior by default.
For example, AE350 supports the RISC-V privileged architecture but not
the optional mtvec vectored mode, and may use the Andes Vectored PLIC
extension instead.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2026-10-19 10:27:11 +02:00
Daniel Leung
59513a0b4b soc: qemu/xtensa/sample_controller32/mpu: support LLEXT tests
This adds the necessary bits to enable running LLEXT tests
against board qemu/xtensa/sample_controller32/mpu.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2026-10-19 10:22:28 +02:00
Raffael Rostagno
43c6df240f soc: esp32p4: Keep the CPU domain on in light sleep below v3
ESP32-P4 below v3 cannot power down the CPU domain on its own. Disable
ESP32_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP by default on rev 1.3.
Peripheral power down still selects it, because powering down TOP
needs CPU retention. Add flash power down config.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-10-19 10:21:30 +02:00
Raffael Rostagno
ec6b73be34 soc: esp32p4: Skip clock ICG retention with TOP power down
With peripheral power down enabled, the clock ICG retention entries
gate the flash clocks during the sleep backup, before the SPI memory
registers are saved. The backup then holds zeros, the flash controller
is restored unconfigured on wake, and the first instruction fetch from
flash hangs until the LP watchdog resets the chip.

Set up clock ICG retention only when peripheral power down is
disabled.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-10-19 10:21:30 +02:00
Jun Lin
90a41b7260 soc: nuvoton: npcx: restore interrupts when leaving sleep sub-state
The commit 04d7964252 ("soc: nuvoton: npcx: add unlimited instant
wake-up and sleep substates") added sub-state 2 ("Sleep") to
pm_state_set() but not to pm_state_exit_post_ops(). Leaving that
sub-state therefore falls through to the default branch and never
calls __enable_irq(), so interrupts stay masked after the first
wake-up from Sleep mode.

Add the missing case.

Assisted-by: Copilot:claude-opus-5
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2026-10-16 13:15:46 +02:00
Quy Tran
0fb14a9f9c soc: renesas: rx: correct system prcr register for rx74n
The SYSTEM_PRCR register of RX74N must be 0x870193FA, add condition to
correct it

Signed-off-by: Quy Tran <quy.tran.pz@renesas.com>
2026-10-16 09:20:22 +02:00
Josuah Demangeon
4babceb22d soc: espressif: common: defaults for video to work out of the box
Enable multiple platform-level defaults to make video receiver work without
the need to configure every sample.

Also supports shared-multi-heap to be turned off and use memory region
names instead as an option.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2026-10-15 16:37:44 +02:00
Miles Wang
d03f0482b4 soc: nxp: rw: increase BT RX stack size for SMP
On RW6xx the PSA crypto operations performed during SMP pairing
(ECDH P-256 key agreement/DHKey and AES-CMAC) run in the BT RX
thread context and are dispatched to the NXP ELS/PKC PSA crypto
driver. That driver's call chain is significantly deeper than the
software mbedTLS path; a single mcuxClPsaDriver driver_wrapper
computation alone consumes over 700 bytes of stack.

The default BT_RX_STACK_SIZE of 1200 bytes is not enough to hold
these computations on top of the existing SMP call chain, leading
to a stack overflow when raising the security level
(e.g. "bt security 2").

Bump BT_RX_STACK_SIZE to 2800 when BT_SMP is enabled. This default
only applies on RW6xx with the PSA crypto backend
(MBEDTLS_PSA_CRYPTO_C + BT). Measured peak usage is ~2.3KB, so 2800
leaves adequate margin.

Signed-off-by: Miles Wang <linxiao.wang@nxp.com>
2026-10-15 14:21:19 +02:00
Clark Jarvis
60e3a9dc4a soc: infineon: psc3: fix flash load address for west flash
PSC3 exposes a single physical flash through CBUS and SAHB address
aliases. Code executes from the CBUS alias, which is what flash0
describes in devicetree, but the device is programmed through the SAHB
alias. The two views sit a constant 0x20000000 apart for both the
secure (0x12000000 -> 0x32000000) and non-secure (0x02000000 ->
0x22000000) banks.

Zephyr linked and loaded PSC3 images at the CBUS alias. The jlink
runner programs zephyr.hex and takes the addresses from the file, so
the records were rejected by the J-Link flash loader, which exposes
the flash at its SAHB programming alias. The erase phase completed and
the program phase failed, leaving the device blank.

Set CONFIG_BUILD_OUTPUT_ADJUST_LMA so the generated image carries
programming-alias addresses, leaving the run address unchanged. This
matches the approach already used by cyw20829 in the same SoC family
and by pse84.

Infineon OpenOCD declares its programmable PSC3 banks at the same SAHB
addresses and maps the CBUS alias onto them as virtual banks, so
kit_psc3m5_evk is unaffected.

Tested on kit_psc3m5_cc2 (jlink) and kit_psc3m5_evk (openocd); both
program and boot.

Assisted-by: Copilot:claude-opus-5
Signed-off-by: Clark Jarvis <Clark.Jarvis@infineon.com>
2026-10-15 14:19:07 +02:00
Jason Yu
bc22383357 soc: nxp: mcxn: fix R_ARM_PREL31 overflow for __ramfunc with FlexSPI XIP
With CONFIG_ARCH_STACKWALK (-funwind-tables) the compiler emits
.ARM.exidx.ramfunc / .ARM.extab.ramfunc unwind entries for every
__ramfunc function.  On MCXN947 FlexSPI flash is at 0x90000000 and
SRAM at ~0x20000000; the 1.75 GB gap exceeds the +-1 GB (31-bit
signed) R_ARM_PREL31 range, causing:

  (.ARM.exidx.ramfunc+0x0): relocation truncated to fit:
  R_ARM_PREL31 against '.ramfunc'

Add linker.ld, a wrapper that discards the problematic entries in an
early SECTIONS block before including the standard ARM template.
This must precede the template's *(.ARM.exidx*) wildcard; using
zephyr_linker_sources(SECTIONS ...) places snippets after that
wildcard and has no effect.

Fixes #118983

Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
2026-10-15 14:16:00 +02:00
Camille BAUD
0ac4a9952e soc: bflb: Fix sf_offset
The result was put in the wrong register.

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-10-15 00:48:09 +02:00
Tobias Frauenschläger
727d0abe86 soc: nxp: rw: enable ENET reference clock before PHY reset
The RMII PHY takes its 50 MHz reference clock from the RW6xx ENET
clock output and must be reset while that clock is running. The ENET
clock gate was only opened by the ENET module device, which
initializes after the PHY device, so the PHY driver reset the PHY
without a clock and it stayed unresponsive.

Open the TDDR ENET clock gate in clock_init() together with the
existing ENET setup, as the MCUXpresso SDK does in
BOARD_InitModuleClock().

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2026-10-14 21:31:34 +02:00
Bas van Loon
8422c6110c drivers: spi: lpspi: Adhere to maximum allowable SCK frequency.
The current implementation does not follow the LPSPI SCK frequency
restriction. Update the driver to cap the max. frequency which is
allowed for the LPSPI peripheral.

Signed-off-by: Bas van Loon <bas@arch-embedded.com>
2026-10-14 13:44:30 +02:00
Arkadiusz Grzelka
b9336f9d82 soc: microchip: pic32cm_sg_gc: Allow SEGGER RTT
USE_SEGGER_RTT depends on HAS_SEGGER_RTT, which each SoC family selects
for itself. PIC32CM SG/GC does not, so CONFIG_USE_SEGGER_RTT=y is
downgraded to n and everything depending on it - SHELL_BACKEND_RTT,
LOG_BACKEND_RTT, RTT_CONSOLE - goes with it. The build succeeds and the
firmware simply has no RTT, which is hard to read from the host: J-Link
binds its RTT telnet port and greets a client whether or not the target
has a control block, so the session looks alive and stays mute.

Nothing about the omission is technical. RTT is a control block in RAM
read out over SWD and needs no SoC feature this family lacks. The
sibling SOC_FAMILY_MICROCHIP_PIC32CX_SG already carries the same line.

With the select in place RTT works on first use on a PIC32CM5112GC: the
control block is found in SRAM and a shell instance on channel 0 answers
over the J-Link while the SERCOM console stays free.

Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
2026-10-13 14:01:47 -05:00
Sebastian Bøe
99611e4a74 soc: nordic: uicr: Fixed bug in flashing order
Fixed bug in flashing order.

See comment for details.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2026-10-13 17:08:56 +02:00
Sylvio Alves
6b1b13a05e soc: espressif: set up the boot tls before the first c call
The RISC-V Espressif SoCs enter from their own start code, not
the arch reset path, so tp keeps its reset value of zero until
the first context switch. TLS accesses before that go through a
zero tp: with STACK_CANARIES_TLS the canary store in z_cstart()
faults on the esp32c5, esp32c61 and esp32p4, where address zero
is protected, and silently writes near address zero elsewhere.

Reserve a zeroed boot TLS area on the stack and point tp at it
before the first C call, and load the TLS initializers once the
flash rodata is mapped.

Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-10-13 17:06:15 +02:00
Pisit Sawangvonganan
5031f957cd soc: nuvoton: fix typo in npcx pinctrl offset field
Rename the misspelled `offest` bit-field in `pinctrl_soc.h` together with
its user in the NPCX pinctrl driver, and fix the other spelling errors in
the same files. Both files change in one commit so the tree builds at
every commit.

Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-10-13 09:37:15 +02:00
Pisit Sawangvonganan
4da1a2a84b soc: {nuvoton, ambiq, amd, aspeed, atmel, espressif, infineon}: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `soc/nuvoton`
- `soc/ambiq`
- `soc/amd`
- `soc/aspeed`
- `soc/atmel`
- `soc/espressif`
- `soc/infineon`

Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-10-13 09:37:15 +02:00
Benjamin Cabé
e35b686be5 soc: atmel: sam0: fix the SAMD5x DPLL ratio above 134 MHz
The DPLL ratio, (f_cpu << 5) / 32768, was computed in 32 bits and
overflows above 134217727 Hz: a 200 MHz clock-frequency gave 65.8 MHz.
Compute it in 64 bits.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-11 18:55:48 +02:00
Robert Robinson
ece2cb2674 soc: nordic: nrf71: init must precede sys_clock_driver_init
As currently configured, nordicsemi_nrf71_init was called after
LFXO clock had started. However some LFXO configuration is done in
nordicsemi_nrf71_init, for which the clock must be off.

Signed-off-by: Robert Robinson <robert.robinson@nordicsemi.no>
2026-10-09 16:59:12 +02:00
Robert Robinson
c36b99c172 soc: nordic: common: poweroff: Access non-secure regulators for nRF7120
nRF7120 makes oscillators and regulator registers non-secure by default
to allow Wi-Fi domain to configure PLL. Therefore other calls to
NRF_REGULATORS must be made from the non-secure side.

Signed-off-by: Robert Robinson <robert.robinson@nordicsemi.no>
2026-10-09 16:59:12 +02:00
Mark Tamas
f31e0c7ec2 kconfig: derive ROM_START_OFFSET default from NUM_IRQS
With MCUboot the 0x200 default fits the image header, but the vector
table at the start of the image must also satisfy the Cortex-M VTOR
alignment of 1 << LOG2CEIL(4 * (16 + NUM_IRQS)), which exceeds 0x200
above 112 interrupts. Many targets carried identical overrides for
this, and targets without one did not work with MCUboot.

Derive the default from NUM_IRQS instead (0x400/0x800/0x1000 tiers,
Cortex-M only). TF-M targets are unaffected: TF-M's own Kconfig fixes
the value for BL2 builds, and SoC-level overrides such as STM32's are
evaluated before this chain. Drop the overrides that
now reproduce the derived value, including the i.MX RT family and
RT700 defaults, whose low-interrupt members move from 0x400 to 0x200;
others with different semantics (i.MX RT boot headers, Espressif,
OpenTitan, ...) are left untouched.

Fixes #91160

Signed-off-by: Mark Tamas <marktamas28@gmail.com>
2026-10-09 16:54:50 +02:00
Tim Lin
ecbec3e4d6 drivers/interrupt_controller: it8xxx2: Fix interrupt IRQ bounds check
CONFIG_NUM_IRQS specifies the number of supported IRQs, so the valid
IRQ range ends at CONFIG_NUM_IRQS - 1.

Reject IRQ numbers greater than or equal to CONFIG_NUM_IRQS in IT8XXX2
interrupt controller implementations to prevent out-of-bounds register
access.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2026-10-09 08:34:34 +02:00
Axel Le Bourhis
6d86020305 soc: nxp: mcxw7xx: enable BLOB flash block cache
The MCXW7x internal flash is ECC-protected with a 16-byte phrase that
may only be programmed once per erase, so a BLE Mesh DFU with an
unaligned chunk size faults without the block cache. Default it on and
set the write block size to 16 when BLOB IO flash is in the build.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2026-10-08 15:07:35 +02:00
André Costa
85c1870c8e manifest: Update LVGL to 9.6.0
Update LVGL to 9.6.0

The LVGL module now sources a zephyr/Kconfig.defaults before the
LVGL Kconfig.

The Zephyr tree no longer re-declares or references symbols of the
LVGL module Kconfig. Boards, shields and SoCs set Zephyr owned LV_Z_*
options instead, and Kconfig.defaults in the LVGL module turns them
into defaults of the matching LVGL options.

LVGL 9.6 replaces the color depth option with the
LV_COLOR_FORMAT_DEFAULT choice. The LV_Z_COLOR_FORMAT choice provides
its SoC, board and shield default, with a no default option that
keeps the LVGL default. LV_Z_DPI_DEF and LV_Z_DRAW_BUF_ALIGN have no
prompt and default to 0, which also keeps the LVGL default.
LV_ATTRIBUTE_MEM_ALIGN_SIZE has no LVGL counterpart and becomes
LV_Z_ATTRIBUTE_MEM_ALIGN_SIZE. LV_USE_GPU_NXP_PXP is used by hal_nxp
and keeps its name.

The render buffers are sized from the bits per pixel of
LV_COLOR_FORMAT_DEFAULT unless LV_Z_BITS_PER_PIXEL is set,
and the monochrome buffer layout follows CONFIG_LV_COLOR_FORMAT_I1,
so both follow a color format set by the application.

Logging and the system monitor stay with the LVGL module. The glue
logs through its own log module using the log level template, and
samples using the system monitor enable CPU_LOAD themselves.

Co-authored-by: Fabian Blatz <fabianblatz@gmail.com>
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
Signed-off-by: André Costa <andre_miguel_costa@hotmail.com>
2026-10-08 09:07:05 +02:00
Aman Lachhiramka
7aa3eb782e soc: ti: am13: fix macro syntax in mpu_regions
Fix a typo of DT_REG_ADDR to DT_REG_SIZE in am13e
mpu_regions

Signed-off-by: Aman Lachhiramka <a-lachhiramka@ti.com>
2026-10-07 09:36:35 +02:00
Pisit Sawangvonganan
903b0e2ad7 soc: {realtek, silabs, snps, st, ti, xlnx}: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `soc/realtek`
- `soc/silabs`
- `soc/snps`
- `soc/st`
- `soc/ti`
- `soc/xlnx`

Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-10-06 22:39:51 +02:00
Raffael Rostagno
f1e1313359 soc: esp32: pm: Fix pmstats garbled output
Currently, the GPIO hold on the console pins is released only in the
sleep exit hook, so any log or print issued between wake and that
release comes out as garbage. Release the hold right after light sleep
returns, leaving more room in power.c for printing after sleep. This
slightly extends the measured sleep window, but the difference is
negligible for the stats purpose.

Assisted-by: Grok:4.7
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-10-06 07:33:35 +02:00
Nicolas Zuluaga
0d9ef5869e soc: st: stm32u5: fix Stop wake-up clock for MSIS
stm32u5 set_mode_stop() checked STM32_SYSCLK_SRC_MSI but U5 has no MSI,
it sets STM32_SYSCLK_SRC_MSIS instead. Testing the wrong macro caused
every U5 to wake up on HSI regardless of SYSCLK source.

Use the proper STM32_SYSCLK_SRC and LL_RCC symbols for U5, same as U3.

Signed-off-by: Nicolas Zuluaga <nicolas.zuluaga@rbr-global.com>
Signed-off-by: Eden Frosst <eden.frosst@rbr-global.com>
2026-10-06 07:33:04 +02:00
Eden Frosst
c106be60fc soc: st: stm32: include stm32_clock_control.h where needed
STM32U0, U3, U5, and C5 power.c all selected the Stop wake-up clock
with `#if{def} STM32_SYSCLK_SRC_xxx` without including the header
they're defined in (stm32_clock_control.h), so the tests were silently
false, causing the part to wake up on the fallback clock (HSI16, or
HSIDIV3 on C5) even when SYSCLK is MSI, MSIS or HSIS.

Similarly, clock_stm32_ll_common.h guarded its declarations with
STM32_*_ENABLED macros, while also missing the same header.

Include the header so the conditions preprocess correctly.

Signed-off-by: Eden Frosst <eden.frosst@rbr-global.com>
2026-10-06 07:33:04 +02:00
Markus Fuchs
0432a72bea soc: nxp: mcx: include kernel header in power management
MCXA and MCXN include arch_interface.h directly. On Cortex-M, this
can reach kernel/thread.h before k_thread_entry_t is defined. With
CONFIG_THREAD_MONITOR enabled, __thread_entry then fails to compile.
Include kernel.h in both power management sources to establish the
required header order.

Assisted-by: Codex:gpt-6
Signed-off-by: Markus Fuchs <markus.fuchs@sautergroup.com>
2026-10-06 07:29:07 +02:00
Benjamin Cabé
d6186e3466 soc: renesas: ra8p1: enable Helium on the CM85 core
The series selects ARMV8_M_DSP but neither of the MVE symbols, so
cmake/gcc-m-cpu.cmake falls through to -mcpu=cortex-m85+nomve and every
build for this part gets scalar code, with __ARM_FEATURE_MVE undefined.
The RA8M1 is the same Cortex-M85 and selects both, and the two parts'
CMSIS core configuration blocks are identical, so this looks like an
omission in a newer port rather than a difference between the devices.

Select them on the CM85 core rather than on the series: the RA8P1 is dual
core and the CM33 alongside it has no Helium.

With this an H.264 decoder carrying Helium kernels builds with
-mcpu=cortex-m85, shrinks by 1168 bytes, and decodes a phone's video
stream on an EK-RA8P1 with 174 MVE instructions in its objects.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-03 09:44:05 +02:00
Benjamin Cabé
110c76d454 soc: espressif: ppa: reject scaled alpha and modes the HAL aborts on
Scale, rotate and mirror took PPA_ALPHA_SCALE and wrote the bits of the
float ratio as the alpha multiplier, so a ratio of 0.5 gave alpha 0.
Reject it with ESP_ERR_NOT_SUPPORTED, as blend already does.

An alpha mode or rotation angle outside its enumeration reached the HAL,
which aborts on it, from the interrupt when the request was queued.
Reject those with ESP_ERR_INVALID_ARG.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-03 09:43:08 +02:00
Benjamin Cabé
aef1cffdb5 soc: espressif: ppa: keep the block bounds check from wrapping
The block offset and size are summed before being compared with the
picture size, so an offset near UINT32_MAX wraps the sum and passes.
The 14-bit descriptor field then truncates the offset and the 2D-DMA
reaches past the picture.

Compare the offset with the picture size first and the block with what
is left of it, as ESP-IDF does. This covers fill, blend and scale,
rotate and mirror alike.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-03 09:43:08 +02:00
Benjamin Cabé
93990a1703 soc: espressif: ppa: size the scaled block as the engine does
The engine scales by an integer part and a number of sixteenths, but the
output block was sized from the float product. For a scale that is not a
multiple of 1/16 the output descriptor then expected more pixels than
the engine writes, 266 columns instead of 250 for 800 scaled by 0.333,
and a block that fits once rounded down was rejected.

Size the block from the programmed factors, as ESP-IDF does, and reject
a scale below 1/16, which the engine would take as zero.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-03 09:43:08 +02:00
Benjamin Cabé
9f24941820 soc: espressif: ppa: take YUV input pictures to scale and rotate
The scale, rotate and mirror engine converts YUV 4:2:0 and 4:2:2 input
to RGB itself, but the driver only knew the pixel size of the RGB,
alpha and grey formats and left the engine's YUV range and conversion
standard at their reset values, so a YUV request was rejected.

Give the 2D-DMA the 1.5 and 2 bytes per pixel of those formats, program
the range and the standard from the input picture, and reject odd
geometry the chroma subsampling cannot describe, as ESP-IDF does. A range
or standard the engine has no setting for is rejected too, as the HAL
aborts on it. YUV 4:4:4 still needs the 2D-DMA to convert it first and
is not taken.

Tested on an ESP32-P4 v3.2 converting 800x480 YUV 4:2:0 to RGB565 with
a quarter turn: 64 sampled pixels per picture agree with a software
BT.601 conversion within one step of each channel.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-03 09:43:08 +02:00
Benjamin Cabé
ed36eff996 soc: nxp: mcxn: select HAS_MCUX_ELS_PKC on CPU0 and MCXN236 only
hal_nxp builds the ELS PKC library for cm33_core0 and exports the core0
CPU macro to the application, so on the MCXN947 and MCXN547 CPU1
targets any build with MBEDTLS_PSA_CRYPTO_C gets the core0 device
header and fails the CMSIS MPU, FPU and DSP checks. Select the library
only on the cores it supports.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-03 09:41:02 +02:00
Benjamin Cabé
a7f2f3bf92 soc: espressif: let applications place code in IRAM
An application could only run code from IRAM on an Espressif SoC by
marking it with a section attribute, which it cannot do for a library
it did not write. The RAMFUNC_SECTION linker snippets that serve this
elsewhere are placed by arch/common/ramfunc.ld, which these SoCs do not
use, so zephyr_linker_sources(RAMFUNC_SECTION ...) was silently ignored
on them.

Include the snippets in .iram0.text, where IRAM_ATTR code goes, so the
input sections they name run from IRAM.

On an ESP32-P4 this places 38 KB of an H.264 decoder library in IRAM,
where fetching it through the flash cache cost a quarter of the
decoding time with both cores running. The other SoCs were not built.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-02 22:11:04 -05:00
Mathieu Choplain
966350a8db soc: st: stm32: u5: wait for VCORE regulator source switch
On STM32U5, transition from LDO to SMPS or vice-versa as VCORE regulator
supply source can take some time (~20 µs). Make sure to wait until the
transition is complete before letting the boot process continue.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-10-02 22:07:22 -05:00
Mathieu Choplain
6ae1f1cad3 soc: st: stm32: wba: wait for VCORE regulator source switch
Transition from LDO to SMPS or vice-versa as VCORE regulator supply
source can take some time (~20 µs) on STM32WBA. Make sure to wait
until the transition is complete before letting the boot process
continue.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-10-02 22:06:55 -05:00