Commit Graph

1473 Commits

Author SHA1 Message Date
Lucas Saavedra Vaz
22e777cf08 tools: Fix BASE_DEFCONFIG generation 2023-07-10 19:54:06 +08:00
chao an
6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Petro Karashchenko
cb2849b4ab Revert "tools: Fix CONFIG_BASE_DEFCONFIG generation"
This reverts commit bc4266fa48.
2023-07-03 19:18:32 -03:00
Petro Karashchenko
d7af2f4c0a tools/ci: remove 'brew update' needed for AVR toolchain installation on OSX
Remove 'brew update' introduced by https://github.com/apache/nuttx-testing/pull/88
as it seems to be not longer needed

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-03 19:16:19 -03:00
Stuart Ianna
b9fa045427 tools/syscall: Resolve compile time warning on address validation.
The following warning is emitted when building with GCC 12.2.0:

"the comparison will always evaluate as ‘true’ for the address of ‘g_parm’ will never be NULL [-Waddress]"

As g_param is an array of char[]. each member should have an actual address, so the validation in each if statement is not required.
2023-06-28 08:47:07 +08:00
Stuart Ianna
160e1a965d mkexport: Allow boards to supply custom gnu-elf.ld.
Allows boards to supply their own gnu-elf linker script, used when building Nuttx applications and CONFIG_BUILD_KERNEL.

This is useful when building fully-linked applications (see #9395).
2023-06-28 08:46:10 +08:00
SPRESENSE
31a2c22112 tools: Add script to parse callstack
Add 'callstack.py' script for parsing stack dump log to callstack.
2023-06-27 10:10:12 -03:00
chao an
df6d799577 tools/ci: Update GNU Arm Embedded Toolchain to Version 12.2-2022.12.22
x86_64 Linux hosted cross toolchains
AArch32 bare-metal target (arm-none-eabi)

arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz

Remove toolchain workaround which already fixed by ARM:
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
https://community.arm.com/support-forums/f/compilers-and-libraries-forum/53470/arm-gnu-toolchain-11-3-rel1-x86_64-arm-none-eabi-wrong-newlib-version-strings-error-when-stdlib-h-is-included

Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-26 20:03:38 +08:00
anjiahao
adc5c8b5ac Debug:support python script auto debug nuttx kernel
This patch add an example and pyhton base modules:
1.add memdump.py is an example to analyze memory
usage by python script.
2.add The most basic data structure analysis, like list, etc.

future ideas:
Maybe we can add modules related to "sched, drivers, arch, fs.." to
automatically analyze scripts to debug some problems

References:
linux kernel (https://github.com/torvalds/linux/tree/master/scripts/gdb)
The official manual of gdb (https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html)

Change-Id: Ib9025a0a141cb89f3813526f7c55dcb28de31ed9
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-25 18:17:30 +08:00
Lucas Saavedra Vaz
bc4266fa48 tools: Fix CONFIG_BASE_DEFCONFIG generation
Modify sed command to avoid appending multiple "-dirty" at the end of the configuration name
2023-06-19 23:07:42 +08:00
zhangyuan21
514e77b75e semaphore: Optimize priority inheritance with only one holder
This PR is a modification that optimizes priority inheritance
for only one holder. After the above modifications are completed,
the mutex lock->unlock process that supports priority inheritance
can be optimized by 200 cycles.

Before modify: 2000 cycle
After modify: 1742 cycle

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-06-17 08:26:46 +03:00
Huang Qi
4c9e11d559 tools: Support string upper/lower case in make
Implement UPPER_CASE/LOWER_CASE function in pure make, usage:
```
UPPER = $(call UPPER_CASE,$(xxx))
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-06-02 11:12:12 -03:00
Lucas Saavedra Vaz
6a220a08ba tools: Add way to get current defconfig name on runtime
This commit aims to provide a way to get the current applied defconfig on runtime by providing CONFIG_BASE_DEFCONFIG that is updated when the configure and build scripts are run.
2023-06-02 09:17:58 -03:00
chao an
fb9b41221d semantic/parser: fix compile warning found by sparse
Reference:
https://linux.die.net/man/1/sparse

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-30 23:00:00 +08:00
chao an
6fdb8b8a66 tools/coredump: add coredump python parser
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 20:42:04 +08:00
yinshengkai
416cd2da35 tools/mkallsyms: add exception handle
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-05-19 20:22:55 +08:00
Liyu Wang
d7d6fa4d82 Fix windows compile errors because of double quotes in config
The "CONFIG_APPS_DIR" generated in .config has double quotes and is not recognized as a path by most make systems. This commits removes these double quotes to make the compile successfully.
2023-05-17 11:56:29 -03:00
chao an
26361ee1d2 tools/nuttx-gdbinit/armv7-a: add fpu support
The offset of the relevant registers in xcp will change after
enabling the FPU, this PR will add fpu offset correct the register offset

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 21:40:43 +08:00
chao an
50cf3d8577 tools/nxstyle: add "_NSGetExecutablePath" into ignore list
sim/posix/sim_hostmisc.c:128:6: error: Mixed case identifier found

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 17:05:42 +08:00
Alan Carvalho de Assis
d3b6bbe4fd tools/refresh.sh: Add option to refresh all archs or all chips
Currently when we modify some Kconfig related to some chip or
some architecture we need to run refresh.sh to all boards that
is too slow (more than one hour to finish).

This patch modify the script to update only the boards configs
of an specific chip or only the boards of an specific architecture.

Examples:

$ ./tools/refresh.sh --silent --defaults arch:renesas
  Normalize us7032evb1/ostest
  Normalize us7032evb1/nsh
  Normalize skp16c26/ostest
  Normalize rx65n-rsk2mb/netnsh
  Normalize rx65n-rsk2mb/ipv6
  Normalize rx65n-rsk2mb/nsh
  Normalize rx65n-rsk1mb/netnsh
  Normalize rx65n-rsk1mb/nsh
  Normalize rx65n-grrose/netnsh
  Normalize rx65n-grrose/ipv6
  Normalize rx65n-grrose/nsh
  Normalize rx65n/nsh

It updates the boards from all 'renesas' architecture (m9c, rx65n, sh1)

$ ./tools/refresh.sh --silent --defaults chip:rx65n
  Normalize rx65n-rsk2mb/netnsh
  Normalize rx65n-rsk2mb/ipv6
  Normalize rx65n-rsk2mb/nsh
  Normalize rx65n-rsk1mb/netnsh
  Normalize rx65n-rsk1mb/nsh
  Normalize rx65n-grrose/netnsh
  Normalize rx65n-grrose/ipv6
  Normalize rx65n-grrose/nsh
  Normalize rx65n/nsh

It updates all the boards from renesas chip 'rx65n' family
2023-05-15 10:44:44 +08:00
chao an
a3ddd4d27a tools/Unix: treat kconfig warning as failure
The syntax check of kconfiglib is stricter than kconfig-frontends,
but the warnings of kconfiglib are not catched by Makefile. Since kconfiglib
is implemented by python, the return value of the shell is always zero($?),
In this PR, I redirected the relevant standard errors to the file to check
whether the kconfig warning is occurred

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-08 21:36:45 +03:00
chao an
95ca613e98 tools/nuttx-gdbinit/armv7-a: reorder and synchronization registers of save/restore
The order of the registers was changed by the following commit:

---------------------------------
| armv7-a/r: modify regs index to improve exception performance
|
| Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-09 01:01:53 +08:00
chao an
af559a8311 tools/nuttx-gdbinit: improve experience of gdb backend scripts
Redefine built-in command (info thread/thread/c) to compatible with developer habits

Test board:
./tools/configure.sh -E lm3s6965-ek:qemu-flat

1. start qemu:
qemu-system-arm   -M lm3s6965evb   -device loader,file=nuttx   -serial mon:stdio   -nographic  -s

2. gdb attach:
gdb-multiarch -ix tools/nuttx-gdbinit nuttx -ex "target extended-remote localhost:1234"

3. show thread info and callstack:

| (gdb) info thread
| * 0 Thread 0x20001548  (Name: Idle Task, State: Running, Priority: 0, Stack: 1000) PC: 0x9eee in up_idle()
|   1 Thread 0x20005058  (Name: hpwork, State: Waiting,Semaphore, Priority: 224, Stack: 1992) PC: 0xa124 in up_switch_context()
|   2 Thread 0x20005c20  (Name: nsh_main, State: Waiting,Semaphore, Priority: 100, Stack: 2000) PC: 0xa124 in up_switch_context()
|   3 Thread 0x20006b30  (Name: NTP daemon, State: Waiting,Semaphore, Priority: 100, Stack: 1952) PC: 0xa124 in up_switch_context()
|   4 Thread 0x200086f0  (Name: telnetd, State: Waiting,Semaphore, Priority: 100, Stack: 2008) PC: 0xa124 in up_switch_context()
| (gdb) bt
| #0  0x00009eee in up_idle () at chip/common/tiva_idle.c:62
| #1  0x00003dd2 in nx_start () at init/nx_start.c:698
| #2  0x00000190 in __start () at chip/common/lmxx_tm4c_start.c:177
| (gdb) thread 4
|   4 Thread 0x200086f0  (Name: telnetd, State: Waiting,Semaphore, Priority: 100, Stack: 2008) PC: 0xa124 in up_switch_context()
| (gdb) bt
| #0  up_switch_context (tcb=0x20001548 <g_idletcb>, rtcb=rtcb@entry=0x200086f0) at common/arm_switchcontext.c:95
| #1  0x0000453a in nxsem_wait (sem=sem@entry=0x2000916c) at semaphore/sem_wait.c:176
| #2  0x0000197e in _net_timedwait (sem=sem@entry=0x2000916c, interruptible=interruptible@entry=true, timeout=timeout@entry=4294967295) at utils/net_lock.c:101
| #3  0x0000198e in net_sem_timedwait (sem=sem@entry=0x2000916c, timeout=timeout@entry=4294967295) at utils/net_lock.c:242
| #4  0x00001996 in net_sem_wait (sem=sem@entry=0x2000916c) at utils/net_lock.c:330
| #5  0x00025f84 in psock_tcp_accept (psock=<optimized out>, addr=<optimized out>, addrlen=<optimized out>, newconn=newconn@entry=0x2000956c) at tcp/tcp_accept.c:274
| #6  0x00025432 in inet_accept (psock=<optimized out>, addr=<optimized out>, addrlen=<optimized out>, newsock=0x20009568, flags=0) at inet/inet_sockif.c:1443
| #7  0x00027a10 in psock_accept (psock=0x200044b8, addr=addr@entry=0x2000921c, addrlen=addrlen@entry=0x2000920c, newsock=newsock@entry=0x20009568, flags=flags@entry=0) at socket/accept.c:149
| #8  0x00027a8c in accept4 (sockfd=sockfd@entry=3, addr=addr@entry=0x2000921c, addrlen=addrlen@entry=0x2000920c, flags=flags@entry=0) at socket/accept.c:280
| #9  0x0002a256 in accept (sockfd=sockfd@entry=3, addr=addr@entry=0x2000921c, addrlen=addrlen@entry=0x2000920c) at net/lib_accept.c:50
| #10 0x0001efaa in telnetd_daemon (config=config@entry=0x20009290) at telnetd_daemon.c:200
| #11 0x0001e508 in telnetd_main (argc=1, argv=0x20008af8) at telnetd.c:98
| #12 0x00008486 in nxtask_startup (entrypt=0x1e4bd <telnetd_main>, entrypt@entry=0x1 <up_putc>, argc=1, argv=0x20008af8) at sched/task_startup.c:70
| #13 0x000056d2 in nxtask_start () at task/task_start.c:134
| #14 0x00000000 in ?? ()
| (gdb) c

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-07 14:49:13 +08:00
chao an
0460165f9a tools/nuttx-gdbinit: remove unsafed function call from script
Some time nuttx will receive SIGSEGV while executing the function:

| Thread 1 "nuttx" received signal SIGSEGV, Segmentation fault.
| 0xf7bab4a0 in __sanitizer::common_flags_dont_use () from /lib/i386-linux-gnu/libasan.so.6
| The program being debugged was signaled while in a function called from GDB.
| GDB has restored the context to what it was before the call.
| Evaluation of the expression containing the function
| (up_check_tcbstack) will be abandoned.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-07 14:49:13 +08:00
chao an
0da1599e9e tools/nuttx-gdbinit: correct xcp context size
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-07 14:49:13 +08:00
liuhaitao
db84cd2e59 tools: add git pre-commit hook based on checkpatch.sh
tools/pre-commit should be copied to .git/hooks/pre-commit to take
effect.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2023-05-03 14:42:34 +02:00
yanghuatao
e9dfa0094f libm/libmcs: add math library libmcs support
add math library libmcs support
(1)open menuconfig  (2)close math.h:build setup->Customize Header Files->math.h (3) select libmcs:Library Rountines->Select math library->Math Library fram LibmCS (4)build

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-04-29 13:47:28 +08:00
chao an
c87da0d115 tools/nxstyle: add white files list to allow assembly headers to pass ci checks
Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-28 09:51:52 +08:00
zouboan
64b948cfde tools/Win.mk: fix error: can't open file .\NuttX\nuttx /arch/dummy/Kconfig in Windows native build 2023-04-27 00:32:15 +08:00
yanghuatao
6d5f8caf53 libm/openlibm: add math library openlibm support.
add math library openlibm support
(1)open menuconfig  (2)close math.h:build setup->Customize Header Files->math.h (3) select openlibm:Library Rountines->Select math library->Math Library fram openlibm (4)build

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-04-25 20:37:00 +08:00
yanghuatao
826dd87f30 libm/newlib: add newlib/libm support
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-04-24 10:32:53 +08:00
Huang Qi
b21f68d751 tools/mksymtab: Fix a compilation warning
Fix:
```
mksymtab.c: In function ‘main’:
mksymtab.c:280:15: warning: the comparison will always evaluate as ‘true’ for the address of ‘g_parm’ will never be NULL [-Waddress]
  280 |       cond = (g_parm[COND_INDEX] && strlen(g_parm[COND_INDEX]) > 0);
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-04-23 12:22:19 +08:00
David Sidrane
b5913af01b tools:Add STM32 Pin migration tool
tools/stm32_pinmap_tool: Generate legacy file

stm32_pinmap_tool:Handel #undef
2023-04-19 09:58:11 +02:00
Fotis Panagiotopoulos
098b7bbfb3 Fixes in asprintf usage. 2023-04-19 02:48:39 +08:00
Fotis Panagiotopoulos
1530e04f20 ostest: Enabled KASAN, UBSAN & assertions. 2023-04-19 02:44:48 +08:00
chao an
41f1044fa0 ci/cibuild.sh: upgrade esptool to 4.5.1
Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-12 23:14:45 +03:00
chao an
743d13c2b0 tools/nxstyle: skip mixed case check for particular headers
Add header keywords into whitelist, skip the warning if the
particular headers will contain the functions with mixed case

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-11 11:12:32 +03:00
Huang Qi
7f27129896 tools: Move Rust relative settings to Rust.defs
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-04-01 16:45:11 +03:00
Huang Qi
2650fa9509 tools/Zig: Simplify compile flags handling
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-31 16:55:15 -03:00
Huang Qi
536739d2da tools: Export LLVM style arch info for non-c language
Current Toolchain.defs set the compile flags directly, it's OK for
target specified gcc toolchain.

But some LLVM based toolchains (Rust/Zig etc) use single toolchain to handle all supported paltform.

In this patch, arch level Toolchain.defs export standard LLVM style arch flags, and let <Lang>.defs to map them into internal style,

This will simplify the intergration of non-c language.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-29 09:26:38 -03:00
Lucas Saavedra Vaz
1b87c86619 boards: Update and fix configs for ESP boards 2023-03-25 12:23:35 +02:00
Stuart Ianna
6a357797cd tools/export: Add LDELFFLAGS to mkexport.sh.
Some targets, such as qemu-rv support multiple architectures. The required flags need to passed to the linker when built "out-of-tree" in the application directory.
2023-03-24 15:02:59 -03:00
Petro Karashchenko
f84f30fe17 tools/ci: upgrade to the latest Xtensa ESP32 toolchains
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-03-21 21:59:30 -03:00
Gustavo Henrique Nihei
81499fcdf2 risc-v/espressif: Add support for ESP32-H2
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-14 23:55:35 +01:00
Gustavo Henrique Nihei
17f7f6e86d risc-v: Add Espressif chip family support on top of esp-hal-3rdparty
Initially supporting ESP32-C3 chip, to be followed by other RISC-V-based
chips from Espressif.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-14 23:55:35 +01:00
yinshengkai
e1c9b5def0 tools/parsetrace: fix context swtich parsing error
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-13 22:23:35 +02:00
Karel Kočí
62661600b2 treewide: add DOWNLOAD variable as unification of curl call
This is a followup to the commit
03b164f59c.
2023-03-08 17:05:05 +08:00
raiden00pl
c4c2b14623 tools/nxstyle: add 'IRQn_Type' to whitelists 2023-03-05 17:56:37 +02:00
chao an
a7de849944 tools/ci: setup wasi-sdk/wamrc into cibuild
wasi-sdk:
https://github.com/WebAssembly/wasi-sdk
wamrc:
https://github.com/bytecodealliance/wasm-micro-runtime

Signed-off-by: chao an <anchao@xiaomi.com>
2023-03-04 01:40:25 +08:00
zhangyuan21
83bbb54558 tools/ci: Don't build simusb on macOS
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-03-03 14:31:30 -03:00