Commit graph

57069 commits

Author SHA1 Message Date
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
zhangyuan29
46f8b3adaf atomic: Unify the compare_exchange functions of nx and stdatomic
define nx_atomic_compare_exchange_weak and nx_atomic_compare_exchange_strong function

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-10 22:00:42 +08:00
simbit18
88239153b8 [sensors]: Removed the unnecessary inclusion of spi header files
- ina219
- apds9960
- veml6070

these sensors use i2c serial communication protocol
2024-12-10 21:59:31 +08:00
simbit18
e0106b00b3 docs: Fix example ina226
added example of doc ina226
2024-12-10 09:38:40 -03:00
wangmingrong1
79d0bfa8cc gcov.c: Add necessary instrumentation functions
(.text.ltp_interfaces_sem_unlink_2_2_main+0xd8): undefined reference to `__gcov_execlk'

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-10 19:42:31 +08:00
Gao Feng
1c7d81881c xtensa/esp32: encrypted MTD for partition offset
Non-encrypted mtd can not be used for encrypted device.

Even without SPI Flash encryption,
encrypted MTD also can be used to read no-encrypted data.
2024-12-10 18:15:47 +08:00
wangchen
993741f36e netconfig.h:add CONFIG_NET_USRSOCK & CONFIG_NET_IPv4 & CONFIG_NET_IPv6 to support communicating in slave core
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-12-10 18:14:26 +08:00
buxiasen
7887d9c6d0 syslog: allow microsecond on user specific time format
FORMAT_MICROSECOND depends on format is not required.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-12-10 18:14:12 +08:00
chao an
2f8d78ef64 libs/libc: rename LIBC_MAX_PATHBUFFER to LIBC_PATHBUFFER_MAX
Unified naming style:

if LIBC_PATHBUFFER
config LIBC_PATHBUFFER_MAX
...
config LIBC_PATHBUFFER_MALLOC
...
endif # LIBC_PATHBUFFER

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-10 16:26:12 +08:00
chao an
face32cd3c libs/libc: add a option to disable path buffer by default
If the current platform does not require a large PATH_MAX size support and toolchain supports alloca(),
we could turn off this option to improve performance.

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-10 16:26:12 +08:00
chao an
4a9a43771b 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-10 16:25:02 +08:00
chao an
afca1a819d 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 14:27:37 +08:00
Kyle Wilson
9b99493e14 Initial STM32H5 SPI Commit
Used STM32H7 spi driver as a base. The register set is nearly identical. All registers are named the same with the same offset. There are some bits within the registers that are different but are not referenced in stm32_spi.c. Therfore this driver may just work as is. I did modify the clock source selection for each SPI peripheral, but not much else. Differences in the registers were applied in hardware/stm32h5xxx_spi.h.

Added functionality to SPI to configure the SPI RCC clock.

Added SPI info to Kconfig, updated stm32_spi.c to select and set the RCC clock, and other minor updates.

Updated Pin Map for SPI, added CFG1_BPASS support

Fixed redefinition of GPIO_SPI6_SCK_2

Added SPI_MAX_KER_CK definition.

This definition was needed because the H50 chips allow a kernel clock of 250 MHz. However the datasheets for all other chips (H52, H53, H56, H57) have a max of 125 MHz.

Changed SPI Clock Source Configuration

Moved setting of SPIx clock sources to stm32h5xx_rcc.c. STM32_SPIx_FREQUENCY and STM32_RCC_CCIPR3_SPIxSEL are now defined in board.h. Added error checking in stm32_spi.c to make sure STM32_SPIx_FREQUENCY and STM32_RCC_CCIPR3_SPIxSEL are actually defined.

Style updates

Removed SPI Clock selection from Kconfig

Update arch/arm/src/stm32h5/stm32_spi.h

Co-authored-by: hartmannathan <59230071+hartmannathan@users.noreply.github.com>

Update arch/arm/src/stm32h5/Kconfig

Co-authored-by: hartmannathan <59230071+hartmannathan@users.noreply.github.com>

Update arch/arm/src/stm32h5/stm32_spi.h

Co-authored-by: hartmannathan <59230071+hartmannathan@users.noreply.github.com>
2024-12-10 09:32:10 +08:00
Alan Carvalho de Assis
2cc838aa40 Doc: Fix kernel thread API
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-12-10 09:28:20 +08:00