Commit Graph

55029 Commits

Author SHA1 Message Date
Jani Paalijarvi 3613eb209a arch/risc-v/src/mpfs/mpfs_corepwm.c: Disable PWM channels in setup
Set frequency to zero and disable channels in pwm_setup()
to avoid unexpected behaviour when starting PWM.

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
2024-09-25 21:47:15 +08:00
Jukka Laitinen 7e6e18697c arch/risc-v/src/mpfs: Remove CONFIG_MPFS_COREPWMx_PWMCLK configs
These are always the same as FPGA peripheral clock, so use that directly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-25 21:47:15 +08:00
Jukka Laitinen 5238c3bb25 drivers/mmcsd/mmcsd_sdio.c: Fix setting SDIO_WIDEBUS for SD cards
This corrects the setting widebus for SD cards, which was recently broken in 4f7f751d2a.

The if checking the priv->caps, priv->buswidth and IS_MMC has been wrong for
some time. The proper logic is that for MMC only the priv->caps is checked.
For SD card, both priv->caps and priv->buswidth need to be checked.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-09-25 21:10:26 +08:00
zhangshuai39 5e74ed8d34 net/tcp: Fix TCP keepalive time unit misuse problem
Summary:
  The conn->keeptimer units is decisecond,but its unit is treated as
half-second in the tcp_timer & tcp_get_timeout function.
  Therefore conn>keeptimer needs to be divided by 5(DSEC_PER_HSEC)
to match half-second units.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2024-09-25 10:04:41 -03:00
hujun5 efdb4322fc arm: we should use tcb->xcp.regs instead of up_current_regs() as the basis for judging whether to call restore_critical_section.
This commit fixes the regression from https://github.com/apache/nuttx/pull/13444

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 17:10:14 +09:00
chao an 542e2ba625 CMake/preprocess: fix typo PREPROCES -> PREPROCESS
correct the marco define from PREPROCES to PREPROCESS

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-25 11:55:06 +08:00
hujun5 b0f8b6e2ca arm64: g_current_regs is only used to determine if we are in irq,
with other functionalities removed.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00
hujun5 c9bdb598b7 irq: use up_interrupt_context to replace up_current_regs
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00
hujun5 349268a536 arm: tc32 nested interrupts are not supported
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00
hujun5 4972a8e02e arm: g_current_regs is only used to determine if we are in irq,
with other functionalities removed.

reason:
by doing this we can reduce context switch time,
When we exit from an interrupt handler, we directly use tcb->xcp.regs

before
size nuttx
   text    data     bss     dec     hex filename
 225920     409   30925  257254   3ece6 nuttx

after
   text    data     bss     dec     hex filename
 225604     409   30925  256938   3ebaa nuttx

 szie change -316

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-25 08:58:20 +08:00
chao an 9bbecc27ab cmake/tricore/tasking: add cmake build for tasking toolchain
cmake build for tasking toolchain

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-25 08:43:28 +08:00
wangjianyu3 73b7128fb6 drivers/rpmsg: Fix a typo error of rpmsg_device_destory()
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-25 01:51:18 +08:00
wangjianyu3 b8029d28a3 drivers/rpmsg: Using safe list iterating in rpmsg_device_created()
To fix list access after delete error

Test:
  /* Export */
  rpmsgdev_export("SERVER", "/dev/DEVNAME");

  /* Register */
  rpmsgdev_register("CLIENT", "/dev/DEVNAME", "/dev/server-DEVNAME", 0);

Log:
  [ap] kasan_report: kasan detected a read access error, address at 0x40b7ae78,size is 8, return address: 0x402a3c50
  [ap] kasan_show_memory: Shadow bytes around the buggy address:
  [ap] kasan_show_memory:   0x40b7ae20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae50: 20 af b7 40 00 00 00 00 c0 17 2a 40 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae70: 00 00 00 00 00 00 00 00[b0 f7 b3 40 00 00 00 00]
  [ap] kasan_show_memory:   0x40b7ae80: c8 48 b8 40 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7ae90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7aea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x40b7aeb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

  $ addr2line -fe nuttx/nuttx 0x402a3c50
  rpmsg_device_created
  /workspace/nuttx/drivers/rpmsg/rpmsg.c:395 (discriminator 2)

Reported by rongyichang@xiaomi.com

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-25 01:51:18 +08:00
Alin Jerpelea 9fa35a774f tools/doreleasenotes
Simple tool to generate the NuttX release notes

tested on Python-3.8.9

Requirements
pip install PyGithub
pip install PyInquirer
pip install tqdm

The following arguments are required for generating a release: release_version, gh_token

Inspired by https://github.com/btashton/nxutils

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-25 01:38:04 +08:00
dongjiuzhu1 c724ed51fb drivers/i3c: update i3c driver documentation
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
dongjiuzhu1 4960f290c8 drivers/i3c: avoid return error when i3c_master_register without i3c/i2c device
1. if i3c_mater_register without i3c/i2c device, rstdaa/clearevents/do_daa could be failed
2. board code/driver code need to actively i3c_master_do_daa when device power on.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
dongjiuzhu1 694750e8af drivers/i3c: remove extra i3c_dev_register, do_daa has created them
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong cffcccafc2 driver/i3c: Fixed i3c pointer format to check null
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong 7a48469e70 I3C: fixed the return value error in send ccc cmd api
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong 9d566d4a9d I3C: fixed the send ccc cmd check condition error
Only affect the send ccc cmd in 3th driver

Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong 9790c3d316 Added the common interface sending ccc cmd in I3C driver
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
dongjiuzhu1 5b48dea4f5 drivers/i3c: support i3c driver model
Reference to: https://github.com/torvalds/linux/tree/master/drivers/i3c

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
chao an a01d9e9ce0 arch/tricore: fix build error on tricore
ctc E333: ["arch/tricore/src/common/tricore_svcall.c" 123/23] incompatible types at assignment
ctc E333: ["arch/tricore/src/common/tricore_doirq.c" 98/39] incompatible types at argument #2

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 23:11:01 +08:00
chao an f44a9c44a7 libc/pathbuffer: fix build warning on tasking
[263/1096] Building C object libs/libc/CMakeFiles/c.dir/misc/lib_pathbuffer.c.obj
ctc W574: ["libs/libc/misc/lib_pathbuffer.c" 144/3] 'return' with an expression in function returning void

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 23:10:31 +08:00
SPRESENSE 6a825f1ee7 net/usrsock: Clear usockid when USRSOCK_EVENT_ABORT is received
When usrsock receives a USRSOCK_EVENT_ABORT, it determines that
the usrsock daemon's socket is closed. Then usrsock clears the usockid.
2024-09-24 23:09:20 +08:00
hujun5 e13d255345 sched: add nxsched_remove_self
reason:
1In the scenario of active waiting, context switching is inevitable, and we can eliminate redundant judgments.

code size
before
hujun5@hujun5-OptiPlex-7070:~/downloads1/vela_sim/nuttx$ size nuttx
   text    data     bss     dec     hex filename
 262848   49985   63893  376726   5bf96 nuttx

after
hujun5@hujun5-OptiPlex-7070:~/downloads1/vela_sim/nuttx$ size nuttx
   text    data     bss     dec     hex filename
 263324   49985   63893  377202   5c172 nuttx

reduce code size by  -476

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-24 22:07:00 +08:00
Xiang Xiao dc6eeba453 Revert "arm64: refine the fatal handler"
This reverts commit 291d5a2acc.
2024-09-24 10:21:42 -03:00
Xiang Xiao 9e8df3b3fa Revert "arm64: save FPU regs every time"
This reverts commit 3c4f3c1008.
2024-09-24 10:21:42 -03:00
Xiang Xiao f6f072ee1c Revert "arm64: add arm64_current_el to obtain current EL"
This reverts commit e38f2b2a6d.
2024-09-24 10:21:42 -03:00
Xiang Xiao 0a2a6dfa57 Revert "arm64: simply the vectors"
This reverts commit 370679c65b.
2024-09-24 10:21:42 -03:00
Xiang Xiao 24fba43591 Revert "Kernel build: enter exception save sp_sl0,exit exception restroe sp_el0"
This reverts commit 52a4fb6fab.
2024-09-24 10:21:42 -03:00
xuxin19 5095955591 cmake(bugfix):make sure the extra lib only added once
avoid duplicate definitions of target when
`nuttx_add_extra_library` is called between different models at the same time

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-24 21:06:26 +08:00
SPRESENSE 1e103bd41f drivers/modem/alt1250: Fix issue where the program would get stuck
Fix issue where the program would get stuck
if an unsupported ALTCOM packet was sent.
2024-09-24 20:00:21 +08:00
chao an a5251161c6 syslog/channel: rename syslog_channel() to syslog_channel_register()
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 19:28:49 +08:00
chao an 8288fe4e30 Revert "toolchain/ghs: Fix CONFIG_SCHED_CRITMONITOR_MAXTIME_XXX "zero used for undefined preprocessing identifier" warnings"
move private define to public

This reverts commit 236678d730.

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 09:00:27 +08:00
wangjianyu3 a5b85fcd96 misc/rpmsgdev: Fix invalid pointer error when there are more than one remotes
Test: (see tests/testcases/rpmsgdev for details)
  # 1. Register dummy device
  testdev -d 0 -r "/dev/ttyGNSS0"
  # 2. Call rpmsgdev_export() to export the device to remote
  testdev -d 2 -c "droid" -l "/dev/ttyGNSS0"

Log:
  [ap] arm_busfault: PANIC!!! Bus Fault:
  [ap] arm_busfault:        IRQ: 5 regs: 0x3c434e44
  [ap] arm_busfault:        BASEPRI: 00000000 PRIMASK: 00000000 IPSR: 00000005 CONTROL: 00000004
  [ap] arm_busfault:        CFSR: 00008200 HFSR: 00000000 DFSR: 00000000 BFAR: 00000000 AFSR: 00040000
  [ap] arm_busfault: Bus Fault Reason:
  [ap] arm_busfault:        Precise data bus error
  [ap] dump_assert_info: Current Version: NuttX ****** ***** *** 12.3.0 ********** Sep 23 2024 18:35:50 arm
  [ap] dump_assert_info: Assertion failed panic: at file: armv8-m/arm_busfault.c:113 task: testdev process: testdev 0x2c86ca75

Backtrace:
  backtrace_unwind
  /workspace/nuttx/arch/arm/src/common/arm_backtrace_unwind.c:632
  sched_backtrace
  /workspace/nuttx/sched/sched/sched_backtrace.c:105
  sched_dumpstack
  /workspace/nuttx/libs/libc/sched/sched_dumpstack.c:69
  dump_running_task
  /workspace/nuttx/sched/misc/assert.c:629
  arm_busfault
  /workspace/nuttx/arch/arm/src/armv8-m/arm_busfault.c:113
  irq_dispatch
  /workspace/nuttx/sched/irq/irq_dispatch.c:142
  arm_doirq
  /workspace/nuttx/arch/arm/src/armv8-m/arm_doirq.c:95
  strcmp
  /workspace/nuttx/libs/libc/machine/arm/armv8-m/gnu/arch_strcmp.S:107
  rpmsgdev_server_created
  /workspace/nuttx/drivers/misc/rpmsgdev_server.c:520 (discriminator 1)
  rpmsg_register_callback
  /workspace/nuttx/drivers/rpmsg/rpmsg.c:245
  rpmsgdev_export
  /workspace/nuttx/drivers/misc/rpmsgdev_server.c:552
  _register_driver
  /workspace/tests/testcases/rpmsgdev/testdev.c:216
  nxtask_startup
  /workspace/nuttx/libs/libc/sched/task_startup.c:70
  nxtask_start
  /workspace/nuttx/sched/task/task_start.c:114

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 23:59:12 +02:00
chao an 9afcd34282 Revert "pthread_mutex:add deadlock assert"
EDEADLK alreay checked in:
https://github.com/apache/nuttx/blob/master/sched/pthread/pthread_mutextimedlock.c#L112-L127
https://github.com/apache/nuttx/blob/master/sched/pthread/pthread_mutex.c#L195-L201

This reverts commit 112cc083d3.

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-23 23:54:38 +08:00
lipengfei28 52a4fb6fab Kernel build: enter exception save sp_sl0,exit exception restroe sp_el0
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 23:43:24 +08:00
ligd 370679c65b arm64: simply the vectors
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-23 23:43:24 +08:00
qinwei1 e38f2b2a6d arm64: add arm64_current_el to obtain current EL
Summary
  Add a macro to obtain current execute level

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2024-09-23 23:43:24 +08:00
ligd 3c4f3c1008 arm64: save FPU regs every time
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-23 23:43:24 +08:00
qinwei1 291d5a2acc arm64: refine the fatal handler
Summary
  The original implement for exception handler is very simple and
haven't framework for breakpoint/watchpoint routine or brk instruction.
  I refine the fatal handler and add framework for debug handler to
register or unregister. this is a prepare for watchpoint/breakpoint
implement

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2024-09-23 23:43:24 +08:00
liwenxiang1 a5bc9a9da2 arch/x86_64:Add FP backtrace function
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-09-23 23:15:01 +08:00
Tim Hardisty 5a4d31f315 SAMA5 sam_mcan.c unitialized variable 2024-09-23 10:13:29 -03:00
Tiago Medicci Serrano b025c6285d Documentation: Document stack and backtrace dump for Espressif SoCs
Stack and backtrace dump for Espressif's SoCs (ESP32, ESP32-S2,
ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2) is now documented in a
new section for each chip entry page.
2024-09-23 20:40:58 +08:00
Tiago Medicci Serrano 27858f913b tools: Add generic tool to decode the backtrace dump
The script can decode the backtrace dump, considering the syntax
of the backtrace format (properly handle the dump when SMP is
enabled, for instance) based on chip name or the toolchains's
addr2line tool.
2024-09-23 20:40:58 +08:00
Tiago Medicci Serrano cdeb720bf8 xtensa/esp32[|s2|s3]: Fix task backtrace dump
- Fix `MAKE_PC_FROM_RA` macro to consider the instruction region
base address;
- Add sanity check for calculated PC and SP registers;
- Check if the stack pointer is within the interrupt stack to
enable backtrace dump if an exception occurs during the ISR;
2024-09-23 20:40:58 +08:00
Tiago Medicci Serrano d6ee1742a9 xtensa/Kconfig: Fix dependency for backtrace dump on Xtensas
`CONFIG_XTENSA_INTBACKTRACE` is necessary to enable backtrace dump
for the tasks because exceptions are treated like interrupts (even
when an exception occurs during a normal task execution). It's now
automatically selected when `CONFIG_SCHED_BACKTRACE` is enabled.
This commit also removes outdated Kconfig options.
2024-09-23 20:40:58 +08:00
zhangshoukui d68fab125e FS_RAMMAP depends on FS_REFCOUNT and remove useless macro
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-09-23 18:22:35 +08:00
zhangshoukui 7e97691452 Should call fs_putfilep put fs reference when call files_fget complete
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-09-23 18:22:35 +08:00