Commit graph

58963 commits

Author SHA1 Message Date
Theodore Karatapanis
707cdaf42e drivers/misc/optee: Expanded RPC support.
This commit expands RPC support for the OP-TEE driver using 2 files:
1) drivers/misc/optee_rpc.c
   * Add support for RPCs that can be handled directly by the kernel.
   * Can delegate RPC handling to optee_supplicant.c for RPCs that
     need userspace interaction.
2) drivers/misc/optee_supplicant.c
   * Enable communication between the userspace TEE supplicant and the
     kernel driver.

Additional changes were needed to the following files:
1) drivers/misc/optee.c
   * Add ioctls used SOLELY by the userspace TEE supplicant.
   * Register /dev/teepriv0 if the supplicant is enabled in Kconfig
   * Add OPTEE_ROLE_CA and OPTEE_ROLE_SUPPLICANT conditionals to
     differentiate paths, between a normal Client Application (CA)
     and the TEE supplicant.
   * Change some functions from static to "public" to reuse them
     in other C files.
   * Adjust optee_to/from_msg_param() to work with RPCs.

2) drivers/misc/optee_smc.c
   * Call the RPC handler from optee_rpc.c

3) drivers/misc/optee_msg.h
   * Add definition needed for RPCs

4) drivers/misc/tee.h
   * Add ioctl definitions
   * Add TEE_SHM_SUPP flag, checked when unregistering supplicant
     memory.

5) Documentation/guides/optee.rs
   * Add documentation for RPCs and the supplicant.

6) drivers/misc/{CMakeLists.txt, Make.defs}
   * Account for the new files.

7) drivers/misc/Kconfig
   * Add DEV_OPTEE_SUPPLICANT option to enable/disable the supplicant
     driver.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-08-06 02:29:33 +08:00
Theodore Karatapanis
95ca3e7ca5 drivers/misc/optee: Add mmap shm op + remove memfd
The previous approach with memfd has 3 problems:
1) The close operation on the memfd isn't tied with optee_shm_close,
   therefore close(fd) doesn't free the optee_shm struct allocated
   by the kernel.

2) The kernel unnecessarily maps the file descriptor to its memory,
   however only userspace should need to do that.

3) Since the kernel doesn't need to map the file descriptor we
   don't need to unmap it.

To use anonymous mapping, the prototype of map_anonymous() was
moved from fs/mmap/fs_anonmap.h to include/nuttx/fs/fs.h. Since
fs_anonmap.h didn't contain any other information it is deleted.

A type from fs/mmap/fs_rammap.h was moved to the public :
include/nuttx/fs/fs.h as well.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-08-06 02:29:33 +08:00
Theodore Karatapanis
cbdd3ac39b drivers/misc/optee: Add virtual and physical address to sturct optee_shm
The VA -> PA translation must be performed once, at allocation time,
while the caller's virtual address space is known. If a second process
later tries to translate the same VA from a different mapping, the
calculated physical address can be wrong.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-08-06 02:29:33 +08:00
nuttxs
7b3913da60 libs/libc/netdb: Optimize the timeout calculation logic:
1. Adopt an exponential backoff strategy () to dynamically adjust the timeout
   duration, which is suitable for retry scenarios.
2. Optimize the default configuration to set the initial timeout to 5 seconds.
3. Support dynamic modification of the maximum timeout limit to adapt
   to different scenarios.
Reference: RFC 1536 (section on retransmission implementation recommendations)

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-08-06 01:58:05 +08:00
Laczen JMS
c506c25f19 drivers/mtd: introduce nvblk
NVBLK provides a block device that operates on top of a non volatile
memory (as a mtd device) that enables wear levelling for non volatile
memory. It's operation is similar to the dhara wear levelling library,
but nvblk is meant to be used on smaller (nor, mram, rram) memory.

I am also the author and maintainer of the nvblk library.

A block device can be created during startup by using:
```
nvblk_initialize(0, mtd, CONFIG_MTD_NVBLK_DEFAULT_LBS,
                         CONFIG_MTD_NVBLK_DEFAULT_IOBS,
                         CONFIG_MTD_NVBLK_DEFAULT_SPEB);
```
and a fat filesystem on top of this as:
```
nsh> mkfatfs /dev/mtdblock0
nsh> mount -t vfat /dev/mtdblock0 /mnt
```
this fat filesystem can then be used:
```
nsh> echo "test" > /mnt/test.txt
nsh> cat test.txt
test
nsh>
```

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-08-06 01:53:56 +08:00
Eren Terzioglu
1c0e1698cd bugix/risc-v/esp32c6: Fix build error of LP_I2C
Fix build error of LP_I2C for esp32c6

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-08-05 08:00:12 -03:00
Konstantin Tyurin
85923c1797 arch/arm/stm32f0l0g0/: Fix I2C IRQ numbers
This patch sets a correct interrupt vector number
for each I2C controller.

Signed-off-by: Konstantin Tyurin <konstantin@pluraf.com>
2025-08-05 12:18:14 +02:00
Jukka Laitinen
9cda3ce216 arch/*/*_sigdeliver.c: Fix a race condition is signal delivery for SMP
This fixes the same issue for other targets, which was already fixed for
xtensa in commit 50d94863.

After the signals have been delivered, the local irqs need to be
disabled until the context switch. But just calling
leave_critical_section(regs[xx]) will enable them if they were
enabled in the context.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-04 21:11:13 +08:00
George Poulios
ddf74ae059 boards/imx93-evk: Add a flat build config with OP-TEE
Mostly for CI purposes to validate OP-TEE changes
against a flat build. It has not been runtime-tested
with any specific setup involving an actual OP-TEE.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-08-03 13:00:47 -03:00
George Poulios
c78e5b983a drivers/misc/optee_smc: Fix sched_yield() on flat builds
Previous change that introduced yielding upon OP-TEE
return with reason foreign interrupt, omitted to include
<sched.h>. This worked on kernel builds, but not on flat
builds. Include it.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-08-03 13:00:47 -03:00
wangjianyu3
8c32bed29e drivers/sensors/gnss: Skip copying extended satellite flags
The extended member `flags` of `info` of `struct sensor_gnss_satellite` is not parsed from GSV.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-08-03 10:41:06 +08:00
wangjianyu3
508418917e drivers/sensor: Add flags for GNSS satellite
Some applications require satellite information for positioning using the flag USED_IN_FIX.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-08-03 10:41:06 +08:00
kywwilson11
163bf0a906 arch/arm/stm32h5: Use double-buffer for ADC DMA in Circular Mode
Clear dma interrupt flags as before.

Change HTEF to HTF, fixes typo.

Remove ALL_FLAGS define. Clear CXFCR with all 1s like other instances do.

Handle half-transfer interrupt only if in circular mode.

Add ADC_HAVE_DMA guard around adc_rstart_dma. It is needed because priv->circular is guarded by ADC_HAVE_DMA.
2025-08-01 22:57:31 +08:00
lipengfei28
4fa6d4b791 drivers/pci: epc add dma heap
The PCI inbound address space and the CPU cache need to maintain cache coherence

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-08-01 20:47:43 +08:00
Jukka Laitinen
50d94863f2 arch/xtensa: Fix a race condition in xtensa_sig_deliver for SMP
After the signals have been delivered, the local irqs need to be
disabled until the context switch. But just calling
leave_critical_section(regs[REG_PS]) will enable them if they were
enabled in the context.

Any interrupt on this cpu before xtensa_context_restore() would set
the rtcb->xcp.regs to NULL, causing a crash in context restore.

Fix this by calling leave_critical_section(up_irq_save()) instead.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-01 08:54:39 -03:00
Shanmin Zhang
73cf02d63a Revert "libs/libc/stdlib/lib_exit.c: fix multiple definition of __dso_handle in msys2"
This reverts commit 8f96e59aee.

The implementation of __dso_handle is independent of the HOST OS but dependent on the specific compiler.
Therefore, this patch will cause compilation failures for other cross-compilers on the Windows platform, such as arm-none-eabi-gcc and aarch64-none-elf-gcc.
Constraints should be applied to compiler target rather than compiler host.
2025-07-31 22:10:36 +08:00
George Poulios
199c301a8e drivers/misc/optee_smc: Explicitly yield during NW interrupts
CPU heavy OP-TEE calls would starve the Normal World tasks.
OP-TEE foreign interrupts were delivered to NW but we would
resume OP-TEE immediately without giving any potentially
unblocked tasks a chance to run. This would violate real-
time guarantees. Fix that by calling sched_yield() during
OP-TEE return with reason foreign interrupts.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-07-31 09:14:34 -03:00
Alan Carvalho de Assis
59dc9a3884 arch/arm/imxrt: Initial modification to support two USB Controllers
Many iMXRT MCUs have internally two USB OTG controllers, however
NuttX currently only supports one USB controllers. This patch will
prepare the "house" to support both ports at same time.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-31 08:04:31 +02:00
Liu, Richard Jiayang
d2282ec26a fs/vfs/fs_rename: fix directory move operation.
* Recurrency is removed from filesystem directory rename.
* Fixes use after free in buffer that was used as output and argument.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2025-07-31 01:53:59 +08:00
Michal Lenc
f43d0f03c0 Documentation/platforms/arm/samv7: add entry for supported PIC32CZ CA70
This adds entry for a newly supported PIC32CZ CA70 MCU and its
evaluation kit, PIC32 CA70 Curiosity.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-07-30 19:28:07 +08:00
Michal Lenc
8841b338be boards: add support for PIC32CZ CA70 Curiosity Evaluation Kit
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-07-30 19:28:07 +08:00
Michal Lenc
cbfaf4224a arch/arch/src/samv7: add support for PIC32CZ CA70 series
PIC32CZ CA70 family is pin to pin and binary compatible with
SAMV70/SAME70 families, therefore the support is placed in samv7
directory. The only difference is larger RAM memory compared to SAM
families.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-07-30 19:28:07 +08:00
Alan Carvalho de Assis
e745b8ec7f Doc: Remove MOTD string from nsh shell on simulator
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-30 12:01:56 +08:00
Alan Carvalho de Assis
e9cb6907c8 doc: Fix quickstart since the login is not required and quit exists
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-30 12:01:56 +08:00
jianglianfang
b7156384d1 video: add sched_note_mark at fb_remove_paninfo and fb_notify_vsync
fb_notify_vsync is called when TE irq comming, and fb_remove_paninfo is called after paninfo comsumed

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2025-07-30 02:50:21 +08:00
Shanmin Zhang
5a91b1b0ee x86_64: allow specifying alternative compilers via CROSSDEV, rather than restricting to specific compiler
Test:

git clone -b dev -depth 1 https://github.com/open-vela/prebuilts_gcc_windows-x86_64_x86_64-none-elf.git ${HOME}/x86_64-none-elf
export CROSSDEV=${HOME}/x86_64-none-elf/bin/x86_64-none-elf-
./tools/configure.sh -l qemu-intel64:nsh
make

Output:

Create version.h
LN: platform/board to /home/shanmin/git/nuttx-apps/platform/dummy
Register: hello
Register: dd
Register: nsh
Register: sh
Register: ostest
LD: nuttx

Signed-off-by: Shanmin Zhang <zhangshanmin@xiaomi.com>
2025-07-30 02:41:29 +08:00
Shanmin Zhang
57d5d87d46 x86_64: Add the -Wa,--divide option for all x86_64 assemblers
Signed-off-by: Shanmin Zhang <zhangshanmin@xiaomi.com>
2025-07-30 02:41:29 +08:00
simbit18
a0c5d035d7 arm: CMake build for the i.MX RT series implemented.
CMake added board ARCX Socket Grid

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-07-30 02:41:08 +08:00
simbit18
141cd3478b [Kconfig] boards/arm: Fix Kconfig style
Remove spaces from Kconfig
Add TABs
Add comments

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-07-29 17:28:46 +02:00
Alan Carvalho de Assis
719ffdd994 Doc: Update weact-stm32h743 doc to include flashing instructions
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-29 22:15:45 +08:00
Alan Carvalho de Assis
934b7b4bf5 drivers/lcd/st7735: Don't define st7735_rdram if write only mode
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-29 08:18:30 -03:00
Alan Carvalho de Assis
a97355167b Doc: Add documentation to weact-stm32h743:st7735
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-29 08:18:30 -03:00
Alan Carvalho de Assis
94bb3e52f5 boards/weact-stm32h743: Add support to ST7735 display
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-29 08:18:30 -03:00
ligd
1bfe705226 libc: fix assert "Free memory from the wrong heap" with flat mode and user separated heap enabled mode
In flat mode:
kernel code, like net driver...
strdup    -> nx_strdup -> kmm_malloc
lib_free  -> kmm_free

app code, like stdlib...
strdup -> malloc
free   -> free

Signed-off-by: ligd <liguiding1@xiaomi.com>
2025-07-28 16:04:03 -03:00
Alan Carvalho de Assis
4a90c179f8 Documentation: Add documentation to arc-socket-grid
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-28 11:13:07 -03:00
Alan Carvalho de Assis
a94dddabb9 boards/imxrt: Add ARCX Socket Grid board
This commit add support to ARCX Socket Grid board powered
by iMXRT-1052 MCU.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-28 11:13:07 -03:00
lipengfei28
5eea680e44 documentation/arm64/imx9: add imx95 support
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-07-28 09:58:02 -03:00
lipengfei28
99103b79c5 boards/arm64/imx9: add imx95 support
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-07-28 09:58:02 -03:00
lipengfei28
44016fbe77 arch/arm64/imx9: add imx95 support
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-07-28 09:58:02 -03:00
Matteo Golin
b0760dceb6 drivers/sensors/l86xxx: Use uORB GNSS lower-half
Changes the implementation of the L86xxx driver to use the
gnss_lowerhalf driver implementation, simplifying this driver's logic.
It also fixes the `read_line` function which would early return on `\r`,
as well as adding some retries for response checking and better mutex
locking.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-07-28 10:46:55 +02:00
Rodrigo Sim
a8ac255386 boards/arm/stm32f401rc-rs485: Add support to MAX31855 and MAX6675
This commit adds support for MAX31855 and MAX6675 thermocouple
sensors on the STM32F401RC-RS485 board via SPI1. It also updates
the board documentation accordingly.

Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
2025-07-27 10:04:03 -03:00
Rodrigo Sim
80e1f70832 boards/arm/stm32f4discovery: Add support to HX711 ADC
This commit adds support for the HX711 ADC in the STM32F4-Discovery
board and updates the board documentation accordingly.

Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
2025-07-27 17:43:19 +08:00
Côme VINCENT
596a425066 nucleo-h743zi: Add ADC2 support and expand ADC channel list
- Added support for ADC2 initialization and registration.
- Defined new ADC2 channels and corresponding pin mappings.
- Expanded ADC1 channel list and updated pin mappings.
- Updated board.h with additional ADC channel definitions.
- Ensured all ADCs are properly initialized and registered.

- Tested by opening and reading /dev/adc0 and /dev/adc1, checking
  that the correct values are read.

Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com>
2025-07-26 10:02:32 -03:00
kywwilson11
4995c836f3 arch/arm/stm32h5: Add DMA Support to STM32H5 Serial Driver
Style fixes.
2025-07-26 20:57:26 +08:00
Côme VINCENT
ec64401c62 docs: Add Nix flake development environment guide
This commit introduces a new guide in  that details how to set up a reproducible development environment for NuttX using Nix flakes.

The guide covers:
- Prerequisites for using Nix flakes.
- Steps to enter the NuttX development shell.
- Benefits of using the Nix flake (reproducibility, simplified onboarding, dependency management).
- An overview of the  contents.

A link to this new guide has also been added in index.rst to ensure discoverability.

Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com>
2025-07-26 20:55:29 +08:00
Côme VINCENT
92be21982d tools/nix: Add Nix flake for reproducible dev environment
This commit introduces a Nix flake (flake.nix and flake.lock) to provide
a reproducible development shell for NuttX using Nix and flakes.

- Adds a devShell with all required build tools and dependencies for NuttX,
  including CMake, Ninja, GNU Make, clang-tools, ARM toolchain, and other
  utilities (automake, bison, flex, genromfs, gettext, gperf, kconfig-frontends,
  libelf, expat, gmp, isl, libmpc, mpfr, ncurses, zlib, kconfiglib).
- Uses flake-utils to support multiple platforms.
- Sets up a shell hook to enable CMake compile commands and provide a welcome
  message.
- Based on nixpkgs `nixos-unstable` for up-to-date packages.

Purpose:
- Simplifies onboarding and ensures a consistent build environment across
  contributors.
- Reduces "works on my machine" issues by pinning dependencies.

Tested by running `nix develop` and building NuttX on x86_64-linux.

No impact on runtime or target builds; this only affects developer tooling.

For more details, see the new flake.nix file.

Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com>
2025-07-26 20:55:29 +08:00
YAMAMOTO Takashi
0f73f92ffc add esp32s3-devkit:mbedtls kconfig
Note: CONFIG_LIBC_RAND_ORDER=2 is a workaround for
https://github.com/apache/nuttx/issues/16760

Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
2025-07-25 21:29:11 +08:00
makejian
ac54fe8875 crypto/cryptosoft: fix aadlen used uninitialized warning
Signed-off-by: makejian <makejian@xiaomi.com>
2025-07-25 08:59:53 -03:00
YAMAMOTO Takashi
69bcbfb207 esp32s3_extraheaps.c: add a missing include for xtensa_imm_initialize
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
2025-07-25 15:51:38 +08:00
Matteo Golin
da72df9ab6 drivers/sensors/l86xxx: Fix kernel crashes on failed registration
Sometimes this driver will boot when the serial port is of the wrong
baud rate, and it cannot set the correct baud rate or verify
communication. This commit prevents registration if any settings fail to
be set, and also prevents the kernel thread from setting the L86 to
enabled (this is done only by the uORB upper half).

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-07-25 10:48:55 +08:00