Commit graph

24491 commits

Author SHA1 Message Date
Piyush Patle
579684974a espressif/ws2812: include esp_rmt.h in ws2812 headers
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
Eren Terzioglu
5c9f5f1323 arch/risc-v/espressif: Fix wrong C3 naming
Fix wrong C3 naming in Kconfig

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-03-27 19:32:10 +08:00
Jiri Vlasak
7f5e0285a8 kinetis/pinmux: Do not redefine PIN_UART2_RTS
When a developer working on BSP wants UART1 with RTS, the following
needs to be added in the BSP's include/board.h file:

	#define PIN_UART1_RTS PIN_UART1_RTS_1

which says that PIN_UART1_RTS_1 -- the first alternative pin with UART1
RTS function -- should be used for the UART1's RTS.

There are no alternative pins for PIN_UART2_RTS, therefore a similar
definition is not used for PIN_UART2_RTS.

However, that is a complication when we want PIN_UART2_RTS to be defined
as GPIO, for example:

	#define PIN_UART2_RTS (GPIO_OUTPUT | PIN_PORTB | PIN2)

In such a case, PIN_UART2_RTS is later redefined to the only alternative
function from hardware/kinetis_???pinmux.h file.

This patch avoids the redefinition of already defined names.

We considered renaming PIN_UART2_RTS to PIN_UART2_RTS_1 in the
hardware/kinetis_???pinmux.h file, but that is breaking change. We try
to avoid breaking change.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-03-27 09:37:06 +08:00
Jiri Vlasak
b2349aee5c kinetis/serial: Do not fake TX interrupt
Because it is not needed anymore.

The original code here is from the initial implementation in the commit
66b873ef77.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-03-27 09:37:06 +08:00
Jiri Vlasak
444073e370 kinetis/serial: Do not xmit when no chars to xmit
When there are no data in the TX buffer, we can avoid call to the
uart_xmitchars.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-03-27 09:37:06 +08:00
Jiri Vlasak
fd3e524c0f kinetis/serial: Enable RTS as GPIO for RS485CONTROL
When using CONFIG_UART?_RS485CONTROL, RTS pin is set high when sending
data and low otherwise. PIN_UART?_RTS is defined in the board.h file as
the appropriate ALT functionality of the chip's port.

However, it may happen that PIN_UART?_RTS is wired to another pin of the
chip that does not support the RTS as ALT functionality of the UART?  in
question. This commit addresses such a situation.

When UART?_RS485CONTROL_RTSISGPIO is set in menuconfig for the given
UART?, it is expected that the PIN_UART?_RTS is defined as GPIO_OUTPUT,
and the PIN_UART?_RTS is set high when sending data and low otherwise.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-03-27 09:37:06 +08:00
Filipe Cavalcanti
365756e3d1 arch/risc-v/espressif: select EFUSE when ESPRESSIF_EFUSE is enabled
Add 'select EFUSE' entry to enable NuttX EFUSE support.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-03-26 13:39:53 -04:00
simbit18
0a76e9fe8a arch\xtensa: Fix Kconfig style
- Remove spaces from Kconfig

- Add TABs

- Add comments

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-26 13:39:41 -04:00
Peter Barada
870c96350f arch/arm/stm32*: Cleanup stm32 irq reporting
Rename STM32_IRQ_NEXTINT to STM32_IRQ_NEXTINTS across all stm32
variants.
In stm32_dumpnvic() dynamically print NVIC enable and priority
registers based on STM32_IRQ_NEXTINTS.
Use PRIx32 format specifier instead of 'x' (since uint32_t on arm is
actually a long unsigned int).
Simplify if/else chain in stm32_irqinfo() to determine irq reg/bit.
There's no stm32_irqinfo.c; remove mention in stm32f0l0g0/Make.defs.

Signed-off-by Peter Barada <peter.barada@gmail.com>
2026-03-26 23:00:56 +08:00
SPRESENSE
2a4c5c8bee arch: cxd56xx: Fix nxstyle
Fix error: Case statement should be on a new line.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2026-03-26 13:24:40 +08:00
SPRESENSE
48e9de51f9 arch: cxd56xx: Fix DMA transfer for large memory size
When using a dummy memory address in DMA LLI transfers,
do not update the memory address.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2026-03-26 13:24:40 +08:00
simbit18
fa4ecef410 risc-v/src/fe310: CMake build implemented for SiFive FE310
- added  SiFive FE310

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-25 19:20:58 -04:00
simbit18
b38095beac risc-v/src/hpm6750: CMake build implemented for HPMicro HPM6750
- added  HPMicro HPM6750

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-25 14:43:54 -03:00
kywwilson11
c717873ae3 stm32h5/adc: fix TROVS bit and watchdog threshold register writes
Fix adc_oversample() where priv->trovs (a bool, 0 or 1) was OR'd
directly into setbits instead of using ADC_CFGR2_TROVS (bit 9).
This caused triggered oversampling to never actually be enabled.

Fix ANIOC_WDOG_UPPER and ANIOC_WDOG_LOWER ioctls where the TR1
register was overwritten with only the new threshold value, zeroing
out the opposite threshold and the AWDFILT digital filter bits.
Use read-modify-write to preserve the other fields.

Signed-off-by: kywwilson11 <kwilson@2g-eng.com>
2026-03-25 18:12:26 +08:00
simbit18
073c0d794d arch/arm64/src/rk3399: CMake build implemented for Rockchip RK3399
- added Rockchip RK3399

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-24 13:40:45 -04:00
simbit18
7048298f4f arch/arm64/src/a64: CMake build implemented for Allwinner A64
- added Allwinner A64

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-24 22:03:53 +08:00
simbit18
56a84607ca arch/arm64/src/imx8: CMake build implemented for NXP i.MX 8
- added NXP i.MX 8

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-24 22:03:33 +08:00
buxiasen
9e048af2c3 imx9: usdhc fix dmapreflight rejecting small unaligned buffers
imx9_dmapreflight() rejected unaligned buffers unconditionally, but
dmarecvsetup() has a bounce path via priv->rxbuffer for small
transfers. Add a buflen > sizeof(priv->rxbuffer) check so that
small reads (e.g. ext_csd 512-byte stack buffer) can use the
bounce buffer instead of failing with -EFAULT.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-03-24 15:39:07 +08:00
buxiasen
0b75df277d imx95-a55-evk: add USDHC eMMC driver support
Port USDHC1 (eMMC) driver to the i.MX95 FRDM EVK board:
- Create imx95_pinmux.h with SD1/USDHC1 pin definitions
- Add USDHC1 pin macros to board.h
- Create board-level imx9_usdhc.c glue code
- Update imx9_bringup.c with DMA allocator and USDHC init
- Add SCMI clock guards in imx9_usdhc.c (imx95 clock roots
  are owned by System Manager, direct CCM writes are no-ops)
- Fix CCM_CR_USDHC2 copy-paste bug to CCM_CR_USDHC1

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-03-24 15:39:07 +08:00
buxiasen
695774a940 imx9: add GPIO support for imx95
Add imx95 GPIO register definitions (same IP block as imx93), fill
g_gpio_base[] array for imx95, include imx95_gpio.h from the common
header, and compile imx9_gpio.c/imx9_gpiobase.c for imx95 in cmake.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-03-24 15:39:07 +08:00
buxiasen
25feecbc02 imx9: imx95 fix uSDHC IRQ naming to match NuttX USDHC convention
Rename IMX9_IRQ_uSDHC{1,2,3} to IMX9_IRQ_USDHC{1,2,3} in both arm
and arm64 imx95_irq.h to follow the all-caps naming convention used
by imx93_irq.h and the rest of the NuttX codebase. Remove the now
unnecessary USDHC IRQ alias block from arm64 imx95_irq.h.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-03-24 15:39:07 +08:00
buxiasen
7a3b7922ee cmake: arm64/common sync modifyreg sources with Make.defs
arm64_modifyreg8.c, arm64_modifyreg16.c, arm64_modifyreg32.c were
present in Make.defs but missing from CMakeLists.txt, causing link
errors when building with cmake.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-03-24 15:39:07 +08:00
Huang Qi
e09048cc88 style: Fix "is is" typo across the codebase.
Correct duplicate "is is" word found in 181 files throughout the
codebase.
In most cases "is is" was changed to "is", but in contexts like
"MCU is is sleep mode" it was corrected to "MCU in sleep mode".

Also fixes a "the the" typo in net/inet/inet_sockif.c.

This is a pure style/documentation fix that improves code readability.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2026-03-24 09:39:26 +08:00
simbit18
1bbe9276df arch\x86_64: Fix Make style
- Remove spaces from make file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-23 18:16:46 -04:00
simbit18
fbd63b5d2b arch\mips: Fix Make style
- Remove spaces from make file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-23 18:16:46 -04:00
simbit18
f6ac99d586 arch\ceva: Fix Make style
- Remove spaces from make file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-23 18:16:46 -04:00
simbit18
572913d422 arch\risc-v: Fix Make style
- Remove spaces from make file

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-03-23 18:16:46 -04:00