Commit Graph

51416 Commits

Author SHA1 Message Date
Jiuzhu Dong 032a5c75a4 drivers/sensors/: Add coordinate conversion function
convert from body coordinate system to right-hand
coordinate system.

Example:
Compared to the standard coordinate system,
the x-axis and y-axis are interchanged and have opposite directions,
the z-axis remains normal.

  body coordinate   ---->     right-hand coordinate
              +x               +y
               |                |
               |                |
               |                |
               |                |
     -y<-------.                .------>+x
              /                /
             /                /
            /                /
           /                /
         +z                +z

So for the above conversion, using "P3" to represent transformation relationships
The front is 1 0 2, which represents the y x z axis.
The standard order is 0 1 2, so y and x are interchanged.

The following -1 1 1 indicates the direction of the axis.
The standard is 1 1 1. Because the current y-axis is opposite to
the standard x-axis, it is -1.

static const struct sensor_axis_map_s g_remap_tbl[] =
{
  { 0, 1, 2,  1,  1,  1 }, /* P0 */
  { 1, 0, 2,  1, -1,  1 }, /* P1 */
  { 0, 1, 2, -1, -1,  1 }, /* P2 */
  { 1, 0, 2, -1,  1,  1 }, /* P3 */
  { 0, 1, 2, -1,  1, -1 }, /* P4 */
  { 1, 0, 2, -1, -1, -1 }, /* P5 */
  { 0, 1, 2,  1, -1, -1 }, /* P6 */
  { 1, 0, 2,  1,  1, -1 }, /* P7 */
};

you can call the function sensor_remap_vector_raw16 and pass P3 parameters
to perform the conversion.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2023-09-24 11:01:08 +08:00
ligd 00c0801743 local socket: fix accept used after free
==1729315==ERROR: AddressSanitizer: heap-use-after-free on address 0xf0501d60 at pc 0x032ffe43 bp 0xef4ed158 sp 0xef4ed148
READ of size 2 at 0xf0501d60 thread T0
    #0 0x32ffe42 in nxsem_wait semaphore/sem_wait.c:94
    #1 0x3548cf5 in _net_timedwait utils/net_lock.c:97
    #2 0x3548f48 in net_sem_timedwait utils/net_lock.c:236
    #3 0x3548f8c in net_sem_wait utils/net_lock.c:318
    #4 0x350124d in local_accept local/local_accept.c:246
    #5 0x3492719 in psock_accept socket/accept.c:149
    #6 0x3492bcc in accept4 socket/accept.c:280
    #7 0x662dc04 in accept net/lib_accept.c:50
    #8 0x55c81ab in kvdb_loop kvdb/server.c:415
    #9 0x55c860a in kvdbd_main kvdb/server.c:458
    #10 0x33d968b in nxtask_startup sched/task_startup.c:70
    #11 0x32ec039 in nxtask_start task/task_start.c:134
    #12 0x34109be in pre_start sim/sim_initialstate.c:52

0xf0501d60 is located 288 bytes inside of 420-byte region [0xf0501c40,0xf0501de4)
freed by thread T0 here:
    #0 0xf7aa6a3f in __interceptor_free ../../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
    #1 0x73aa06e in host_free sim/posix/sim_hostmemory.c:192
    #2 0x34131d6 in mm_free sim/sim_heap.c:230
    #3 0x3409388 in free umm_heap/umm_free.c:49
    #4 0x35631f3 in local_free local/local_conn.c:225
    #5 0x3563f75 in local_release local/local_release.c:129
    #6 0x34f5a32 in local_close local/local_sockif.c:785
    #7 0x3496ee8 in psock_close socket/net_close.c:102
    #8 0x36500bc in sock_file_close socket/socket.c:115
    #9 0x3635f6c in file_close vfs/fs_close.c:74
    #10 0x3632439 in nx_close_from_tcb inode/fs_files.c:670
    #11 0x36324f3 in nx_close inode/fs_files.c:697
    #12 0x3632557 in close inode/fs_files.c:735
    #13 0x55be289 in property_set_ kvdb/client.c:210
    #14 0x55c0309 in property_set_int32_ kvdb/common.c:226
    #15 0x55c03f5 in property_set_int32_oneway kvdb/common.c:236

Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-09-24 10:42:35 +08:00
ligd 13f0051747 mm: rewrite the memdump code for more readable
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-09-24 10:39:18 +08:00
dongjiuzhu1 dcb8188f07 driver/spi: avoid calling QPOLL to change rx_length and cause data loss
When the application calls poll and returns the POLLIN event,
QPOLL will be called again during the read operation,
causing rx_length to change and data to be lost.
Therefore, read only need to actively call qpoll to collect driver
data when rx length is 0.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-24 10:34:55 +08:00
raiden00pl ade23b92d1 arch/{nrf52|nrf53}/pwm: fix compilation for MULTICHAN not set 2023-09-24 10:32:29 +08:00
makejian cb3abc48d7 crypto/cryptodev: expansion hash operation
(1) remove size restriction for single hash operation
(2) support hash operation to update uint32_t data
Signed-off-by: makejian <makejian@xiaomi.com>
2023-09-24 03:49:33 +08:00
dulibo1 7a417da65e pm:check the domain in pm_querystate
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-24 03:49:08 +08:00
xuxin19 712734d55b bcm43xxx: remove unuse function
I added a function that I didn't use when I upstream another patch. Delete it
https://github.com/apache/nuttx/pull/10709

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-09-24 03:48:55 +08:00
ligd cb94f825af kasan: add builtin_return_address(0) to kasan
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-09-24 03:48:39 +08:00
zhanghongyu 03e220a271 bcm43xxx: revert part of the previous upstream code
Revert WPA failure reason codes to the previous community version

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-09-24 01:55:54 +08:00
guohao15 2bce0f404c fs:add syncfs api for sync whole fs data
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2023-09-23 15:58:00 +08:00
zhanghongyu a41f68da84 dns: fix dns failed when ipv4/6 dual stack enable
The ipv6 address filled the cache, and the ipv4 address did not have a
place to store it, causing the resolution to fail. so if IPV6 has already
filled the buffer, rewrite ipv4 DNS results from half of the buffer.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-09-23 15:56:05 +08:00
yinshengkai 4f25c287d2 arch/sim: add sim uart_ram support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-09-23 15:22:42 +08:00
wanggang26 d827ee5ffc refine: set file mode when oflags contains O_CREAT
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-23 15:20:51 +08:00
Shanmin Zhang 582e0ab51f goldfish: add goldfish sensors driver
Implemented Goldfish Sensors:
Accelerometer
Gyroscope
MagneticField
AmbientTemperature
Proximity
Light
Pressure
RelativeHumidity
MagneticFieldUncalibrated
GyroscopeFieldUncalibrated
HeartRate

Unimplemented Goldfish Sensors:
(sensor type is not defined nuttx)
Orientation
HingeAngle0
HingeAngle1
HingeAngle2
WristTilt

Verification:
uorb_listener -r 1 sensor_accel
uorb_listener -r 1 sensor_mag
uorb_listener -r 1 sensor_gyro
uorb_listener -r 1 sensor_prox
uorb_listener -r 1 sensor_light
uorb_listener -r 1 sensor_humi
uorb_listener -r 1 sensor_baro
uorb_listener -r 1 sensor_temp
uorb_listener -r 1 sensor_hrate

Signed-off-by: Shanmin Zhang <zhangshanmin@xiaomi.com>
2023-09-23 15:20:25 +08:00
xinbingnan a104fdc3a5 tools/minudumpserver: support auto start GDB and execute some commands
VELAPLATFO-16485

like
```bash
./nuttx/tools/minidumpserver.py -l log.log -e vela_ap.elf -a arm --gdb prebuilts/gcc/linux/arm/bin/arm-none-eabi-gdb -i
```

Signed-off-by: xinbingnan <xinbingnan@xiaomi.com>
2023-09-23 15:19:20 +08:00
xuxin19 8d1cb466f4 Unix.mk:replace process substitution to pipe avoid out of order
process substitution `>(..)` have different behaviors in different shells,unreliable execution order will lead to the problem of being unable to intercept errors.
pipe are used here to ensure that `kwarning` is generated before the if statement.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-09-23 15:15:22 +08:00
wangbowen6 d15a69a406 parsememdump.py: support the sequence number parse
In https://github.com/apache/nuttx/pull/9335, the sequence numbuer
is added to the memory node, the memdump log changed also, so update
the parsememdump.py script to keep in sync.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-09-23 15:13:00 +08:00
wangming9 029bbf6bbd arch/arm: Enable FPU on qemu and goldfish platforms
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2023-09-23 08:42:00 +02:00
yintao da7d6ef37b sim_rptun: unlink shm when quit
if not unlink shm, the shared memory object still exists in host /dev/shm after quit
if nuttx is started with administrator privileges, or if it is restarted with user
privileges, there will be a problem with the permission to open this shm file

Signed-off-by: yintao <yintao@xiaomi.com>
2023-09-23 08:39:38 +02:00
laoniaokkk 4256dd934f Fix onchip flash erase fail 2023-09-23 12:36:11 +08:00
wanggang26 7f5e6bd383 hostfs: mask bit fields of not support
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-23 05:28:57 +09:00
Theo 52096aeb80 Add activation of SPI0 on arduino due 2023-09-23 01:46:23 +08:00
xuxin19 b53af5602d give a prompt when apps dir cannot be found
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-09-22 21:37:30 +08:00
raiden00pl 0a78095bb7 Kconfig: add ICS license option 2023-09-22 20:41:10 +08:00
raiden00pl 3ad3b66e11 boards/thingy52: use RTT console as default
External JLink is required to program the board, so the console via RTT
is available anyway. It is much more convenient to use than soldering the
P4 connector and working with an external UART converter.
2023-09-22 19:46:43 +08:00
raiden00pl 59cf80cf90 boards/nucleo-h745zi: access CM4 core NSH over uart rpmsg
Command on the CM7 core:

  nsh-cm7> cu -l /dev/ttyproxy
  NuttShell (NSH) NuttX-10.4.0
  nsh-cm4>
2023-09-22 19:46:26 +08:00
raiden00pl 8833501084 arch/stm32h7/dualcore: don't use stm32_hsem interface for cores synchronisation
stm32_hsem functions can use debug messages but cores synchronisation is done when
the OS is not yet fully initialized
2023-09-22 19:46:26 +08:00
raiden00pl 0e01836f09 serial: add an option that selects uart rpmsg as console 2023-09-22 19:46:26 +08:00
SPRESENSE 7f574210a7 drivers:alt1250: Correspond to shutdown
ALT1250 driver to support shutdown.
2023-09-22 13:51:28 +08:00
wanggang26 e930476b4b enable O_CLOEXEC explicit
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-22 13:51:00 +08:00
wangyongrong 2d817deecb armv8m/strcpy: add arch optimize version 2023-09-22 08:52:25 +08:00
guoshichao abfb7da553 libs/libc/libc.csv: add the implemented wchar api declaration
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 5bd8e56cbe libs/libc/wchar: add fputws implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao d67090c47e libs/libc/wchar: add putwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao a9b2857754 libs/libc/wchar: add putwchar implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao f8b5f613e2 libs/libc/wchar: add fputwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao d386df4424 libs/libc/wchar: add wcswidth implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 7c0685c53d libs/libc/wchar: add wcwidth implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao f9c8461c72 libs/libc/wchar: add wcswcs implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 199bc57035 libs/libc/wchar: add wcstok implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 9070743fe8 libs/libc/wchar: add wcsstr implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 20802fcf5c libs/libc/wchar: add wcsspn implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao 181a2d916d libs/libc/wchar: add wcspbrk implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
xinbingnan 524cb33729 tools/minudumpserver: support auto parse log file feature
VELAPLATFO-16476

1. support to extract log and list all possible dumps from a full log file

Signed-off-by: xinbingnan <xinbingnan@xiaomi.com>
2023-09-22 08:47:47 +08:00
dulibo1 b57e43b4d0 clk:fix some issues when use rpmsg clk
1.check the rpmsg name when clk_register.
2.clk_get rpmsg clk print error:
clk/clk.c:1231:3: runtime error: null pointer passed as argument 2, which is declared to never be null
3.fix some function miss keyword FAR.
4.clk_disable_unused may disable rpmsg clk which disable the clk that maybe used by others

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-22 08:47:23 +08:00
zhuanglin 13ee3f8117 sched/clock Add special handling for TCB null pointer cases
Adding a judgment in the code that null return values are not referenced for dereference

Signed-off-by: zhuanglin <zhuanglin@xiaomi.com>
2023-09-22 08:46:50 +08:00
dulibo1 2db471fab3 regulator:fix some issues when use rpmsg
1.client get the regualtor which is enabled by server, will disable the regualtor.
2.regulator_rpmsg_server_unbind will disable regualtor which maybe used by other client.
3.regulator_rpmsg_server_unbind will be deadloop when the regulator is always_on;
4.regulator_rpmsg_client_destroy does not match server cpu name,may destory by stop other rptun dev

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-21 19:41:34 -04:00
dulibo1 da1cd59f35 regualtor:fix regulator_register check rpmsg regulator which leads to recursion
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-09-21 19:41:34 -04:00
Daniel P. Carvalho f0bc20c815 Fix I2C1 pinout. 2023-09-22 00:54:07 +08:00