Commit Graph

7335 Commits

Author SHA1 Message Date
Yanfeng Liu
cf27f085f5 add const for romfs_img_len
this makes both declarations read-only as they are corelated.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-04 09:12:48 -08:00
Lee Lup Yuen
41a4963515 config.nims: Support Nim Apps for RISC-V 32-bit and 64-bit
NuttX Build fails when it compiles `examples/hello_nim` for RISC-V (32-bit and 64-bit). That's because the Nim Config Script `config.nims` couldn't identify the Nim Target Platform: `riscv32` or `riscv64`.

This PR fixes `config.nims` so that Nim Compiler correctly derives the Nim Target Platform (`riscv32` or `riscv64`), by searching NuttX `.config` for `CONFIG_ARCH_FAMILY=rv32` or `rv64`.

This logic is slightly different from the Nim Targets `arm` and `arm64`, which are currently derived from `CONFIG_ARCH=arm` and `arm64`.

`config.nims` is explained in this article: https://lupyuen.github.io/articles/nim#inside-nim-on-nuttx
2024-01-04 09:11:34 -08:00
Xiang Xiao
e55c0d9aa5 Remove @ tag from all comments
and format the multiple line comments

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-01-04 10:26:49 +01:00
Zhe Weng
9489659890 netutils/ping: Optimize stack usage of icmp_ping
Can reduce 88~144 Bytes on ARMv7-A depending on optimization level.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-02 19:47:23 +01:00
Lee Lup Yuen
16bca8b568 examples/hello_nim: Fix nimcache location
The Nim Example App fails to build because the `.nimcache` is located 2 folders up. This PR fixes the location of `.nimcache` in the `Makefile` of the Nim Example App.

`.nimcache` is explained in this article: https://lupyuen.github.io/articles/nim#inside-nim-on-nuttx
2024-01-02 09:52:54 -08:00
Zhe Weng
4c0bd143eb nshlib/ifconfig: Let "dns" option depends on CONFIG_NETDB_DNSCLIENT
"dns" option of `ifconfig` can work just with `CONFIG_NETDB_DNSCLIENT`,
no need to depend on `CONFIG_NETINIT_DNS` or `CONFIG_NETINIT_DHCPC`.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-30 01:40:05 -08:00
renjianguang
d9b8a0ee62 drivertest: Fix drivertest_audio crash
1.call AUDIOIOC_RELEASE when finished
2.make sure the driver dequeue all buffers before free the buffers

Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2023-12-28 05:38:58 -08:00
Yanfeng Liu
4d9f2e3692 optional argument for generated ROMFS file path.
existing headerfile path is used when argument is missing.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-28 05:36:18 -08:00
fangxinyong
ba075747be ostest: Add initial support for CONFIG_BUILD_KERNEL
task_* APIs are unavailable in kernel build mode, replacing with
posix_spawn or pthread_* API to pass the case. But posix_spawn requires
some dependency, for example CONFIG_BUILTIN and CONFIG_LIBC_EXECFUNCS,
so pthread_* APIs are used in most scenarios. Some tests should be
re-visited because the intent is to user another task (in this case
another process) to e.g. receive signals.
That will require quite a bit of extra work.

Tests that had to be disabled:
- restart: task_restart() does not work at all with kernel mode so it is
  disabled entirely
- fpu: make sure the FPU test is not even attempted, because it will cause
  ASSERT() and stop the test
- vfork: vfork() does not work for some reason in CONFIG_BUILD_KERNEL,
  there is something missing on the kernel side, so just disable the test for now

Tests that should be re-visited:
- The signal tests, now they signal the process itself while before the
  signal was sent to another task. This will require building the part
  that receives the signal as a separate process
- waitpid: Like stated above, waitpid does not work for pthreads
- suspend: kill to send signal does not work for pthreads

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
Co-authored-by: Ville Juven <ville.juven@unikie.com>
2023-12-27 10:01:05 -08:00
YAMAMOTO Takashi
f12586c51e interpreters/wamr: add INTERPRETERS_WAMR_DEBUG_AOT option
At least it's sometimes useful for nuttx sim.

eg. (modified a bit to avoid github autolinks)
```
spacetanuki% lldb ./nuttx
(lldb) target create "./nuttx"
Current executable set to '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64).
(lldb) settings set plugin.jit-loader.gdb.enable on
(lldb) b foo
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 37011 launched: '/Users/yamamoto/git/nuttx/nuttx/nuttx' (x86_64)

NuttShell (NSH) NuttX-10.4.0
nsh> mount -t hostfs -o fs=/tmp/wasm /mnt
nsh> iwasm /mnt/test.aot
1 location added to breakpoint 1
Process 37011 stopped
* thread #_1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #_0: 0x0000000105800673 JIT(0x1058002d4)`foo(exenv=0x0000000101284280) at test.c:5
   2
   3    __attribute__((noinline))
   4    void foo()
-> 5    {
   6        printf("hello from %s\n", __func__);
   7    }
   8
Target 0: (nuttx) stopped.
(lldb) bt
* thread #_1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #_0: 0x0000000105800673 JIT(0x1058002d4)`foo(exenv=0x0000000101284280) at test.c:5
    frame #_1: 0x000000010580077a JIT(0x1058002d4)`bar(exenv=0x0000000101284280) at test.c:12:2
    frame #_2: 0x000000010580086a JIT(0x1058002d4)`baz(exenv=0x0000000101284280) at test.c:19:2
    frame #_3: 0x0000000105800972 JIT(0x1058002d4)`__main_argc_argv(exenv=<unavailable>, argc=<unavailable>, argv=<unavailable>) at test.c:26:3
    frame #_4: 0x00000001058061aa JIT(0x1058002d4)`aot_func#14 + 278
    frame #_5: 0x00000001058005cd JIT(0x1058002d4)`aot_func#2 + 153
    frame #_6: 0x00000001000e250f nuttx`push_args_end at invokeNative_em64.s:61
    frame #_7: 0x000000010013851a nuttx`wasm_runtime_invoke_native(exec_env=0x0000000101284280, func_ptr=0x0000000105800534, func_type=0x00000001011e2e20, signature=0x0000000000000000, attachment=0x0000000000000000, argv=0x0000000000000000, argc=0, argv_ret=0x0000000000000000) at wasm_runtime_common.c:4631:9
    frame #_8: 0x00000001000da1ae nuttx`aot_call_function(exec_env=0x0000000101284280, function=0x00000001011e1fb0, argc=0, argv=0x0000000000000000) at aot_runtime.c:1654:15
    frame #_9: 0x0000000100134b56 nuttx`wasm_runtime_call_wasm(exec_env=0x0000000101284280, function=0x00000001011e1fb0, argc=0, argv=0x0000000000000000) at wasm_runtime_common.c:2048:15
    frame #_10: 0x00000001000fbad4 nuttx`execute_main(module_inst=0x00000001011e3890, argc=1, argv=0x00000001011b63f8) at wasm_application.c:112:15
    frame #_11: 0x00000001000fb995 nuttx`wasm_application_execute_main(module_inst=0x00000001011e3890, argc=1, argv=0x00000001011b63f8) at wasm_application.c:238:11
    frame #_12: 0x00000001000ea1a0 nuttx`app_instance_main(module_inst=0x00000001011e3890) at main.c:113:5
    frame #_13: 0x00000001000e9d60 nuttx`iwasm_main(argc=1, argv=0x00000001011b63f8) at main.c:947:21
    frame #_14: 0x0000000100023275 nuttx`nxtask_startup(entrypt=(nuttx`iwasm_main at main.c:545), argc=2, argv=0x00000001011b63f0) at task_startup.c:70:8
    frame #_15: 0x000000010001065a nuttx`nxtask_start at task_start.c:134:7
    frame #_16: 0x000000010003a15f nuttx`pre_start at sim_initialstate.c:52:3
(lldb)

```
2023-12-25 04:47:07 -08:00
Takumi Ando
730370e565 fsutils: passwd: Fix wrong macro
passwd_update/adduser/deluser should be enabled
if CONFIG_FSUTILS_PASSWD_READONLY is NOT defined.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-12-21 16:16:20 +01:00
Huang Qi
afa282ca4f WASI-SDK.defs: Simplify CFLAGS filters
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-20 21:24:20 -08:00
Tiago Medicci Serrano
11f2d5e5e4 examples/rmtchar: Implement RX and/or TX using the RMT char driver
The RMT (remote control) character driver is used to send and/or
receive data packets. Eventually, this app can be used to perform
a loopback test to validate the RMT driver implementation.
2023-12-19 03:34:28 -08:00
yuanyongjian
dcfb4d0662 nshlib:dmesg add '-c|-C' opt
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2023-12-14 20:14:25 -08:00
Zhe Weng
b7c5bdbdc9 nshlib/ifconfig: Add error print for inet_pton fail
> ifconfig wlan0 inet6 add fb
nsh: ifconfig: argument invalid

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-12 22:17:05 -08:00
dependabot[bot]
7768e72d94 build(deps): bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 17:41:23 -08:00
anjiahao
ffbf920623 gdbstub:update gdb_process api
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 08:43:34 -08:00
Xiang Xiao
d6a5307270 Fix nuttx/porttimer.c:71:24: error: a function declaration without a prototype is deprecated
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-11 14:03:06 +08:00
Xiang Xiao
f28797cddf interpreters/bas: Fix compiler warning after gcc upgrade to version 12
bas_token.l: In function 'yylex':
Error: bas_token.l:1210:31: error: 'strcpy' writing 1 or more bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
 1210 |                             }
      |                               ^
In file included from bas_auto.h:77,
                 from bas_token.l:16:
bas_token.h:103:8: note: at offset 2 into destination object 'name' of size 2
  103 |   char name[2/* ... */];
      |        ^~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-10 06:40:51 -08:00
anjiahao
1334306585 coredump:support coredump command restore coredump form block device
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-08 19:28:09 -08:00
Petteri Aimonen
fcd0729e21 ptpd: Fix reserved word 'class'
When ptpd.h is included in C++ code, the use of identifier 'class'
caused a compilation error. Changed to "clockclass".
2023-12-07 18:26:39 -08:00
Zhe Weng
9abc82c792 nshlib/ifconfig: Generate default IPv4 gateway with netmask
Generate default gateway using configured netmask instead of fixed
255.255.255.0, which may be more flexible under certain situations.
e.g. A subnet like 10.0.23.16/28 may not contain the .1 address.

Before:

ifconfig eth0 10.0.23.22 netmask 255.255.255.252 => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.255.240 => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.255.0   => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.0.0     => DRaddr:10.0.23.1

ifconfig eth0 10.0.23.22 => Mask:255.255.255.0      DRaddr:10.0.23.1

After:

ifconfig eth0 10.0.23.22 netmask 255.255.255.252 => DRaddr:10.0.23.21
ifconfig eth0 10.0.23.22 netmask 255.255.255.240 => DRaddr:10.0.23.17
ifconfig eth0 10.0.23.22 netmask 255.255.255.0   => DRaddr:10.0.23.1
ifconfig eth0 10.0.23.22 netmask 255.255.0.0     => DRaddr:10.0.0.1

ifconfig eth0 10.0.23.22 => Mask:255.255.255.0      DRaddr:10.0.23.1

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-07 07:16:43 -08:00
Zhe Weng
fb72849089 nshlib/ifconfig: Set network mask before setting gateway
Switch the order of setting network mask and gateway, re-order only, no
logic change.

In IPv6 cases, we may set `addr6` and prefix length together to an
interface, but the gateway logic may change the value in `addr6`, and
result in wrong address set to the interface.

The order doesn't change behavior in network stack, so we just need to
make sure the value is correct.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-07 07:16:43 -08:00
liqinhui
91a697a3f4 renew6: Optimize the process of obtaining an IPv6 address.
If Managed Address Congfiguration flag in the Router Advertisement
Messsage is set, we would obtain the IPv6 address though the stateful
DHCPv6 procedure.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-12-07 06:26:50 -08:00
Huang Qi
f57cd2cf0c tools: Move final wasm module to bin/wasm as elf
And leave all intermediate file in apps/wasm,
such as .map file, entry object etc used in
wasm module build.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-06 08:29:00 -08:00
Huang Qi
3c624d38cd tools: Allow customize ld flags for each wasm module
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-06 08:29:00 -08:00
Huang Qi
bd159e103c tools: Split origin Wasm.mk into Wasm.mk and WASI-SDK.defs
Try to follow current NuttX's toolchain parttern:
Wasm.mk: Provide target rule for building wasm module
WASI-SDK.defs: Provide compile flags for building

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-06 08:29:00 -08:00
Huang Qi
f55b8face6 wamr: Add support for thumb target triple in Toolchain.defs
Before WAMR 1.3.0, eabihf in wamrc is `gnueabihf`, so without
this patch call wamrc will failed with target abi was `eabihf`,
we should convert the standard llvm target to wamrc required.

Both `eabihf` and `gnueabihf` supported after WAMR 1.3.0.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-06 08:29:00 -08:00
Huang Qi
3129b7a465 tools: Emit map file for wasm module
Emit map file like NuttX's `System.map` for more
debug information.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-12-06 08:29:00 -08:00
YAMAMOTO Takashi
733b6de818 toywasm: regen for v35
```
REF=e2ec1b60e06dbe360ae638970d01906ded5ab497 ./regen.sh
```
2023-12-06 08:17:42 -08:00
YAMAMOTO Takashi
282f9a744c toywasm: update to v35 2023-12-06 08:17:42 -08:00
Alan Carvalho de Assis
454426547c examples/modbus: Fix modbus example to keep running 2023-12-04 06:52:14 -08:00
Petteri Aimonen
6dd9adbb5b ptpd: Code quality improvements 2023-12-04 00:30:26 -08:00
Xiang Xiao
083eb5e993 Fix the wrong comment banner
"Private Type"->"Private Types"
"Public Data Type"->"Public Types"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-03 14:27:14 -03:00
raiden00pl
6a8344bf37 examples/nxscope: change the vector data sent by nxscope to be a 3-phase sin waveform
A changing waveform is nicer to visualize than a static vector.
2023-12-02 20:11:21 -08:00
raiden00pl
e7bb97cb5f examples/nxscope: make channel 19 configurable
Channel 19 uses an additional thread to send a text message.
This commit makes this behaviour configurable.
2023-12-02 20:11:21 -08:00
raiden00pl
5cfcd769bf examples/nxscope: make main interval configurable 2023-12-02 20:11:21 -08:00
Michal Lenc
aa49523bb3 testing: add open_memstream test tool
Test tool application for open_memstream for CI testing. Performs basic
write/seek operations.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-11-29 02:12:58 -08:00
chao an
f289cdb2ec lvgl/makefile: workaround for lvgl.v8
Since this change is only merged into the lvgl.v9, let us workaround for v8:
 37835260ca

 ./lvgl/src/core/lv_obj.c:363:25: warning: variable 'x' set but not used [-Wunused-but-set-variable]
   363 |         static uint32_t x = 0;
       |                         ^
 1 warning generated.

CFLAGS += -Wno-unused-but-set-variable

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-28 03:52:27 -08:00
Petteri Aimonen
af6e4d2cb9 ptpd: Code style and FAR pointer fixes 2023-11-24 20:15:38 -08:00
Petteri Aimonen
0adce22400 ptpd: Implement status & stop interfaces 2023-11-24 20:15:38 -08:00
Petteri Aimonen
efc6cfddb4 ptpd: Fix compilation error when debug messages disabled
The debug macros did not get declared in all setups.
2023-11-24 20:15:38 -08:00
Petteri Aimonen
e2168abe9a ptpd: Implement delay reqs, fix timing bugs
Fixed bug where negative offsets were not properly handled because
clock_timespec_subtract clamps values to zero.

Implement support for SO_TIMESTAMP to get accurate packet
reception timestamp.

Implemented delay requests for measuring packet transfer delay.

Implemented clock drift estimation to bring the clocks closer to
sync and to filter out measurement jitter.
2023-11-24 20:15:38 -08:00
Petteri Aimonen
8dbf26016a ptpd: Re-join multicast group after timeout
If multicast PTP packets are not being received, rejoin the multicast group.
This automatically recovers from situations such as rebooting a network switch.
2023-11-24 20:15:38 -08:00
zhanghongyu
ae59177279 matter: download chip and dependent source for open source version
The community version needs to dynamically fetch the matter source code at compile time and apply the required nuttx adaptation patch

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-23 00:19:37 -08:00
zhanghongyu
72e67e9d6d jsoncpp: add cmake scripts for jsoncpp
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-23 00:19:37 -08:00
zhanghongyu
891c5e0cc8 matter: add cmake support
A nuttx with the matter command can be compiled using cmake and enable CONFIG_MATTER option.
The matter compiled by the current script is just a lighting example of
a limited number of commands that can be tested by chip-tool.

After nuttx is connected to the LAN and the matter command is executed, other devices in the LAN, such as linux PCS, can run the following commands to scan, connect, turn on and off, adjust brightness and contrast, and so on.

chip-tool pairing onnetwork 1 20202021
chip-tool onoff on 1 1
chip-tool levelcontrol move-to-level 128 10 0 0 1 1
chip-tool colorcontrol move-to-hue-and-saturation 240 100 0 0 0 1 1

Depends on the following configuration options:
CONFIG_CRYPTO_MBEDTLS=y
CONFIG_DEV_URANDOM=y
CONFIG_LIBCXX=y
CONFIG_LIBM=y
CONFIG_NET_IPv6=y
CONFIG_NET_ICMPv6=y
CONFIG_NET_ICMPv6_AUTOCONF=y
CONFIG_NET_ICMPv6_NEIGHBOR=y
CONFIG_NET_ICMPv6_ROUTER=y
CONFIG_NET_ICMPv6_SOCKET=y
CONFIG_NET_IGMP=y
CONFIG_NET_MLD=y
CONFIG_NET_MLD_ROUTER=y

This initial version does not yet have Bluetooth and OTA support.

The community version needs to dynamically fetch the matter source code at compile time and apply the required nuttx adaptation patch.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-23 00:19:37 -08:00
Huang Qi
097411de49 wamr: Add support for custom section loading
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-11-21 08:11:59 -08:00
Marco Casaroli
ba43911a77 libtest: add PRIVATE to CMakeLists.txt
It looks like this word is needed for this build to work with cmake
2023-11-21 08:05:02 -08:00
raiden00pl
27588be53e examples/foc: replace CONFIG_INDUSTRY_FOC_* with CONFIG_EXAMPLES_FOC_*
Decouple the FOC example configuration from the FOC lib configuration.
Purely cosmetic change, without affecting functionality.
2023-11-18 08:40:16 -08:00