Commit graph

56802 commits

Author SHA1 Message Date
wangjianyu3
9a63f9a881 esp32s3-devkit/adb: Initializing configuration for ADB
Build & Flash

  ./tools/configure.sh -l esp32s3-devkit:adb
  make -j16
  make flash ESPTOOL_PORT=/dev/ttyACMx

Runtime

  $ adb -s 1234 shell
  nsh> uname -a
  NuttX 0.0.0  Nov 22 2024 11:41:43 xtensa esp32s3-devkit

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-11-22 13:28:44 -03:00
YAMAMOTO Takashi
72a8764ea8 fs/littlefs: Add a kconfig to override littlefs version
Hopefully, It's more user-friendly than the current method,
which is just an overridable make variable. It would also help
to make some features (and their associated local patches)
conditional on littlefs version in future.

Also, update CMakeLists.txt to use the same littlefs version as Makefile.
2024-11-22 21:02:54 +08:00
yinshengkai
0413d74f31 libs: add gcov framework support
In devices without storage media, you can export data to the
command line and then generate the corresponding gcda file

It can save the result output by calling __gcov_info_to_gcda
The usage is similar to:
https://gcc.gnu.org/onlinedocs/gcc/Freestanding-Environments.html#Profiling-and-Test-Coverage-in-Freestanding-Environments

Usage:
 ./tools/configure.sh qemu-armv7a:nsh
Modify the configuration
+CONFIG_COVERAGE_ALL=y
+CONFIG_COVERAGE_MINI=y
+CONFIG_SYSTEM_GCOV=y
Run:
qemu-system-arm -cpu cortex-a7 -nographic -smp 4 \
     -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/nuttx -semihosting -s | tee gcov.txt
./nuttx/tools/gcov_convert.py -i ./gcov.txt
./nuttx/tools/gcov.sh -t arm-none-eabi-gcov

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-22 19:08:08 +08:00
yinshengkai
0194c2f88a gcov: update gcov compilation parameters
profile-generate is used to generate compilation feedback optimization data, not just code coverage data

It will rely on the toolchain library:
nuttx/libs/libc/misc/lib_utsname.c:94:(.text.uname+0x2c): undefined reference to `__gcov_indirect_call_profiler_v4'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x178): undefined reference to `__gcov_indirect_call'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x188): undefined reference to `__gcov_time_profiler_counter'
arm-none-eabi-ld: nuttx/staging/libc.a(lib_utsname.o):(.data..LPBX0+0x30): undefined reference to `__gcov_merge_time_profile'

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-22 19:08:08 +08:00
Jouni Ukkonen
74cdb53027 tools/imx9: Add norimage support to bootloader
Fetch fspi header and fcb generation script,
using mkimage generate nor bootable image.
compile bootloader using -mstrict-align

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-22 18:53:21 +08:00
wangmingrong1
1f2d1e97e8 x86-64: Added KASan compilation options
Sorry for this commit: 6cd43777c3
This is the real x86-64 modification, and this patch is x86
Fortunately, except for the error in the previous modification, the actual architecture is supported

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-22 15:06:02 +08:00
Zhe Weng
5ec2c97424 tools/gdb: Supports args and help for netstats
(gdb) help netstats
Network statistics
    Usage: netstats [iob|pkt|tcp|udp|all]

    Examples: netstats - Show all stats
              netstats all - Show all stats
              netstats iob - Show IOB stats
              netstats tcp udp - Show both TCP and UDP stats

(gdb) netstats iob pkt
IOB:       size    ntotal     nfree     nwait nthrottle
           1518        72        72         0        40

Packets:   IPv4   IPv6    TCP    UDP   ICMP ICMPv6
Received     12     20      2     10      0      0
Dropped       0     20      0      0      0      0
  VHL         0      0      -      -      -      -
  Frag        0      0      -      -      -      -
  Chksum      0      -      0      0      -      -
  Type        -      -      -      -      0      0
  Proto       0      0      -      -      -      -
Sent          4      0      4      0      0      0
  Rexmit      -      -      2      -      -      -

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-11-22 13:38:23 +08:00
Zhe Weng
d0884828ed tools/gdb: Add TCP in netstats
(gdb) netstats
IOB:       size    ntotal     nfree     nwait nthrottle
           1518        72        70         0        38
<...>
TCP Conn:  st flg ref tmr uack nrt       txbuf       rxbuf+ofo           local_address        remote_address
0           4  61   1   3    0   0     0/16384    28/16384+0            10.0.1.2:11315        10.0.1.1:5001

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-11-22 13:38:23 +08:00
Zhe Weng
395090284a tools/gdb: Add UDP in netstats
(gdb) netstats
IOB:       size    ntotal     nfree     nwait nthrottle
           1518        72        70         0        38
<...>
UDP Conn:  flg       txbuf       rxbuf         local_address        remote_address
0           41     0/16384     0/16384              :::19279         fc00::1:5001
1           41     0/16384     0/16384              :::19280         fc00::1:5001
2           41     0/16384     0/16384              :::19281         fc00::1:5001
3           41     0/16384     0/16384              :::19282         fc00::1:5001
4           41     0/16384     0/16384              :::19283         fc00::1:5001
5           41     0/16384     0/16384         0.0.0.0:19284        10.0.1.1:5001
6           41     0/16384     0/16384         0.0.0.0:19285        10.0.1.1:5001
7           41     0/16384     0/16384         0.0.0.0:19286        10.0.1.1:5001
8           41     0/16384     0/16384         0.0.0.0:19287        10.0.1.1:5001
9           41     0/16384     0/16384         0.0.0.0:19288        10.0.1.1:5001

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-11-22 13:38:23 +08:00
Zhe Weng
1c884ee230 tools/gdb: Add packet statistic in netstats
Unlike NuttX's one, we use decimal instead of hexadecimal, because other
stats may all use decimal.

(gdb) netstats
IOB:       size    ntotal     nfree     nwait nthrottle
           1518        72        72         0        40

Packets:   IPv4   IPv6    TCP    UDP   ICMP ICMPv6
Received    137     43      0     49     88      0
Dropped       0     43      0      0     74      0
  VHL         0      0      -      -      -      -
  Frag        0      0      -      -      -      -
  Chksum      0      -      0      0      -      -
  Type        -      -      -      -     74      0
  Proto       0      0      -      -      -      -
Sent      11481  11542      0  17223     27      4
  Rexmit      -      -      0      -      -      -

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-11-22 13:38:23 +08:00
Zhe Weng
4ff0447027 tools/gdb: Add net.py and netstats command
Only support IOB stats now, may add socket status later.

(gdb) netstats
IOB:       size    ntotal     nfree     nwait nthrottle
           1518        72        72         0        40

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-11-22 13:38:23 +08:00
c0669e3fc9 CI: Run CI Job other only for Simple x86 PR
Presently, Simple x86 PRs will run All CI Checks (across all Architectures), as reported here: https://github.com/apache/nuttx/pull/14885#issuecomment-2492555557

This PR fixes the CI Build Rules, so that Simple x86 PRs will run only One Single CI Job: `other`.
2024-11-22 13:32:33 +08:00
xuxingliang
992d5e0127 tools/gdb: add info shm command
(gdb) info shm
  /var/shm/xms:bq-325-1044165565 memsize: 1536000, paddr: 0x41de3970
  /var/shm/xms:bq-325-2123092606 memsize: 1536000, paddr: 0x41f5a9a8
  /var/shm/xms:fakemq-325-1835096569 memsize: 12, paddr: 0x420d19e0
(gdb)

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-22 12:30:12 +08:00
xuxingliang
4e2ad314d7 tools/gdb: avoid building a full list
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-22 12:30:12 +08:00
yangao1
ab3aa41f39 tools/gdb/fs.py: add print fdinfo,modify the print format
Execute fdinfo or fdinfo -p pid.

(gdb) fdinfo
PID: 0
FD  OFLAGS  POS   PATH                  BACKTRACE
0   3       0     /dev/console          0x4028ff0c <sched_backtrace+48>                 /home/neo/projects/vela2/nuttx/sched/sched/sched_backtrace.c:105
                                        0x402888f8 <file_allocate_from_tcb+236>         /home/neo/projects/vela2/nuttx/fs/inode/fs_files.c:615
                                        0x402979d0 <nx_vopen+104>                       /home/neo/projects/vela2/nuttx/fs/vfs/fs_open.c:326
                                        0x40297ad4 <nx_open+116>                        /home/neo/projects/vela2/nuttx/fs/vfs/fs_open.c:449
                                        0x40291eb4 <group_setupidlefiles+28>            /home/neo/projects/vela2/nuttx/sched/group/group_setupidlefiles.c:75
                                        0x4028df94 <nx_start+628>                       /home/neo/projects/vela2/nuttx/sched/init/nx_start.c:651
                                        0x4028119c <arm64_boot_primary_c_routine+16>    /home/neo/projects/vela2/nuttx/arch/arm64/src/common/arm64_boot.c:205

1   3       0     /dev/console          0x4028ff0c <sched_backtrace+48>                 /home/neo/projects/vela2/nuttx/sched/sched/sched_backtrace.c:105
                                        0x40289574 <file_dup3+248>                      /home/neo/projects/vela2/nuttx/fs/vfs/fs_dup2.c:177
                                        0x40288b88 <nx_dup3_from_tcb+176>               /home/neo/projects/vela2/nuttx/fs/inode/fs_files.c:314
                                        0x40288c64 <nx_dup2_from_tcb+16>                /home/neo/projects/vela2/nuttx/fs/inode/fs_files.c:901
                                        0x40288c88 <nx_dup2+28>                         /home/neo/projects/vela2/nuttx/fs/inode/fs_files.c:924
                                        0x40291ec4 <group_setupidlefiles+44>            /home/neo/projects/vela2/nuttx/sched/group/group_setupidlefiles.c:84
                                        0x4028df94 <nx_start+628>                       /home/neo/projects/vela2/nuttx/sched/init/nx_start.c:651
                                        0x4028119c <arm64_boot_primary_c_routine+16>    /home/neo/projects/vela2/nuttx/arch/arm64/src/common/arm64_boot.c:205

2   3       0     /dev/console          0x4028ff0c <sched_backtrace+48>                 /home/neo/projects/vela2/nuttx/sched/sched/sched_backtrace.c:105
                                        0x40289574 <file_dup3+248>                      /home/neo/projects/vela2/nuttx/fs/vfs/fs_dup2.c:177
                                        0x40288b88 <nx_dup3_from_tcb+176>               /home/neo/projects/vela2/nuttx/fs/inode/fs_files.c:314
                                        0x40288c64 <nx_dup2_from_tcb+16>                /home/neo/projects/vela2/nuttx/fs/inode/fs_files.c:901
                                        0x40288c88 <nx_dup2+28>                         /home/neo/projects/vela2/nuttx/fs/inode/fs_files.c:924
                                        0x40291ed0 <group_setupidlefiles+56>            /home/neo/projects/vela2/nuttx/sched/group/group_setupidlefiles.c:117
                                        0x4028df94 <nx_start+628>                       /home/neo/projects/vela2/nuttx/sched/init/nx_start.c:651
                                        0x4028119c <arm64_boot_primary_c_routine+16>    /home/neo/projects/vela2/nuttx/arch/arm64/src/common/arm64_boot.c:205

Signed-off-by: yangao1 <yangao1@xiaomi.com>
2024-11-22 12:30:12 +08:00
zhengyu9
136b7065b7 gdb tools: print inode info
go through each inode and print its structure info
in the form like below:
├── i_name: bin, i_ino: 51
│   i_parent: , i_peer: data, i_child: , i_crefs: 1, i_flags: 3
│   ......(other info)
│   ├── i_name: audio, i_ino: 5
│   │   i_parent: dev, i_peer: binder, i_child: mixer......

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
2024-11-22 12:30:12 +08:00
zhengyu9
fab9670857 gdb tools: mount command
support mount command in gdb, print mount information
test result:
/bin type binfs
/data type hostfs
/etc type romfs
/proc type procfs
/resource type hostfs
/tmp type tmpfs

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
2024-11-22 12:30:12 +08:00
simbit18
d16de91e39 [MSYS2] CMake+Ninja Fix arm-none-eabi-ar: Argument list too long
This issue is related to the Arm toolchain for Windows which is available for x86 host architecture only (compatible with x86_64)

Windows (mingw-w64-i686) hosted cross toolchains
AArch32 bare-metal target (arm-none-eabi)

Issue
/bin/sh: line 1: /home/nuttx/nuttxnew/tools/gcc-arm-none-eabi/bin/arm-none-eabi-ar: Argument list too long

On Windows, arm-none-eabi-ar can only accept strings up to a maximum length of 32,768 characters.

We could suppress the 32K include string limitation by setting the CMake variable CMAKE_NINJA_FORCE_RESPONSE_FILE to ON.

This is unfortunately not enough!!! ): In the build phase this error comes out

$ cmake --build build
[2/1025] Building ASM object arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj
FAILED: arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj
/home/nuttx/nuttxnew/tools/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe @arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj.rsp -MD -MT arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj -MF arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj.d -o arch/CMakeFiles/arch.dir/arm/src/armv7-m/arm_exception.S.obj -c /home/nuttx/nxninja/nuttx/arch/arm/src/armv7-m/arm_exception.S
C:/msys64/home/nuttx/nxninja/nuttx/arch/arm/src/armv7-m/arm_exception.S:42:10: fatal error: nuttx/config.h: No such file or directory
   42 | #include <nuttx/config.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.

The Workround I found to solve this problem is to overwrite
the responsible file flag CMAKE_${lang}_RESPONSE_FILE_FLAG with $DEFINES $INCLUDES $FLAGS

Maybe there is a better solution but this one it works. :)
2024-11-21 19:18:38 -03:00
wangjianyu3
27f278af90 lm3s6965-ek/qemu: Using default max command line length
The large max command line length may cause stack overflow.

Test
  ./tools/configure.sh lm3s6965-ek:qemu-flat
  make -j16
  qemu-system-arm -semihosting \
  		-M lm3s6965evb \
  		-device loader,file=nuttx.bin,addr=0x00000000 \
  		-netdev user,id=user0 \
  		-serial mon:stdio -nographic

Link: https://github.com/apache/nuttx-apps/pull/2850
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-11-21 14:08:17 -03:00
wangmingrong1
6cd43777c3 x86-64: Support symbol table and kasan global variables cross-border detection
1. Add kasan compilation options
2. Modify the link process to support symbol tables and kasan global variables cross-border detection

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-22 00:01:36 +08:00
Neo Xu
1518f8bdb8 tools/gdb: fix type and comments
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-11-21 23:08:55 +08:00
anjiahao
cd78de7c63 memleak:Add reminder information
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-11-21 23:08:55 +08:00
anjiahao
b507a57158 thread.py: fix bug that ARM-A TCB info register offset is discontinuous
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
0f1e2cc7dc tools/gdb: make it compatible with older gdb
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
anjiahao
f53869f86f memleak:use global symbol to search all global variables
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-11-21 23:08:55 +08:00
anjiahao
8575f11e1e memdump.py:use import_check inside of once_init
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-11-21 23:08:55 +08:00
anjiahao
e71d45ce86 utils.py:support import check and requirements.txt
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-11-21 23:08:55 +08:00
buxiasen
bf2d6a3554 tools/gdb/memdump: add biggest/orphon dump.
information prefer from gdb to python class

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
fc0f7365bb tools/gdb: fix import error for certain gdb
For the prebuilt arm-none-eabi-gdb, there's no python builtin module
available.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
de5f70b3c8 tools/gdb: remove 'Nx' prefix for unique commands
1. Remove Nx prefix for nuttx unique commands.
2. Add docstring for most of the commands in order to show help message.
3. Add 'init_once' method for Memmap command. The prerequisite is checked the moment it's used.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
3a46b6e6af tools/gdb: cache gdb.Type result
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
1d25eed55c tools/gdb: fix CONFIG_SMP_NCPUS could be none
The macro could be eliminated by optimization.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
715c3ab079 tools/gdb: fix notification suppress not working
"on" string is always in the word 'notification'. Should use "is on" instead.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
ad1be85be7 tools/gdb: catch exception when there's no selected frame
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
bbf51ba071 tools/gdb: no need to read the whole memory firstly
Read the whole memory costs additional time. When the number memory nodes is
small, test on qemu shows that read memory directly is faster.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
12783c031c tools/gdb: only define c and s when thread comands enabled
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
yinshengkai
b81212e96f tools/gdb: Add memory fragmentation rate calculation
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
9dbf58f1be tools/gdb: optimize memleak speed
1. Avoid to_bytes by using memoryview directly.
2. No need to call gdb to cast to char *.
3. Cache the memory data without invoke gdb in every iteration.
4. Do code cleanup.

memleak speed improved from 261.93 seconds to 29.9 seconds for x4b
usecase.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
4e067fd762 tool/gdb: use second inferior to get symbol
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
yinshengkai
614e07c8f0 tools/gdb: supports generating memory map images
Display all memory nodes in a picture, which can be used to help analyze memory fragmentation

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-21 23:08:55 +08:00
xuxingliang
2f8c9070c5 tools/gdb: use native thread command
For coredump, gdb-stub, the thread command is natively supported.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-21 23:08:55 +08:00
anjiahao
089877c693 memleak:support use gdb to catching absolute memory leaks
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-11-21 23:08:55 +08:00
Zhe Weng
752245aca4 net: Move NET_TCP/UDP_HAVE_STACK to netconfig.h
Now the HAVE_PFINET(6)_SOCKETS depends on NET_TCP/UDP_HAVE_STACK, which
is previously defined in net/ folder and cannot be included.
Considering many places use this check, maybe moving them to netconfig.h
could be better.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-11-21 23:07:30 +08:00
Jouni Ukkonen
085830612c arch/arm64/imx9: Fix cntfrq_el0 to correct value
Read base frequency from system counter0 and write it
to arm core register. This corrects timers to work properly
Then enable counting.

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-11-21 11:26:45 -03:00
wangmingrong1
1d04884812 gcov: Add toolchain gcov dependency option
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-21 21:32:06 +08:00
wangchen
b58eaf7bc8 lib_getifaddrs.c:set the last multi ipv6addr next pointer to be NULL
If the pointer is not set to zero, it will erroneously point to itself, resulting in an erroneous loop pointing

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-11-21 21:31:28 +08:00
meijian
4e7f323633 net/getifaddrs: fix coverity bug
Signed-off-by: meijian <meijian@xiaomi.com>
2024-11-21 21:31:28 +08:00
meijian
884a6803d6 net/getifaddrs: Support multiple IPv6 addresses for getifaddrs
Signed-off-by: meijian <meijian@xiaomi.com>
2024-11-21 21:31:28 +08:00
guoshichao
f6cfcfa39f armv6-m: fix the incorrect stub-function entry address of svc call
the stub-function entry address is stored in r4, we should branch to the
stub-function with blx r4, not r5

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-11-21 20:08:42 +08:00
cuiziwei
58f226d2b5 libcxxmini: Add missing runtime related classes.
reference:https://github.com/libcxxrt/libcxxrt/tree/master/src

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-11-21 20:03:15 +08:00