2289 Commits

Author SHA1 Message Date
zhanghongyu
7dd4b28950 netpkt_ethercat.c: fix the description of usage
the current usage description is incorrect,
ifname must follow ethercat. The number of transfers can be specified
only after ifname is specified.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-29 18:02:08 +08:00
zhanghongyu
429befe1ed examples/netpkt: add ethercat test example for robot
add a simple example to test ethercat's sending and receiving

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-27 15:59:14 +08:00
xuxingliang
28c3c05c28 example/libtest: add malloc/free to libtest
So we can verify flags like kasan are effective or not.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-27 15:05:36 +08:00
Neo Xu
c4b6fd77be lvgldemo: allow to customize input dev path
Default to /dev/input0, now it's configurable.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-27 14:05:37 +08:00
Petro Karashchenko
7f7bbe236d examples/mqttc: add option to use MBED TLS for connections
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-10-26 19:11:55 -03:00
Neo Xu
0109ab39ec lvgldemo: should use nuttx_deinit to free all resources
Memory leak can be detected when simply change the while(1) loop to exit. The lv_nuttx_deinit will free resources including display, input etc.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-26 21:33:00 +08:00
Felipe Moura
f517b66d60 examples/spislv_test: Added app that allows users to test SPI Slave comm
This application continuously reads the file system of the spislv. Each received message will be written to the user in hexadecimal form, and the same received data will be sent back. In this way, the user can test if their spislv driver and hardware setup are working properly before proceeding further.

On a master device, using the SPI tool, when sending the message: spi exch -x 4 deadbeef

The slave device will output:
Slave: 4 Bytes read
 Value in hex form from /dev/spislv2: de ad be ef
Slave: Writing value back to /dev/spislv2
2024-10-22 18:41:12 +02:00
raiden00pl
a7024aea89 examples/foc: protect control loop with critical section
If the controller frequency is high, system timer interrupts will
eventually interrupt the controller function, thereby increasing the
execution time. This may lead to skipping the control cycle, which
negatively affects the control algorithm.

With this option enabled, interrupts are disabled for the duration
of the controller function execution.

Here example results from CONFIG_EXAMPLES_FOC_PERF output
for b-g431b-esc1 board with CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ=10000:

1. CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC=n

  exec ticks=5258
    nsec=30929
  per ticks=21268
    nsec=125105

2. CONFIG_EXAMPLES_FOC_CONTROL_CRITSEC=y

  exec ticks=3428
    nsec=20164
  per ticks=19203
    nsec=112958

The difference is ~12us!
2024-10-18 10:43:46 +08:00
raiden00pl
b85a5ed306 examples/foc: ignore error for align and ident routines when motor controller disabled
CONFIG_EXAMPLES_FOC_RUN_DISABLE option is used for tests and benchmarks, so we don't
care about wrong results for motor identification and sensor alignment routines
2024-10-18 10:43:46 +08:00
raiden00pl
1aacc99491 examples/foc: print aling results only when verbose output enabled
it is a costly operation that takes a lot of time and is not of much value
2024-10-18 10:43:46 +08:00
raiden00pl
103bf83608 examples/foc: fix option that disable motor controller
fix some compiler error when EXAMPLES_FOC_RUN_DISABLE is enabled
2024-10-18 10:43:46 +08:00
raiden00pl
beeec27afd examples/foc: improve perf monitor
improve FOC perf monitor:

- add options to choose when perf result should be printed
- measure the controller thread call period
2024-10-18 10:43:46 +08:00
raiden00pl
5c166edf63 examples/foc: fix compilation error
fix compilatgion error:

foc_motor_f32.c: In function 'foc_motor_init':
foc_motor_f32.c:1574:7: error: label 'errout' used but not defined
 1574 |       goto errout;
2024-10-18 10:43:46 +08:00
raiden00pl
fc863b6cd0 examples/foc: fix snprintf warning
fix snprintf warning:

    foc_thr.c:110:39: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 7 [-Wformat-truncation=]
      110 |   snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, envp->id);
          |                                       ^~
    foc_thr.c:110:36: note: directive argument in the range [-2147483648, 0]
      110 |   snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, envp->id);
          |                                    ^~~~~~
    foc_thr.c:110:3: note: 'snprintf' output between 5 and 15 bytes into a destination of size 10
      110 |   snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, envp->id);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-10-18 10:43:46 +08:00
wangjianyu3
0b727d290b examples/sotest: Correct the path in the log
e.g.
  - ERROR: dlopen(/sotest) failed
  + ERROR: dlopen(/mnt/sotest/romfs/sotest) failed

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-10-17 08:53:49 +08:00
wangjianyu3
4eba6101b4 module/sotest: Using syslog to print log
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-10-16 21:42:39 +08:00
anjiahao
bb492e789d sotest & chardev:change elf loading method
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-16 07:38:06 +08:00
anjiahao
bebb7e9a46 module/sotest:use Compile dynamic modules using a unified compilation method
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-16 07:38:06 +08:00
yintao
2d248c1eaa examples/rpsock: fix redefined warning
CC: rpsock_client.c:41:9: warning: 'ALIGN_UP' macro redefined

Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-16 07:16:07 +08:00
yintao
bfde92a3fd examples/rpmsgsocket: fix build warning
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-16 07:16:07 +08:00
ouyangxiangzhen
44d2250b6e apps: Fix compilation error after nuttx/arch.h excluded.
This patch fix compilation error after excluding nuttx/arch.h.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-10-16 07:12:40 +08:00
yinshengkai
dbef7b5f85 examples: fix usrsocktest compiler warning
error: variable 'ret' set but not used [-Werror=unused-but-set-variable]
   112 |   int ret;

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-13 10:35:20 +08:00
likun17
3927b33237 examples/bmi160:bmi160 add urob mode example.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-12 10:34:22 +08:00
Neo Xu
d91e3db9fd noteprintf: fix compile warnings
noteprintf_main.c:52:7: warning: unused variable 'binary' [-Wunused-variable]
   52 |     } binary =

Fix typo of sched.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-11 18:30:33 +08:00
Huang Qi
648e25bac1 examples/pipe: Enhance test by different r/w thread priority
By arranging and combining the priorities of read and write
threads to cover more usage scenarios.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-10-11 18:20:29 +08:00
xuxin19
190926b467 cmake:add romfs/unionfs/tcpblaster/udpblaster exmaple app CMake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-09 20:15:49 +08:00
yinshengkai
30df081276 examples: fix noteprint compile error
The sched_note_string/bprintf/dump interfaces have been removed and replaced with printf and event

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-08 23:35:46 +08:00
wangmingrong
cc1c4a3722 examples/romfs: Compilation error after enabling options
Enable CONFIG_PROFIG_EXAMPLES_ROMFS compilation error

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-10-08 14:04:39 +08:00
wanggang26
d5d8e9eacb fix build error:
[linguini@pastabox nuttx]$ make -j
CC:  tcpblaster_server.c
LN: platform/board to
/home/linguini/cuinspace/pico-nuttx/apps/platform/dummy
tcpblaster_server.c: In function ‘tcpblaster_server’:
tcpblaster_server.c:159:14: error: implicit declaration of function
‘accept4’; did you mean ‘accept’? [-Wimplicit-function-declaration]
  159 |   acceptsd = accept4(listensd, (FAR struct sockaddr *)&myaddr,
&addrlen,
      |              ^~~~~~~
      |              accept
make[3]: *** [Makefile:92: tcpblaster_server.hobj] Error 1
make[2]: *** [Makefile:53:
/home/linguini/cuinspace/pico-nuttx/apps/examples/tcpblaster_context]
Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:180: context] Error 2
make: *** [tools/Unix.mk:457:
/home/linguini/cuinspace/pico-nuttx/apps/.context] Error 2
make: *** Waiting for unfinished jobs....

from https://github.com/apache/nuttx-apps/issues/2632

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-05 09:06:43 +08:00
Petro Karashchenko
66b79a7c89 style: fix indentation issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-10-04 08:17:51 +08:00
xucheng5
76d419ca45 example/can: replace field ch_unused with ch_tcf
Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-02 21:22:14 +08:00
Petro Karashchenko
161c996079 apps: use sizeof array in snprintf
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-10-02 10:40:05 +02:00
dongjiuzhu1
6c88a1ad76 examples/elf/sotest: enable and run them simultaneously
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-02 01:53:14 +08:00
dongjiuzhu1
15c90ac17e examples/sotest/elf: rename romfs_img to run test with CONFIG_NSH_ROMFSETC
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-02 01:53:14 +08:00
dongjiuzhu1
fdc35d0bad examples/elf: remove unnecessary config CONFIG_EXAMPLES_ELF_DEVPATH
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-02 01:53:14 +08:00
Kevin Zhou
23bf7fb449 usbserial: Add config for customize direction, message and wait time 2024-10-01 11:37:45 +08:00
dulibo1
46768fc85d gpio:add example for wakeup gpio type
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-30 18:31:03 +08:00
Huang Qi
2ecaf0ec48 examples: Add wamr_module
This example demonstrates how to register a external module
into WAMR runtime.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-28 15:47:40 +08:00
jianglianfang
e4e46c3f53 fb_main: fix draw_rect24
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-09-28 10:51:34 +08:00
wanggang26
eab2cba4a1 enable SOCK_CLOEXEC explicit
leaking here means fork/vfork will duplicate fd without O_CLOEXEC flag
to the child process.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-26 16:13:29 +08:00
wangjianyu3
b1c4e39205 examples/gps: Add default case for switch-warning of vendor extended sentence
Vendor may add extended sentence may not handled in switch, error if -Werror=switch enabled.
And extended sentence should not added to general examples.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 22:11:39 +08:00
wangjianyu3
ad2514fc6f examples/gps: Fix switch error
Log:
  gps_main.c:83:7: error: enumeration value 'MINMEA_SENTENCE_LOR_LSQ' not handled in switch [-Werror=switch]
     83 |       switch (minmea_sentence_id(line, false))
        |       ^~~~~~

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:42:31 +08:00
wangjianyu3
dae4d7572f module/sotest: Try devminor of romdisk
For case that /dev/ram${EXAMPLES_SOTEST_DEVMINOR}(e.g. /dev/ram0) already exists, and users may not care which device to use.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-18 12:16:02 +08:00
wangjianyu3
758ed55722 examples/sotest: Fix warning of unused variable 'devname'
Config:
  +CONFIG_EXAMPLES_SOTEST=y
  +CONFIG_EXAMPLES_SOTEST_BINDIR="/data"
Log:
  sotest_main.c: In function 'sotest_main':
  sotest_main.c:105:8: error: unused variable 'devname' [-Werror=unused-variable]
    105 |   char devname[32];
        |        ^~~~~~~

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-18 11:36:27 +08:00
wangjianyu3
74b05468d6 module/sotest: Fix depends of SOTEST_BUILTINFS
Log:
  sotest_main.c: In function 'sotest_main':
  sotest_main.c:116:29: error: storage size of 'desc' isn't known
    116 |   struct boardioc_romdisk_s desc;
        |                             ^~~~
  sotest_main.c:116:29: error: unused variable 'desc' [-Werror=unused-variable]
  cc1: all warnings being treated as errors

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-18 11:36:27 +08:00
Huang Qi
140647cf8c Minor code style fixes
Fix issue in these files:
examples/flowc/flowc_mktestdata.c
examples/nxhello/nxhello_listener.c
examples/system/system_main.c
fsutils/passwd/passwd_append.c
graphics/ft80x/ft80x_gpio.c
graphics/pdcurs34/pdcurses/pdc_keyname.c
graphics/pdcurs34/pdcurses/pdc_touch.c
modbus/functions/mbfuncdiag.c

Fixed by AI and checked by manual

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-15 02:27:41 +08:00
xuxin19
683f25af15 cmake:support romfs prog for SIM CMake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-13 23:16:26 +08:00
xuxin19
3d8dc5dce5 cmake:implement CMake build for NuttX Lua interpreter
add CMake module for register lua mod
nsh> lua
Lua 5.4.0  Copyright (C) 1994-2020 Lua.org, PUC-Rio
> hello.say_hello()
Hello World!
> io.write("abs is =",math.abs(-10),"\n")
abs is =10
> os.exit()
nsh>

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-13 12:31:10 +08:00
meijian
1f51bfe64d apps/ipforward: fix ci check failure
note: static declaration of 'chksum' follows non-static declaration

Signed-off-by: meijian <meijian@xiaomi.com>
2024-09-12 13:38:38 +08:00
meijian
002e31c56d apps/dhcpd: fix dhcpd set dip error
dhcpd will set dip routing table 0.0.0.0|0.0.0.0|10.0.0.1 (TARGET|NETMASK|ROUTER) which will cover other's router 0.0.0.0|0.0.0.0|10.1.10.1.
And will cause shell/apps to internet failure.

Signed-off-by: meijian <meijian@xiaomi.com>
2024-09-12 01:11:30 +08:00