Commit Graph

52665 Commits

Author SHA1 Message Date
p-szafonimateusz
7d95bec148 qemu-intel64: move PCI initialization back to board logic
this partly revert 4123615621 which works OK for PCI serial and network cards
but breaks QEMU EDU due to usage of sem and usleep in IDLE thread context.
Another solution will be provided later.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-03-07 15:03:40 -03:00
chao an
beb2af8378 sched/group: skip child wait if here is only self in member list
Skip the child wait if here is only self in member list,
since the members of the task group should be 1 if task exit.

Fix Regression issue that the task could not terminate normally.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-07 22:53:19 +08:00
chao an
2b7742fc08 binfmt/task/member: remove invaild membership reverse
As long as the process id reversed between parent and child,
the process member ship will automatically reversed.

Fix Regression by PR #11848:

| commit ec08031e4b
| Author: chao an <anchao@lixiang.com>
| Date:   Wed Mar 6 10:13:47 2024 +0800
|
|     sched/group: change type of task group member to single queue
|
|     Change the type of task group member to single list chain to
|     avoid accessing the memory allocator to improve the performance
|
|     Signed-off-by: chao an <anchao@lixiang.com>

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-07 22:53:19 +08:00
Xiang Xiao
1ba065db87 drivers/pipe: Change to the block mode by file_ioctl(FIONBIO)
it's simpler and safer than file_fcntl(F_SETFL)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-07 10:09:35 -03:00
Xiang Xiao
64ea027b1a Replace PRIxPTR with %p and remove the cast of (uintptr_t)
The cast of (uintptr_t) is not necessary, and it is better to use %p

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-07 09:59:42 -03:00
Yanfeng Liu
cc389b1984 riscv/nuttsbi: revise PMP manipulation in NuttX SBI
Current NuttX SBI assumes empty PMP settings but that is not always
true, for example some bootloaders may have PMP entries locked before
handling over to NuttX. This patch revises it by not using hardcoded
PMP region number.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-07 09:58:55 -03:00
Tiago Medicci Serrano
522c5c0eac boards/esp32: Increase init task stack size to 3072
This is done to avoid casual stack overflows. Especially after
PR #11777, that increased stack usage.
2024-03-07 20:47:40 +08:00
chenwen@espressif.com
53f50c8183 xtensa/esp32s3: Configure DMA maximum buffer size based on access to different RAM
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-03-07 13:32:28 +08:00
chao an
ec08031e4b sched/group: change type of task group member to single queue
Change the type of task group member to single list chain to
avoid accessing the memory allocator to improve the performance

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-07 12:39:29 +08:00
chao an
eb6fe17baa nuttx/list/queue: add helper macro list/sq/dq_is_singular()
add helper macro list/sq/dq_is_singular() to tests whether a list has just one entry.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-07 12:39:29 +08:00
chao an
d29748258b fs/inode: add pre-allocated task files to avoid allocator access
Pre-allocated files to avoid allocator access during thread creation
phase, For functional safety requirements, increase
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK could also avoid allocator access
caused by the file descriptor exceeding the limit.

For Task Termination, the time consumption will be reduced ~3us (Tricore TC397 300MHZ):
10.65(us) -> 7.35(us)

NOTE:
This commit will not waste of extra heap, just pre-allocates the list of files for task_group.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-07 10:58:55 +08:00
hujun5
236ec9844f fs: dup3 should pass the fdcheck & fdsan
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
ligd
9f51c47c10 fs: remove un-useful memcpy() in nx_close_from_tcb()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
ligd
e1cd082c29 fs: enhance dup3() mulit-threads saftey
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
ligd
60b25556d4 fs: enhance file_allocate_from_tcb() mulit-threads saftey
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
hujun5
577eb47966 fdcheck: Enable fdcheck to automatically detect ownership of fd
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-03-07 09:08:48 +08:00
Jorge Guzman
4b5ad956c3 stm32h7/linum-stm32h753bi: Add support to eeprom using the i2c3
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2024-03-07 01:55:56 +08:00
Sammy Tran
b4b7710c63 Disable interrupt during FTFC operation 2024-03-06 13:31:48 -03:00
chao an
89bd6ab74a sched/pthread: fix memory leak of pthread_tcb_s
pthread tcb should be released appropriately

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-06 20:37:06 +08:00
chenwen@espressif.com
09960c5c7d xtensa/esp32s3: Fix the issue of erasing a wide range of flash sectors
Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-03-06 18:13:20 +08:00
Yanfeng Liu
850e64bc19 riscv/k230: remove unnecessary ARCH_LAZYFPU from defconfigs
The ARCH_LAZYFPU is unnecessary for risc-v so we can remove them from
the defconfigs.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-06 18:10:48 +08:00
chao an
6233680cad nuttx/sched: remove unused group link node
This change is missing from the below commit:

| commit 7cb1f3b3c0
| Author: chao an <anchao@lixiang.com>
| Date:   Tue Mar 5 10:23:30 2024 +0800
|
|     sched/group: replace group_findbypid to task_getgroup
|
|     Task group could find from process id, replace group_findbypid to
|     task_getgroup to simplify the search logic
|
|     Signed-off-by: chao an <anchao@lixiang.com>

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-06 13:32:02 +08:00
Yanfeng Liu
a66c7c3ee1 comments/docs: fix typos in comments
This fix some typos in comments.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-06 13:31:50 +08:00
trns1997
54e9e582d5 Use C++ standard lib from toolchain
Signed-off-by: trns1997 <trns1997@gmail.com>
2024-03-06 08:42:44 +08:00
ligd
113ab704c7 goldfish & qemu: handle MMU table and CONFIG_RAM_END
Reproduce:

configure:
./tools/configure.sh qemu-armv7a:nsh -j8
open kasan:
CONFIG_MM_KASAN=y
run:
qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
error:
run hanged

Rootcause:

In Qemu armv7a, the ram-end reserved for MMU PGTABLE:

And the up_allocate_heap()  directly use the ram-end for heap in arch/arm/src/common/arm_allocateheap.c

*heap_size  = CONFIG_RAM_END - g_idle_topstack;

Then they are conflict.
Usually, we won't use the heap end, so can't find the error.
BUT, the KASAN will use the heap end for shadow, so found the error.

Resolve:

up_allocate_heap() consider of MMU, re-define the RAM_END at chip.h

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-06 09:26:44 +09:00
raiden00pl
a20b3e8335 arch/nrf{52|53|91}/spi: fix error message
wrong parameters were passed to spierr()
2024-03-06 00:50:00 +08:00
Eren Terzioglu
8b931b43b1 boards/esp32c6: Remove sotest config for esp32c6
boards/esp32c3: Add ostest config for esp32c3
boards/esp32h2: Add ostest config for esp32h2
2024-03-06 00:49:50 +08:00
chao an
8592e7e009 sched/task: save argument counter to avoid limit check
The maximum startup parameters have been checked accordingly in nxtask_setup_stackargs(),
let us save argument counter to avoid limit check.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-05 22:25:28 +08:00
chao an
0902231deb drivers/sensors: fix comments typo
Signed-off-by: chao an <anchao@lixiang.com>
2024-03-05 22:25:28 +08:00
chao an
7cb1f3b3c0 sched/group: replace group_findbypid to task_getgroup
Task group could find from process id, replace group_findbypid to
task_getgroup to simplify the search logic

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-05 22:24:52 +08:00
chao an
dfd1e38b40 sched/environ: check envcp validity before hold sched_lock()
check envcp validity before hold sched_lock() to avoid unnecessary schedule lock

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-05 22:24:14 +08:00
Marco Casaroli
73c4f2f1e7 fix(esp32s3_spiflash_mtd): debug type specifiers
These log messages are wrong if we use CONFIG_FS_LARGEFILE.
2024-03-05 22:23:50 +08:00
ligd
d45a45da94 sched.h: add empty realize when NO CONFIG_SMP
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-05 17:50:58 +08:00
ligd
27de65edc0 sched.h: fix CPU_EQUAL(s1, s2) write error
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-05 17:50:58 +08:00
Michal Lenc
44a087111d samv7: add support for USART TX DMA transfers
This commit adds support for TX DMA transfers for USART peripheral. Code
refactor in sam_serial.h was also required in order to have correct
defines for all possible cases (both RX and TX DMA used, just one used,
none used).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-03-05 09:48:03 +08:00
Tiago Medicci Serrano
dcad39a962 arch: Fix style warnings regarding included header files
This commit fixes style warnings regarding including header files
outside the `Included Files` section.
2024-03-05 09:45:49 +08:00
Tiago Medicci Serrano
658dd94863 procfs: Change variable name to ease debugging 2024-03-05 09:45:49 +08:00
Tiago Medicci Serrano
e287ed9090 documentation: implement on-demand paging for RISC-V devices
It documents how the on-demand paging was implemented for RISC-V
devices and how it can be extended to other architectures.
2024-03-05 09:45:49 +08:00
Tiago Medicci Serrano
c67502d9b4 riscv: Implement page-fault exception and on-demand paging
When an application is being loaded `up_addrenv_create ` calls
`create_region` to create the address environment. Only the first
entry is mapped when the region is created. Virtual memory that is
not mapped will trigger an exception when accessed. Other memory
pages are allocated and mapped on-demand. This enables setting
larger heap and stack for the process without compromising the
overall system memory.
2024-03-05 09:45:49 +08:00
Tiago Medicci Serrano
ae9ef972c0 paging: Rename existing CONFIG_PAGING to CONFIG_LEGACY_PAGING
Current `CONFIG_PAGING` refers to an experimental implementation
to enable embedded MCUs with some limited RAM space to execute
large programs from some non-random access media.

On-demand paging should be implemented for the kernel mode with
address environment implementation enabled.
2024-03-05 09:45:49 +08:00
ligd
264e8116b0 armv7-a/r: use _ebss as idle stack both in SMP mode or not
this commit fix:
7d45afe871

which in PR:
https://github.com/apache/nuttx/pull/11814

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-04 20:42:21 -03:00
Saurav Pal
1bec133385 drivers/mtd/mtd_nandram: Adds virtual NAND Flash device simulator.
Adds virtual NAND Flash device simulator, NAND flash log wrapper, and documentation for it.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-03-04 10:38:08 -03:00
SPRESENSE
3b3f2d97e9 arch: cxd56: Follow interface change of set_buf() operation
set_buf() operation is changed to have the argument about
format. Follow the change.
2024-03-04 20:39:44 +08:00
Philippe Leduc
8de922186e Exported CMake toolchain file is broken when the target is linked against NuttX and another library that shall also be linked against NuttX too.
Fix: ensure that NuttX libraries are linked at the end as they are the root of linkage dependency tree.
2024-03-04 20:38:37 +08:00
chao an
9489953230 sched/tcb: add free tcb flag to support static tcb
Add support for static tcb, applications in some special case can
initialize system resources in advance through static tcb.

|  static struct task_tcb_s g_tcb;
|
|  memset(&g_tcb, 0, sizeof(struct task_tcb_s));
|  g_tcb.cmn.flags = TCB_FLAG_TTYPE_KERNEL;
|  nxtask_init(&g_tcb, "PTCB", 101, NULL, 1024, ptcb_task, NULL, NULL, NULL);
|
|  ...
|  nxtask_activate(&g_tcb.cmn);

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-04 20:05:11 +08:00
ligd
91f0a0f1a8 Revert "goldfish & qemu: handle MMU table and CONFIG_RAM_END"
This reverts commit 2f7b107608.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-04 18:08:15 +08:00
ligd
b599fdbc0e stm32: fix compile failed
Error: chip/stm32_sdmmc.c:1911:7: error: variable 'regaddress' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
 1911 |   if (priv->base == STM32_SDMMC1_BASE)

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-04 18:08:15 +08:00
chenrun1
3f872807bf sh:Change expansion path logic
We will first check whether the target file path exists. If it does not exist, we will check whether the common exists. If not, we will restore the path that should be spliced ​​at the beginning.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-03-04 01:18:45 +08:00
chenrun1
97da73d9b8 sh:Enhanced compilation system
We'll look for ETC resources from two paths
1.board/src/etc
2.common/etc

Search for the content in the board/src/etc directory first

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-03-04 01:18:45 +08:00
Yanfeng Liu
a4d61dea80 risc-v/k230: improvements to support K230 vendor u-boot
Previously we need turn off the PMP locks in K230 vendor u-boot to use
NuttX, this complicates the setup process. This patch supports running
NuttX with original vendor u-boot so that to reduce setup complexity.

It also enables empty NSH prompt string in AMP master config as the apps
side support is ready.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-03 12:04:14 -03:00