Commit Graph

24517 Commits

Author SHA1 Message Date
Tiago Medicci Serrano 36f07f5c44 arch/xtensa/esp32: Fix ROM strdup heap issue in USER_HEAP mode
When ESP32's flat build mode is selected with the external PSRAM
on USER_HEAP mode, the ROM strdup internally calls malloc which may
be mapped to a different heap than lib_free, causing cross-heap
allocation issues and system crashes.

This commit adds a new Kconfig option ESP32_DONT_USE_ROM_LIBC to
allow using NuttX libc instead of ROM newlib functions. When
USER_HEAP mode is selected, this option is automatically enabled.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-04-14 09:21:17 +02:00
461911662 877ddd06a8 arch/xtensa/esp32s3: Fix ROM strdup heap issue in USER_HEAP mode
In ESP32-S3 flat build with USER_HEAP mode, ROM strdup internally calls
malloc which may be mapped to a different heap than lib_free, causing
cross-heap allocation issues and system crashes.

This commit adds a new Kconfig option ESP32S3_DONT_USE_ROM_LIBC to
allow using NuttX libc instead of ROM newlib functions. When USER_HEAP
mode is selected, this option is automatically enabled.

Fixes: 60ca804b56 ("esp32s3: Fix bug related to the PSRAM-allocated task stack")

Signed-off-by: 461911662 <461911662@qq.com>
Reviewed-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
Reviewed-by: Almir Okato <almir.okato@espressif.com>
Reviewed-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-14 09:21:17 +02:00
Peter van der Perk 143938777a arch/arm/imx9: eDMA5 don't enable all interrupts
Fixes irq_unexpected_isr when receiving interrupts not used
by the M7 core

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-04-14 04:05:52 +02:00
raiden00pl 1513b3e20c arch/nrf52|nrf53: add qencoder support
add qencoder support for nrf52 and nrf53

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-12 19:41:52 -04:00
raiden00pl 5bacc302eb arch/stm32f0l0g0: add qencoder support
add QENCODER support for STM32F0/L0/G0/C0

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-12 19:41:29 -04:00
raiden00pl afda7316e5 arch/stm32f0l0g0/tim: TIM2 is 32-bit on F0/G0/C0
fix TIM2 width - it is 32-bit on F0/G0/C0 but 16-bit on C0

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-12 19:41:29 -04:00
raiden00pl 6928384019 arch/stm32{f7|h7|l4|l5|u5}: remove references to CONFIG_STM32_TIMx_QECLKOUT
Remove useless references to CONFIG_STM32_TIMx_QECLKOUT

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-04-12 10:52:36 -04:00
Filipe Cavalcanti 8fb8c2dca5 arch/xtensa: register Wi-Fi IRQs in non_iram mask for SPI flash
Wi-Fi used a locally allocated vector_desc, so those CPU interrupt lines
were never recorded in the HAL non_iram_int_mask.
During SPI flash, esp_intr_noniram_disable() therefore did not mask them,
and Wi-Fi ISRs could still run with the cache off.
Now, Wi-Fi IRQs are treated as non-IRAM and get masked while flash/cache is suspended.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-04-11 13:40:44 +08:00
Filipe Cavalcanti e8bcbbc5d3 arch/risc-v: register Wi-Fi IRQs in non_iram mask for SPI flash
Wi-Fi used a locally allocated vector_desc, so those CPU interrupt lines
were never recorded in the HAL non_iram_int_mask.
During SPI flash, esp_intr_noniram_disable() therefore did not mask them,
and Wi-Fi ISRs could still run with the cache off.
Now, Wi-Fi IRQs are treated as non-IRAM and get masked while flash/cache is suspended.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-04-11 13:40:44 +08:00
wangjianyu3 0885b45256 xtensa/esp32s3: refactor cam driver to use cam_ll HAL layer
Replace direct putreg32/getreg32 register accesses in esp32s3_cam.c
with cam_ll_* inline functions from Espressif's esp_hal_cam component.
This reduces maintenance burden by using the vendor-provided HAL
abstraction instead of raw register manipulation.

Changes:
- Add lcd_cam_dev_t *hw pointer to driver struct
- Use cam_ll_start/stop/reset/fifo_reset for CAM control
- Use cam_ll_get_interrupt_status/clear_interrupt_status for ISR
- Use cam_ll_set_recv_data_bytelen for DMA buffer length
- Use cam_ll_select_clk_src/set_group_clock_coeff for clock config
- Use cam_ll_enable_vsync_filter/set_vsync_filter_thres
- Use cam_ll_enable_vsync_generate_eof/enable_rgb_yuv_convert
- Use struct access for interrupt enable (cam_ll_enable_interrupt
  requires __DECLARE_RCC_ATOMIC_ENV not available in NuttX)
- Add esp_hal_cam include paths to hal.mk

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-11 13:36:53 +08:00
Tiago Medicci Serrano 745f7542d9 arch/risc-v: Enable low power mode for ESP32-P4
This commit introduces the necessary changes to enable low power
mode for ESP32-P4. Please check the corresponding documentation.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-04-10 14:33:52 -03:00
Tiago Medicci Serrano 213a651509 arch/risc-v/esp32[-c3|-c6|-h2]: Add auto sleep
Add auto sleep for risc-v based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-10 20:34:46 +08:00
Vlad Pruteanu ad168fdf2d arch/xtensa/esp32: Add support for hardware accelerated PBKDF2
This adds support for the PBKDF2 algorithm in the ESP32 crypto
driver. Here, it will take advantage of the hardware-accelerated
implementation of SHA.

Signed-off-by: Vlad Pruteanu <pruteanuvlad1611@yahoo.com>
2026-04-10 20:32:46 +08:00
simbit18 4f1a3356f9 arch/risc-v/src/common/espressif: Aligned Cmake with Make
Add:
- replace rmtchar with arch-specific lirc adapter apache#18654

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-04-10 08:34:41 -03:00
karaketir16 d09bfc021d rp23xx: add hardware SHA-256 cryptodev support
Add an RP23xx hardware crypto driver for /dev/crypto with SHA-256
support backed by the RP2350 SHA accelerator.

Wire the new driver into the RP23xx ARM build and register
CRYPTO_SHA2_256 through cryptodev.

Also fix the RP23xx SHA256 CSR BSWAP bit definition in both the ARM and
RISC-V RP23xx headers. The previous value used bit 18, but the RP2350
hardware uses bit 12. Without this fix, the accelerator hashed input
words with the wrong byte order and produced incorrect digests.

Signed-off-by: karaketir16 <osmankaraketir@gmail.com>
2026-04-10 17:02:57 +08:00
wangjianyu3 7c451141f5 xtensa/esp32s3: cam driver support MMAP buffer allocation
Implement imgdata_ops alloc/free callbacks so the V4L2 framework
can use MMAP mode to allocate frame buffers with proper GDMA
alignment.  This lets applications avoid hardcoding platform-
specific alignment values.

- Add esp32s3_cam_alloc() using kmm_memalign with the alignment
  derived from the GDMA external memory block size setting.
- Add esp32s3_cam_free() wrapper around kmm_free.
- Introduce ESP32S3_CAM_EXT_MEMBLK / ESP32S3_CAM_DMA_ALIGN macros
  so the block size enum and byte alignment are defined in one
  place and stay in sync automatically.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-10 10:47:07 +02:00
wangjianyu3 929acd26e0 xtensa/esp32s3: fix esp32s3_cam uninit/stop_capture bugs
Fix several issues in the ESP32-S3 CAM driver:

- stop_capture: reset DMA channel, CAM module and AFIFO under
  spinlock to fully quiesce hardware before returning. Clear
  pending VSYNC interrupt to prevent stale ISR firing.

- uninit: reset CAM/AFIFO before releasing DMA to prevent
  in-flight transfers after channel detach. Use esp_teardown_irq
  with correct peripheral ID (ESP32S3_PERIPH_LCD_CAM) instead of
  irq_detach which corrupts the shared IRQ mapping table. Mask
  interrupts and clear pending flags under spinlock before
  detaching handler.

- uninit: preserve XCLK output so the sensor remains accessible
  via I2C for subsequent re-initialization.

- set_buf/uninit: track driver-allocated vs user-provided frame
  buffers with fb_allocated flag to prevent double-free when
  using V4L2 USERPTR mode.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-10 10:47:07 +02:00
Peter Barada 60ae1681a2 arm/imx6: Fix IMX_IRQ definitions
arch/arm/include/imx6/irq.h looks to originally be for i.MX6 Quad
and includes multiple (re)definitions of IRQ names, some of which are
different or don't exist on i.MX6 SoloLite/Solo/Dual/DualLite.
Update irq.h to specify/reserve IRQ names/numbers as defined by the
IM6SDLRM, IMX6DLRM, and IMX6DQRM reference manuals.

Signed-off-by Peter Barada <peter.barada@gmail.com>
2026-04-10 10:28:39 +08:00
Eren Terzioglu 44ffb7521b arch/xtensa/esp32: Fix IRAM heap boot issue
Fix IRAM heap boot issue for esp32

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-09 20:14:44 +08:00
Pavel Pisa b6cb94a06d arch/arm/stm32h7: fix stm32_mdio private structure use
The struct stm32_mdio_bus_s aka g_stm32_mdio_bus
has not been referenced at all, because  mdio_register()
allocates its own structure. Then lower half drivers
receive only their respective part in mdio_read()
and mdio_write() because MDIO_WRITE/MDIO_READ provides
only d->lower to the specific lower level drivers.

Signed-off-by: Pavel Pisa <pisa@fel.cvut.cz>
2026-04-09 13:21:50 +02:00
aviralgarg05 54ee939f82 arch/espressif: serialize Wi-Fi RX queue access.
Protect the common Espressif Wi-Fi netdev RX queue with a spinlock. The Wi-Fi RX callback enqueues packets while the netdev upper-half RX thread dequeues them, and the IOB queue helpers are not internally serialized.

Under sustained receive traffic that race can corrupt the queue state, strand IOBs, and degrade throughput over time as reported in issue #16915.

Initialize the lock during device setup and use it when clearing the queue on ifup, enqueueing received packets, and dequeuing them for the upper half.

Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-04-08 15:04:31 -03:00
Jiri Vlasak 92b8bc14b8 kinetis/dac: Implement basics DAC
Minimum working implementation for Kinetis' DAC.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-04-08 14:06:52 +02:00
Tiago Medicci Serrano 98875f005d arch/risc-v: migrate hr timer backend to HAL esp_timer adapter
Align RISC-V timer integration with Xtensa by replacing the
legacy systimer-thread backend with esp_timer adapter layers.

Rename local GPTIMER files to avoid header ambiguity, and
update board/build integration plus sdkconfig timer task
options for HAL compatibility.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-04-08 09:52:39 +08:00
buxiasen 93a2c4d2eb arch/arm/arm_dispatch_syscall: fix callee-saved reg corruption in protected
Build Documentation / build-html (push) Has been cancelled
arm_dispatch_syscall in armv7-m clobbered r11 with 'mov r11, sp' and the
user-space callee-saved register value leaked back through the exception
frame when SYS_syscall_return restored the context, resulting in corrupted
parameters on subsequent syscalls and system hangs in protected builds.

In armv6-m, r4 was used to load g_stublookup (Thumb-1 cannot use ip for
indexed addressing) but was not restored before SYS_syscall_return,
causing the same class of register corruption.

Fix with minimal changes:
  - armv7-m: remove 'mov r11, sp' to stop clobbering user r11
  - armv6-m: restore r4 from the stack frame before SYS_syscall_return

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-07 14:51:10 +02:00
Piyush Patle 13d0e64ee6 style: fix checkpatch issues after debug.h move
Build Documentation / build-html (push) Has been cancelled
Fixed copespell errors, for CI sucess!

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03:00
Piyush Patle 0dccc8ba21 include/debug.h: Move to include/nuttx/debug.h
debug.h is a NuttX-specific, non-POSIX header. Placing it in the
top-level include/ directory creates naming conflicts with external
projects that define their own debug.h.
This commit moves the canonical header to include/nuttx/debug.h,
following the NuttX convention for non-POSIX/non-standard headers,
and updates all in-tree references.

A backward-compatibility shim is left at include/debug.h that
emits a deprecation #warning and re-includes <nuttx/debug.h>,
allowing out-of-tree code to continue building while migrating.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03:00
Piyush Patle 579684974a espressif/ws2812: include esp_rmt.h in ws2812 headers
Build Documentation / build-html (push) Has been cancelled
esp_ws2812.h exposes esp_ws2812_setup() with a struct rmt_dev_s * argument
but did not include esp_rmt.h directly.

After guarding the LIRC board registration path with CONFIG_DRIVERS_RC,
non-RC ESP configs no longer pulled in the RMT type indirectly and CI
started failing with an incomplete struct rmt_dev_s declaration.

Include esp_rmt.h in the Xtensa and RISC-V ws2812 headers.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-04 11:18:32 -03:00
Piyush Patle 140f2c1c78 docs/rc: document RC/LIRC drivers and remove empty drivers/rmt files
Add documentation for the RC/LIRC character driver subsystem covering
device registration, the LIRC interface, and usage from user space.

Remove placeholder empty files under drivers/rmt that were left over
from the rmtchar era and are no longer referenced.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-04 11:18:32 -03:00
Piyush Patle 7b590f9c43 espressif/rmt: replace rmtchar with arch-specific lirc adapter
Replace the ESP-specific rmtchar upper-half with arch-local esp_lirc
adapters for Xtensa and RISC-V.

 This moves the RMT upper-half out of drivers/rmt, registers LIRC
 devices from the ESP board bring-up paths, and removes the old common
 rmtchar driver and headers.

 Also update the ESP Kconfig and build wiring to build esp_lirc when
 ESP_RMT and DRIVERS_RC are enabled.

 Fixes discovered during hardware validation:
  - register TX as /dev/lirc1 so RX and TX do not collide
  - parse the RX worker thread argument from the correct argv slot
  - keep RX devices from advertising TX capability

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-04 11:18:32 -03:00
wangjianyu3 c100e9a9e8 esp_i2s: use actual channel count for BCLK calculation
The I2S BCLK frequency is calculated as:
  bclk = sample_rate * total_slot * data_width

Previously, total_slot was always taken from the static config
(esp_i2s0_config / esp_i2s1_config), which is hardcoded to 2.
This is correct for mono and stereo, but wrong for TDM modes
with more than 2 channels (e.g. 4-channel recording with ES7210).

With 4 channels but total_slot=2, the BCLK is only half of what
it should be, causing the actual sample rate to be half of the
requested rate (e.g. requesting 16 kHz actually samples at 8 kHz).

Replace priv->config->total_slot with MAX(priv->channels, 2) in
all three BCLK calculation sites (i2s_check_mclkfrequency and
i2s_set_clock for both master and slave paths). The MIN of 2
preserves the I2S protocol requirement that at least 2 slots
exist even for mono, while correctly scaling for multi-channel
TDM configurations.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-03 13:34:36 +08:00
wangjianyu3 3b1aac55a8 esp_i2s: fix I2S RX DMA path for ESP32-S3
Fix multiple bugs in the I2S RX receive path on ESP32-S3 with GDMA:

- Set streaming=true in i2s_rxdma_start so completed buffers are not
  incorrectly marked AUDIO_APB_FINAL
- Restore up_enable_irq calls for DMA interrupt after esp_dma_load
  resets the channel
- Skip i2s_hal_rx_reset/rx_reset_fifo on ESP32-S3 which clears the
  TDM slot configuration set by i2s_configure
- Accept 1-16 RX channels on ESP32-S3 (was limited to 2)
- Add getreg32 read-back after DMA start to flush CPU write buffer
- Auto-stop RX channel when no pending buffers remain, preventing
  hardware from running without DMA descriptors after stop
- Remove duplicate return OK in i2s_rxdma_start
- Fix i2s_ll_tx_enable_mono_mode to i2s_ll_rx_enable_mono_mode in
  i2s_rxchannels
- Fix tx_slot_cfg.std to rx_slot_cfg.std in RX PCM slot config
- Fix DMA direction, peripheral ID, data_width, rx_start sequencing,
  and rx_eof_num word count in RX path
- Fix esp32s3_board_i2s.c I2S port index

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-03 13:34:36 +08:00
Felipe Moura 11d15bb238 arm/ht32f491x3: rework PWM lower-half like nrf53
Use static lower-half instances per timer and select the channel
through Kconfig and board data instead of passing runtime PWM
routing into the driver.

This keeps the HT32 PWM support aligned with the existing NuttX
pattern and documents the esk32 single-device TMR3 routing.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-04-02 12:11:13 +02:00
Filipe Cavalcanti b5b7e8f72e arch/espressif: add flash encryption support on CMake
Add support for burning flash encryption E-Fuses on target.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-04-02 13:16:54 +08:00
Filipe Cavalcanti e59604bbe6 tools/espressif: add support for target flashing using CMake
Support flashing target using cmake --build <build> -t flash.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-04-02 13:16:54 +08:00
Filipe Cavalcanti ed217f8f3f arch/risc-v: add CMake support for Espressif RISC-V devices
Adds CMake build support. Touches arch and board at the same time to avoid
creating a commit that is not able to build.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-04-02 13:16:54 +08:00
Peter Barada efdbdfe409 arch/arm/stm32*: Use PRIx32 format specifier where appropriate
Replace 'x' printf format specifier with PRIx32 where
corresponding value is uint32_t type.

Signed-off-by Peter Barada <peter.barada@gmail.com>
2026-04-01 13:48:58 +08:00
Eren Terzioglu 7e321e0aba arch/risc-v/espressif: Add LPI2C support for esp32p4
Add LPI2C support for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-01 10:06:46 +08:00
Eren Terzioglu 6480bb231d arch/risc-v/espressif: Add LPUART support for esp32p4
Add LPUART support for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-04-01 10:06:46 +08:00
p-szafonimateusz 8b57a48d8f arch/intel64: add CPU affinity support for irq
add CPU affinity support for interrupts (up_affinity_irq)

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-03-31 21:10:51 +08:00
Eren Terzioglu dedf9045c1 arch/risc-v/espressif: Add lpcore support for esp32p4
Add ULP lpcore support for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-03-31 08:37:24 -03:00
Eren Terzioglu 8c42fda257 arch/risc-v/espressif: Add RTC GPIO support for esp32p4
Add RTC GPIO support for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-03-31 08:37:24 -03:00
likun17 b606180da9 boards/risc-v/esp32p4: add sram_high as second heap region for rev < v3
On ESP32-P4 rev < v3, the 768KB HP L2MEM is split into two
non-contiguous regions: sram_low and sram_high. Previously only
sram_low was used for the heap, wasting 384KB of sram_high.

Export _sram_high_heap_start and _sram_high_heap_end symbols from
the linker script and add sram_high to the heap via kumm_addregion()
in riscv_addregion() when MM_REGIONS > 1.

Signed-off-by: likun17 <likun17@xiaomi.com>
2026-03-30 16:46:29 +02:00
likun17 81602e16a2 boards/risc-v/esp32p4: restore chip revision check with macro guard
The chip revision check was disabled with #if 0 for v1.0 bringup.
Restore the original #ifndef ESP32P4_IGNORE_CHIP_REVISION_CHECK
guard so boards can selectively bypass the PANIC by defining
this macro, while keeping the warning message in the #else branch.

Signed-off-by: likun17 <likun17@xiaomi.com>
2026-03-30 16:46:29 +02:00
likun17 6123cc3cbe nuttx/arch/risc-v/src/common/espressif: add 32MB flash size option
Add ESPRESSIF_FLASH_32M Kconfig option and the corresponding
esptool flash size mapping in Config.mk to support boards with
32MB NOR flash.

Signed-off-by: likun17 <likun17@xiaomi.com>
2026-03-30 16:46:29 +02:00
Felipe Moura bd6a466317 ht32f491x3/esk32: add docs and flash helpers
Document the HT32F491x3 ESK32 board, build steps,
flashing flow, and validation commands. Add WSL and
PowerShell flash backends plus a Python wrapper.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-03-30 09:48:16 +08:00
Felipe Moura ba6ee9d559 arch/arm/ht32f491x3: add initial support
Add initial HT32F491x3 support with startup, IRQ handling,
serial console, GPIO helpers, custom vectors, and CMake build files.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-03-30 09:48:16 +08:00
trns1997 219a5ce09e build/cmake/stdlib: guard include/cxx by LIBMINIABI, fix div_t conflict
include/cxx contains NuttX's mini C++ ABI shims and must only be added
to the include path when CONFIG_LIBMINIABI is selected.  tools/Config.mk
was adding it unconditionally for every non-LIBCXX/non-UCLIBCXX build,
and the platform.cmake files for arm, arm64, risc-v, x86_64 and tricore
were adding it inside the CONFIG_LIBCXXTOOLCHAIN block.

With an unpatched downloaded ARM GNU Toolchain, <cstdlib> uses
newlib's stdlib.h, defining div_t as an anonymous struct.  A later
inclusion of NuttX's stdlib.h via <cstdio>->stdio.h->kmalloc.h then
redefines div_t with struct tag div_s, causing a conflicting declaration
error.

Guard the div_t/ldiv_t/lldiv_t definitions in stdlib.h with
redefinitions when a toolchain stdlib.h was already processed.

Also fix lldiv_s members typed as long instead of long long.

Signed-off-by: trns1997 <trns1997@gmail.com>
2026-03-29 16:45:29 -03:00
wangjianyu3 f92b3d8d79 arch/xtensa/esp32s3: fix CAM DMA race and heap-allocate descriptors
- Remove debug polling loop from esp32s3_cam_start_capture() that
  busy-waited on DMA status register.

- Fix DMA ISR race: stop DMA before invoking capture callback to
  prevent ISR re-triggering while callback processes the buffer.
  Check priv->capturing before restarting DMA in ISR.

- Move DMA descriptors from struct to heap allocation, avoiding
  stack/BSS alignment issues with cache-line-aligned descriptors.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-03-29 12:35:22 -03:00
Shunchao Hu fc6fd3f24d arch/risc-v/qemu-rv: Configure PMP before booting secondary harts.
Export qemu_rv_configure_mpu() and invoke it on the secondary-hart
boot path before riscv_cpu_boot().

This keeps protected SMP builds from faulting on !CPU0 when userspace
work is first scheduled there.

Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
2026-03-28 16:00:58 -03:00
Tiago Medicci Serrano c17e16eaed xtensa/espressif: Update common-source integration for Xtensa devices
This commit updates the common-source integration for Xtensa-based
Espressif devices (ESP32, ESP32-S2, and ESP32-S3). This is part of a larger
common-source update split by architecture for better maintainability.

Major components updated:
- IRQ allocator refactoring with intr_alloc integration
- Common-source drivers (GPIO, RMT, I2C, SPI, UART, etc.)
- Espressif components upgrade to release/master.b-test
- Peripheral drivers (ADC, PWM, LEDC, MCPWM, PCNT, Temperature Sensor, etc.)
- Wireless adapters (Wi-Fi and BLE)
- esp_timer migration to the common-source path for Xtensa devices
- Common-source power management implementation (auto-sleep and wakeup paths)
- Board defconfigs for all Xtensa Espressif boards
- SMP support improvements for ESP32-S3
- Critical section handling improvements

Key architectural changes:
- IRQ Allocator: The new interrupt allocator enables multiple mapping
  options from interrupt sources to CPU interrupts, providing flexibility
  required by modern peripherals. Although this introduces breaking changes
  to the interrupt handling API, the required ARCH_MINIMAL_VECTORTABLE
  Kconfig option is explicitly checked during startup to ensure proper
  configuration. This validation prevents runtime issues from configuration
  mismatches.
- Xtensa-specific interrupt handling via esp_xtensa_intr.c providing
  NuttX-native implementations of xt_ints_on/off and interrupt handlers,
  avoiding conflicts with NuttX's core Xtensa macros.
- Timer/RTC unification: ESP32/ESP32-S2/ESP32-S3 move from chip-specific
  RTC/RT-timer code to common-source Espressif integration, including
  esp_timer_adapter/esp_rtc paths and the required bringup/defconfig updates.
- Power management consolidation: Xtensa PM follows the common-source
  implementation, including common-source auto-sleep behavior, UART/Wi-Fi
  wakeup coordination, and tickless-safe sleep flow compatibility.

Note: This is a large commit to maintain bisectability. Breaking the
changes into smaller commits would result in non-building intermediate
states across the common-source infrastructure update.

Tested configurations:
- All defconfigs were tested, including `ostest`.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-03-29 00:33:11 +08:00