Commit graph

1964 commits

Author SHA1 Message Date
Huang Qi
f2a88059e7 tools/nxstyle.c: Add missing zlib function names to white list
The zlib compression functions are used in network utilities
for compression/decompression. These functions need to be added to
the nxstyle white list to prevent style checking errors since they
follow the zlib naming convention rather than NuttX's style guide.

Specifically, these functions are used in:
- apps/netutils/telnetc/telnetc.c for compressed data handling

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 15:26:39 -03:00
Eren Terzioglu
5e2fc181c2 tools/Unix.mk: Add host_info target to print nxdiag output
Nxdiag examples scripts  modified to print system information
without building and flashing nxdiag application to get report
about system without reflash or reconfigure.
2025-01-07 01:03:44 +08:00
wangmingrong1
2c5d849e01 gcov.py: Supports parsing multiple sets of gcov outputs at the same time and merging the results
Use the "-a" parameter to pass in gcda files exported by multiple devices

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-03 21:15:28 +08:00
Filipe Cavalcanti
1ae7efd388 tools/espressif: add fill-flash-size to build if MERGEBIN selected 2024-12-24 10:49:39 +08:00
wangmingrong1
b3813bd450 gcov: Solve the problem of incorrect report generation caused by different compilation and test environments
Due to the makefile, the relative paths of the files are different, and
it is impossible to use existing tools such as gcov and lcov to specify
a base compilation path for them.
The solution for Linux is to copy a copy of the source code from
the compilation environment to the test environment,
and there is a place that is consistent with the absolute
path of the compilation environment.
This solution is to pass in the "-b" parameter to directly
modify the info file generated by lcov. The search path will be
executed in the next step of genhtml

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-23 14:53:58 +08:00
wangmingrong1
e26e8bda0e gcov: gcov.py, gcov_convert.py scripts merged
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-21 20:49:37 +08:00
wangmingrong1
7d6b2e4804 gcov/script: gcov.sh is implemented using Python
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-21 20:49:37 +08:00
yaojingwei
bbd6931d61 nuttx/audio: add fake audio driver.
The fake audio driver aims to easily simulate the functions of audio driver through reading and writing files.
With it, you can conveniently customize and define various capture or playback audio drivers for debugging or automated testing.

Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-12-20 11:47:08 -03:00
wangmingrong1
391aa9b5f3 gcov: Enhanced gcov script
1. Add "-s" to specify the path to collect gcno files
2. Add "-a" to specify the path to collect gcda files.
3. Add "-x" for copy-only operation

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-18 20:24:14 +08:00
chao an
33d717d3a0 tools/parsetrace.py: fix typo lenght -> length
Signed-off-by: chao an <anchao@lixiang.com>
2024-12-17 20:48:07 +08:00
Matteo Golin
e96fb6b118 arch/bcm2711, boards/raspberry-pi-4b: Add preliminary support for the BCM2711 and Raspberry Pi 4B.
Includes a Mini-UART NSH console for the 4B, tested on the 4GB RAM
model. Part of an I2C driver which can only read, boiler-plate for a SPI
driver, and a GPIO driver with limited pins. Some tools are present for
automatically fetching the boot files and creating the `config.txt` file
based on selected Kconfig options.
2024-12-17 16:43:17 +08:00
Alin Jerpelea
f65a17da37 tools/macar-qcs.sh: migrate license to ASF
Xiaomi has signed the SGA and we can migrate the license to ASF

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-16 14:14:55 +08:00
YAMAMOTO Takashi
566e1c3a7d tools/ci/platforms/darwin.sh: bump bloaty version
hopefully this can fix build failure on macos-13. (see below)

i tested "cibuild.sh -i" with macOS 15.2, x86-64, Xcode 16.1.

```
 [470/495] Linking CXX executable bloaty
FAILED: bloaty
: && /Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -W -Wall -Wno-sign-compare -fdiagnostics-color=always -O2 -g1 -isysroot /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=13.7 -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/bloaty.dir/src/main.cc.o -o bloaty  liblibbloaty.a  third_party/protobuf/cmake/libprotoc.a  third_party/re2/libre2.a  third_party/capstone/libcapstone.a  /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libz.tbd  third_party/abseil-cpp/absl/strings/libabsl_strings.a  third_party/protobuf/cmake/libprotobuf.a  /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libz.tbd  third_party/abseil-cpp/absl/strings/libabsl_strings_internal.a  third_party/abseil-cpp/absl/base/libabsl_base.a  third_party/abseil-cpp/absl/base/libabsl_spinlock_wait.a  third_party/abseil-cpp/absl/numeric/libabsl_int128.a  third_party/abseil-cpp/absl/base/libabsl_throw_delegate.a  third_party/abseil-cpp/absl/types/libabsl_bad_optional_access.a  third_party/abseil-cpp/absl/base/libabsl_raw_logging_internal.a  third_party/abseil-cpp/absl/base/libabsl_log_severity.a && :
ld: Undefined symbols:
  absl::debugging_internal::Demangle(char const*, char*, int), referenced from:
      bloaty::ItaniumDemangle(std::__1::basic_string_view<char, std::__1::char_traits<char>>, bloaty::DataSource) in liblibbloaty.a[2](bloaty.cc.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
2024-12-13 23:28:02 +08:00
hujun5
98ce36cdc7 remove fl_crefs
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-13 23:04:10 +08:00
YAMAMOTO Takashi
fce4f2b3ee tools/ci/platforms/darwin.sh: update bloaty pin
This seems to fix build errors on my environment.
(macOS 15.1.1, x86-64, xcode 16.1)

```
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:45:5: error: use of undeclared identifier 'ABSL_INTERNAL_ASSUME'
   45 |     ABSL_INTERNAL_ASSUME(hi != 0);
      |     ^
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:49:3: error: use of undeclared identifier 'ABSL_INTERNAL_ASSUME'
   49 |   ABSL_INTERNAL_ASSUME(low != 0);
      |   ^
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:141:9: error: redefinition of 'operator/'
  141 | uint128 operator/(uint128 lhs, uint128 rhs) {
      |         ^
/usr/local/Cellar/abseil/20240722.0/include/absl/numeric/int128.h:1040:16: note: previous definition is here
 1040 | inline uint128 operator/(uint128 lhs, uint128 rhs) {
      |                ^
/Users/yamamoto/git/nuttx/tools/bloaty-src/third_party/abseil-cpp/absl/numeric/int128.cc:152:9: error: redefinition of 'operator%'
  152 | uint128 operator%(uint128 lhs, uint128 rhs) {
      |         ^
```
2024-12-13 18:23:29 +08:00
YAMAMOTO Takashi
ac3aa0185c tools/ci/platforms/darwin.sh: Don't use PIP_USER if venv is activated
On my environment PIP_USER doesn't work well.
```
error: externally-managed-environment
```
(macOS 15.1.1, x86-64, xcode 16.1)

Also, I prefer to use virtualenv anyway.
2024-12-13 18:23:29 +08:00
edbf2e21e7 CI: Move rv-virt:python from risc-v-06 to risc-v-07 2024-12-12 23:38:35 +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
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
wangmingrong1
909bf2dbb4 kasan/globals: fix compile error
../../../mm/kasan/global.c:58:44: error: type of 'g_global_region' does not match original declaration [-Werror=lto-type-mismatch]
   58 | extern const struct kasan_global_region_s *g_global_region[];
      |                                            ^
kasan_globals.tmp:3:21: note: 'g_global_region' was previously declared here
    3 | const unsigned long g_global_region[] = {
      |                     ^
lto1: all warnings being treated as errors

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 20:37:47 +08:00
wangmingrong1
cc88063646 debug symbol level: Use config instead
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-04 22:36:45 +08:00
xuxingliang
08139fb1db nxgdb/thread: fix ps command
Fix ps command reports wrong running stack corruption.
To get running tcb registers, need to read from frame register not the tcb context.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-12-02 13:43:52 +08:00
xuxingliang
1d55f111f3 gdb: check if pid is valid
Add check to make sure pid is valid.
Remove stack check for interrupt context.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-12-02 13:43:52 +08:00
xuxingliang
1f2435641d nuttxgdb: fix memdump busyloop when nodesize is 0
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-12-02 13:43:52 +08:00
xuxingliang
659e3f87a0 gdb/mmleak: add diagnose API to report details of the leak
Example of json dump:

    {
        "title": "Memory Leak Report",
        "summary": "Total 105 blks, 22768 bytes leaked",
        "result": "fail",
        "command": "mm leak",
        "data": [
            {
                "count": 1,
                "pid": 0,
                "size": 48,
                "address": 1100447608,
                "seqno": 0,
                "alive": true,
                "backtrace": []
            },
            {
                "count": 1,
                "pid": 4,
                "size": 368,
                "address": 1100549056,
                "seqno": 1041,
                "alive": false,
                "backtrace": [
                    {
                        "address": 1076428472,
                        "function": "<mm_zalloc+8>",
                        "source": "mm_heap/mm_zalloc.c:45"
                    },
                    {
                        "address": 1076424018,
                        "function": "<mm_calloc+18>",
                        "source": "mm_heap/mm_calloc.c:57"
                    },
                    {
                        "address": 1076419750,
                        "function": "<calloc+22>",
                        "source": "umm_heap/umm_calloc.c:73"
                    },
                    ....
                 ]
            },
  }

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-12-02 13:43:52 +08:00
Zhe Weng
3ad53656b9 tools/gdb: Fix gdbinit to unload all nuttxgdb related modules
There are many modules like nuttxgdb.* that we need to unload

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-12-02 13:43:52 +08:00
trns1997
7d2d38f899 install kconfiglib using apt repo 2024-12-02 13:43:29 +08:00
chao an
2961ecab9f sim/tflm: add tflite-micro demo into ci build
$ cmake -B build -DBOARD_CONFIG=sim/tflm -GNinja
$ cmake --build build
$ ./build/nuttx

NuttShell (NSH) NuttX-10.4.0
nsh> tflm -h

Utility to use tflite micro on nuttx.
[ -C       ] Compile tflite model into c++ codes.
[ -E       ] Do once evaluation (for profiling).
[ -i <str> ] Readable model file path.
[ -o <str> ] Writable c++ file path.
[ -p <str> ] Prefix of compiled code.
[ -a <int> ] Arena size (mempool).
[ -h       ] Print this message.

nsh> tflm -E -i /data/MobileNet-v3-Small.tflite -o /data/MbileNet-v3-Small.out
0 (id=0): size=602112, offset=0, first_used=0 last_used=1
1 (id=1): size=602112, offset=602112, first_used=1 last_used=2
2 (id=2): size=602112, offset=0, first_used=2 last_used=3
3 (id=3): size=607504, offset=802816, first_used=3 last_used=4
...
* (id=114): size=4096, offset=0, first_used=114 last_used=115
* (id=115): size=4000, offset=4096, first_used=115 last_used=115
 0: 00000000000000000000000000...................................................... (588k)
 1: 0000000000000000000000000011111111111111111111111111............................ (1176k)
 2: 2222222222222222222222222211111111111111111111111111............................ (1176k)
 3: 22222222222222222222222222........333333333333333333333333333................... (1182k)
...
"Event","Tag","Ticks"
0,SUB,0
1,MUL,0
2,PAD,0
3,CONV_2D,1
4,HARD_SWISH,0
5,PAD,0
...
110,MEAN,0
111,FULLY_CONNECTED,0
112,FULLY_CONNECTED,0
113,MUL,0
114,FULLY_CONNECTED,0
"Unique Tag","Total ticks across all events with that tag."
SUB, 0
MUL, 0
PAD, 0
CONV_2D, 3
...
"total number of ticks", 3
nxai done!

Signed-off-by: chao an <anchao@lixiang.com>
2024-11-29 18:34:10 +08:00
yangao1
968bb179fe nuttxgdb/rpmsg.py:dump rpmsg_service message
(gdb)rpmsg_service
g_rpmsg_cb:
rpmsg_cb_s at        ns_match                                 ns_bind
-------------        --------                                 -------
0xf4e00ac0           0x44708225 <rpmsg_rtc_server_ns_match>   0x4470874c <rpmsg_rtc_server_ns_bind>
0xf4e27b20           0x440c8fd6 <syslog_rpmsg_ns_match>       0x440c966a <syslog_rpmsg_ns_bind>
0xf4e27af0           0x0                                      0x0
g_rpmsg:
Endpoint at          Name                 local Addr   dest Addr    cb                                       ns_bound_cb                              ns_unbind_cb
-----------          ----                 ----------   ---------    --                                       -----------                              ------------
0xf2302ac0           NS                   53           53           0x44699520 <rpmsg_virtio_ns_callback>    0x0                                      0x0
0xf3c0f920           rpmsg-ttysensor      1025         1028         0x44704457 <uart_rpmsg_ept_cb>           0x0                                      0x0
0xf301d058           rpmsg-sensor         1026         1029         0x440c1680 <sensor_rpmsg_ept_cb>         0x440c1871 <sensor_rpmsg_device_ns_bound> 0x44693a18 <rpmsg_destroy_ept>
0xf2302a6c           rpmsg-ping           1027         1036         0x440a10d2 <rpmsg_ping_ept_cb>           0x0                                      0x0

List update: rpmsg dump contains none initialized list, need to take care of it in
NxList.

Signed-off-by: yangao1 <yangao1@xiaomi.com>
2024-11-28 20:40:04 +08:00
simbit18
00f831028f [ci] platforms: added toolchains
add toolchains for macOS on Apple Intel

xtensa-esp32s2
xtensa-esp32s3

add toolchains for macOS on Apple Silicon

xtensa-esp32s2
xtensa-esp32s3

add install for ubuntu.sh

xtensa-esp32s2
xtensa-esp32s3

add install for linux.sh

xtensa-esp32s2
xtensa-esp32s3
2024-11-26 10:14:42 +08:00
yinshengkai
e69903c939 tools/gdb: Add a singleton class for macros
Usage:
    macro = Macro("nuttx/nuttx")
    print(macro.CONFIG_MM_BACKTRACE)
    if macro.CONFIG_MM_BACKTRACE:
        print("mm backtrace is enabled")
    else:
        print("mm backtrace is disabled")

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-25 22:58:53 +08:00
yinshengkai
9eaec7ba49 tools/gdb: move the macros cache files to a temporary directory
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-25 22:58:53 +08:00
yinshengkai
7aa2dc24cd tools/gdb: fix checkpatch warning
Use Python raw strings to avoid escaping:
SyntaxWarning: invalid escape sequence '\?'

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-25 22:58:53 +08:00
xuxingliang
8031c9c1de gdb/mm: cache global variables to save time of memleak check
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:42 +08:00
xuxingliang
a0e9b82a79 tools/gdb: always use name to read register
For unknown reason, for some cases, GDB refuses to read register using descriptor. Let's stick to the register name.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:42 +08:00
xuxingliang
9881fbae28 tools/gdb: fix thread command not working
`thread` is a GDB prefix command. Use `define` can only change it to a
user prefix command. In this case, `thread 3` is unable to pass
the argument 3 to python.

Use python code to register command to overwrite this behavior. It may
not work with future GDB, but all is good for now.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:42 +08:00
xuxingliang
efb890abd3 gdb/diagnose: use unified message for command error
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:42 +08:00
xuxingliang
5b477aacca gdb/diag: catch gdb.error in diagnositics
gdb.error could report if memory is corrupted. Save and report the exception and continue to next command.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:42 +08:00
xuxingliang
191dbcc4f1 gdb/debug: add debugpy to debug python code
Usage:
(gdb) debugpy
Waiting for connection at localhost:5678

In VSCode, add new configuration in launch.
{
  "name": "Python Debugger: Remote Attach",
  "type": "debugpy",
  "request": "attach",
  "connect": {
    "host": "localhost",
    "port": 5678
  }
}

and launch.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:30 +08:00
xuxingliang
6119a5ea63 gdb: print trace back when some modules failed to load
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:19 +08:00
yangao1
400790d40b tools/gdb/gdbinit.py:add hint
Signed-off-by: yangao1 <yangao1@xiaomi.com>
2024-11-25 13:37:19 +08:00
xuxingliang
db9b5c4cee tools/gdb: register commands gracefully
Report any error and continue to try to register next command.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:19 +08:00
xuxingliang
65a93e972c tools/gdb: guide user for correct usage of nuttxgdb
Should use gdbinit.py instead of package __init__.py. Report the correct usage if user try to source the package directly.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 13:37:19 +08:00
xuxingliang
358261af19 tools/gdb: avoid direct access to tcb['name']
It could be disabled at compile time. Use utils.get_task_name to handle it

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00
xuxingliang
41c4eb08c0 gdb/mm: fix prev free judging and region search
1. The prev free flag should use field size instead of preceding to compare.
2. If not prev-free, then prevnode should be None.
3. Cast type to mm_freenode_s in order to access flink, blink when node is free.
4. Heap itself is also included in first region.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00
xuxingliang
8667f911bc gdb/mm: fix memdump when mempool backtrace is disabled
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00
xuxingliang
ee9673f62e gdb/memdump: add option to exclude nodes from specific PID
This is useful to exclude memory nodes for mempool.

E.g.

(gdb) mm dump --nob --top 5 --sort size --nop --no-pid -1
  Pool          CNT          PID         Size  Overhead          Seqno            Address Backtrace
     H            1            0     16777264        44             13         0x41a79010
     H            2          160      1536048        44     1129827490         0x41d6aad0
     H            1        45374      1536176        44     1129829080         0x45ef1010
     H            3          141       408440        44         145817         0x43905bf0
     H            7          158       131120        44          32955         0x4308d090
Total 14 blks, 23528696 bytes
(gdb) mm dump --nob --top 5 --sort size --nop
  Pool          CNT          PID         Size  Overhead          Seqno            Address Backtrace
     H            1            0     16777264        44             13         0x41a79010
*    H            6           -1      1048640        44         116954         0x436a0fd0
*    H            5           -1      1048640        44         146821         0x43b24fd0
*    H            3           -1      1048640        44          66161         0x4335bfd0
*    H            3           -1      1048640        44         156337         0x43d3ffd0
Total 18 blks, 16777264 bytes

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00
xuxingliang
f849092ede gdb/memdump: add option to parse memdump log from device
igned-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00
xuxingliang
06a696076a gdb/memdump: reorganize the memdump parameters
Make the dump_nodes etc more common to use.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00
xuxingliang
6d2ebfdec6 mm: dump node overheadp during memdump
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00