Commit graph

60363 commits

Author SHA1 Message Date
buxiasen
f8501fa3ea arch/x86_64: add ARCH_HAVE_ELF_EXECUTABLE
Able to support kernel build apps debug

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-23 23:29:51 +08:00
buxiasen
a0fdb7f63b arm/goldfish: add ARCH_HAVE_ELF_EXECUTABLE
Able to support kernel build apps debug

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-23 23:29:51 +08:00
simbit18
5c02379548 Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2025-01-23 23:01:54 +08:00
hujun5
aa9f366eec x86_64: fix regression https://github.com/apache/nuttx/pull/15651
reason:
In x86_64, tcb->xcp.regs is always valid, and we obtain the location
where the context is saved through irq_xcp_regs every time an interrupt occurs.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-23 21:46:27 +08:00
wangzhi16
b0af946b7a Because sched_lock is now called in spin_lock_irqsave, there is no need to call it explicitly.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-23 20:43:51 +08:00
hujun5
b69111d16a spinlock: add sched_lock to spin_lock_irqsave
reason:
We aim to replace big locks with smaller ones. So we will use spin_lock_irqsave extensively to
replace enter_critical_section in the subsequent process. We imitate the implementation of Linux
by adding sched_lock to spin_lock_irqsave in order to address scenarios where sem_post occurs
within spin_lock_irqsave, which can lead to spinlock failures and deadlocks.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-23 19:58:49 +08:00
hujun5
914ae532e6 sched: remove csection and reduce the interrupt disabling time in sched_[un]lock
reason:
1 Accelerated the implementation of sched_lock, remove enter_critical_section in sched_lock and
only enter_critical_section when task scheduling is required.
2 we add sched_lock_wo_note/sched_unlock_wo_note and it does not perform instrumentation logic

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-23 19:58:49 +08:00
hujun5
b49f4286fb spinlock: Due to semantic inconsistency, remove/rename some functions with the _wo_note suffix.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-23 19:58:49 +08:00
tengshuangshuang
c6858061ed nuttx/boards:fix kconfig under apps/testing folder that change config-testing-mm to config-testing-heap
Under apps/testing folder, the macro of CONFIG_TESTING_MM is changed to CONFIG_TESTING_HEAP.
So we need to update the defconfig containing CONFIG_TESTING_HEAP in the nuttx/boards folder.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2025-01-23 18:19:02 +08:00
chao an
5de6f7f6fd serial/uart_ram: update lower buffer offset if previous send completes
UART RAM will have probabilistic bubble time during continuous transmission.
Update the offset after sending to avoid this problem.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-23 18:14:48 +08:00
chao an
45f2a4b2cb drivers/rpmsg_port_uart: remove debug message of datalen
datalen message after file_read is always 0

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-23 18:14:16 +08:00
chao an
801cd455ef sim/posix/uart: add host_printf() to debug some critical issue
Sometimes we need to bypass the system to debug some issue in critical sections

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-23 16:14:36 +08:00
wangmingrong1
49460518a9 Doc: Fortify Instructions
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-23 15:36:14 +08:00
wangmingrong1
7774271ad6 Docu: Stack overflow check
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-23 14:14:38 +08:00
chao an
cefb6cbd00 sim/rpmsg_uart: add sim rpmsg uart support
add sim_rpmsg_port_uart.c to verify the rpmsg port uart wrapper layer,

The physical transport layer could be:
1. SIM_RAM_UART(current)
2. SIM_UART(through "socat" virtual "/dev/pts/*", "socat" could monitor the bus data)

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-23 10:41:38 +08:00
chenxiaoyi
de55f64a7f xtensa: inline up_cpu_index
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2025-01-23 10:24:43 +08:00
Michal Lenc
d9270f9ea8 bch: add BIOC_DISCARD ioctl that discards cached sector
This forces the bch layer to read the sector from the physical device
instead of using the cached values. It is necessary to call when the
device is updated from the different source than bch, for example
erased by the MTD ioctl command.

It also has to invalidate readahead buffer from FTL if option
CONFIG_DRVR_READAHEAD is set.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-01-23 02:35:46 +08:00
simbit18
4050c79505 [cmake] savedefconfig.cmake: fix EOL changes to defconfig files on Windows
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   ../../boards/arm/stm32/nucleo-l152re/configs/nsh/defconfig

no changes added to commit (use "git add" and/or "git commit -a")
2025-01-23 02:34:50 +08:00
hujun5
a095b1d6a6 arch: set (*running_task)->xcp.regs to NULL when exit from irq/exception
reason:
(*running_task)->xcp.regs is invalid when in threadcontext, we marke it as NULL to avoid misusage

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-22 23:52:17 +08:00
wangjianyu3
4211ce3212 drivers/rpmsg: update format string
The `file_write()` may return negative `errno`.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-01-22 23:18:36 +08:00
wangmingrong1
cd9f2d7099 Docu/gcov: Modify the description and fix the script error
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-22 21:41:06 +08:00
Ville Juven
aefafc45e9 riscv/context_switch: Set tp when a context switch occurs
This removes the need to call nxsched_self upon exception return. Later
with a bit of added logic, it is possible to use tp in kernel to store and
read the current tcb.

Note: setting tp in riscv_restorecontext is too late for this, as
this_task() points to the (next) ready-to-run task, thus tp should be
updated when the rtr list is updated (via up_update_task, which does not
exist for risc-v yet)
2025-01-22 20:34:25 +08:00
wangzhi16
099801630d Use small lock to protect resources related to irq in arch risc-V and xtensa.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-22 20:30:20 +08:00
wangzhi16
0b542ff824 Use small lock to protect resources related to lpi2c.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-22 20:30:15 +08:00
Eero Nurkkala
9424abf3d6 risc-v/mpfs: ddr: lock segmentation registers
Set the LOCKED bit when the final ddr segmentatition is
in place. Otherwise the system is prone to potential
security issues if the config is altered later. Once the
LOCKED bit is set, the register may no longer be changed.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2025-01-22 20:29:43 +08:00
Yanfeng Liu
4e8bcf1ba4 procfs/meminfo: align page fields to columns
meminfo before:
```
      total       used       free    maxused    maxfree  nused  nfree name
    3129344      10824    3118520      11184    3118104     25      2 Kmem
   13631488    1114112   12517376   12517376 Page
```
and after:

```
      total       used       free    maxused    maxfree  nused  nfree name
    3129344      10824    3118520      11184    3118104     25      2 Kmem
   13631488    1114112   12517376              12517376               Page
```
Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-22 20:29:07 +08:00
Yanfeng Liu
944f6ceeec libc/modlib: guard modname field usage
This guards `.modname` field usage with same condition as header
definitions.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-22 20:29:07 +08:00
chao an
ada75b0b93 drivers/rpmsg: fix compiler warning
In file included from nuttx/drivers/rpmsg/rpmsg_port_uart.c:27:
nuttx/drivers/rpmsg/rpmsg_port_uart.c: In function ‘rpmsg_port_uart_send_connect_req’:
nuttx/drivers/rpmsg/rpmsg_port_uart.c:219:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  219 |       rpmsgerr("Send connect request failed, ret=%d\n", ret);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                         |
      |                                                         ssize_t {aka long int}
nuttx/drivers/rpmsg/rpmsg_port_uart.c:219:51: note: format string is defined here
  219 |       rpmsgerr("Send connect request failed, ret=%d\n", ret);
      |                                                  ~^
      |                                                   |
      |                                                   int
      |                                                  %ld
nuttx/drivers/rpmsg/rpmsg_port_uart.c: In function ‘rpmsg_port_uart_send_connect_ack’:
nuttx/drivers/rpmsg/rpmsg_port_uart.c:235:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
  235 |       rpmsgerr("Send connect ack failed, ret=%d\n", ret);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~
      |                                                     |
      |                                                     ssize_t {aka long int}
nuttx/drivers/rpmsg/rpmsg_port_uart.c:235:47: note: format string is defined here
  235 |       rpmsgerr("Send connect ack failed, ret=%d\n", ret);
      |                                              ~^
      |                                               |
      |                                               int
      |                                              %ld

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 16:54:14 +08:00
Jukka Laitinen
20f15130aa arch/arm64/src/imx9/imx9_lpuart.c: Call uart_xmitchars when txint is enabled
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-22 16:53:45 +08:00
chao an
ff50bc191c fs/uio: do not overwrite the return value
Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 16:45:46 +08:00
chao an
2c9b287b2e fs/vfs: initialize uio only if lower implement readv/writev
to simple signle read/write logic, initialize uio only if lower implement readv/writev

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 16:45:46 +08:00
chao an
9fb96af643 sim/nsh: enable debug assertion by default
In order to more easily catch the assertion issue in advance

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 16:36:02 +08:00
liwenxiang1
7eccf4493a arch/x86_64:Adapt coredump
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-01-22 16:35:32 +08:00
Neo Xu
ec9b079c04 arch/x86-64: fix cmake compile error
-- Configuring done
CMake Error at cmake/nuttx_add_library.cmake:142 (add_library):
  Cannot find source file:

    /vela/nuttx/libs/libc/machine/x86_64/arch_elf.c
Call Stack (most recent call first):
  libs/libc/CMakeLists.txt:22 (nuttx_add_kernel_library)

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-01-22 16:35:32 +08:00
Jukka Laitinen
c00b5862c7 arch/risc-v/src/mpfs/mpfs_ddr.c: Fix CA training verify step
Corrections to CA training verify step. The original copied from HSS didn't
make sense in all aspects:
- The check is not per lane, so it should be out of the "for (lane_sel" loop.
- The check wasn't proper. The expected outcome is just a vector of increasing numbers
  separated enough

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-22 16:32:06 +08:00
Jukka Laitinen
6ca6608dea arch/risc-v/src/mpfs/mpfs_ddr.c: Clean up the TXDLY verify step
Just verify that the delay for the selected clock != 0

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-22 16:32:06 +08:00
Jukka Laitinen
e8cc1d3c4f arch/risc-v/src/mpfs/mpfs_ddr.c: Add read dq/dqs eye centering test
After read training, check also that the eye is centered properly. Sometimes
after the training the width is long enough, but it is not centered.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-22 16:32:06 +08:00
Jukka Laitinen
f695fc6884 arch/risc-v/src/mpfs: Disable external interrupts on all SMP harts
Interrupts on MPFS platform are currently served on the hart, on
which the up_enable_irq was called.

Call to up_disable_irq may execute on different hart than on which
the up_enable_irq was executed. In this case the interrupt is not
disabled currently.

While there is nothing fancy (irq affinity control or such), an
easy way to fix this is to simply disable the irq on all harts.

This also changes the prototypes of mpfs_plic_get_iebase and
mpfs_plic_get_claimbase to get the hart id as an argument, in
order to accomplish this.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-22 15:30:32 +08:00
chao an
9db4d327fa sim/virtio: fix typo sim_rpmsg_vritio.c -> sim_rpmsg_virtio.c
Build Error:
CMake Error at arch/sim/src/sim/CMakeLists.txt:278 (target_sources):
  Cannot find source file:

    /home/archer/code/nuttx/n3/nuttx/arch/sim/src/sim/sim_rpmsg_vritio.c

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 15:28:13 +08:00
wangzhi16
bed3bd0852 Use small lock to protect resources related to irq in arch avr, hc, mips and or1k.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-22 15:27:30 +08:00
wangjianyu3
72d793b26e Documentation: Add usage of Wireshark for USB monitor
For: https://github.com/apache/nuttx/issues/15595
Ref: https://wiki.wireshark.org/CaptureSetup/USB

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-01-22 15:17:38 +08:00
YAMAMOTO Takashi
ab9522fd23 file_readv_compat: add a comment to explain limitations 2025-01-22 14:29:35 +08:00
chao an
0ffb0b716e drivers/iovec: revert vector io implement from loop/null/zero driver
basic driver does not need such complex wrapper

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 11:29:39 +08:00
wangmingrong1
5918335b7f armv8m: Default open hardware stack check
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-21 11:55:10 -03:00
Yanfeng Liu
1828d09b2a boards/qemu-armv7a: revises kernel build sample config
This adjusts `qemu-armv7a:knsh` with following changes:

- use smaller flash/memory so that `-m 1024` can be omitted.
- use ELF_EXECUTABLE for apps to allow easier app debugging.
- enable graceful shutdown from NSH command.
- enable more cases of ostest (e.g. vfork, pthread_exit etc).

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-21 19:50:09 +08:00
xuxingliang
dc3ab55e6d libc/gdbstub: avoid RLE decoding special characters
Read/write special data like 0x2a2a2a2a will trigger this issue.
The current GDB implementation has this flaw. GDB processes the RLE
decoding before espaping the data, make it impossible to repeate special
characters.

The details can be seen in GDB source code remote.c
remote_target::read_frame function.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-21 18:26:42 +08:00
xuxingliang
03765a6a1e libc/gdbstub: add memory binary read support
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-21 18:26:42 +08:00
xuxingliang
b1d0b5a4d6 libc/gdbstub: support binary data sent from stub
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-21 18:26:42 +08:00
Tim Kan(SSS)
4dd042d00b fix(libc): lib_strftime %F month number off-by-one
Corrects the month number output for the %F format specifier in lib_strftime.
2025-01-21 18:24:35 +08:00
chenwen@espressif.com
1fb09dbb7f xtensa/esp32s3: Fix wrong dummy length in mode register reading
1. Corresponding link: 54a9386b2e
2025-01-21 16:25:33 +08:00