Commit Graph

839 Commits

Author SHA1 Message Date
Masayuki Ishikawa
147a796a7a system: popen: Fix to build with CONFIG_BUILD_KERNEL=y
Summary:
- This commit fixes to build with CONFIG_BUILD_KERNEL=y

Impact:
- None

Testing:
- Tested with sabre-6quad:knsh (not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-07-29 10:20:19 +08:00
jihandong
74af9a8065 app/system/uorb: fix error, memset() wrong size.
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
131e4dc69d system/uorb: simply orb_check by SNIOC_UPDATED
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
3f865c4f9e uorb/listener: ignore first get_state failed.
Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
2b8bfc5be7 app/system/uorb: modify unit test to support data persist
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
874ed7654d app/system/uorb: fix listener run_once not work.
And remove dead code.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
f02c5a5d7e system/uorb: support new api
orb_advertise_multi_queue_persist

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
ligd
37f1e453b1 uorb: use another writing method to avoid compiler bug
int func(int b)
{
    int a;

    while (1) {
        ...;

        if (b != 0)
            a = 1000 / b;

        ...;
    }
}

if b == 0, then system crash in Xtensa arch, clang compiler

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
8558e63772 uorb_listener: support set batch latency
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
3a8f4b53fc apps/uorb: fix compile break
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
384c05beb2 app/system/uorb: alloc on heap instead of stack.
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
e97b1a79d6 uorb_listener: support subscribe physical sensor before node register
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
5bb4e14aad system/uorb: always let orb_advertise, orb_advertise_queue for instance 0
1.orb_advertise, orb_advertise_queue for instance 0
2.orb_advertise_multi, orb_advertise__multi_queue for specified instance
3.If orb_advertise_multi_queue with instance is NULL, auto increase
instance from existing base.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
53ee04ba3c uorb/listener: add new api: orb_open and orb_close
don't using subscriber to get state to avoid rpmsg access

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
d44dd1c426 uorb_unit_test: optimize stack used
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
6fceb913a2 system/uorb: optimize stack used
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
9f6d322186 system/uorb: listener, has 'top' command.
Listener can scan device under ORB_SENSOR_PATH, subscribe them and
cotinue printing messages by call their cb.

'-T' can Continuously print updating objects, '-l' means only
print once.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
4ec3f70f1d apps/system/uorb: support orb_get_meta by name string
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
Jiuzhu Dong
46c98420b7 system/uorb: add builtin sensor topics
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
d8d1e1e761 apps/system/uorb: c unit testcases
testcases:
1. test_single(): single instance, advertise then subscribe.
2. test_multi_inst10(): 10 instance, each 1 subscriber.
3. test_multi(): 2 instances, 2 advertisers, 2 subscribers.
4. test_multi_reversed(): same as test_multi(), but subsribe before
		          advertise.
5. test_unadvertise(): unadvertise upper 4 advertisers.
6. test_multi2(): same as tset_multi(). but multi-thread.
7, test_queue():  topic queue_size = 16.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-23 16:57:58 -03:00
jihandong
3528b5515f apps/system/uorb: c interfaces.
refer to: https://docs.px4.io/v1.12/en/middleware/uorb.html

- orb_open: do real work for advertise() and subscribe(), if thre is
            no user, register topic first, then save meta in driver;
            only first user can successfully set buffer number.
- orb_exists: check topic state, if topic only has subscribers,
	      return "not exists".

Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-07-23 16:57:58 -03:00
Xiang Xiao
c252ec1481 Add printflike to all printf like functions
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-18 14:09:10 +03:00
Norman Rasmussen
5c84c47cad system/hostname: Add an option to read the hostname from a file 2022-07-18 12:29:51 +08:00
Xiang Xiao
dd7e98129a system/libuv: Fix the undefined reference to `uv__strscpy'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-03 20:25:52 +03:00
Xiang Xiao
f5c094aef1 system/libuv: Skip compile strscpy.c when CONFIG_LIBUV_UTILS_TEST enable
since test/test-strscpy.c will include it in this case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-03 20:25:52 +03:00
Xiang Xiao
8d1484b562 system/libuv: Include nuttx/tls.h to call task local storage api
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-01 22:50:54 +03:00
Huang Qi
24c16780e2 libuv: Don't add idna.c to CSRCS if test enabled
test-idna.c will include idna.c and then cause multiple definition.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-05-13 08:23:23 +03:00
chao.an
725fe76b91 trace: format the usage output
before:
Usage: trace <subcommand>...
Subcommand:
  start [-c][<duration>]          : Start task tracing
  stop                            : Stop task tracing
  dump [-a][-c][<filename>]           : Output the trace result
 [-a] <Android SysTrace>
  mode [{+|-}{o|w|s|a|i|d}...]        : Set task trace options
  switch [+|-] : Configure switch trace filter
  syscall [{+|-}<syscallname>...] : Configure syscall trace filter
  irq [{+|-}<irqnum>...]          : Configure IRQ trace filter
  print [+|-] : Configure dump tnsh>

after:
Usage: trace <subcommand>...
Subcommand:
 start   [-c][<duration>]            : Start task tracing
 stop                                : Stop task tracing
 cmd     [-c] <command> [<args>...]  : Get the trace while running <command>
 dump    [-a][-c][<filename>]        : Output the trace result
                                       [-a] <Android SysTrace>
 mode    [{+|-}{o|w|s|a|i|d}...]     : Set task trace options
 switch  [+|-]                       : Configure switch trace filter
 syscall [{+|-}<syscallname>...]     : Configure syscall trace filter
 irq     [{+|-}<irqnum>...]          : Configure IRQ trace filter
 print   [+|-]                       : Configure dump trace filter

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-05-12 14:55:34 +08:00
chao.an
089c05cbd8 system/trace: correct arg index if command is alreay set
An error occurs when the same command is executed twice

$ trace switch +
$ trace switch +
Usage: trace <subcommand>...
Subcommand:
  start [-c][<duration>]          : Start task tracing
  stop                            : Stop task tracing
  dump [-a][-c][<filename>]           : Output the trace result
 [-a] <Android SysTrace>
  mode [{+|-}{o|w|s|a|i|d}...]        : Set task trace options
  switch [+|-] : Configure switch trace filter
  syscall [{+|-}<syscallname>...] : Configure syscall trace filter
  irq [{+|-}<irqnum>...]          : Configure IRQ trace filter
  print [+|-] : Configure dump tnsh>

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-05-12 14:55:34 +08:00
chao.an
8ce86fe572 system/sched_note: fix build break
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-05-12 14:55:34 +08:00
Xiang Xiao
385603666b system: Add gcov command
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-04 18:08:07 +03:00
Abdelatif Guettouche
473611d51d system/ping: Guard against division by zero when calculating the RTT.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2022-04-23 20:17:45 +03:00
Huang Qi
768a21b587 system/i2c: Fix fd leak in i2ccmd_reset
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-04-19 14:53:51 +03:00
Huang Qi
c7413ee859 system/critmon: Fix dead code
Remove branch since errcount could never bigger than 100.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-04-19 18:21:00 +08:00
okayserh
c8bc287a29 According to the help text, the balance command without value
should display the current balance value. This patch adjusts
the code accordingly.
2022-04-11 11:07:49 +08:00
chao.an
8c1a4994cc system/note: correct unflatten format
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-08 01:38:13 +08:00
Petro Karashchenko
319203d5d8 apps: unify FAR attribute usage across apps
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-05 00:55:22 +08:00
chao.an
124c1328a6 sched/note: add support of trace section mark
The implementation of this feature is based on android systrace:

https://source.android.com/devices/tech/debug/ftrace

Application developers are more concerned about the performance of
the specified application section,
added two APIs to implement performance measurement:

void sched_note_begin(FAR const char *str);
void sched_note_end(FAR const char *str);
or
SCHED_NOTE_BEGIN();  /* defined to sched_note_begin(__FUNCTION__) */
SCHED_NOTE_END();    /* defined to sched_note_end(__FUNCTION__) */

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-03 18:04:28 +08:00
chao.an
f4a41c6ed4 system/trace: fix the irq print compatibility with systrace
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-03 18:04:28 +08:00
chao.an
023971d46c system/trace: add switch priority print to align with ftrace
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-03 18:04:28 +08:00
chao.an
2fd38eb57b system/trace: force flush the output stream
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-03 18:04:28 +08:00
chao.an
7612d2aea8 system/trace: correct preamble header pid
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-03 18:04:28 +08:00
chao.an
90484a33e9 sched/trace: correct the note print format
note print should with Instruction pointer.

e.g:

        trace_printk("hello NuttX");

trace dump:

        hello-6  [000] .... 23080.367994: 0xc044a005: hello NuttX

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-03 18:04:28 +08:00
chao.an
0dc716d426 sched/note: unify the data format
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-03 18:04:28 +08:00
Petro Karashchenko
214dbe51b4 open() options: pass file options 0 if only ioctl is used
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-01 12:22:07 -03:00
qiaohaijiao1
442d52e878 system/nxlooper: fix warning
nxlooper.c:615:7: warning: 'playbufs' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2022-03-31 16:59:16 +08:00
qiaohaijiao1
68fa377c5e system/nxplayer: fix warning
nxplayer.c:400:57: warning: array subscript 4 is above array bounds of 'uint8_t[4]' {aka 'unsigned char[4]'} [-Warray-bounds]
nxplayer.c:400:57: warning: array subscript 5 is above array bounds of 'uint8_t[4]' {aka 'unsigned char[4]'} [-Warray-bounds]
nxplayer.c:400:57: warning: array subscript 6 is above array bounds of 'uint8_t[4]' {aka 'unsigned char[4]'} [-Warray-bounds]
nxplayer.c:400:57: warning: array subscript 7 is above array bounds of 'uint8_t[4]' {aka 'unsigned char[4]'} [-Warray-bounds]

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2022-03-31 16:59:16 +08:00
ligd
9730eaad9e nsh: sh_main also support isctty = true
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 22:47:37 +03:00
ligd
427798f7ee nxlooper: support different period size of player & recorder
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 02:46:07 +08:00
Huang Qi
ec15dc0344 system/libuv: Support specify stack size for worker thread
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-29 18:09:10 +03:00