Commit graph

42798 commits

Author SHA1 Message Date
Jiuzhu Dong
b05bce3090 tzset: avoid taking semaphore in interrupt for non-kernel mode
Change-Id: Ic72819eddb38621751e462fe32e9e433288fb33c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-08-02 20:45:34 +08:00
Xiang Xiao
31f761cd48 libc: Support message catalog function
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/nl_types.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 19:47:20 +08:00
Xiang Xiao
400db72d79 libc: Rename match to fnmatch
specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/fnmatch.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 12:02:39 +08:00
Xiang Xiao
14c6bd1a5d libc: Add the empty nl_langinfo implementation
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 09:49:11 +08:00
Xiang Xiao
ac89e5cddc libc: Reorder LC_XXX as Linux
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 09:49:05 +08:00
Xiang Xiao
8f24fb9706 libc: Implement local_t related functions
since local_t isn't really implemented on NuttX,
we can simply redirect to the non-locale version.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 09:48:47 +08:00
Xiang Xiao
74fe533bb1 locale: Add LC_GLOBAL_LOCALE which is specified by the standard
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 09:48:36 +08:00
yangjiukui
309b215cda L61: Sensor: Add driver for OPT3007 light sensor.
N/A

Add light sensor.

Signed-off-by: yangjiukui <yangjiukui@xiaomi.com>
Change-Id: I91654ffff94a7faff17b765524b595cd92049b33
2021-08-02 09:12:18 +08:00
ligd
b09c2b42dd arm: add ARM_HAVE_NEON to Kconfig
Change-Id: I112037aa15a6fae76cf4b7c2df10a42899c38a61
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-30 14:31:39 +08:00
丁欣童
92be27f157 Use exit func iml host_abort.
N/A

When use poweroff command,host_abort will be called,but may be make __stack_chk_fail irq, and host_abort be called in PANIC(), so bring infinite loop, in turn it can not exit SIM.

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: If428e5fc65ace053420cc85c809ed7010b3df7d1
2021-07-30 11:46:33 +08:00
Jiuzhu Dong
20ff96a58d Revert "sim: change ownership to user ID of the calling process for shm file"
This reverts commit 03c1496e8e.
2021-07-29 23:01:08 +08:00
Xiang Xiao
cf41dee0f6 fs: Don't define UTIME_OMIT if __cplusplus is defined
to avoid libcxx misdetect NuttX support utimensat(_LIBCPP_USE_UTIMENSAT).
This patch need be reverted after utimensat is supported in NuttX.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-29 10:52:58 +08:00
Xiang Xiao
4574d83d0c fs: Add fchstat and chstat callback into mountpt_operations
and implement all status related change function. the individual
file system change will provide in other upcoming patchset.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8fde9db8eba9586e9c8da078b67e020c26623cf4
2021-07-29 10:52:58 +08:00
anjianjun
1c06fc0ca4 L61:bsp:Add bes mmcsd control support for provisional
Signed-off-by: anjianjun <anjianjun@xiaomi.com>
Change-Id: I390e740de1e4e6a42f702a83781082f9933e0647
2021-07-28 19:13:49 +08:00
anjianjun
52cfa2d4a3 drivers/mmcsd:Send cmd0 just once for Increased compatibility
Signed-off-by: anjianjun <anjianjun@xiaomi.com>
Change-Id: Ic2372c677af250b6268e6d29e823e50713ea138c
2021-07-28 17:31:14 +08:00
anjianjun
07d7eb3ac0 drivers/mmcsd:fix build error of debug
N/A

Signed-off-by: anjianjun <anjianjun@xiaomi.com>
Change-Id: I7b5f5590bb953add6919b64fa37f73cdcfc32b49
2021-07-28 17:30:59 +08:00
liuhaitao
3ad890d10f Make top Make.defs symlink to board Make.defs instead
Symlink to board Make.defs for top Make.defs, so top Make.defs
syncs in realtime.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
Change-Id: I379997dbc969d97f5b469286e1c99b91f75e059a
2021-07-28 16:52:15 +08:00
liucheng5
d82a248863 feature: driver: Add a Linux SPI into simulator.
N/A

When SIM_SPI is valid, a specified Linux SPI device ‘spidevN.P’(N is bus number and P is CS number) is attached to nuttx simulator, shown as 'spi0' under /dev. One may type spi command (need SPITOOL valid) in NSH to control the Linux SPI and exchange data, other devices such sensors can use it to debug in simulator on a Ubuntu PC. Note that a USB<>SPI module (e.g. CH341A/B) should be plugged in to achieve Linux SPI ports.

Change-Id: I275b2c2bbf6d14bcdf514c89efb9a2264d69e9a3
Signed-off-by: liucheng5 <liucheng5@xiaomi.com>
2021-07-28 10:05:26 +08:00
zhuyanlin
b0dbde28a5 arch:xtensa:vector: fix typo error in level4_ventor
Change-Id: I66cd3ff30e50e18ed718499aef609dd7aeb82dd3
2021-07-27 16:26:55 +08:00
zhuyanlin
39e702ab5d arch: xtensa: save current SP before overwrting in dispatch_c_isr.
In levelx(2,3,4,5)_handler, first need to save sp in a12,
then after dispatch_c_isr we can restore sp from a12.

Change-Id: Idb6b64a782da866670a4db80b33435a9b63f02c3
2021-07-27 16:26:50 +08:00
Jiuzhu Dong
e09737b061 wqueue: optimize work_s structure
Change-Id: I908ac2fcead3a6fed3078b2339392ed93d2e4809
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-27 15:53:52 +08:00
Xiang Xiao
ba9396d827 arch/sim: Copy include/nuttx/config.h to the local folder
so the source code compiled by host environment can include config.h
directly and then avoid pass Kconfig option through Makefile manually

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic9fe6f846082cef2d0808dc717df8ae6ed929edf
2021-07-27 11:08:58 +08:00
Xiang Xiao
ccb8538b6d sim: Correct the typedef in nuttx/hostfs.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5fbfd519417c5686325822549c068b1d42f83946
2021-07-27 11:08:47 +08:00
liuhaitao
14cc2d09d2 board/ctrl: add BOARDCTL_SWITCH_BOOT switch boot system support
BOARDIOC_SWITCH_BOOT is required to communicate the boot partition from
userspace (OTA subsystem) to board. It can be used to change the system
boot behavior. So it's useful for A/B boot or even single boot case.

For the board support A/B boot case:
1. Download the new image from the sever
2. Write the new image to the alternative partition
3. Call BOARDCTL_SWITCH_BOOT to the alternative system

For single boot partition case:
1. Download the new image from the sever
2. Call BOARDCTL_SWITCH_BOOT and reboot to a small system
3. Write the new image to the main partition in the small system
4. Call BOARDCTL_SWITCH_BOOT again to the main system

Change-Id: Ifebb495784ecf06842946a249bec64f75dce894f
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-07-26 22:46:18 +08:00
Jiuzhu Dong
c4e5410fa5 usrwqueue: implement order work queue
N/A

Change-Id: I9b6a76dec96f669c0b55bef39a9e5a2a71dde50b
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-25 00:12:40 +08:00
Jiuzhu Dong
3d8a09e4cb fs/inode: add sanity check for inode
Change-Id: Ib2c74ba308b8f15756fac4e69632c296243eb4ab
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-24 15:20:27 +08:00
Jiuzhu Dong
03c1496e8e sim: change ownership to user ID of the calling process for shm file
Change-Id: Ia0b5721421c2eb7fb408d55a26f821d6e95202df
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-23 21:55:15 +08:00
xiatian6
941aa03401 Feature: Seneor: Add sx9373 capacitive sensor driver.
N/A

Add sx9373 capacitive sensor driver for nuttx.

Change-Id: I7179633ac0ea5c9f073ddc13b50b442997e4a2c2
Signed-off-by: xiatian6 <xiatian6@xiaomi.com>
2021-07-23 18:36:13 +08:00
xiatian6
f8ef15915a Fix: Sensor: Fix the problem of uneven sampling.
N/A

Simply using workqueue will result in uneven sampling, so
the timer is used here to ensure the uniformity of the sampling
rate.

Change-Id: If49f4782bfe7d6c4d8335141bda6d3209d6241ae
Signed-off-by: xiatian6 <xiatian6@xiaomi.com>
2021-07-23 18:36:01 +08:00
Xiang Xiao
cd8be916d4 pthread: Shouldn't check the uninitialized field in pthread_barrier_init
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4d22e3945bba92020376a9c8485897533562d0b4
2021-07-23 13:58:17 +08:00
ligd
5988732436 arm: add up_secure_irq support
Change-Id: Ibc9402dcef4045ca122da400940d57de6b508308
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-22 12:02:06 +08:00
ligd
c4b1720b98 arch: add depends to trigger_irq
Change-Id: I334f625f8f1a6ebaa4fa5ea292de142a93120f51
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-22 12:02:06 +08:00
丁欣童
6805257488 fakesensor: transform ddmm.mmmm to dd.mmmmmm.
N/A

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: I8c4b0e73ee20507721fe9bac13de1519fedf4807
2021-07-22 10:22:58 +08:00
Xiang Xiao
cfee19f9a6 libc: Implement times function
https://pubs.opengroup.org/onlinepubs/009604599/functions/times.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If2cccfedd532a77f86035d16d36d94ae38d8f09c
2021-07-21 19:50:54 +08:00
Xiang Xiao
84b11713be libc/sysconf: Implement the query of _SC_CLK_TCK
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I36a62d97b14ea06bbc2054ee96fd2319b2f6897c
2021-07-21 19:49:02 +08:00
Jiuzhu Dong
1c3fe27235 sensor: directly return -ENOTSUP without the set_interval or batch
implementation for lowerhalf driver.

Change-Id: I7b02e0331e5f8b89b39896049a9e24ce30116f8a
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-21 19:41:06 +08:00
chao.an
f246c7e6ad net/socket: add SO_SNDBUF support
Change-Id: Ie7f82afd3a4c053112d15424499797eb046ed413
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-21 11:43:00 +08:00
chao.an
d58c9f1f47 net/wrb: add tcp/udp_inqueue_wrb_size() interface
Change-Id: Iccf2829e445d4842181cd6b8c0422cdfb35c498a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-21 11:42:11 +08:00
liuhaitao
332f2835a2 board/ctrl: correct BOARDIOC_USER command value
Change-Id: I3a8eb8c6c39516bbf24b1aee73312767c37158cd
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-07-20 22:26:17 +08:00
Jiuzhu Dong
8b4749f89f sim/rptun: optimize multi-core startup
Don't need to wait each other.

Change-Id: I6172823c84a96e4082fa5f33bdb05d7bd1d3b056
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-20 18:27:11 +08:00
Xiang Xiao
a27f0defa8 sim/rptun: Trigger the callback only the sequnece number change
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4fc8b876541ccb6ee12fa92145628eece0b90e3c
2021-07-20 17:59:53 +08:00
Xiang Xiao
6e5e9cf8a1 drivers/rptun: Start/stop remote processor in the background thread
to avoid blocking the main thread initialization process

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib8ab2a661ee9540bb03d9d4d851a8d8ee212404e
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-20 17:55:28 +08:00
ligd
45f9a11b29 netdb: fix access within misaligned address error
netdb/lib_dnsquery.c:444:14: runtime error: member access within misaligned address 0xef2f5a1b for type 'struct dns_question_s', which requires 2 byte alignment
0xef2f5a1b: note: pointer points here
 63  6f 6d 00 00 01 00 01 c0  0c 00 05 00 01 00 00 00  1c 00 1a 05 6d 75 73 69  63 06 6e 74 65 73 35
              ^
netdb/lib_dnsquery.c:445:14: runtime error: member access within misaligned address 0xef2f5a1b for type 'struct dns_question_s', which requires 2 byte alignment
0xef2f5a1b: note: pointer points here
 63  6f 6d 00 00 01 00 01 c0  0c 00 05 00 01 00 00 00  1c 00 1a 05 6d 75 73 69  63 06 6e 74 65 73 35
              ^

Change-Id: Id20d1f2eed5aa5e78a42233de0f5f2b51876dd44
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-20 15:32:58 +08:00
YAMAMOTO Takashi
3bc0c152c5 iob_trimhead: fix an integer truncation
I guess this fixes https://github.com/apache/incubator-nuttx/issues/4181
2021-07-20 15:29:27 +08:00
ligd
af8530f3fa socket_rpmsg: fix typepo
Change-Id: I7d75efd4f4b3c3ff1b0ecc020e81ac5a972eadb5
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-19 23:17:05 +08:00
Xiang Xiao
40661849d6 fs: mkdir return EEXIST if the path already exist
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie1808697b860974367c17e0ba614ca5cae79f324
2021-07-19 21:13:49 +08:00
Xiang Xiao
681069bdcf fs/tmpfs: Handle the tail '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia2beeaced2de9c38afefd92a2ddc13dfb4919c45
2021-07-19 21:13:49 +08:00
ligd
36ecaa87d1 ARM: fix CPSR corruption after exception handling
It seems to be caused by the corrupted or wrong CPSR restored on return
from exception. NuttX restores the context using code like this:

    msr spsr, r1

GCC translates this to:

    msr spsr_fc, r1

As a result, not all SPSR fields are updated on exception return. This
should be:

    msr spsr_fsxc, r1

This bug has been fixed by Heesub Shin in:
343243c7c0

Change-Id: Ibc64db7bceecd0fb6ef39284fb5bc467f5603e2e
2021-07-19 20:48:00 +08:00
Jiuzhu Dong
dc1c7a644a wqueue: delete sem_wait to avoid race condition
when work_cancel was called, we need to check work.timer whether is active
by WDOG_ISACTIVE for work_queue with delay.

The wdog cb has not been executed when the flag:active is cleared
and if we check flag:active at this moment, WDOG_ISACTIVE will return false.
so the work_cancel will sem_wait until post a semaphore, but all free hpwork_thread
also wait this semphore and their priority are high than caller, this will be a race
condition causing thread/task of calling work_cancel block.

Change-Id: Id86289da60bf967d1062c1cdaaf6959b4f6dd054
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-19 20:20:47 +08:00
丁欣童
932926d0d7 Delete miwear soft link.
N/A

Move miwear boards file to vendor/xiaomi/miwear/boards,so this link is
not needed.

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: I39754ca6399dec8e87137fd4304347545988b0af
2021-07-19 17:50:34 +08:00