Commit graph

39506 commits

Author SHA1 Message Date
guowei15
e2dce4e2ec arm/setjmp.h:add c++ support
N/A

Change-Id: I619cc15570adeff10f3a9b69bf9a3cff83e625c1
Signed-off-by: guowei15 <guowei15@xiaomi.com>
2021-02-24 16:41:57 +08:00
guowei15
dee30cae27 arm/setjmp.h:fix return_function undefined
N/A

Change-Id: Ic72fd8053b88cf349922154696fd8c3163cd850a
Signed-off-by: guowei15 <guowei15@xiaomi.com>
2021-02-24 10:11:19 +08:00
Xiang Xiao
4b3b32478a pthread: Change the default name from <pthread> to <0xyyyyyyyy>
since it's very easy to identify thread through entry pointer

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-02-22 16:07:34 +08:00
Xiang Xiao
f2f39c7e44 fs/procfs: Avoid the duplicated 0x prefix in pthread cmdline
like this:
... <pthread> 0x0x341de68c
 by removing "0x" from format string

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-02-22 16:05:26 +08:00
Peter Bee
1cd87d6f97 fs/mmap: add fd validation to correct errno
MIRTOS-111

Errors EBADF correctly. This is only a quick fix, and a lot needs
to be done with mmap().

Change-Id: Ica88360972447fbdd7c6af3bf76d8eeba4747db2
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-02-22 15:40:20 +08:00
chao.an
a77d103263 net/arp: add timeout to avoid infinite send wait
add timeout to avoid infinite send wait if the network device is unreachable

Change-Id: I839a5fe1fb64b7d6eee7ad28d93d2b27f067b915
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-02-22 10:37:58 +08:00
Peter Bee
3cc8acd454 boards/sim: add kvdb server start on boot
N/A

Works with kvdb server version

Change-Id: I763b39e80795201adb0138f3287e63c056d859fe
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-02-20 16:11:37 +08:00
Jiuzhu Dong
d1f3707798 signal: set SIGRTMIN to SIGUSR1 because signo 0 don't catch.
MIRTOS-434

Change-Id: I600fed48d25e19c229aac899508b86ddfebb24f6
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-19 16:51:08 +08:00
Jiuzhu Dong
fc2b0eb037 multi-uorb test config
N/A

Change-Id: Ie43cbe28d87e9482dcd55ef23585b7865a095b4c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-18 09:42:08 +08:00
Xiang Xiao
897270bcbf net/local: Add an option to specify the prefix of named pipe
N/A

to avoid the user create socket under the real filesystem
which isn't supported by nuttx VFS yet.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib04c90e9c3c5a215bfda65515498d81e5f834895
2021-02-17 19:29:56 +08:00
Jiuzhu Dong
de92bc7fad driver/sensor: gets the capacity of the hardware fifo
N/A

to hold the number of events

Change-Id: I58a9ad07913c7b189e1fd229ab22e91e220e01f6
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-09 11:51:09 +08:00
Jiuzhu Dong
94f6836d14 driver/sensor: Fetch(with O_NONBLOCK) will directly return.
N/A

when sensor is disable.

Change-Id: I02c02aa447ee0b0d681082b4209ecd36e10f2547
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-09 11:50:50 +08:00
Jiuzhu Dong
f44a5eeb4a driver/sensor: replace lower->buffer_size with lower->buffer_number
N/A

more efficient

Change-Id: I0823b10248caf75e4dd6a5086ad230ba4a7298f6
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-09 11:50:30 +08:00
丁欣童
96f1076140 Perfect fakesensor driver.
N/A

1.Add semaphore to wake up thread.
2.Unified use container_of.
3.Modify interval unit in order to keep pace
  with set_interval() function.

Change-Id: I93ac931e9d004c98d3a5100d26fbdb97f420a9d3
Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
2021-02-08 14:10:29 +08:00
chao.an
2898b4a71a net/sendmsg: workaround to support multi-iov case
Change-Id: I66e538c2f3a13db2f84eec9a3f364cf21902c5d1
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-02-08 10:51:43 +08:00
chao.an
65b95eea6f net/tcp: dynamic calculation of available iobs
Change-Id: I4b0d01204af74f1692ae061914617dbb4e8698c0
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-02-08 10:47:43 +08:00
chao.an
6f39a980f5 mm/iob: add iob_get_queue_count() helper
Change-Id: I73cc9bc9c51b25c828cefef917df12d202ffa414
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-02-08 09:50:32 +08:00
丁欣童
4fa2a5b4d1 Add fakesensor driver.
N/A

This driver can read data from csv file.

Change-Id: Ibf7af0553441b5c05a4a4f3e6ed4786472771be1
Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
2021-02-07 17:17:23 +08:00
Jiuzhu Dong
9674f89d56 libc/valloc: support valloc
MIRTOS-424

Change-Id: Ieb425a77b0a8d758956996d201223a0050ae4920
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-07 15:03:36 +08:00
Xiang Xiao
554ebdf851 mtd/ftl: Don't call ferr if return value equals -ENOTTY
MIRTOS4BES-22

since -ENOTTY is an expected code to indicate IOCTL isn't supported

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I62cf58c514be696327ad769ab2f35099154bcb42
2021-02-05 11:17:59 +08:00
Jiuzhu Dong
0e05d49284 rptun: fix compile break when disable openamp
N/A

Change-Id: I63251524d94fae43bfb0a71c324d55bf91d363f8
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-04 22:10:24 +08:00
Jiuzhu Dong
f9e7a0fc01 builtin: execute app whose filename is longer than NAME_MAX
MIRTOS-360

Change-Id: I0d8ed47c0391e65467cc8a2f4f499b0fbfa8c122
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-02-04 15:58:27 +08:00
ligd
00a9bc79d1 sim/up_uart.c: fix losting uart data when user paste long cmd
N/A

Change-Id: I66c01c0789fc83ae8f6db522d61ff8ab63cd9211
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-02-03 13:41:15 +08:00
chao.an
78f48fff18 libs/libc/time/localtime: fix race condition
fix race condition on create the instance of lcl/gmt

Change-Id: I214cc5c544d680b7206552e3caee2b17a722a0c3
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-02-02 17:27:56 +08:00
Xu Xingliang
245112dcdf Update symbol link to miwear/configs.
N/A

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Change-Id: I05b76dd0986d59cde22ba4e89596054586cfbb72
2021-02-02 15:05:08 +08:00
chao.an
effa0e0b1a sched/notifier: fix invaild unique key
N/A

Change-Id: Ie63af2a24a0421239d40b580b841cbf5abae446f
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-29 20:42:38 +08:00
Xiang Xiao
5e77dea5af pthread/barrier: call sem_get_value instead of nxsem_get_value
N/A

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I65eef2c23f0b59627730a45577d158877c987b78
2021-01-29 20:01:19 +08:00
chao.an
1b53662a72 sched/notifier: replace the unique key to freerun counter
N/A

replace the unique key to freerun counter to avoid traverse
of the notifier list.

Change-Id: I802fd51f07e27299bf6ad59a749bb674322f5357
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-29 18:04:09 +08:00
chao.an
9dd135ff07 net/ip: do not drop the udp packet from IP layer
N/A

this change to support receive the udp data from the specified
port without obtaining the address.

e.g: disable the Bootstrap flag on dhcpc handshake

Reference:
RFC1542: Clarifications and Extensions for the Bootstrap Protocol.

Change-Id: I9e2c4d8223e3be62e1722d51bf5b2f8258bee307
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-29 17:36:48 +08:00
chao.an
5f59460834 sched/wqueue/notifier: protect the work notifier with critical section
N/A

replace the semaphore to avoid the notifier holding the lock in the interrupt context

ASSERT:

libs/libc/assert/lib_assert.c:36   :_assert
sched/semphore/sem_wait.c:113      :nxsem_wait
sched/semphore/sem_wait.c:222      :nxsem_wait_uniterruptible
sched/wqueue/kwork_notifier.c:371  :work_notifier_signal
mm/iob/iob_free.c:188              :iob_free
drivers/syslog/syslog_stream.c:272 :syslogstream_destroy
...
sched/irq/irq_dispatch.c:183       :irq_dispatch

Change-Id: Ic4353bb2deeba0e517fd89f094156aa348623039
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-29 17:14:37 +08:00
liuhaitao
b8423e9681 [Boottime] add syslog info in system bootup stages
N/A

Add syslog in nuttx kernel entry and init start entry.

Change-Id: I014c58528e6f474d68d9664224a3c50937967a04
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-01-29 13:08:38 +08:00
chao.an
673526fc74 net/tcp: reset the connection ref count before tcp_free()
reset the connection refcount if SYN retry count has elapsed

Assertion:

up_assert: Assertion failed at file:tcp/tcp_conn.c line: 764 task: netdev_wq

N/A

Change-Id: I3b0966af52a9dc52d459e8b5aa7d478955d6691f
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-28 19:54:11 +08:00
Peter Bee
1f41e8bc0b sched/semaphore: sem_destroy sets semcount to 0
MIRTOS-386

matching the behavior of pthread_barrier_init check

Change-Id: I294df7ffed1d5d35497a8e18d6882d977565bb15
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-01-28 18:28:42 +08:00
liuhaitao
9532a100ff fs/romfs: fix open zero-byte file fail issue
N/A

Error log as below:
romfs_open: ERROR: Failed to locate start of file data: -5

Change-Id: I0594a84b727077606450dea3ea348cfc2390458b
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-01-27 20:56:08 +08:00
Jiuzhu Dong
2186b3b560 board/sim: Don't Exit immediately if command abnormal exits
N/A

Change-Id: I3b62fa4300d8d38896fce80021ba2cbcb79967f8
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-27 17:40:10 +08:00
chao.an
0687f3e83c drivers/bluetooth/bridge: correct the reference count condition
Change-Id: I771382efc2c61c96a3a20bffcea730c1a28568bc
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-26 21:32:50 +08:00
ligd
f4df6ab356 syslog_rpmsg: fix system crash when open CONFIG_SCHED_HAVE_PARENT
Reason:
nx_start use syslog at every early time event the idle thread not
full setup, then syslog_rpmsg -> work_queue -> work_signal ->
nxsig_kill -> rtcb is NULL -> crash

Fix:
sched work_queue after is_rpmsg_ept_ready() is true

Change-Id: I225469ff2526e4b810bf3e23473b55d57e64a1ff
2021-01-26 11:12:41 +08:00
danguanghua
85d38b9348 print message with nwarn to avoid constantly printout.
Change-Id: Ie549935ee227615e5b2b1fb13374608313ce1c66
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2021-01-25 22:13:29 +08:00
Jiuzhu Dong
d8452d22be unistd/getcwd: enhance getcwd when buf is NULL
N/A

Change-Id: I595e1874349f089691dc5291f31fb376cf0e2e2c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-25 16:01:39 +08:00
Peter Bee
d4080a4058 libc/pthread: return EBUSY when barrier is in use
MIRTOS-114

Add check for semcount==0 before barrier destroy and initialization

Change-Id: Ifa0cdb363714ad15eafa5ef49a025520ce836b1f
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-01-25 15:03:54 +08:00
chao.an
ac9251049b sim/init.d: enable fluoride
Change-Id: I91c1fb4eb9bd44bf33388383ee5a2f0136db6ab2
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-21 22:35:17 +08:00
ligd
0fe5ec8a48 sigdeliver: fix system block when kill signal to idle in SMP
Bug description:

CONFIG_SMP=y

Suppose we have 2 cores in SMP, here is the ps return:

PID GROUP CPU PRI POLICY TYPE    NPX STATE     STACK   USED  FILLED COMMAND
  0     0   0   0 FIFO   Kthread N-- Assigned 004076 000748  18.3%  CPU0 IDLE
  1     0   1   0 FIFO   Kthread N-- Running  004096 000540  13.1%  CPU1 IDLE

nsh> kill -4 0
or:
nsh> kill -4 1

system blocked.

Reason:

In func xx_sigdeliver() restore stage, when saved_irqcount == 0, that means
rtcb NOT in critical_section before switch to xx_sigdeliver(), then we need
reset the critical_section state before swith back.

Fix:

Add condition to cover saved_irqcount == 0.

Change-Id: I4af7f95e47f6d78a4094c3757d39b01ac9d533b3
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-21 16:56:44 +08:00
ligd
96d0764bbc signal/sig_kill.c: remove the limitation of kill(0, xx)
since there are situation which send singal to idle thread already,

CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y

Signo SIGCHLD will send to parent group, when child exit

Change-Id: Iceb2ac41948c1c3418839a3b5de70985d48c75d1
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-21 16:43:08 +08:00
Peter Bee
c61ca4000a sched/clock: add nsec range check in clock_settime
MIRTOS-109

Return error when tv_nsec <0 or >=1000 million.

Change-Id: Iddbbcda163cb402551f619efb7486f6798859d57
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-01-21 10:43:22 +08:00
ligd
387323b9b1 fs/tmpfs: fix compile error
make[2]: Entering directory '/home/ligd/platform/mirtos2/apps'
tmpfs/fs_tmpfs.c: In function 'tmpfs_rewinddir':
tmpfs/fs_tmpfs.c:2084:27: error: 'tdo' undeclared (first use in this function)
 2084 |   dir->u.tmpfs.tf_index = tdo->tdo_nentries;
      |                           ^~~
tmpfs/fs_tmpfs.c:2084:27: note: each undeclared identifier is reported only once for each function it appears in
Makefile:94: recipe for target 'fs_tmpfs.o' failed
make[1]: *** [fs_tmpfs.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: 'libwireless.a' is up to date.

Change-Id: I3846efa802fc6104bf908b8927138b9dd18f1227
2021-01-20 22:37:19 +08:00
Xiang Xiao
abebd91725 fs/tmpfs: Iterate the entry reversely in readdir
MIRTOS-342

to avoid readdir return the wrong entry in the following code:
void rmdir_recursive(FAR const char *path)
{
  FAR DIR *dir = opendir(path);

  while (1)
    {
      char fullpath[MAX_PATH];
      FAR dirent *ent = readdir(dir);

      if (ent == NULL)
        {
          break;
        }

      sprintf(fullpath, "%s/%s", path, ent->d_name);
      if (DIRENT_ISDIRECTORY(ent->d_type))
        {
          rmdir_recursive(fullpath);
        }
      else
        {
          unlink(fullpath);
        }
    }
}

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ide60fe8db6aada88ad3d8e45367f11599a6f33b1
2021-01-20 21:57:31 +08:00
Peter Bee
7a72a80d2a libc/sysconf: Add MONOTONIC_CLOCK for consistency
MIRTOS-107

Add _SC_MONOTONIC_CLOCK to sysconf when CONFIG_CLOCK_MONOTONIC is set

Change-Id: I0ae57798ebe89247a10ccb517e128866d1f907de
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2021-01-20 18:06:14 +08:00
chao.an
1cd39d813f net/dev: check the available address further
check the available address further to avoid obtain unusable device

Change-Id: Icdd91cf0c4cb158f00a49f74d054425c2aeacd14
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-20 16:33:43 +08:00
Jiuzhu Dong
68855c212f unistd/fpathconf: enhance fpathconf
MIRTOS-293

Change-Id: Id780d7b56b9790206d572d22aa210a8e0222108c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-19 21:48:53 +08:00
chao.an
832257677f sim/hcitty: remove the poll lock to avoid invalid wait
It is unnecessary to protect pollnotify since the wakeup
source comes from idle thread

Change-Id: I99c06508029dc18aa8ded1cb672b14f77e9509a0
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-19 20:21:40 +08:00