Commit graph

60363 commits

Author SHA1 Message Date
ouyangxiangzhen
c67ac63da3 timer: pt_expected + 1 before set the timer.
This commit is to prevent the insufficient sleep time.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
ouyangxiangzhen
5e543421ab clock: constants change to unsigned.
This commit change the type of the constants to unsigned, avoiding signed integer division.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
ouyangxiangzhen
3622e4830a sched: Correct word spelling mistakes.
This commit fixed serveral word spelling mistakes.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
ouyangxiangzhen
a255c99eb8 sched/wdog: Add CONFIG_TIMER_ADJUST_USEC.
This commit added CONFIG_TIMER_ADJUST_USEC to support the time compensation for wdog timer. Normally, timer event cannot triggered on exact time due to the existence of interrupt latency. Assuming that the interrupt latency is distributed within [Best-Case Execution Time, Worst-Case Excution Time], we can set the timer adjustment value to the BCET to reduce the latency.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
ouyangxiangzhen
8e65375365 sched: Remove unnecessary tick++ for absolute wdog timer.
To improve the absolute timer accuracy, this commit move the tick++ to relative wdog timer.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
ouyangxiangzhen
ba06ea6fd7 sched/wdog: Simplify nxsched_timer_process.
This commit simplified `nxsched_timer_process` implementation and
improve its readability.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
buxiasen
5d9a1aaf75 armv7a/mmu: update from l1entry replace to TTBR0 update
The l1entry replace cause huge time when text/data is big,
Need 16KB per task to hold l1table.
Also critical_section no longer required, as table per-task maintained.

For complex goldfish emulator scarios can speed up:
     enter_nsh/application_init_done,
from 23.517300/05:07.067500
to   01.501500/00:06.587300
at least 10 times faster.

As we don't have do x_NPAGES swap out etc.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
7b90b78b52 arch/arm/mmu: unify all uint32_t & uintptr_t
Only keep cp15 API use uint32_t, other mmu all use uintptr_t

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
1de87953e6 mm/gran: add gran_alloc_align API
for arm-v7a, possible region with 4K and need align with 16K.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
68008aa9d7 arch/arm/armv7-a: add mmu_l1_setpgtable
Decrease the direct access of cp15, use mmu interface replace

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
94ea4efe4c arch/arm/arm-v7a: fix comment typo
Catched by codespell

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
cd7a8f73eb comments: update text typo pre-empted to preempted
Or will be catch by codespell, when do checkpatch.sh

Also fix the relative comment file changed.

include/nuttx/scsi.h
drivers/syslog/ramlog.c
excluded as we have to modify field name in struct

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
172c707a02 arch/arm/arm_cache: remove not required critical_section
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
cdbe91aeb9 armv7a: rename and implement va2pa & pa2va
Notice: the up_addrenv_pa_to_va is not correct, it will be complex if we
search all address to lookup all virtual address according to physical
address.
Use up_addrenv_x method as common interface across va & pa

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
d00ee139f9 arch/arm/src: fix warning of up_addrenv_va_to_pa
chip/sam_memories.c: In function 'sam_physramaddr':
chip/sam_memories.c:936:14: warning: implicit declaration of function 'up_addrenv_va_to_pa' [-Wimplicit-function-declaration]
  936 |       return up_addrenv_va_to_pa((FAR void *)virtramaddr);
      |              ^~~~~~~~~~~~~~~~~~~

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
wangzhi16
4e4acce514 arch/arm: fix compile error.
BUILD CMD: ./tools/configure.sh -l sama5d3x-ek/nx; make -j`nproc`

chip/sam_memories.c:705:17: note: each undeclared identifier is reported only once for each function it appears in
 chip/sam_memories.c:706:27: error: 'CONFIG_SAMA5_DDRCS_PGHEAP_SIZE' undeclared (first use in this function); did you mean 'CONFIG_SAMA5_DDRCS_HEAP_SIZE'?
 706 | poolend = poolstart + CONFIG_SAMA5_DDRCS_PGHEAP_SIZE;
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | CONFIG_SAMA5_DDRCS_HEAP_SIZE
 make[1]: *** [Makefile:168: sam_memories.o] Error 1
 make[1]: Target 'libarch.a' not remade because of errors.
 make: *** [tools/LibTargets.mk:170: arch/arm/src/libarch.a] Error 2
 make[1]: Target 'libsched.a' not remade because of errors.
 make: *** [tools/LibTargets.mk:71: sched/libsched.a] Error 2
 make: Target 'all' not remade because of errors.
 ~/nuttx/tools/testbuild.sh: line 385: ~/nuttx/../nuttx/nuttx.manifest: No such file or directory

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-05-12 15:01:37 +08:00
buxiasen
fb221e4d0d sama5/memory: align va&pa method to up_addrenv_x
Align prototype and make more easy to understand.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-05-12 15:01:37 +08:00
Windrow14
b05ec7729d drivers/mmcsd/mmcsd_sdio.c: use dma to receive setup if dma is enabled
Call SDIO_DMARECVSETUP instead of SDIO_RECVSETUP if CONFIG_SDIO_DMA
is defined, aligning with other callings of in mmcsd_sdio.c.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
2025-05-11 20:28:55 +08:00
wangjianyu3
5fc950e608 drivers/sensor: Fix spell errors of uorb.h
../nuttx/tools/checkpatch.sh -c -u -m -g d611304d61a79f581210584813a5b2894b838490..HEAD
Used config files:
    1: .codespellrc
    /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/uorb.h:307: afte ==> after
    /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/uorb.h:405: multipled ==> multiplied
    /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/uorb.h:416: multipled ==> multiplied
    /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/uorb.h:432: provies ==> provides, proves
    /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/uorb.h:1173: subcribers ==> subscribers
    Error: Process completed with exit code 1.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-05-11 20:28:17 +08:00
wangjianyu3
fda251aad0 drivers/sensor: Add timestamp for GNSS data
Add timestamp for GNSS measurements and clock, for matching.

When recovering the combination of `GnssMeasurement` and `GnssClock` into
[GnssData](https://android.googlesource.com/platform/hardware/libhardware/+/
           refs/heads/android14-release/include/hardware/gps.h#1748),
the reason for splitting is that the uORB buffer is not large enough to
accommodate `GnssData`, since different topics cannot guarantee the
same timing when publishing and subscribing data, we need an index to match.

WARNING: A new member "timestamp" of type uint64_t has been added at
the beginning of the struct "sensor_gnss_measurement" and "sensor_gnss_clock".

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-05-11 20:28:17 +08:00
ouyangxiangzhen
36a4d5feaf sched/wqueue: Improve performance of the work_queue.
This commit improve the performance of the work_queue by reducing
unnecessary wdog timer setting.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-11 10:47:13 +08:00
ouyangxiangzhen
f442a41102 sched/wqueue: Fix work_cancel_sync.
This commit fixed work_cancel_sync at a very rare boundary case. When a worker thread re-enqueues the work data structure during the execution of work, the user thread cannot directly dequeue the work in work_cancel_sync. Instead, it should wait until all workers' references to the work data structure have been eliminated after dequeuing.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-11 10:47:13 +08:00
EmomaxD
d611304d61 style: fix typos in comment.
- Corrected the typo in the comment of the arch/arm/src/arm/arm_cache.S file.
- Standardized the cache terminology, changing "D-cache" and "I-cache" to "Dcache" and "Icache" for consistency with existing code style.

Signed-off-by: EmomaxD <emreleno@gmail.com>
2025-05-10 12:02:23 +08:00
Serg Podtynnyi
185c55e16d arch/arm/rp23xx: remove spinlock from up_txint
spin lock/unlock introduced before sometimes got stuck on tx

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-05-09 19:21:51 +08:00
Theodore Karatapanis
0011f165ff style: fix typos required by ci-cd
- Added "infor" to .codespellrc ignore-words-list.
  This term is used by NXP's ROMAPI naming conventions and is not a typo
  in this context.
- This prevents CI/CD codespell checks from failing due to false positives.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
Theodore Karatapanis
5d63c3e460 arch/arm64: Allow non MMU builds.
MMU initialization is redundant for bootloaders(BL2) that load TF‑A(BL31).
TF-A will ignore and overwrite any MMU configuration performed by BL2.
Additionally the MMU comes with a large memory footprint (~50 KB)
which could be precious for such setups.

When the MMU is disabled all the memory is treated as device memory and
all alignment faults generate exceptions (as opposed to normal memory when
MMU is enabled). For that reason we need to add -fno-builtin when compiling
with CONFIG_ARCH_USE_MMU != y to prevent alignment faults.

- Guard MMU initialization with CONFIG_ARCH_USE_MMU
- If CONFIG_ARCH_USE_MMU is not set add -fno-builtin which prevents alignment errors.
- Deliberately didn't try to replace CONFIG_ARCH_HAVE_MMU with CONFIG_ARCH_USE_MMU
  occurrences, because this will break a lot of build targets that assume MMU without
  guarding the MMU initialization.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
Theodore Karatapanis
d278c6cb15 arch/arm64/imx9: Add ROMAPI and AHAB support for i.MX9
This adds support for the i.MX9 ROMAPI, allowing boot in a more
device agnostic and portable manner. The ROMAPI "natively" allows to:
- Query the boot device for information.
- Copy data from the boot device to RAM.

An extra functionality was added to ROMAPI to calculate
offsets of sequential AHAB containers.

The AHAB functionality is built on top of raw ELE primitives and allows to:
- Authenticate a container image.
- Release the authenticated container.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
Theodore Karatapanis
3c48031ec3 arch/arm64/imx9: Extend ELE API for container authentication
This extends ELE API to:
- Authenticate i.MX container header.
- Verify container images.
- Release resources of the authenticated containers.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-05-09 19:21:17 +08:00
Eren Terzioglu
9a59cf4004 Documentation/xtensa: Add SDM docs for esp32[-|-s2|-s3]
Add SDM docs for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-05-09 19:20:47 +08:00
Eren Terzioglu
4b36d69630 boards/xtensa: Add SDM peripheral board layer support for esp[-|-s2|-s3]
Add SDM perpiheral board layer support for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-05-09 19:20:47 +08:00
Eren Terzioglu
39465d2156 arch/xtensa: Add SDM peripheral support for esp32[-|-s2|-s3]
Add SDM peripheral support for Xtensa based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-05-09 19:20:47 +08:00
Eren Terzioglu
bf2a7ad49a Documentation/risc-v: Add SDM peripheral docs for esp32[-c3|-c6|-h2]
Add SDM peripheral docs for risc-v based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-05-09 19:20:47 +08:00
Eren Terzioglu
521e1b15b6 boards/risc-v: Add board layer support of SDM for esp32[-c3|-c6|-h2]
Add SDM board layer support for risc-v based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-05-09 19:20:47 +08:00
Eren Terzioglu
466e63d554 arch/risc-v: Add SDM support for esp32[-c3|-c6|-h2]
Add SDM peripheral support for risc-v based Espressif devices

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-05-09 19:20:47 +08:00
Serg Podtynnyi
622a45183e Documentation: update rp23xx page for recent changes
DMA, FPU/DSP, watchdog, chip tags

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-05-09 19:17:00 +08:00
Matteo Golin
81060b6721 rp2040/gpio: Fix debug assertion for interrupts.
The previous interrupt implementation allowed only one single interrupt
mode to be selected. The debug assertion is now updated to allow the
entire range of possible interrupt combinations (a 4-bit field), up to
0xf.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-05-09 15:54:45 +08:00
Rodrigo Sim
7a64c86c1b boards/risc-v/esp32c6 Add initial support to Seeed Studio XIAO ESP32c6
This commit introduces initial support for the Seeed Studio XIAO ESP32C6
board. Five configurations are available:
- nsh: Basic NuttShell support over UART0
- usbnsh: Basic NuttShell support over USB
- gpio: NuttShell over USB + GPIO
- wifi: NuttShell over USB + Wifi support

Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
2025-05-09 12:54:50 +08:00
Rodrigo Sim
c133dd58a0 Documentation/ Add Seeed Studio XIAO ESP32C6 Board
This commit adds the documentation for the Seeed Studio XIAO ESP32C6
board. It includes examples for NSH, USBNSH, GPIOs and Wifi.

Signed-off-by: Rodrigo Sim rcsim10@gmail.com
2025-05-09 12:52:21 +08:00
George Poulios
16143b82b3 Documentation/guides/optee: Add an OP-TEE guide
The guide:
 - explains the different OP-TEE transports available
   in NuttX
 - gives brief instructions on how to enable the OP-TEE
   driver
 - documents the IOCTLs supported, and
 - shows typical usage in a NuttX app

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-09 10:29:26 +08:00
George Poulios
b103a64a87 drivers/misc/optee: Add SMC backend for arm archs
So far NuttX has supported OP-TEE interfacing over
local and RPMsg sockets. This commit introduces support
for direct invocation of OP-TEE through arm SMCs. The
SMC transport is enabled through CONFIG_DEV_OPTEE_SMC.

This SMC implementation has been tested only with arm64,
OP-TEE rev 4.4.

Note that it does not support reverse direction RPCs,
i.e. from the Secure World to the Normal World to
something like optee supplicant. A basic RPC handling
skeleton is provided with implementation for some
basic functions (alloc/free mem, and foreign interrupts)
but no supplicant command handling.

(+one minor change s/parm/param in arch/arm64/include/syscall
to satisfy the spellchecker during PR)

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-09 10:29:26 +08:00
George Poulios
a2b8c9d1d8 drivers/misc/optee.c: Add shm registration support
Adds support for SHM_REGISTER IOCTL. Registration can
be requested both against the driver (for automatic cleanup)
and against the secure OS (for sharing).

Introduces also `optee_{msg,free}_alloc()` to allocate
aligned memory for message arguments depending on the
`alignment` specified in the driver's private data. For
alignment greater than word size, memory is allocated on the
heap, otherwise it's allocated on the stack (similar to the
previous implementation but using `alloca()` instead).

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-09 10:29:26 +08:00
George Poulios
8546fb080d drivers/misc/optee.c: Add memory sanity checks
Besides a few checks for NULL IOCTL argument values, this
commits introduces also a check to ensure that user specified
memory (mainly IOCTL arguments) indeed belongs to the user.
This is applicable only with `CONFIG_ARCH_ADDRENV`.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-09 10:29:26 +08:00
George Poulios
5c8e5d2ef2 drivers/misc/optee.c: Close session on open error
Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-09 10:29:26 +08:00
George Poulios
da0586c7e3 drivers/misc/optee.c: Decouple transport from driver
Prepares the ground for introducing new transports to
the OP-TEE driver. "transports" as in alternatives to
RPMsg and local network.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-09 10:29:26 +08:00
Serg Podtynnyi
bc4a52f910 arch/arm/rp23xx: update serial code smp fixes from cxd56
Most of the code is the same, update to recent fixes

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-05-08 11:39:24 -03:00
Jukka Laitinen
e4d5c78008 Fix signal delivered to a wrong thread
When using pthread_kill, the signal should be delivered to the
specified thread. Current implementation, however, may add the
signal to the groups pending list, if the signal is masked at the
time of dispatch. From the group's pending list it can be delivered
to any thread of the group, which is wrong.

Fix this by adding a new field "FAR struct tcb_s *tcb" to
"struct sigpendq", marking if the signal needs to be delivered
to a specific thread. Use NULL for the value if delivery to any
thread in the group is ok.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-08 21:32:35 +08:00
Jukka Laitinen
efc0f400bb sched/signal/sig_dispatch.c: Correct spelling in comments, waitting ==> waiting
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-08 21:32:08 +08:00
Jukka Laitinen
a0efb1fefe sched/signal: Move dynamic allocation of pending signals to a safe place
The kmm_alloc can break the critical section, if it sleeps on the
heap mutex. If we run out of pending signal structures, allocate more
right after entering the critical section but before checking if the signal
needs to be added to the pending queue.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-08 21:32:08 +08:00
Jukka Laitinen
77df55db45 sched/signal: Move nxsig_find_action outside of critical section
The TCB used in find_action is locked by spinlock, so it doesn't belong
inside critical section. Just find the possible action already in the
beginning of nxsig_tcbdispatch.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-08 21:32:08 +08:00
Matteo Golin
e67247843d arm/sam34/boards/sam4e-ek: Migrate README to RST.
Migrate README.txt documentation to RST format as part of #11077.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-05-08 19:27:23 +08:00