Commit graph

57082 commits

Author SHA1 Message Date
hujun5
98ce36cdc7 remove fl_crefs
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-13 23:04:10 +08:00
Huang Qi
de5151c64b riscv_percpu: Replace critical section with irqsave/irqrestore
Since the SCRATCH register is used to store the percpu pointer,
which should not be accessed by other CPUs, we can replace the
critical section with irqsave/irqrestore.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-12-13 23:03:48 +08:00
YAMAMOTO Takashi
fce4f2b3ee tools/ci/platforms/darwin.sh: update bloaty pin
This seems to fix build errors on my environment.
(macOS 15.1.1, x86-64, xcode 16.1)

```
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:45:5: error: use of undeclared identifier 'ABSL_INTERNAL_ASSUME'
   45 |     ABSL_INTERNAL_ASSUME(hi != 0);
      |     ^
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:49:3: error: use of undeclared identifier 'ABSL_INTERNAL_ASSUME'
   49 |   ABSL_INTERNAL_ASSUME(low != 0);
      |   ^
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:141:9: error: redefinition of 'operator/'
  141 | uint128 operator/(uint128 lhs, uint128 rhs) {
      |         ^
/usr/local/Cellar/abseil/20240722.0/include/absl/numeric/int128.h:1040:16: note: previous definition is here
 1040 | inline uint128 operator/(uint128 lhs, uint128 rhs) {
      |                ^
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:152:9: error: redefinition of 'operator%'
  152 | uint128 operator%(uint128 lhs, uint128 rhs) {
      |         ^
```
2024-12-13 18:23:29 +08:00
YAMAMOTO Takashi
ac3aa0185c tools/ci/platforms/darwin.sh: Don't use PIP_USER if venv is activated
On my environment PIP_USER doesn't work well.
```
error: externally-managed-environment
```
(macOS 15.1.1, x86-64, xcode 16.1)

Also, I prefer to use virtualenv anyway.
2024-12-13 18:23:29 +08:00
YAMAMOTO Takashi
a3849afe9f linum-stm32h753bi/littlefs: bump littlefs version to 2.10.0 2024-12-13 18:22:30 +08:00
YAMAMOTO Takashi
760b557f3f esp32s3-devkit/toywasm: bump littlefs version to 2.10.0 2024-12-13 18:22:30 +08:00
YAMAMOTO Takashi
fa8d5cd53d littlefs: Use LFS_DEFINES if available 2024-12-13 18:22:30 +08:00
Gao Feng
9e8e7ace09 xtensa: support coredump by register set alignment 2024-12-13 18:21:37 +08:00
Windrow14
5cdc6c77cf fs/fat/fs_fat32util.c: fix potential exception due to dividing zero during mounting when fat is corrupted
Check fs_fatsecperclus' value when read from eMMC device. Return an error if it is zero.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
2024-12-13 11:22:54 +08:00
p-szafonimateusz
15250540eb Documentation: add PCI CAN cards doc
Documentation: add PCI CAN cards doc

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-12-13 11:19:22 +08:00
p-szafonimateusz
7b8f01f2da drivers/can: add CTU CAN FD driver (qemu only)
Add CTU CAN FD driver for qemu only:
https://www.qemu.org/docs/master/system/devices/can.html#ctu-can-fd-support-examples

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-12-13 11:19:22 +08:00
p-szafonimateusz
033f203e2a drivers/can: add Kvaser PCI card driver (qemu only)
add Kvaser PCI card driver support, works only with QEMU now:

https://www.qemu.org/docs/master/system/devices/can.html#examples-how-to-use-can-emulation-for-sja1000-based-boards

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-12-13 11:19:22 +08:00
SPRESENSE
0df0a105d1 arch: cxd56xx: Fix not restart after TX error
Fix a bug that I2C driver can not transfer after TX abort error.
It caused by remaining NO_STOP flag status.
2024-12-13 10:51:17 +08:00
Tiago Medicci Serrano
38b41e5417 rv-virt/citest: Increase init task stack size to 3072
After https://github.com/apache/nuttx/pull/15075, the size of the
stack size has decreased 8 bytes and the init stack size for the
rv-virt:citest defconfig was near its full capacity, which lead to
crashing the `ps` command. The init stack size for this defconfig
was increased from 2048 to 3072 to avoid stack overflow.
2024-12-13 03:15:10 +08:00
chao an
7b85272b08 binfmt/exec: initialize binary_s to empty to avoid invaild access
Signed-off-by: chao an <anchao@lixiang.com>
2024-12-13 01:31:21 +08:00
Huang Qi
4e9702c7fb risc-v: Move CSR register manipulation macros to csr.h
This patch allow public arch level code use them, make it possible to access system register in common code, such as percpu.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-12-13 01:29:26 +08:00
edbf2e21e7 CI: Move rv-virt:python from risc-v-06 to risc-v-07 2024-12-12 23:38:35 +08:00
Tiago Medicci Serrano
89d8a8a193 Documentation: Add entry for Python on NuttX
This commit adds entries in the documentation referring to the
Python's port for NuttX.
2024-12-12 23:38:35 +08:00
Tiago Medicci Serrano
598556c307 risc-v/qemu-rv/rv-virt: Add CPython (python) defconfig
This defconfig enables building NuttX's port of Python for RISC-V
QEMU.
2024-12-12 23:38:35 +08:00
hujun5
f301524cb9 sem: remove the additional assignment.
reason:
running tcb->waitobj should be NULL

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-12 22:01:50 +08:00
Takuya Miyasita
f66c4a0733 Documentation/guides: add the guide:how to port.
I think the guy who wants to port NuttX is expected to understand NuttX kernel code and related configurations,
but the getting enough knowledge needs to read the kernel codes deeply.

To reduce the time for NuttX beginner who wants to port,
I tried to make the guide (how to port) based on my porting journey.
2024-12-12 21:52:24 +08:00
Jukka Laitinen
366977b767 fs/shm/shmfs_alloc.c: Allocate zero-initialized memory in flat build
POSIX requires that the shm objects are zero-initialized. This has been broken
in some earlier commits (starting from 9af5fc5d09)

Also fix the flat build memory allocation to allocate both object data and payload
in the same chunk (as the comment also suggests). This saves allocations and memory
in a system with lots of shm objects.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-12-12 21:47:41 +08:00
yaojiaqi
890cf4764f drivers/timers/watchdog: support the configurations of Auto-monitor reset timeout and Auto-monitor keep alive interval in milliseconds.
In some areas with high security requirements such as vehicle control, in order to meet functional safety requirements, the timeout and feeding interval of the watchdog need to be configured in milliseconds

Signed-off-by: yaojiaqi <yaojiaqi@lixiang.com>
2024-12-12 17:02:05 +08:00
chao an
cafdcb1eb0 sched/clock: cleanup g_system_ticks reference if arch timer is enabled
continue work of: https://github.com/apache/nuttx/pull/15139

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-12 09:52:07 +01:00
ligd
4a51c21afc sched/clock: call up_timer_gettime() to get higher resolution
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-12-12 14:47:02 +08:00
chao an
083027b9dc binfmt/loadable: move binary_s to stack to avoid access allocator
Improve performance by reducing allocator accesses

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-12 14:00:08 +08:00
chao an
894b1431e3 arm64/imx9: refrash defconfig of imx93-evk
Signed-off-by: chao an <anchao@lixiang.com>
2024-12-12 13:47:22 +08:00
chao an
b46edd1252 fs/reference_count: set default reference count option depends on DISABLE_PTHREAD
Most of developers will not have the scenarios of open/close file descriptors in multi-threads,
The default option will incur additional code size overhead for such devices.
this PR will preserve the behavior before PR#13296 was introduced, and ensure that the default code size is not affected.

Note that this option will ensure the safety of access to the file
system from multi-tasks (Task A blocking rw(fd), then Task B close(fd)),
the disadvantage is that it will increase the amount of code-size,
there is no need to enable this option if the application could ensure
he file operations are safe.

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-12 13:47:22 +08:00
anjiahao
e15fe23424 procfs:fix cmdline overflow
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-12-12 11:49:37 +08:00
chao an
b99e7617aa fs/inode: refresh tcb after each file sync() is completed
After tcb is destroyed, it is very dangerous to back reference tcb through file.
This commit will perform file operations while ensuring the validity of tcb during
fsync, with will avoid tcb check in each subsystem.

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-12 02:21:32 +08:00
simbit18
e4705e7f62 Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2024-12-12 02:18:23 +08:00
chao an
1efbe6b302 binfmt/modlib: reduce size of binary_s if CONFIG_LIBC_MODLIB is disabled
Test on nsh/sim

before:
sizeof(struct binary_s): 216

after:
sizeof(struct binary_s): 56(-160)

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-12 02:06:05 +08:00
Jukka Laitinen
fd3f0b7dd9 arch/risc-v/src/mpfs/mpfs_corespi.c: Add support for multiple bit widths
The corespi fpga block supports just one frame length, which is defined when
the block is instantiated on the FPGA.

This adds support for emulating different frame lengths if they are multiples
of 8-bit. That is, with 8-bit corespi one can do 8,16 and 24-bit transfers.

This is implemented by simply writing several 8-bit frames for a single word
when needed.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-12-12 02:05:16 +08:00
Tero Salminen
186b11c941 mpfs_corespi: fix semaphore race condition
SPI TX_DONE interrupt can be received after a semaphore timeout,
but before interrupts are disabled. This will leave the semaphore
to the signaled state.

After a timeout the semaphore is always reset to non-signaled state
to fix this race condition.

Signed-off-by: Tero Salminen <tero.salminen@unikie.com>
2024-12-12 02:05:16 +08:00
wangjianyu3
5a51d3b23f drivers/bch: Drivers may not support command BIOC_FLUSH
Calling `bchlib_flushsector()` maybe enough on some devices.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-12-12 01:56:55 +08:00
simbit18
1dcada4917 [ci] macOS platforms: added LLVM toolchain for Arm
added LLVM toolchain for Arm on Apple Intel
release-17.0.1

added LLVM toolchain for Arm on Apple Silicon
release-19.1.1

ì
2024-12-11 14:09:45 -03:00
chao an
4eeb6546ec esp/mcpwm: fix unpaired spin lock
N/A

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-11 21:36:51 +08:00
Tiago Medicci Serrano
f3ec1bd60c xtensa/esp32s3: Update the reserved size for struct __lock
After https://github.com/apache/nuttx/pull/15075, the static
assertion at `nuttx/arch/xtensa/src/esp32s3/esp32s3_libc_stubs.c`
was being triggered when building any of the ESP32-S3's defconfigs.
This commit updates the reserved size to reflect the changes
introduced by the related PR.
2024-12-11 21:36:20 +08:00
Jouni Ukkonen
8a7f96e7f4 arch/arm64/imx9: Fix usdhc dma receive
Invalidate cache when dma transfer is ready

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-12-11 21:35:41 +08:00
chao an
a75e2704dc mps2-an500/knsh: disable SPINLOCK to avoid build break
workaround for remove libc depends from kernel api

build break on phase 2 userspace link:

| arm-none-eabi-ld -o nuttx_user.elf --undefined=nsh_main --entry=nsh_main -T /nuttx/boards/arm/mps/mps2-an500/scripts/memory.ld \
| -T /nuttx/boards/arm/mps/mps2-an500/scripts/user-space.ld -L/nuttx/staging/ -L/nuttx/staging/ -L/nuttx/staging/ -L/nuttx/staging/ \
| -L/nuttx/staging/ -L/nuttx/staging/ mps_userspace.o --start-group -lproxies -lc -lmm -larch -lxx -lapps --end-group \
| "prebuilts/linux/gcc/arm/bin/../lib/gcc/arm-none-eabi/13.3.1/thumb/v7e-m+fp/hard/libgcc.a"
|
| arm-none-eabi-ld: /nuttx/staging//libc.a(lib_pathbuffer.o): in function `spin_unlock_wo_note':
| /nuttx/include/nuttx/spinlock.h:380:(.text.lib_get_pathbuffer+0x298): undefined reference to `g_irq_spin_count'
| arm-none-eabi-ld: /nuttx/include/nuttx/spinlock.h:380:(.text.lib_get_pathbuffer+0x29c): undefined reference to `g_irq_spin'
| arm-none-eabi-ld: /nuttx/staging//libc.a(lib_pathbuffer.o): in function `lib_put_pathbuffer':
| /nuttx/libs/libc/misc/lib_pathbuffer.c:147:(.text.lib_put_pathbuffer+0x210): undefined reference to `g_irq_spin_count'
| arm-none-eabi-ld: /nuttx/libs/libc/misc/lib_pathbuffer.c:147:(.text.lib_put_pathbuffer+0x214): undefined reference to `g_irq_spin'
| make[1]: *** [Makefile:61: nuttx_user.elf] Error 1
| make[1]: Leaving directory '/nuttx/boards/arm/mps/mps2-an500/kernel'
| make: *** [tools/Unix.mk:540: nuttx] Error 2

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-11 20:33:34 +08:00
chao an
7c4f7723d7 libc/chdir: replace heap alloc to path buffer to improve performance
realloc path buffer to avoid alloc from realpath()

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-11 20:33:34 +08:00
Nathan Hartman
5607eece84 Documentation: Tweak text about Zero Latency Interrupts
This is a follow-up to 366c8a5d94 (PR-15102).

* Documentation/guides/zerolatencyinterrupts.rst
  (Title): Make title case consistent.
  (Getting Back into the Game, Maskable Nested Interrupts): Clarify discussion
   about priorities.
  (Cortex-M3/4 Implementation): The first half of a sentence was deleted in
   366c8a5d9 because the Kconfig that was described there no longer exists:
   CONFIG_ARMV7M_USEBASEPRI. Write a new beginning for this sentence that
   matches current implementation.
  (Disabling the High Priority Interrupt): Change "cannot" to "must not be
   allowed to" to improve clarity.
  (Configuring High Priority Interrupts): Change "to NVIC" to "in NVIC" to
   improve clarity.
2024-12-11 01:27:48 +08:00
chao an
abb10a497a libc/chdir: chdir/fchdir should not depend on environment variables
This PR will still allow basic shell operations such as cd/ls/pwd to be used even when the environment is disabled.

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-11 00:34:25 +08:00
buxiasen
3164f201fb document/drivertest: add more information in drivertest
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-12-11 00:33:48 +08:00
Xiang Xiao
366c8a5d94 Documentation: Remove CONFIG_ARMV7M_USEBASEPRI from code base
since the basepri is always used without any configuraion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-12-10 10:42:32 -05:00
Gao Feng
10a1d17a85 xtensa/esp32s3: add lock for async operation work
g_work as singleton can be changed by context switching,
but previous one async operation have not finished yet.
2024-12-10 22:01:43 +08:00
meijian
d1786507b6 net/tcp_timer: fix tcp RTO abnormally large after retransmission occurs
when tcp retransmission only double conn->timer in Karn(tcp_timer.c L602), after retransmission in Jacobson
M is is now rtt test will become a negative value.
```
  signed char m;
  m = conn->rto - conn->timer; // M is now rtt test

  /* This is taken directly from VJs original code in his paper */

  m = m - (conn->sa >> 3);
  conn->sa += m;              //conn->sa is a negative value
  if (m < 0)
	{
	  m = -m;
	}

  m = m - (conn->sv >> 2);
  conn->sv += m;
  conn->rto = (conn->sa >> 3) + conn->sv; //rto
```
For example,we lost one ack packet, we will set conn->timer = 6 by backoff,conn->rto still 3.
After retransmission we will Do RTT estimation, then will get
```
conn->sa = 253
conn->rto = 46
```
Then if any packets lost it will wait for a long time before triggering a retransmission.

Test method.
We can reproduce this issue by adding drop ACK packets in tcp_input, and debug conn->rto after Jacobson.

Signed-off-by: meijian <meijian@xiaomi.com>
2024-12-10 22:00:55 +08:00
zhangyuan29
fb4a246fcc tools/ci: change sem_init_6_1 to support skip result
After SEM_VALUE_MAX change to INT_MAX, need to support
skip result.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-10 22:00:42 +08:00
zhangyuan29
46701fa30c arm/lpc17xx: disable mqueue sysv
mqueue sysv not used, remove to reduce sram usage

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-10 22:00:42 +08:00
zhangyuan29
b74a50775f sem: change sem wait to atomic operation
Add sem_wait fast operations, use atomic to ensure
atomicity of semcount operations, and do not depend
on critical section.

Test with robot:
before modify:
nxmutex_lock cost: 78 ns
nxmutex_unlock cost: 82 ns

after modify:
nxmutex_lock cost: 28 ns
nxmutex_unlock cost: 14 ns

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-10 22:00:42 +08:00