Commit graph

57030 commits

Author SHA1 Message Date
Windrow14
90870ae62e 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 18:19:38 +08:00
Jukka Laitinen
1a74a44022 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-13 18:19:38 +08:00
chao an
200015d514 binfmt/exec: initialize binary_s to empty to avoid invaild access
Signed-off-by: chao an <anchao@lixiang.com>
2024-12-13 18:19:13 +08:00
chao an
c6dfdbad41 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-13 18:19:13 +08:00
chao an
5abcc49789 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-12 22:00:45 +08:00
chao an
2ccdd947a1 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-12 22:00:45 +08:00
chao an
bf27e4d75d esp/mcpwm: fix unpaired spin lock
N/A

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-12 22:00:28 +08:00
Tiago Medicci Serrano
6eb9b09960 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-12 22:00:07 +08:00
Jouni Ukkonen
75ef5ea11e 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-12 21:58:39 +08:00
anjiahao
5e4c14d8e8 procfs:fix cmdline overflow
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-12-12 21:58:23 +08:00
chao an
a94264ea00 arm/cxd56xx: Add g_ prefix to rtc spin lock
continue work of a68b00206b

| commit a68b00206b
| Author: hujun5 <hujun5@xiaomi.com>
| Date:   Mon Dec 9 20:48:09 2024 +0800
|
|     cxd56_rtc.c: use small lock in arch/arm/src/cxd56xx/cxd56_rtc.c
|
|     reason:
|     We hope to remove all instances of spin_lock_irqsave(NULL).
|
|     Signed-off-by: hujun5 <hujun5@xiaomi.com>

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-11 20:35:45 +08:00
buxiasen
52c4408db9 document/drivertest: add more information in drivertest
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-12-11 20:35:28 +08:00
Nathan Hartman
532bf64515 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 20:35:28 +08:00
Xiang Xiao
34d1a7fd54 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-11 20:35:28 +08:00
chao an
32ab151712 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 20:35:00 +08:00
meijian
3fdcd065cf 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-11 20:34:23 +08:00
hujun5
3063f2c0e0 litex_serial: use small lock in arch/risc-v/src/litex/litex_serial.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-11 00:52:20 +08:00
hujun5
7e5088f4ea cxd56_rtc.c: use small lock in arch/arm/src/cxd56xx/cxd56_rtc.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-10 21:59:17 +08:00
hujun5
ecab220c39 max32660_rtc: use small lock in arch/arm/src/max326xx/max32660/max32660_rtc.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-10 21:59:06 +08:00
simbit18
6b7722cfb4 build(CMAKE): fix pac sim elf ONLY in Linux platform
avoid SIM compilation post build issues on other platforms

same fix for build with make
https://github.com/apache/nuttx/pull/14800
2024-12-10 21:57:55 +08:00
hujun5
c8bdfb537e lc823450_dma: use small lock in arch/arm/src/lc823450/lc823450_dma.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-10 21:57:44 +08:00
hujun5
bae0b64da3 s32k3xx_serial: use small lock in arch/arm/src/s32k3xx/s32k3xx_serial.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-10 21:57:34 +08:00
simbit18
eec97064d7 fix nxstyle
Removed extra spaces from .h and .c files
2024-12-10 21:57:22 +08:00
Alan Carvalho de Assis
0164e09339 Doc: Fix kernel thread API
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-12-10 21:57:09 +08:00
Alan Carvalho de Assis
e268b2a5b9 Fix small typo in rp2040_adc.c 2024-12-10 21:57:09 +08:00
chao an
01e76ddcd9 limits/path: replace CONFIG_PATH_MAX to PATH_MAX to ensure consistency
replace CONFIG_PATH_MAX to PATH_MAX to ensure consistency

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-10 21:56:57 +08:00
wangjianyu3
7562aff615 fs/tmpfs: Skip any slash at the beginning of relpath
`tmpfs_stat()` fails when relpath start with slash.

Log

  Host
    $ adb -s 1234 pull /tmp/subdir
    adb: warning: skipping special file '/tmp/subdir/uname' (mode = 0o0)
    /tmp/subdir/: 0 files pulled. 1 file skipped.

  Device
    state_process_list (411): stat failed </tmp/subdir//uname> -1 22

Ref: https://github.com/apache/nuttx/blame/master/libs/libc/stdlib/lib_realpath.c#L111
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-12-09 21:20:20 +08:00
hujun5
16b63ed837 armv7/8m: fix regresion from https://github.com/apache/nuttx/pull/14881
reason:
svc call may trigger hardfault

Background
    The origin of this issue is our desire to eliminate the function of storing
"regs" in g_current_regs and instead utilize (*running_task)->xcp.regs for storage.
The benefits of this approach include faster storage speed and
avoiding multiple accesses to g_current_regs during context switching,
thus ensuring that whether returning from an interrupt or an exception,
we consistently use this_task()->xcp.regs

Issue Encountered
    However, when storing registers, we must ensure that (running_task)->xcp.regs is invalid
so that it can be safely overwritten.
According to the existing logic, the only scenario where (running_task)->xcp.regs
is valid is during restore_context. We must accurately identify this scenario.
Initially, we used the condition (running_task)==NULL for this purpose, but we deemed
this approach unsatisfactory as it did not align well with the actual logic.
(running_task) should not be NULL. Consequently, we adopted other arch-specific methods for judgment,
but due to special logic in some arch, the judgment was not accurate, leading to this issue.

Solution:
    For armv6-m, we haven't found a more suitable solution, so we are sticking with (*running_task)==NULL.
    For armv7-m/armv8-m, by removing support for primask, we can achieve accurate judgment.

    PRIMASK is a design in armv6-m, that's why arm introduce BASEPRI from armv7-m.
It's wrong to provide this option for armv7-m/armv8-m arch.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-09 21:20:06 +08:00
hujun5
702affa63b armv6m: fix regresion from https://github.com/apache/nuttx/pull/14881
reason:
svc call may trigger hardfalt

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-09 21:20:06 +08:00
Alin Jerpelea
d368c0cc04 arch/arm: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-06 22:31:35 +08:00
lipengfei28
aa1df4e9a9 pci: fix pci dev alloc bridge mem error
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-12-06 21:12:24 +08:00
wangmingrong1
6e3f8d0356 virtio: fix compile error
CC:  virtio/virtio-mmio.c virtio/virtio-mmio.c: In function 'virtio_mmio_config_virtqueue':
virtio/virtio-mmio.c:346:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  346 |       addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.desc);
      |              ^
virtio/virtio-mmio.c:350:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  350 |       addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.avail);
      |              ^
virtio/virtio-mmio.c:354:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  354 |       addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.used)

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-06 20:32:21 +08:00
wangjianyu3
0481533833 boards: Update configs about system/usbmsc
The Kconfig of system/usbmsc has updated to support setting paths that bind to LUN at runtime.
More details: https://github.com/apache/nuttx-apps/pull/2876

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-12-06 13:38:23 +08:00
Andreea Luca
e6a01a0167 Integrated feedback
Integrated feedback: refreshed mqttc defconfig file.
2024-12-06 10:59:17 +08:00
Andreea Luca
666d55a8f4 Add configs for esp-sparrow-kit
Add configs for esp-sparrow-kit, to ease enabling wifi
and mqttc applications
2024-12-06 10:59:17 +08:00
hujun5
1e49cb4828 armv7-a/armv7-r/armv8-r: percpu reg store this_task
This is continue work of https://github.com/apache/nuttx/pull/13726

We can utilize percpu storage to hold information about the
current running task. If we intend to implement this feature, we would
need to define two macros that help us manage this percpu information
effectively.

up_this_task: This macro is designed to read the contents of the percpu
register to retrieve information about the current
running task.This allows us to quickly access
task-specific data without having to disable interrupts,
access global variables and obtain the current cpu index.

up_update_task: This macro is responsible for updating the contents of
the percpu register.It is typically called during
initialization or when a context switch occurs to ensure
that the percpu register reflects the information of the
newly running task.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-06 09:27:33 +08:00
Alin Jerpelea
344968b8c2 arch/arm: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-06 09:25:23 +08:00
Anner J. Bonilla
497c9b9309 Update cdc.h typo
Fixed typo
2024-12-06 09:23:55 +08:00
xuxin19
f2b4ab283f cmake(bugfix):fix CMake build break on MacOS
report by https://github.com/apache/nuttx/issues/14936

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-12-05 23:36:16 +08:00
Xiang Xiao
60fb917eda Remove FAR from 32/64bit arch
since these arch doesn't distinguish between near and far pointers

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-12-05 22:55:39 +08:00
hujun5
cbd07a86c9 s32k1xx_serial: arch/arm/src/s32k1xx/s32k1xx_serial.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-05 22:16:45 +08:00
cuiziwei
ae5c7a7fd8 libcxxabi: Soft link the libcxxabi header file to nuttx/include.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-12-05 21:56:23 +08:00
wangmingrong1
75fc19d729 virtio: Fix the problem of incorrect setting of virtio queue address under tags kasan
There is also a printing error due to https://github.com/apache/nuttx/pull/15043:
Configuration/Tool: rv-virt/virt_nsh
In file included from virtio/virtio-mmio.c:29:
virtio/virtio-mmio.c: In function 'virtio_mmio_init_device':
Error: virtio/virtio-mmio.c:826:14: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     uint32_t {aka long unsigned int}
virtio/virtio-mmio.c:826:24: note: format string is defined here
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |                       ~^
      |                        |
      |                        int
      |                       %ld
cc1: all warnings being treated as errors
make[1]: *** [Makefile:109: virtio-mmio.o] Error 1
make[1]: Target 'libdrivers.a' not remade because of errors.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 21:23:30 +08:00
hujun5
1ab1dbc0f0 wm8776: use small lock in drivers/audio/wm8776.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-05 21:22:32 +08:00
buxiasen
617fee66ff Revert "arm/rp2040: use custom vectors to make smp_call work with exception_common"
This reverts commit 9464afe7c3.
2024-12-05 20:42:22 +08:00
buxiasen
108aaf8bbb Revert "arm/lc823450: use custom vectors to make smp_call work with exception_common"
This reverts commit c2cb58ff31.
2024-12-05 20:42:22 +08:00
buxiasen
9473cee85b Revert "arm/cxd56: use chip specific vectors to allow smpcall update regs"
This reverts commit 4a1afab88e.
2024-12-05 20:42:22 +08:00
buxiasen
af3c159cff arm-v6/7/8m: sigaction forward to pendsv
For exception directly, tcb->xcp.regs should not be used.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-12-05 20:42:22 +08:00
buxiasen
55822753be arm-v6/7/8m: sigaction should use running_task
Nested irq possible cause readytorun not match with regs

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-12-05 20:42:22 +08:00
wangmingrong1
909bf2dbb4 kasan/globals: fix compile error
../../../mm/kasan/global.c:58:44: error: type of 'g_global_region' does not match original declaration [-Werror=lto-type-mismatch]
   58 | extern const struct kasan_global_region_s *g_global_region[];
      |                                            ^
kasan_globals.tmp:3:21: note: 'g_global_region' was previously declared here
    3 | const unsigned long g_global_region[] = {
      |                     ^
lto1: all warnings being treated as errors

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 20:37:47 +08:00