Commit graph

1900 commits

Author SHA1 Message Date
Kevin Zhou
fb5f27e984 xtensa/esp32s3: fix tickless mode timer unexpect interrupt handle
Signed-off-by: Kevin Zhou <kevin.zhou@sony.com>
2025-04-28 22:13:52 +08:00
Filipe Cavalcanti
b8e9bc3313 arch/xtensa: fix build errors related to data types on ESP32|S2|S3
Fix format specifier macros after compiler type changes.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-04-18 09:32:58 +08:00
Filipe Cavalcanti
0715c584b7 arch/xtensa: use compiler's definition of uint32 and int32
Modify types.h and inttypes.h to use the correct _int32_t and _uint32_t types.
Type is now defined according to recent compiler versions.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-04-18 09:32:58 +08:00
Tiago Medicci Serrano
2bbafcacc1 xtensa/esp32s3: Fix getting the flash mappings by openocd-esp32
This adds new fields to the metadata section used by MCUBoot.
The openocd-esp32 project requires these fields to properly map the
flash segments and enable using SW breakpoints and flash through
openocd-esp32.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-04-18 02:25:14 +08:00
Tiago Medicci Serrano
31b6cdac6d xtensa/esp32s2: Fix getting the flash mappings by openocd-esp32
This adds new fields to the metadata section used by MCUBoot.
The openocd-esp32 project requires these fields to properly map the
flash segments and enable using SW breakpoints and flash through
openocd-esp32.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-04-18 02:25:14 +08:00
Tiago Medicci Serrano
7a3e67d59a xtensa/esp32: Fix getting the flash mappings by openocd-esp32
This adds new fields to the metadata section used by MCUBoot.
The openocd-esp32 project requires these fields to properly map the
flash segments and enable using SW breakpoints and flash through
openocd-esp32.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-04-18 02:25:14 +08:00
Filipe Cavalcanti
99099a1a9d arch/xtensa: ADC support on ESP32|S2|S3
Add common ADC source for ESP32|S2|S3.
Remove legacy ADC from ESP32S3.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-04-17 13:56:40 +08:00
anjiahao
28ad852a6c arch/xtensa:add crt0 to initialize environment
we use crt0 inside of start hook in pr https://github.com/apache/nuttx/pull/16154, so xtensa also need add it.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2025-04-16 01:24:57 +08:00
chao an
52482219c8 libc/elf: rename modlib to libelf
Renaming "modlib" to "libelf" is more in line with the implementation content,
which makes it easier for individual developers to understand the capabilities of this module.

CONFIG_LIBC_MODLIB -> CONFIG_LIBC_ELF

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-04-11 09:43:22 +08:00
anjiahao
422c43949a binfmt:use crt0 inside of starthook
test:
1.use mps3-an547 build helloxx as module and run it
2.use qemu-armv7a:knsh test kernel build helloxx and run it

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2025-04-09 23:07:29 +08:00
Tiago Medicci Serrano
05e63e31c4 arch/xtensa/espressif: Fix ESP32-S2 SPI flash frequency selection
This commit fixes the SPI flash frequency selection for ESP32-S2,
enabling the Kconfig macros to be selected when ESP32-S2 SoC is
enabled. Please note that this was recently changed to make it
compatible with already existing SPI flash Kconfig macros for ESP32
and ESP32-S3 and it introduced this regression for ESP32-S2.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-04-09 14:00:08 +08:00
Eren Terzioglu
8a835dd545 arch/xtensa: Remove legacy I2S implementation for esp32[-|-s2|s3]
Remove legacy I2S implementation without breaking defconfigs for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-04-08 22:53:58 +08:00
Eren Terzioglu
97ff8906e4 arch/esp[s2|s3]: Update common layer version
Update common layer version of Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-04-08 22:53:58 +08:00
Eren Terzioglu
873a6319bb arch/esp32[s2|s3]: Add common I2S arch layer support
Add common I2S arch layer support for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-04-08 22:53:58 +08:00
Eren Terzioglu
fd4914b953 arch/xtensa/esp32[s3]: Add more dma functions
Add dma function to use peripheral more efficiently

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-04-08 22:53:58 +08:00
chenxiaoyi
b3567fe964 xtensa/esp32s2: enable sysclk and deassert reset signal for uart1
The uart1 is found be in reset state, and the sysclk is not enabled
for it.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2025-04-08 22:44:59 +08:00
Tiago Medicci Serrano
622355b5c3 arch/xtensa/esp32s3: Fix bug regarding SPI flash operation mode
SPI flash operation modes - Dual Output (dout), Dual I/O (dio),
Quad Output (qout), Quad I/O (qio) and Octal (opi) were not being
properly selected. This commit fixes this behavior and the device
is now able to boot and initialize the proper SPI flash mode.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-04-08 14:44:38 +08:00
Tiago Medicci Serrano
80559890ff espressif: Simplify the selection of the SPI flash frequency
This commit simplifies the selection of the SPI flash frequency for
Espressif SoCs by using a standardized Kconfig-defined macro.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-04-05 11:26:32 +08:00
Tiago Medicci Serrano
1e8250d918 boards/xtensa/esp32s3: Move some .bss sections to the external RAM
This commit moves some internal libraries' .bss sections to the
external PSRAM chip, freeing internal memory for other usages. Note
that it is necessary to update `esp32s3-devkit:python` defconfig
otherwise it would fail to build.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-04-05 11:24:58 +08:00
Laczen JMS
34bb3c88a2 arch/xtensa/src/esp32: remove espnow
remove espnow pktradio from arch/xtensa/src/esp32

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-04-04 06:49:50 +08:00
Laczen JMS
58463d9484 arch/xtensa/src/common/espressif: Introduce espnow
Move espnow:
 arch/xtensa/src/esp32 -> arch/xtensa/src/common/espressif

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-04-04 06:49:50 +08:00
raiden00pl
5d2e0f8c80 arch/esp32s3/esp32s3_wdt_lowerhalf.c: fix printf warning
fix printf warning:

chip/esp32s3_wdt_lowerhalf.c:497:17: error: format '%u' expects argument of
type 'unsigned int', but argument 4 has type 'long unsigned int'

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-04-02 08:29:00 -03:00
raiden00pl
649e979f58 arch/esp32s2/esp32s2_wdt_lowerhalf.c: fix printf warning
fix printf warning:

chip/esp32s2_wdt_lowerhalf.c:493:17: error: format '%u' expects argument of
type 'unsigned int', but argument 4 has type 'long unsigned int'

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-04-02 08:29:00 -03:00
raiden00pl
1a6cb4c784 arch/esp32s3/esp32s3_ble_adapter.c: fix printf warning
fix printf warning:

chip/esp32s3_ble_adapter.c:1065:13: error: format '%u' expects argument of
type 'unsigned int', but argument 3 has type 'long unsigned int'

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-04-02 08:29:00 -03:00
raiden00pl
ea28e08be4 arch/esp32/esp32_ble_adapter.c: fix printf warning
fix printf warning:

  chip/esp32_ble_adapter.c:1137:13: error: format '%u' expects argument of
  type 'unsigned int', but argument 3 has type 'long unsigned int'

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-04-02 08:29:00 -03:00
Laczen JMS
b8964f5c46 arch/xtensa/src/common/espressif: Add wlan config option
Add an option to configure wlan support

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-03-31 11:35:39 -03:00
wangjianyu3
cc23e06ea2 arch/esp32s3: The MISO, MOSI and C/S are optional
The MISO or MOSI pin is optional.
The C/S pin is unnecessary when `ESP32S3_SPI_UDCS` is enabled.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-03-29 10:33:45 +08:00
nuttxs
bfcc283694 arch/esp32_himemcdev: Multiple instances of struct file for the same file
share the f_inode, ensuring that the mapping status is associated with
the file entity rather than a single descriptor.
Avoid redundant mapping operations caused by multiple descriptors
operating on the same file.

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-03-27 02:27:35 +08:00
Tim Kan(SSS)
1c6b603eec feat(arch/xensa): add CONFIG_SPIRAM_MEMTEST from ESP-IDF
The CONFIG item is beneficial for startup performance tuning, so
it would be better to have it in Nuttx as well.

Co-authored-by: FunatsuTaishi <51806905+FunatsuTaishi@users.noreply.github.com>
Co-authored-by: Roy Feng <roy.feng@sony.com>
Signed-off-by: Tim Kan(SSS) <tim.kan@sony.com>
2025-03-27 02:21:16 +08:00
nuttxs
720c6cce6f arch/esp32_partition: read data from SPI Flash at designated
address (with decryption)

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-03-27 02:21:04 +08:00
nuttxs
72f3ac98e2 arch/esp32_partition: add some partition operation interfaces for esp32
Relocate the enum ota_img_ctrl_e and ota_img_bootseq_e
to a directory visible to the application.
Inspect if the MTD partition (factory/ota_0/ota_1) is mapped as text.
Adding an ioctl interface ota_invalidate_bootseq() to the ESP32 partitions,
by deleting the corresponding otadata, makes the boot sequence (ota_0/1) invalid.

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-03-27 02:21:04 +08:00
Gao Feng
5afed2cb00 xtensa/esp32: write encrypt func implementation
based on spec, 16 bytes alignment is checked.
2025-03-27 02:20:14 +08:00
nuttxs
e1ffc1075d arch/esp32_spi: Add check to see if the TX_FIFO is empty
to avoid sending empty data

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-03-27 02:20:02 +08:00
Eren Terzioglu
43f982db1a arch/xtensa/esp32s3: Change default pins for esp32s3-lcd-ev-board v1.5
Change default pins for esp32s3-lcd-ev-board to prevent pin changes between boards

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-03-24 21:28:04 +08:00
Eren Terzioglu
9a5a719835 arch/xtensa/esp32[-|-s2|-s3]: Fix I2C Slave driver write bug
Fix I2C Slave driver write bug when multiple write operation existed for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-03-23 17:48:18 +08:00
Eren Terzioglu
a11baeabc1 arch/xtensa/espressif: Fix I2C Slave driver build error
Add missing files which are causing I2C Slave driver build error for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-03-23 17:48:18 +08:00
Gao Feng
4b8e19b2c7 Revert "arch/xtensa: set PS.EXCM initial value to 1 while new thread created"
This reverts commit 3194ef0e7c.

since level-2 and above interrupt, PS.EXCM is still 1.
window rotation related instruction is undefined behavior.

https://github.com/apache/nuttx/pull/15985#issuecomment-2728509964
2025-03-19 11:47:31 -03:00
Filipe Cavalcanti
238e0c05ac arch/xtensa/esp32s3: add ARCH_CHIP_ESP32S3WROOM1N8R2 option to ESP32S3
Add support for module with 2MB PSRAM and 8MB flash.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-03-19 15:23:04 +01:00
chenwen@espressif.com
b60b54b476 esp32[s2|s3]: Add number of IRQ status lists for PHY initialization configuration
The current default number of IRQ state lists for PHY initialization is 3 (i.e. NR_IRQSTATE_FLAGS).
When calling in a nested manner, the number of times the concurrent behavior enters the critical section exceeds 3, which will trigger an assert crash.
Therefore, the size of NR_IRQSTATE_FLAGS needs to be increased, this PR makes NR_IRQSTATE_FLAGS configurable.
Please refer to the changes of esp-hal-3rdparty: 5d4868f08b

Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2025-03-17 12:22:04 +01:00
Laczen JMS
24221b611f arch/xtensa/esp32:espnow pktradio simplify addressing
Modify addressing to allow only 2 byte node address.
Allow modifying the node address by modifying the ipv6 address
(the ipv6 address has a direct relation with the node address)
Introduce the option to add a 4 byte random number to the mac header
as a preparation for ciphered data exchange.
Introduce a FCB (frame control byte) as a replacement for the INFO
field in the mac header.
Update esp32-devkitc:espnow config to reflect address size change.
Update the documentation to reflect address size changes.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-03-17 09:15:09 +01:00
Laczen JMS
4ffedf4ec8 arch/xtensa/esp32: espnow pktradio improvements
Split handling of receive and transmit in their own work queue.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-03-17 09:15:09 +01:00
Gao Feng
3194ef0e7c arch/xtensa: set PS.EXCM initial value to 1 while new thread created
To avoid level-1 interrupt break retrieve PC/A0/SP/A2 register,
PS.EXCM set to 1 by CPU HW while handling exception/interrupt.

But if context switching happens and new thread created,
the thread initial value of PS.EXCM is used.

Same behevior as ESP-IDF code:
https://github.com/espressif/esp-idf/blob/master/
components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c#L366

Signed-off-by: Gao Feng <Feng.Gao@sony.com>
2025-03-15 11:39:23 +08:00
chenxiaoyi
e0b02314e6 arch/xtensa: initial support for debugpoint api
Implement up_debugpoint_add/up_debugpoint_remove for xtensa.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2025-03-13 09:51:03 +01:00
Eren Terzioglu
4d89d7186e arch/xtensa/esp32[s2|s3]: Add I2C slave support
Add I2C slave support on arch level for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-26 16:32:40 +01:00
Filipe Cavalcanti
b89ad74660 xtensa/esp32: use common Espressif wireless source
Update the wireless symbols from ESP32_* to ESPRESSIF_* for using common layer.
Remove ESP32 specific WiFi files and edit build system to use common layer.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-02-25 12:35:46 +01:00
Eren Terzioglu
713c10717c esp32[s2|s3|c3|c6|h2]: Update common layer
Update common layer to prevent build errors

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-24 10:35:11 -03:00
Eren Terzioglu
5865d2a8ff esp32[s2|s3]: Enhance SPIRAM/PSRAM support
Add esp_spiram_writeback_range function to flush some areas of spiram cache

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-02-24 10:35:11 -03:00
Tiago Medicci Serrano
8956fc440f xtensa/esp32[|s3]: re-enable cache during exception handler
This commit implements re-enabling the cache before the exception
handler for ESP32-S3 and removes unnecessary checks (cache should
always be re-enabled during an exception handler and disabled again
after processed, except for ESP32-S3 that implements no recoverable
exceptions).

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-02-23 07:51:14 -03:00
Tiago Medicci Serrano
97aa90570c xtensa/esp32s3: allow moving .bss data to the external PSRAM
This commit allows placing .bss data into the external PSRAM.
Previously, the PSRAM was fully allocated to the heap memory only
and now part of it can be used to allocate .bss data freeing the
internal memory.
2025-02-19 11:44:18 -03:00
Roy Feng
c9a8f96aac xtensa/esp32: set cpuint to initial value after deallocate
on ESP32, cpuint was allocated when register wdt handler, but not
deallocated when unregister, which cause debug assert when checking
`DEBUGASSERT((*freeints & bitmask) == 0)`, so set cpuint to initial value
after deallocate.

The same issue on ESP32s3 has been fixed by PR#15433
2025-02-18 11:32:07 -03:00