Commit graph

60363 commits

Author SHA1 Message Date
Luchian Mihai
11a47a4b0c boards/stm32/nucleo-f429zi: update netnsh defconfig
This PR updates the netnsh defconfig for nucleo-f429zi board, as currently the board would not get ip.
Few changes comes with this PR:
* enabled CONFIG_NETINIT_NOMAC option.
* enabled CONFIG_NETINIT_DHCPC and CONFIG_NETUTILS_TELNETD as I wanted to get a telnet shell and did not care about ip handling
* disabled legacy pinmap and updated the board.h config to get the board to compile
2025-01-31 12:53:36 +08:00
Jukka Laitinen
80e545aedd arch/risc-v/src/common/riscv_backtrace.c: Fix "error: pointer of type 'void *' used in arithmetic"
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-31 00:58:54 +08:00
Javier Casas
52dbfda355 bug fix: can_datahandler wrong return value
can_datahandler returns an unsigned value that represent the
number of bytes actually bufffered, but the call to iob_tryadd_queue
returns a negative value when it fails so that value can't be used as
can_datahandler return value because it is interpreted as unsigned so
a big number is wrongly returned when iob_tryadd_queue fails.

The fix is just setting the return value to zero when iob_tryadd_queue
fails, reflecting the actual meaning that no bytes have been buffered.
2025-01-30 11:37:29 -03:00
Javier Casas
d52ff33e78 net/can/: add statistics for recv, sent and drop
Add support for network statistics for CAN.
It includes counters for receive, sent
and drop frames.

Signed-off-by: Javier Casas <javiercasas@geotab.com>
2025-01-30 11:37:29 -03:00
Yanfeng Liu
48b93b8dc8 boards/rv-virt: use modlib gnu-elf.ld
This drops the board specific gnu-elf.ld for KERNEL apps as the
preprocessed modlib/gnu-elf.ld suffices. Checked w/ rv-virt:knsh
and rv-virt:knsh64

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-30 13:55:57 +08:00
Jukka Laitinen
ef875d7d9e arch/risc-v/src/mpfs/mpfs_ddr.c: Re-try DDR training on any error
Also errors which currently return other than -EAGAIN, are typically
recoverable with retraining. So just re-try trainining 20 times on any
error, resetting the controller in between.

Only reset if it is not recovered in this time.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-30 13:55:27 +08:00
Jukka Laitinen
107b29ee67 arch/risc-v/src/mfs_start.c: After failed DDR training, reset with WDT
Resetting via WDT leaves more proper reset reason in SYSREG_RESET_SR
than resetting via soft reset.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-30 13:55:27 +08:00
Jari Nippula
f3b0e68124 arch/risc-v/src/mpfs: Add hardware/mpfs_wdog.h 2025-01-30 13:55:27 +08:00
Michal Lenc
4fa5e294ac boards/samv7/common: add support for UART RX DMA polling
This adds the support for RX DMA polling. The board initializes
timer channel SAMV7_UART_RXDMA_POLL_TIMER with frequency
SAMV7_UART_RXDMA_POLL_FREQUENCY that triggers DMA polling function.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-01-30 13:55:13 +08:00
Michal Lenc
7af7655234 samv7/serial: allow TX/RX DMA for UART drivers
So far only USART drivers could use TX/RX DMA. This commit adds the
support for UART drivers as well (with the exception of serial console).

UART peripheral does not have timeout interrupt, so external polling
is required to flush the RX data from DMA buffers even if the buffer
is not yet full. The board layer can do this by calling
sam_serial_dma_poll function.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-01-30 13:55:13 +08:00
Michal Lenc
cde21ae8bf w25qxxxjv: fix missing QSPI locking
There was a missing QSPI locking for w25qxxxjv_get_die_from_addr
function. We can't have the lock directly in w25qxxxjv_get_die_from_addr
because the function is called from already locked function
w25qxxxjv_erase_sector.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-01-30 13:49:46 +08:00
Jukka Laitinen
f53afd174e arch/risc-v/src/mpfs/mpfs_cache.c: Move l2zerodevice to use cache ways starting from 0
If scratchpad is being used, the cache way 0, which is automatically
enabled at boot, needs to be re-configured as part of scratchpad memory
Otherwise there is a possibility of random memory corruption in the
scratchpad
area due to cache eviction from way 0.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-30 13:48:15 +08:00
xuxingliang
eddc22c47f gdb/wdog: add basic wdog dump command
(gdb) wdog
WDog@0x404864e8: tick: 4294978078       0x402e36b0 <wdtest_callback> arg: 0x40462500
WDog@0x40462ef8: tick: 4294978078       0x402c7900 <nxsig_timeout> arg: 0x40462e70
WDog@0x40462d88: tick: 4294978078       0x402c7900 <nxsig_timeout> arg: 0x40462d00
WDog@0x4046e488: tick: 4294978079       0x402e36b0 <wdtest_callback> arg: 0x40462440
WDog@0x40462658: tick: 4294978079       0x402c7900 <nxsig_timeout> arg: 0x404625d0
(gdb)

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-30 13:46:01 +08:00
xuxingliang
d3c4f4ec52 gdb/workqueue: add basic workqueue dump support
(gdb) worker
hpwork@0x40424b40, idle, 2 threads, 0 work
lpwork@0x40424a80, idle, 2 threads, 0 work
test@0x4045a8c0, running, 2 threads, 2 work
    Running:
    kworker_s@0x4045a908 work_s@0x406cf330: 0x0 arg=0x406cf300
    Queued:
    work_s@0x406cf370: 0x402f1954 <count_worker> arg=0x406cf318
    work_s@0x406cf3b0: 0x402f1954 <count_worker> arg=0x406cf318
(gdb)

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-30 13:45:41 +08:00
Huang Qi
69495f8a40 docs: Add Rust examples including JSON handling and Slint UI framework
Summary:
- Added two new Rust example applications to the documentation:
  - `hello` example showcasing JSON serialization/deserialization, async runtime usage, and C interoperability in a NuttX environment
  - `slint` example demonstrating the integration of the Slint UI framework with NuttX's framebuffer and touchscreen devices for creating GUI applications in Rust
- Each example includes detailed explanations of key features and how they are implemented using Rust's modern language capabilities

Impact:
- Enhances the documentation for Rust development within NuttX, providing clear and practical examples for developers
- Facilitates easier adoption of Rust for new projects by demonstrating how to leverage its features while maintaining compatibility with existing NuttX infrastructure
- No changes to the core NuttX system; the additions are entirely within the documentation and examples directory

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-30 13:45:01 +08:00
Jorge Guzman
7240565ca3 boards/linum-stm32h753bi: Fix LVGL video memory allocation
Previously, the LVGL example had a workaround in lv_nuttx_fbdev.c to prevent
video memory invasion. This fix properly addresses the issue by:

- Reducing total SDRAM size from 8MB to 6MB
- Moving LTDC base address to 0xC0600000
- Reserving dedicated space for video memory outside NuttX heap

This ensures proper memory separation between video buffer and system heap.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2025-01-29 12:43:39 +08:00
Huang Qi
68d1750c12 docs: Rename hello_rust to rust/baremetal to reflect the actual codebase
Summary:
- The `hello_rust` example has been moved to `rust/baremetal` to better reflect its purpose as a bare-metal Rust application.
- The move also helps in organizing the Rust examples more clearly, separating them into categories based on their environment (bare-metal vs. non-bare-metal).
- A new directory structure has been created under `rust/baremetal`, and the `index.rst` file has been updated to describe the `baremetal` example in detail.
- The top-level `rust/index.rst` file has been created to include the new `rust/baremetal` directory in the toctree.

Impact:
- The new file structure and documentation improvements will help new contributors and users understand the purpose and setup of the example more easily.
- This change aligns the documentation with the actual codebase, enhancing the overall maintainability and clarity of the project.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-29 12:41:06 +08:00
Huang Qi
abcbb1eebd tools/Rust.defs: Use 'gnu' target for Linux and 'darwin' for macOS
Summary:
- Updated `Rust.defs` to use `gnu` as the target for Linux systems and `darwin` for macOS systems
- This change aligns with Rust toolchain conventions, where `gnu` is used to declare the system environment rather than the actual ABI name (e.g., `sysv`)

Impact:
- No functional changes - the Rust toolchain interprets `gnu` correctly for Linux targets
- Improves consistency with Rust toolchain conventions and reduces potential confusion
- Maintains compatibility with existing Rust builds on Linux and macOS systems

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-28 16:43:37 +08:00
Huang Qi
a2e8bb83a4 sim: Align LLVM target info across CMake and Makefile
Summary:
- Unified the specification of LLVM architecture and ABI types across the CMake and Makefile configurations.
- Introduced `LLVM_ARCHTYPE` and `LLVM_CPUTYPE` variables in the CMake configuration to match the Makefile's approach.
- Standardized the ABI type (`LLVM_ABITYPE`) to `sysv` for both Linux and macOS host configurations.

Impact:
- Ensures consistent LLVM target definitions across build systems (CMake and Makefile).
- Simplifies future maintenance by avoiding divergence in LLVM-related configurations.
- No functional changes to the build output; only the internal representation of LLVM target information is aligned.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-28 16:43:37 +08:00
Kyle Wilson
689aa55e01 Initial STM32H5 USB Commit
Progress in USB driver

Nothing is working yet. But just getting this in here so it is saved.

Minor changes with USB power enabled

Serial over USB is working now.

Removed stm32_usbdev.c, added stm32_usbfs.c. Still needs review before pull-request.

Rewrote VDDUSB valid check to use register definitions. Wait for USB33RDY before moving on. Also style updates.

Renamed stm32_usbdev files to stm32_usbfs. Renamed STM32H5 configuration options from STM32H5_USB to STM32H5_USBFS. Properly named REGDEBUG defines. Added STM32H5_USB_REGDEBUG to Kconfig and updated stm32_usbfs.c to use it. TRACE functionality still needs work.

Updated REGDEBUG for 32-bit register accesses.

More style updates.

Added usbnsh defconfig to nucleo-h563zi

Update to allow 16 buffers (max for 8 endpoints). Renamed lpinterrupt and lptransfer. Changed board.h to use SYNCSRC_USB only if USB is enabled.

Buffer size is still set to max packet size of 64 bytes, because we are using a full-speed peripheral. It is unclear to me whether having a buffer larger than the max packet size has any benefit. Double buffering is a way to increase throughput, though that still needs to be implemented.

Adapted USBFS Buffer table for 32-bit accesses.

Style updates

Build stm32_hsi48.c based on CONFIG_STM32H5_HAVE_HSI48.

Change LPMODE CNTR bit to SUSPRDY.
2025-01-28 16:43:07 +08:00
Matteo Golin
044879e7a3 sensors/lis2mdl: Create a UORB driver for the LIS2MDL magnetometer. 2025-01-28 16:34:17 +08:00
chao an
20f45f907f arm/armv7: update percpu task only for co-processor
fix smp crash on sabre-6quad/smp, regression from:

|commit 1e49cb4828
|Author: hujun5 <hujun5@xiaomi.com>
|Date:   Thu Dec 5 16:58:17 2024 +0800
|
|    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>

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-27 23:35:07 +08:00
chao an
196ce5918c riscv/esp32: refresh defconfig to avoid ci fail
Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-27 11:11:54 -03:00
Yanfeng Liu
1f53d6ae6c boards/qemu-armv7a: revise nsh config
This revises qemu-armv7a:nsh sample config with the following changes:

- reduced memory size so that `-m 1024` is optional
- enables graceful shutdown from within NuttX
- enables more cases in `ostest`.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-27 20:45:00 +08:00
zouboan
1452f32b14 zynq-mpsoc: add support for pll 2025-01-27 10:13:30 +08:00
Xiang Xiao
4ef36cff80 boards: Renanme CONFIG_TESTING_SENSORTEST to CONFIG_SYSTEM_SENSORTEST
follow the change from: https://github.com/apache/nuttx-apps/pull/2976

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-01-27 02:24:38 +01:00
Daniel Jasinski
9e64505f8d build: CMake fix for sim:btuart
bt_bridge.c file was missing in nuttx/drivers/wireless/bluetooth.

Signed-off-by: Daniel Jasinski <jasinskidaniel95szcz@gmail.com>
2025-01-27 08:24:37 +08:00
Huang Qi
e2a51ee856 qemu-i486: Simplify Make.defs by include Toolchain.defs
Summary:
- Simplified `Make.defs` by including `Toolchain.defs` from the x86 common directory
- Removed redundant toolchain and flag definitions, consolidating them into a single shared file

Impact:
- Reduces code duplication and improves maintainability by centralizing toolchain configurations
- No functional changes - the build process remains the same, but the configuration is now more modular and reusable

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-27 02:28:39 +08:00
Huang Qi
fe0949ad38 tools/x86_64: Add LLVM target definitions
Summary:
- Added LLVM target definitions (`LLVM_ARCH`, `LLVM_CPU`, `LLVM_ABI`) to `arch/x86_64/src/cmake/Toolchain.cmake` and `arch/x86_64/src/common/Toolchain.defs`
- These definitions are necessary for compatibility with LLVM-based toolchains and ensure proper target architecture, CPU, and ABI settings

Impact:
- Enables support for LLVM-based toolchains when building for x86_64 architecture
- No functional changes for existing GNU-based toolchains
- Improves maintainability by centralizing LLVM-specific configurations in the toolchain files

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-27 02:28:29 +08:00
Huang Qi
7ffea386e6 x86/Toolchain.defs: Add LLVM target definitions
Summary:
- Added LLVM target definitions (`LLVM_ARCHTYPE`, `LLVM_CPUTYPE`, `LLVM_ABITYPE`) to the x86 toolchain configuration file
- These definitions are necessary for compatibility with LLVM-based toolchains

Impact:
- Enables support for LLVM toolchains when building for x86 targets
- No functional changes for existing GCC-based toolchains
- Improves cross-compilation flexibility by supporting additional toolchain options

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-27 02:28:29 +08:00
Yanfeng Liu
d13b745be4 tools/mkexport.sh: stop refering kernel path
This stops exported LDELFFLAGS from referring to kernel folder
linkscripts because kernel folder might not be present in such
app building use cases.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-26 20:28:35 +08:00
Yanfeng Liu
145827ea12 tools/mkexport.sh: add LDMODULEFLAGS export
This adds LDMODULEFLAGS export so that kernel module can build
for kernel mode NuttX via `make import` approach.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-26 20:28:35 +08:00
Huang Qi
49dd1e0ff0 tools: Export LLVM flags for kernel build
Summary:
- Added LLVM_ARCHTYPE, LLVM_CPUTYPE, and LLVM_ABITYPE to the exported build configuration in both `Export.mk` and `mkexport.sh`
- These flags are now included in the generated `makeinfo.sh`, `Make.defs`, and `target.cmake` files during the export process

Impact:
- Enables LLVM-specific build configurations to be properly exported and used in kernel builds
- Improves compatibility with LLVM-based toolchains by ensuring necessary architecture, CPU, and ABI information is available during the build process
- No functional changes for non-LLVM builds, as these flags are only used when LLVM toolchains are specified

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-26 20:22:35 +08:00
Huang Qi
6ba5955435 tools: Export ZIG/ZIGFLAGS in Export.mk instead
Summary:
- Moved the export of `ZIG` and `ZIGFLAGS` from `tools/Unix.mk` to `tools/Export.mk`
- Simplified the `export` target in `tools/Unix.mk` by removing redundant `ZIG` and `ZIGFLAGS` variables

Impact:
- No functional changes - the `ZIG` and `ZIGFLAGS` variables are still exported correctly
- Improves code maintainability by centralizing environment variable exports in `Export.mk`

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-26 20:22:26 +08:00
wangzhi16
8f3a2a6f76 No need to call sched_lock explicitly after call spin_lock_irqsave, since it will be called in func spin_lock_irqsave.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-24 17:27:50 +08:00
tengshuangshuang
1655537810 nuttx:fix tools-mm to heap
config-testing-heap is changed to conofig-testing-heap, so the citest tools need to change.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2025-01-24 14:16:47 +08:00
wangzhi16
c8f8a61f89 Fix wrong variable name. lock -> eth_lock
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-24 13:40:55 +08:00
wangzhi16
60125038fc Use small lock to protect resources related to ethernet.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-24 12:13:28 +08:00
chao an
ace7f0c633 fs/spinlock: replace no sched_lock() version to improve the performance
after below change merge to kernel, spin_lock() will turn off preemption by default,
but this change is not applicable to all scenarios. The locations in the kernel that
use spin_lock() extensively only require short critical sections and do not trigger
scheduling, which leads to serious performance degradation of NuttX in AMP mode.

In this PR, I try to expose similar problems and hope that each subsystem will carefully check the code coverage

https://github.com/apache/nuttx/pull/14578
|commit b69111d16a
|Author: hujun5 <hujun5@xiaomi.com>
|Date:   Thu Jan 23 16:14:18 2025 +0800
|
|    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>

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-24 11:48:23 +08:00
Jorge Guzman
b9e995b321 boards/linum-stm32h753bi: Fix wrong usbnsh example name
Fixes the incorrect board profile name to 'usbnsh' used on
linum-stm32h753bi board.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2025-01-24 11:46:05 +08:00
wangzhi16
60df0cd6da Fix compile error.
CC: socket/listen.c chip/lpc17_40_i2c.c: In function 'lpc17_40_i2cbus_initialize': chip/lpc17_40_i2c.c:534:29: warning: 'priv' is used uninitialized [-Wuninitialized]
534 | flags = spin_lock_irqsave(&priv->spinlock);
| ^~~~~~~~~~~~~~~
chip/lpc17_40_i2c.c:529:29: note: 'priv' was declared here
529 | struct lpc17_40_i2cdev_s *priv;
| ^~~~

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-24 11:29:58 +08:00
Neo Xu
1ab1a6eaf3 arch: select LIBC_ARCH_ELF when using COREDUMP
Coredump doens't need CONFIG_ELF to be enabled, but need elf.h to include correct elf32.h or elf64.h.
Select LIBC_ARCH_ELF in COREDUMP to allow LIBC_ARCH_ELF_64BIT to be
defined correctly.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-01-24 09:37:58 +08:00
wanggang26
f6b9a8f577 coredump: fix issue that nvic region overlapped by board memory region
Firstly call arm_coredump_add_region in up_initialize to add nvic region, then call
coredump_set_memory_region to add board mem region, at this moment, an overlap occurs.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2025-01-24 09:15:56 +08:00
xuxingliang
ba18502b93 misc/coredump: move coredump info to note
Add a custom note for NuttX information including magic and coredump
file data size, so when system reboots, we can check if the block device
contains valid coredump file, and save it to file system.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-24 09:12:59 +08:00
Alan Carvalho de Assis
06722d65ec boards/stm32h7: Fix wrong usbnsh name and fix Documentation
Fixes the incorrect board profile name to 'usbnsh' used on
WeAct-STM32H743 board.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-01-24 09:10:04 +08:00
wangzhi16
c754019f5a Use small lock to protect resources related to irq in arch ARM.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-24 02:05:35 +08:00
wangzhi16
919ed2e3d4 Use small lock to protect resources related to i2c.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-24 01:38:16 +08:00
buxiasen
7a94a4553d syscall: add missing epoll API
Add missing epoll syscall API for kernelbuild
epoll_create, epoll_pwait, epoll_close

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-24 01:30:02 +08:00
Michal Lenc
758b3baef0 samv7/adc: fix handling of ANIOC_TRIGGER ioctl
ADC peripheral can be configured also for PWM trigger, so the ifdef
should depend only on CONFIG_SAMV7_AFEC_SWTRIG. Also handle the
situation when ANIOC_TRIGGER is called and the peripheral is not
configured for SW trigger (but the other one may be, so config option
is set).

Trigger values saved to the private structure are also changed to
enums for better code clarity.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-01-24 01:29:44 +08:00
wangzhi16
2c4fe28d4e Use small lock to protect resources related to i2c master and slave.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-24 01:29:27 +08:00