Commit graph

58442 commits

Author SHA1 Message Date
raiden00pl
dc73324ed0 drivers/can: fix codespell errors
drivers/can: fix codespell errors

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-14 10:30:25 -03:00
raiden00pl
5d95d0871f drivers/can: move CAN utils to CAN common files
Move can_bytes2dlc() and can_dlc2bytes() to a common CAN file
that can be shared between socketCAN implementation and CAN
character driver.

This is the first step to simplifying the logic repeated in
many CAN drivers.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-14 10:30:25 -03:00
Serg Podtynnyi
6d9971296b Documentation: pico-2: migrate to rst and update the board docs
Migrate from readme.txt to index.rst
Update Pico 2 board documentation

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-05-14 21:18:16 +08:00
Serg Podtynnyi
07bc717f07 boards/arm/rp23xx/raspberrypi-pico-2: add smp config
Add SMP defconfig for SMP 2 cores configuration

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-05-14 21:18:16 +08:00
simbit18
ea47f0cf42 [Kconfig]: Fix Kconfig style
Remove spaces from Kconfig files
Add comments
Add TABs

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-05-14 21:15:14 +08:00
Serg Podtynnyi
3966097453 arch/arm/src/rp23xx: allow to use armv8m systick lowerhalf
Add ability to use arv8m systick lowerhalf driver
Fix wrong macro for systick current register in initialize

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-05-14 21:14:45 +08:00
Jukka Laitinen
c28c14ad26 sched/wdog/wd_cancel: Return 0 (OK) when cancelling an inactive wdog
In case the wdog has already completed when calling cancel, the cancel is
supposed to just return OK.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-14 21:13:48 +08:00
Serg Podtynnyi
6fc7f53f46 arch/arm/rp23xx: wdog: Ensure setup before register phase
The watchdog auto-monitor sets up during the register phase,
so we should be prepared before calling register.

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-05-14 07:18:46 -03:00
dongjiuzhu1
83967601aa fs/close: move inode to last to void race condition
race condition:

A Thread:                                    B Thread:
close
file_close
filep->inode = NULL
                         context switch
	               ------------------->  open to alloc same fd
                                             read from IO
filep->f_tag = 0       <-------------------
filep->f_san = 0       ------------------->  ioctl(fd, ...)
                                             fdcheck trigger assert

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-05-14 15:02:38 +08:00
dongjiuzhu1
e8d308658d libc/misc: fix typo error about misc/Kconfig
nuttx/libs/libc/misc/Kconfig:96: differents ==> different, difference

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-05-14 15:02:17 +08:00
dongjiuzhu1
c0819324df libs/fdcheck: add dependency LIBC_OPEN_MAX <= 256
The maximum of file desciptor is 255 for current fdcheck design

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-05-14 15:02:17 +08:00
dongjiuzhu1
a9b64df4b4 Revert "fs/fdcheck: Let FDCHECK depend on SCHED_HAVE_PARENT"
This reverts commit 14e5bcaf6e.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-05-14 15:02:17 +08:00
dongjiuzhu1
e2148c513b libc/fdcheck: cause system to panic when a double close occurs
There are many close calls in application without checking return value,
and wrong code causes the same fd to be closed multi times, we should detect
this situation and avoud effecting the fd in other threads.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-05-14 15:02:17 +08:00
raiden00pl
486dabdd2d include/nuttx/can.h: remove dependency on CONFIG_NET_CAN
Remove dependency on CONFIG_NET_CAN for socketCAN definitions.

Definitions from this file are also used by arch/sim CAN
implementation, which is based on a host socketCAN interface.

With this change CONFIG_NET and CONFIG_NET_CAN don't need to
be enabled to support CAN character driver on sim.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-14 03:06:12 +08:00
p-szafonimateusz
5bf3110777 arch/sim/sim_canchar.c: notify upper-half driver that tx done
add missing can_txdone() callback after message is send

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-05-14 03:05:56 +08:00
Jukka Laitinen
e78a33464e arch/sim/src/sim/sim_oneshot.c: Fix spelling in comments, "Ths" -> "This"
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-13 21:05:12 +08:00
Jukka Laitinen
bf870e51ba arch/sim/sim_oneshot: Calculate next oneshot time in ticks instead of timespec
This removes drift in tick start times, when the base time is always rounded to
tick boundary.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-13 21:05:12 +08:00
Jukka Laitinen
55913d16ad libs/libc/semaphore: Enable semaphore fast wait/post paths for counting semaphores
The fast path can be used also for counting semaphores when the priority
inheritance is disabled.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-13 20:52:24 +08:00
Matteo Golin
01040400cb docs/rp2040: Remove documentation duplication of RP2040 boards.
Installation instructions, license exceptions and supported features
of the RP2040 common among all boards have been moved exclusively to the
rp2040/index.rst file. Board documentation links back to the primary
source for installation instructions.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-05-13 14:13:08 +02:00
George Poulios
70b595146b boards/imx93-evk: kernel build with OPTEE/SMC
Add a kernel build with OP-TEE/SMC driver enabled to
i.MX93 EVK (target imx93-evk:koptee). Since this is
derived from the 'knsh' target, it is also preconfigured
for use with AHAB boot (see
https://spsdk.readthedocs.io/en/latest/examples/ahab/imx93/imx93_ahab_uboot.html).

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 10:14:01 +08:00
George Poulios
2799cba36b tools/nxstyle.c: Whitelist libteec mixed case symbols
Whitelist all symbols starting with "TEEC_" and a few
entire struct field names from tee_client_api.h.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 10:14:01 +08:00
George Poulios
47064e42df drivers/misc/optee: Fix non-registered memory ref passing
So far the NuttX implementation of OP-TEE has been using
registered memory references to pass non-registered memory
to OP-TEE OS, passing the physical address of the memory
in what is normally used as a 'cookie'. This was compatible
with the Openvela framework, but no other OP-TEE OS.

Fix this by passing temporary memory instead with the standard
non-contiguous (OPTEE_MSG_ATTR_NONCONTIG) flag.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 10:14:01 +08:00
George Poulios
6f77cb6dce drivers/misc/optee: Proper cleanup of registered shm
This is mostly to handle the case that the user calls
close() before calling close() on the shm. In that case
optee_close() frees the shm and then optee_shm_close()
operates on an invalid reference. Fix that.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 10:14:01 +08:00
George Poulios
7f20487f56 drivers/misc/optee: Rename optee_shm_entry to optee_shm
This is no longer (exactly) the linked list entry that it
used to be, but rather an associated pointer in an idr tree
entry. Plain 'optee_shm' is more concise, and more appropriate.

Changes also reg_pair_to_uintptr() to reg_pair_to_ptr() for
better readability in invocations.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 10:14:01 +08:00
George Poulios
a2a689fee0 drivers/misc/optee: Fix GP API compatibility
Previous implementation was not compatible with GlobalPlatform
API in the following ways:
 - Registered mem IDs would begin from negatives when it should
   have been greater than or equal to 0
 - Register IOCTL would return 0 on success, when it should have
   been returning a file descriptor.
 - Register IOCTL would expect the user-space client to specify
   TEE_SHM_* flags dictating its behaviour when in fact, libteec
   never specifies flags.

This commit fixes all those issues. It uses nuttx/idr.h instead
of a linked list, and it uses `file_allocate` to provide file
descriptors for registered shared memory. Upon close(fd), the
memory is de-registered and freed accordingly. It also updates
the documentation accordingly.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 10:14:01 +08:00
George Poulios
c497ee249b drivers/misc/optee: Harmonize invalid user addr errors
Some calls to `optee_is_valid_range()` would return
-EINVAL and some would return -EACCESS. Change all to
-EFAULT (Bad Address) which is more appropriate.

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-05-13 10:14:01 +08:00
Michal Lenc
c0a6afff11 drivers/usbdev/Kconfig: fix COMPOSITE_VENDORSTR description
Option COMPOSITE_VENDORSTR should be described as composite vendor
string, not vendor id. This is consistent with other USB devices.

Also fixes a typo in USBDEV_EPBUFFER_ALIGNMENT.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-05-13 09:57:30 +08:00
ouyangxiangzhen
64a7049dec clock: Add clock_delay2abstick.
This commit added a macro function clock_delay2abstick to calculate the
absolute tick after the delay.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
ouyangxiangzhen
2e8583f759 clock: Fix timing error.
This commit resolves a timing error caused by the round-up behavior in clock_time2ticks. In rare cases, this could lead to a two-tick increment within a single tick interval. To fix this, we introduced clock_time2ticks_floor, which guarantees the correct semantics for obtaining current system ticks.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-12 19:56:29 +08:00
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