Commit graph

57700 commits

Author SHA1 Message Date
Jukka Laitinen
e56eaffe76 Documentation/platforms/risc-v/mpfs/boards/icicle/index.rst: Add documentation for "hwtest" board configuration
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-02-08 19:31:13 +08:00
Jukka Laitinen
e23f2edc63 boards/risc-v/mpfs/icicle/configs/nsh/defconfig: Increase stack sizes
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-02-08 19:30:29 +08:00
Jukka Laitinen
88f12ee001 boards/risc-v/mpfs/icicle: Combine "network" and "usb" targets to "hwtest"
Reduce the amount of configurations for CI.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-02-08 19:30:29 +08:00
Kyle Wilson
7b3b24d9f6 Added missing UARTs and USARTs to STM32H56xx pinmap. Fixed UART IRQ definitions. Added missing rx and tx buffers. 2025-02-08 14:17:29 +08:00
Jukka Laitinen
ca6f5db6fc arch/risc-v/Kconfig: Select ARCH_RV_CPUID_MAP for all mpfs targets
The default mapping functions are needed for mpfs

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-02-07 23:46:40 +08:00
zouboan
6dbb2edd2c Documentation:add documentation about ethernet for Zynq MPSoC and ZCU111
This commit add documentation Description for ZYNQ-MPSOC's NET driver key
features and ethernet config of ZCU111.
2025-02-07 20:21:18 +08:00
zouboan
22f2d39e21 arch/zynq-mpsoc improve the ethernet driver
1. Changes the phyadd to 0xC to speed up the training of phyadd.
2. Set RX DMA buffer size configureable.
3. Create netnsh configs as ethernet boot from QSPI FLASH.
4. Fix some typo in #15720 which is nonsynchronous with local code.
2025-02-07 20:21:18 +08:00
chao an
9754fdf63c mps/mps3-an547: correct command line of genromfs
genromfs -a 128 -f ../romfs.img -d pic

f: -f output
a: -a alignment

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-07 17:41:04 +08:00
chao an
e06d8575c0 cmake/pic: sync pic related compiler flags from makefile
PIC(Position-Independent-Code) board could work on cmake:

cmake -B ap -DBOARD_CONFIG=mps3-an547:ap -GNinja

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-07 17:41:04 +08:00
chao an
b001b61401 rptun/ivshmem: RPTUN_IVSHMEM should depends on DEV_SIMPLE_ADDRENV
fix build break:

ld: drivers/libdrivers.a(rptun_ivshmem.c.obj): in function `rptun_ivshmem_get_resource':
nuttx/drivers/rptun/rptun_ivshmem.c:215:(.text.rptun_ivshmem_get_resource+0xfc): undefined reference to `simple_addrenv_initialize'
ld: openamp/libmetal/lib/libmetal.a(io.c.obj): in function `metal_io_phys_to_offset_':
nuttx/openamp/libmetal/lib/system/nuttx/io.c:112:(.text.metal_io_phys_to_offset_+0xc): undefined reference to `up_addrenv_pa_to_va'

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-07 17:40:38 +08:00
chao an
c3426325d8 qemu-armv7a/ivshmem: add ivshmem chapter
An example implementation for OpenAMP based on the Inter-VM share memory(ivshmem)::

rpproxy_ivshmem:  Remote slave(client) proxy process.
rpserver_ivshmem: Remote master(host) server process.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-07 17:40:38 +08:00
chao an
8204b0028a qemu-armv7a/ivshmem: add ivshmem(Inter-VM share memory) example
rpproxy_ivshmem:  Remote slave(client) proxy process.
rpserver_ivshmem: Remote master(host) server process.

Please refer to the official Qemu ivshmem documentation for more information:

https://www.qemu.org/docs/master/system/devices/ivshmem.html

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-07 17:40:38 +08:00
Tiago Medicci Serrano
2ebdd72487 include/stdlib.h: define system()'s prototype for the flat build
The `$(APPDIR)` folder is added to the `$(KERNDEPDIRS)` when
`CONFIG_BUILD_KERNEL=y`. The `depend` phase iterates over the
`$(KERNDEPDIRS)` folders and executes the `depend` recipe of these
folders (including the apps' recipes) with the `__KERNEL__` macro
defined, which prevents `system()`'s prototype from being declared.
2025-02-07 09:03:14 +08:00
xuxingliang
c319863834 nxgdb/mm: fix regular expression to parse log
There could be only one space ahead of address.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-07 08:18:14 +08:00
xuxingliang
1577fe3160 nxgdb/mm: warning if corrupted memory node found
If the nodesize is 0, we cannot iterate to next node, siliently return None will cause memleak command to generate false positive report with no warnings.
Add log to indicate such case.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-07 08:18:14 +08:00
xuxingliang
ef52c68e06 nxgdb/mm: add prenode, nextnode property for mempool
So it looks like a memory node in heap thus we can process it in a unified way

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-07 08:18:14 +08:00
Tiago Medicci Serrano
fdc0b608b5 libc/wcsrtombs: Fix the wcsrtombs() according to the POSIX standard
According to https://pubs.opengroup.org/onlinepubs/9799919799/, the
expected behavior for the wcstombs() function is that it should
convert the wide-character codes stoping conversion either when a
character sequence exceeds the limit of n total bytes or if a null
byte is stored. In the first case, the null-terminated value should
not be appended to the dst buffer.

Currently, no null-terminator is appended to the dst buffer, even
when it's expected to be appended, generating erroneous output.
2025-02-06 10:24:55 +01:00
Michal Lenc
0ae633cc08 clock/clock_adjtime.c: fix compile errors
The missing <nuttx/spinlock.h> header caused following compile errors:

CC:  clock/clock_adjtime.c clock/clock_adjtime.c: In function 'adjtime_wdog_callback':
clock/clock_adjtime.c:67:11: error: implicit declaration of function 'spin_lock_irqsave' [-Wimplicit-function-declaration]
   67 |   flags = spin_lock_irqsave(&g_adjtime_lock);
      |           ^~~~~~~~~~~~~~~~~
clock/clock_adjtime.c:78:3: error: implicit declaration of function 'spin_unlock_irqrestore' [-Wimplicit-function-declaration]
   78 |   spin_unlock_irqrestore(&g_adjtime_lock, flags);

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-02-06 09:22:44 +08:00
xuxingliang
04bd00f80a pynuttx: optimize memory leak check by skipping previously checked pointers
Reduce leak analysis time from 12s to 7.8s, achieving a 35% performance improvement that tested on an internal project.

1. Use memoryview to avoid creating int objects, reducing overhead
2. Store checked pointers in a dictionary for efficient lookups, improving performance.
3. While dictionary operations have some cost, the overall speedup is significant.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-05 09:15:27 -03:00
xuxingliang
b90638493a pynuttx: fix memleak
Only need to check used node, excluding free nodes.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-05 09:15:27 -03:00
Neo Xu
ca92c208c1 arch/arm64: generate error if context size is not aligned to 16bytes
Make sure the registers context size is aligned to 16bytes as required by armv8-a.
This issue has been reported earlier, thus make sense to make sure it won't happen in future.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-02-05 19:28:03 +08:00
xuxingliang
f9d8cdcca2 nxgdb/memdump: add free command
(gdb) free
name            total      used       free       maxused    maxfree    nused      nfree
GImageCache     10485756   10411964   73792      10602184   62328      217        7
uncache         10485756   127812     10357944   270512     10350560   4          2
Umem            26879516   17458732   9420784    20957888   9260768    1211       234
(gdb)

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-04 09:32:07 -03:00
zouboan
586b9c54ac arch/arm64 Fix the SP unalignment issues
zynq-mpsoc and zcu111 borad was broken by #15437, because #15437 changes
ARM64_CONTEXT_REGS from 36 to 37, resulting in the stack no longer being
16-byte aligned which appears to violate the ARMv8-A architecture's
requirement for 16-byte stack alignment. this commit changes ARM64_CONTEXT_REGS
to 38 to fix this issues.
2025-02-04 13:18:32 +08:00
Luchian Mihai
4f6940c533 boards: add arch depends for aurix tc397 board 2025-02-04 13:17:06 +08:00
xuxingliang
8995e5a66e nxgdb/fs: simplify inode print and add more options
Use Inode.__repr__ for print and use single line for all information.
Add 'verbose' and 'nodetype' option to show more details and only print specifiy node type like PIPE.
Add / to name for pseudodir.
Catch memory error when accessing node element.

E.g.

(gdb) foreach inode --nodetype pipe
        ├── run/ 0x41a27a50 PSEUDODIR
        │   ├── bt:bluetoothCS1fd26 0x4530c510 PIPE
        │   ├── bt:bluetoothCS20 0x42daae40 PIPE
        │   ├── socketpair0x457fd2e0SC20540 0x44ea27b0 PIPE
        │   └── tmp/ 0x42dd7cf0 PSEUDODIR
        │       │   └── usock/ 0x42dd6c10 PSEUDODIR
        │       │       └── speech.usockHD 0x42dc8270 PIPE
        │       ├── central_lite.socketCS5e 0x42e1e7b0 PIPE
        │       ├── central_service_lite.socketSC86 0x432ee6d0 PIPE
        │       │   └── usock/ 0x43d6ed60 PSEUDODIR
        │       │       └── speech.usockHD 0x43da2ba0 PIPE
        │       ├── uv-feature-sockSC8d 0x43540430 PIPE
        │       ├── uv-miot-sockCS54 0x42e272e0 PIPE
        │       └── uv-miot-sockSC54 0x42e270b0 PIPE

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-03 09:21:26 +01:00
xuxingliang
dc5251f9c8 nxgdb/fs: use default args
Instead of storing it to self

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-03 09:21:26 +01:00
zouboan
d36b2f94d3 zcu111: add support for net and dp83867 phy
The PS-side Gigabit Ethernet MAC (GEM) implements a 10/100/1000 Mb/s
Ethernet interface, which connects to a TI DP83867IRPAP Ethernet
RGMII PHY before being routed to an RJ45 Ethernet connector on ZCU111
board.The RGMII Ethernet PHY is boot strapped to PHY address 5'b01100
(0x0C) and Auto Negotiation is set to Enable.This commit add Ethernet
support for ZCU111 board and TI DP83867IRPAP Ethernet RGMII PHY.
2025-02-02 14:17:45 +08:00
zouboan
934c93be93 arch/arm64/zynq-mpsoc: add support for ethernet gem
Zynq MPSOC The processing system (PS) is equipped with four gigabit
Ethernet controllers.Each  controller can be configured independently.
Each controller uses a reduced gigabit media independent interface (RGMII)
v2.0. This commit add support for ethernet of ZYNQ MPSOC.
2025-02-02 14:17:45 +08:00
Neo Xu
698b2e00e6 nxgdb: include all files to package
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-02-02 14:02:24 +08:00
xuxingliang
14cc23f42a nxgdb: add missing protocols definitions
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-02-02 14:02:24 +08:00
yinshengkai
50fb43e23b tools: rename tools/gdb/nuttxgdb to tools/pynuttx/nxgdb
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2025-02-02 14:02:24 +08:00
Tiago Medicci Serrano
08fe636001 xtensa/esp32[s2|c3|c6|h2]: fix sched_[lock|unlock] boot crash
Move the code to iram0 since sched_lock/sched_unlock is called in
the early boot phase.
2025-02-02 00:51:42 +08:00
Huang Qi
e043658d1e arch/xtensa: Add --print-memory-usage to LDFLAGS in Toolchain.defs
Summary:
- Added `--print-memory-usage` to `LDFLAGS` in `Toolchain.defs` for both `lx6` and `lx7` architectures
- This flag enables memory usage reporting during the linking phase, providing better visibility into memory allocation

Impact:
- No functional changes - the flag only adds additional debug information during the build process
- Improves debugging and optimization capabilities by providing detailed memory usage statistics
- Maintains compatibility with existing build configurations and toolchains

Testing:
Test result on esp32s3:
```
Memory region         Used Size  Region Size  %age Used
             ROM:      556116 B   16777184 B      3.31%
     iram0_0_seg:       23296 B       304 KB      7.48%
     irom0_0_seg:      621652 B   16777184 B      3.71%
     dram0_0_seg:       85780 B       288 KB     29.09%
     drom0_0_seg:      157180 B   16777184 B      0.94%
    rtc_iram_seg:           0 B       8168 B      0.00%
    rtc_data_seg:           0 B       8168 B      0.00%
rtc_reserved_seg:           0 B         24 B      0.00%
    rtc_slow_seg:           0 B         8 KB      0.00%
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-02-01 13:20:12 -03:00
xuxingliang
c1f9c730be gdb: add tool to check heap memory corruption
Only heap nodes are checked for now.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-31 23:29:34 +08:00
hujun5
8f9c1cbe73 xtensa/esp32s3: Fix esp32s3 sched_lock crash
move the code to iram0 since sched_lock/sched_unlock
is called in the early boot phase

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-31 23:19:59 +08:00
Xiang Xiao
dc2ae56098 arch: Remove the abuse of spinlock in smp boot
What's really need is a done signal sent from the secondary
cpu to the boot cpu, so let's simplify the logic by:
1.Change the spinlock to a bool flag
2.Set the flag to true in the secondary cpu
3.Wait the flag set in the boot cpu before continue booting

This also remove all bad usage of spinlock from the code base:
1.Lock spinlock in one thread, but unlock in a different thread
2.Lock spinlock twice in one thread, but unlock only once

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-01-31 23:19:44 +08:00
Luchian Mihai
4606f1f9e1 feat: drop legacy pinmap for nsh config
migrate from legacy pinmap for nucleo-f429zi board nsh config
2025-01-31 12:53:36 +08:00
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