Commit graph

57750 commits

Author SHA1 Message Date
Xiang Xiao
83c2bcb33a Revert "Use small lock to protect resources related to ethernet."
This reverts commit 60125038fc.
2025-02-13 14:15:43 +08:00
Xiang Xiao
259f25b2ce Revert "Fix wrong variable name. lock -> eth_lock"
This reverts commit c8f8a61f89.
2025-02-13 14:15:43 +08:00
Xiang Xiao
45422e2ad9 Revert "No need to call sched_lock explicitly after call spin_lock_irqsave, since it will be called in func spin_lock_irqsave."
This reverts commit 8f3a2a6f76.
2025-02-13 14:15:43 +08:00
Michal Lenc
99c7b64072 mtd/w25q: ensure the correct behavior if erase sector fails
Function w25qxxxjv_erase wasn't correctly handling an error in
w25qxxxjv_erase_sector call and was returning success even on failure.
Moreover this change does not immediately return EBUSY but waits for
the previous operation to finish. If the timeout is significant (more
than erase time of the entire flash), then it returns EBUSY.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-02-13 10:02:06 +08:00
cuiziwei
b57f3bb840 Fix macOS build error.
1. fix https://github.com/apache/nuttx/issues/14774.
Change the defconfig of libcxxtest and select libcxxabi by default to
fix sim:libcxxtest build in macOS CI can't find cxxabi.h.

2. fix https://github.com/apache/nuttx/issues/15491.
libcxxabi cannot be used with uclibc, so when compiling macos sim, libcxxabi cannot be selected by default in Kconfig.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2025-02-12 15:24:02 -03:00
Huang Qi
df65980273 docs: enhance Rust guide with CPU optimization instructions
Summary:
- Added a section to the Rust guide that explains how to use the `RUSTFLAGS` environment variable to specify the target CPU for optimization.
- Provides examples and instructions for setting `RUSTFLAGS` for different CPU models, such as Cortex-M33 and Cortex-M55, to generate performance-optimized code.

Impact:
- Enhances the developer's ability to produce more efficient Rust applications on NuttX by leveraging CPU-specific optimizations.
- No runtime or functional changes; only documentation improvements to guide users in optimizing their build configurations for specific hardware.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-02-12 15:23:28 -03:00
Huang Qi
081588c1c5 docs: update rust guide to include X86 and X86_64 support
Summary:
- Updated the Rust guide documentation to include X86 and X86_64 platforms in the supported platforms list.
- Ensured that the guide provides accurate and up-to-date information for developers using these new platforms.

Impact:
- Expands the platform support section of the Rust guide, making it more inclusive and useful for a wider range of developers.
- No functional changes to the code itself; this update only affects the documentation.
- Enhances the usability of the guide by providing necessary setup and configuration details for the X86 and X86_64 architectures.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-02-12 15:23:28 -03:00
Jacob Dahl
3dcedd507b h7: eth: add checks for PHYID in stm32_phyinit
Fixes bug where stm32_phyinit will succeed even when no PHY is connected. This is because there is no check that a PHY is actually communicating and returning data.

Update include/nuttx/net/mii.h

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
2025-02-12 15:00:19 -03:00
chao an
e5388558a6 qemu/ivshmem: switch proxy/server roles
In this PR we switch proxy/server roles to set proxy as remoteproc master,
This will help us communicate with the linux kernel without making any changes
in the rpproxy_ivshmem configuration.

Build NuttX RTOS:
$ cmake -B proxy -DBOARD_CONFIG=qemu-armv8a:rpproxy_ivshmem -GNinja
$ cmake --build proxy
$ qemu-system-aarch64 -cpu cortex-a53 -nographic -machine virt,virtualization=on,gic-version=3 -kernel proxy/nuttx \
  -device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb \
  -object memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/ivshmem0,size=4194304,share=yes

Bringup Linux Kernel:
$ qemu-system-aarch64 -M virt -cpu cortex-a57 -smp 1 -m 4G -kernel linux/arch/arm64/boot/Image -initrd busybox-1.35.0/initramfs.cpio.gz \
  -nographic -append "init=/init console=ttyAMA0" \
  -device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb -object \
  memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/ivshmem0,size=4194304,share=yes

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd070]
[    0.000000] Linux version 6.14.0-rc1-00035-g998ca87a4914 (archer@archer) (aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #7 SMP PREEMPT Tue Feb 11 12:19:40 CST 2025
[    0.000000] KASLR enabled
[    0.000000] random: crng init done
[    0.000000] Machine model: linux,dummy-virt
...
[    1.001209] remoteproc remoteproc0: ivshmem_rproc is available
[    1.001548] remoteproc remoteproc0: attaching to ivshmem_rproc
[    1.001721] ivshmem_rproc 0000:00:0b.0: dma declare pa=0x80000000d0 dma=0xd0 size=65536
[    1.002164] ivshmem_rproc 0000:00:0b.0: mem entry pa=0x80000100d0 dma=0x100d0, size=4128560
[    1.003605] ivshmem_rproc 0000:00:0b.0: attach entry
[    1.005573] virtio_rpmsg_bus virtio1: rpmsg host is online
[    1.005741] rproc-virtio rproc-virtio.1.auto: registered virtio1 (type 7)
[    1.005873] remoteproc remoteproc0: remote processor ivshmem_rproc is now attached
[    1.012959] virtio_rpmsg_bus virtio1: creating channel rpmsg-syslog addr 0x400
[    1.014240] virtio_rpmsg_bus virtio1: creating channel rpmsg-sensor addr 0x401
[    1.014454] virtio_rpmsg_bus virtio1: creating channel rpmsg-ping addr 0x402
[    1.014644] rpmsg_ping virtio1.rpmsg-ping.-1.1026: rpmsg_ping_probe

below is rpmsg-syslog from NuttX kernel
...
[    1.116680] [    0.000000] [ 0] [  INFO] [proxy] pci_register_rptun_ivshmem_driver: Register ivshmem driver, id=0, cpuname=server, master=0
[    1.116867] [    0.025900] [ 3] [  INFO] [proxy] pci_scan_bus: pci_scan_bus for bus 0
[    1.116987] [    0.026900] [ 3] [  INFO] [proxy] pci_scan_bus: class = 00000600, hdr_type = 00000000
[    1.117121] [    0.027100] [ 3] [  INFO] [proxy] pci_scan_bus: 00:00 [1b36:0008]
[    1.117232] [    0.027500] [ 3] [  INFO] [proxy] pci_setup_device: pbar0 set bad mask
[    1.117349] [    0.027700] [ 3] [  INFO] [proxy] pci_setup_device: pbar1 set bad mask
[    1.117460] [    0.027900] [ 3] [  INFO] [proxy] pci_setup_device: pbar2 set bad mask
[    1.117573] [    0.028100] [ 3] [  INFO] [proxy] pci_setup_device: pbar3 set bad mask
[    1.117692] [    0.028200] [ 3] [  INFO] [proxy] pci_setup_device: pbar4 set bad mask

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-12 15:41:37 +01:00
Matteo Golin
729f8a75f7 drivers/sensors: Added uORB driver for LSM6DSO32 IMU.
Adds support for the LSM6DSO32 IMU by STM using the uORB framework. This
only contains limited support for the I2C interface, interrupt and
polling driven measurement and standard modes of operation (high
performance ODRs). Features like interrupts besides DRDY, filtering,
gesture recognition and acting as a bus master are not implemented.
2025-02-12 10:44:15 -03:00
Ville Juven
597b3e6ca7 mpfs_i2c: Increase TTOA margin to 1ms
Due to interrupt latencies the i2c transfer done interrupt can get
deferred by a few hunder microseconds. This makes the i2c transfer timeout
way too early, even though the i2c IP block is already done.

Fix this by adding a significant amount of margin (1ms) to the timeout
value.
2025-02-12 10:37:03 -03:00
Ville Juven
255d8c57c0 mpfs_i2c: Clean up the logic in i2c_transfer
This removes several error conditions that can be present after a failed
i2c transaction. The most important of them is the priv->sem_isr semaphore
which can be signaled due to a race condition.

This also ensures the i2c device itself is in idle state before futzing
around with it.

Also, add a comment about the SI-flag in the I2C CTRL register; it has
a hidden dual meaning. Not only does it clear a pending interrupt, it
also moves the I2C IP state machine forward. This requires extra logic
in the driver to cope.
2025-02-12 10:37:03 -03:00
zhaohaiyang1
e657b35720 nuttx/can: Modify poll logic to bind can_reader_s and pollfd.
For clearing some variables corresponding with the pollfds of the felip in can_close API, we modify poll logic by binding can_reader_s and pollfd.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2025-02-12 10:28:21 -03:00
Laczen JMS
31270a8479 net: fix ipv6_input for 6lowpan
6lowpan response for tcp and icmp was mssing because of wrong evaluation
of `dev->d_lltype`.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-02-12 10:19:50 -03:00
Ramin Seyed-Moussavi
381d3fe64f arch/arm/max326xx: add max32690 icc updates
Add updates for MAX32690 Instruction Cache Controller to enhance device support in NuttX architecture.
2025-02-11 12:27:10 -03:00
Ramin Seyed-Moussavi
e99c516a91 arch/arm/max326xx: add max32690 memorymappings
Adds memory mappings for the MAX32690 to extend support for this device in the NuttX architecture.
2025-02-11 12:27:10 -03:00
Ramin Seyed-Moussavi
a691ed84d2 arch/arm/max326xx: add max32690 global control bit definitions
Adds definitions for the global control bits of the MAX32690 to improve support for this device in the NuttX architecture.
2025-02-11 12:27:10 -03:00
Ramin Seyed-Moussavi
a4cfd5f9da arch/arm/max326xx: add max32690 irq and peripheral clock definitions
Add IRQ and peripheral definitions for MAX32690 to enhance device support in NuttX architecture.
2025-02-11 12:27:10 -03:00
Yanfeng Liu
225197b779 littlefs/cmake: fix build issue
This fixes issue on Ubuntu 22.04 with cmake v3.22.1:

```
/usr/bin/arm-none-eabi-gcc -D-DLFS_ASSERT=DEBUGASSERT -D-DLFS_CONFIG=/home/yf/Projects/Nuttx/nuttx/fs/littlefs/lfs_vfs.h -D-DLFS_DEBUG=finfo -D-DLFS_ERROR=ferr -D-DLFS_TRACE=finfo -D-DLFS_WARN=fwarn -DLFS_ATTR_MAX=1022 -DLFS_FILE_MAX=2147483647 -DLFS_NAME_MAX=32 -D__KERNEL__ -D__NuttX__
```

It happeed when building `qemu-armv7a:rpproxy_ivshmem`.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 23:22:07 +08:00
Yanfeng Liu
35e5612bce arch/armv7-r: select ARM_THUMB
This selects ARM_THUMB for ARMV7R per ARM document:
https://developer.arm.com/documentation/dui0471

Thanks to hujun260 for spotting this, now ostest works.

Why it helps is still to be clarified, the `arm_signal_handler.S`
might require this THUMB option.

To keep ARM_THUMB as option, this only selects it for
PROTECTED as per anchao's suggestion.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 19:37:14 +08:00
Yanfeng Liu
ab877b5c93 arm/qemu-armv7r: add heap alloc
This adds up_allocate_heap() support for PROTECTED mode so that
kernel and user heap sizes match memory.ld linker script.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 19:37:14 +08:00
Yanfeng Liu
79c2f4f394 arch/armv7-r: fix SYS_task_start
This fixes task start syscall in PROTECTED mode, following that
of armv7-m so that hello and getprime programs can run smoothly.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 19:37:14 +08:00
Yanfeng Liu
b7fc3aa034 arch/qemu: cortex-r5 PROTECTED support
This adds MPU and userspace handling in QEMU chips so that to
boot PROTECTED target qemu-armv7r:pnsh.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 19:37:14 +08:00
Yanfeng Liu
1cecf6791d arch/armv7-r: add undefined mpu_region_s
This copies struct mpu_region_s from armv7-m to fix PROTECTED mode
build error: `invalid use of undefined type 'struct mpu_region_s'`

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 19:37:14 +08:00
Yanfeng Liu
f1957845b9 arch/armv7-r: fix undefined ARCH_DATA_RESERVE
This fixes undefined 'ARCH_DATA_RESERVE' in arm_syscall.c:382 so
that to build qemu-armv7r:pnsh. Per nuttx/addrenv.h, that macro
is defined for BUILD_KERNEL, we need use BUILD_PROTECTED now.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 19:37:14 +08:00
Yanfeng Liu
b1bd1b292e arch/armv7-r: fix irq.h for PROTECTED mode
This fixes below issues when building for PROTECTED mode:
- `common/arm_fork.c:223 'struct xcpt_syscall_s' has no member 'cpsr'`
- `armv7-r/arm_syscall.c:454 'xcptcontext' has no member 'sigreturn'`

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-11 19:37:14 +08:00
dongjiuzhu1
34bde7b80a qemu/armv7a: register cfi flash
search the device tree and register cfi flash

test flowchart:
mount -t littlefs -o autoformat /dev/cfi-flash1 /data
fstest -m /data

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-02-11 17:23:44 +08:00
dongjiuzhu1
ef24233501 qemu/armv7-a: adjust flash size to free area to register cfi flash
122M->48M, free second cfi flash as filesystem

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-02-11 17:23:44 +08:00
zhengyu9
2c4285d9ac mtd/mtd_cfi: cfi flash bind to mtd interface
Bind cfi flash driver with the existing mtd interface

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-02-11 17:23:44 +08:00
zhengyu9
ac019bbfa2 drivers/mtd: cfi-flash driver
Realization of cfi-flash driver.
Add the interfaces of intel and amd command sets.

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-02-11 17:23:44 +08:00
Rodrigo Sim
405287081d boards/arm Add support to Seeed Xiao nRF52840 Board
Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
2025-02-10 17:08:37 -03:00
simbit18
71a221708c [Kconfig] Fix Kconfig style
drivers\sensors\Kconfig

Remove spaces from Kconfig files
Add TABs
2025-02-10 17:08:16 -03:00
Laczen JMS
6b5fccb32c esp32: add espnow documentation and defconfig.
Added documentation for espnow and a default defconfig to illustrate
the use of espnow for udp communication.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-02-10 16:15:25 -03:00
Laczen JMS
eba0362bde esp32: Add support for espnow based pktradio
Espnow is a connectionless WiFi communication protocol that can be used
to exchange information between esp nodes.

A espnow pktradio driver is proposed that allows building a 6lowpan
network of nodes.

The driver has been evaluated using udpclient & server running on
different devices.

Solves #15347

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-02-10 16:15:25 -03:00
chao an
69b0cefe80 arm64/qemu-armv8a/ivshmem: add ivshmem(Inter-VM share memory) example
rpproxy_ivshmem:  Remote slave(client) proxy process.
rpserver_ivshmem: Remote master(host) server process.

Please refer to the official Qemu ivshmem documentation for more information:

https://www.qemu.org/docs/master/system/devices/ivshmem.html

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-10 15:47:05 -03:00
chao an
7e96b0d934 drivers/devicetree: fix typo FDT_PCI_PREFTCH -> FDT_PCI_PREFETCH
should be FDT_PCI_PREFETCH

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-10 15:47:05 -03:00
chao an
55f616f055 arm64/qemu/fdt: merge ioresource MEM64 to prefetchable memory
this commit with fix prefetchable memory fault on IVSHMEM

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-10 15:47:05 -03:00
chao an
fa44369e0f arm64/qemu/fdt: fix build break
nuttx/boards/arm64/qemu/qemu-armv8a/src/qemu_bringup.c: In function 'register_pci_host_from_fdt':
nuttx/boards/arm64/qemu/qemu-armv8a/src/qemu_bringup.c:138:15: error: too few arguments to function 'fdt_get_reg_base'
  138 |   cfg.start = fdt_get_reg_base(fdt, offset);
      |               ^~~~~~~~~~~~~~~~
In file included from nuttx/boards/arm64/qemu/qemu-armv8a/src/qemu_bringup.c:34:
nuttx/include/nuttx/fdt.h:253:11: note: declared here
  253 | uintptr_t fdt_get_reg_base(FAR const void *fdt, int offset, int index);
      |           ^~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-10 15:47:05 -03:00
chao an
e50b5773de arm64/qemu/fdt: remove duplicate mmio parser code
reuse fdt_virtio_mmio_devices_register() to avoid duplicate

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-10 15:47:05 -03:00
Michal Lenc
ef469bac7f samv7: ensure the correct location of message RAM
The message RAM does not behave correctly if lower 16 bits of
buffer address overflow (upper 16 bits are set once in matrix driver
for the entire CAN driver). For example message RAM starting at
0x2040fc20 would not work for buffers that go beyond 0x20410000 and
MCAN would sent data located at 0x20400000 to the network. The same
issue would occur even if TX buffers would start directly at 0x20410000.
The upper 16 bits would still have 0x2040 value because of RX buffers
located in 0x2040ffff range.

This commit ensures the RAM is always located at the beginning of
the data section and thus the overflow mentioned above should never occur.
The alternative would be to use larger alignment, but the message RAM
can have up to 4352 words and this would cause a significant padding.

The RAM is also initialized to zero to ensure valid parity/ECC checksums.
The address issue is not described anywhere in the manual, so it is
possible this is caused by some incorrect configuration, but the context
of the registers looks valid.

This commit also fixes the compilation errors when the driver is run
without data cache.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-02-10 15:43:54 -03:00
Rodrigo Sim
2d6d52c84a Documentation: Add XIAO nRF52840 Board
Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
2025-02-10 15:42:53 -03:00
Jorge Guzman
04b7e357c0 boards/linum-stm32h753bi: optimize display timings and memory config
- Optimize FMC/SDRAM configuration for faster memory access
- Improve overall display performance for LVGL applications

These changes aim to enhance the FPS in LVGL benchmark demos.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2025-02-10 11:01:45 -03:00
hujun5
a31d983161 bluetooth: miss carrier_[on/off] in bt_netdev
fix regression from https://github.com/apache/nuttx/pull/15237

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-02-10 09:01:03 +01:00
Neo Xu
1aced99ebb board/msp3-an547: add gdbstub config
Add this config so we can test GDB stub feature easily.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-02-09 11:45:43 +08:00
Neo Xu
28cf56ce4f gdbstub: fix memory binary upload on latest GDB
GDB release 16.2 recently to fix the incompatibility issue with LLDB.
For us, the only change is stub must report it support feature 'binary-upload' before GDB will use this feature.
For more information, find bug report and discussion in https://sourceware.org/bugzilla/show_bug.cgi?id=32593

Use GDB 16.2, now it works with binary upload.
```
  [remote] Sending packet: $x39c,4#a7
  [remote] Received Ack
  [remote] Packet received: b\000\203
```

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-02-09 11:45:43 +08:00
Kyle Wilson
ac0ba3f413 Add STM32H5 architecture documentation.
Add documentation for nucleo-h563zi development board.

Removed whitespace at the end of lines.

Fixed column formatting.

Fixed Title overline too short error.

Added image to nucleo-h563zi documentation.
2025-02-09 00:01:45 +08:00
Stepan Pressl
d269c0f350 arch/arm/src/samv7/sam_tc_lowerhalf.c: do not set the CPCSTOP bit
The CPCSTOP has a negative effect on the periodic timer operation.
This causes the timer to stop when an overrun occurs.
Timer must be then restarted in the interrupt. However, as interrupts
are not infinitely fast, this prolongs the next timeout.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-02-08 10:44:28 -03:00
Eren Terzioglu
b25c4ec963 esp32[s3]: Add ES8311 support for esp32s3-lcd-ev board 2025-02-08 10:41:03 -03:00
Yanfeng Liu
ac4b5395f1 qemu/armv7-r: add poweroff
This adds poweroff function to qemu-armv7r:nsh using
semihosting based approach.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-08 19:38:56 +08:00
Yanfeng Liu
20098f3b34 arch/arm: add semihosting poweroff
This adds semihosting based poweroff to arm/common. It uses
semihosting operation SYS_EXIT (0x18) with parameter AppExit
(0x20026).

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-02-08 19:38:56 +08:00