Commit Graph

49398 Commits

Author SHA1 Message Date
Petro Karashchenko 8254b374dd drivers/mmcsd: fix style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Petro Karashchenko 1e86682feb drivers/mtd: fix C89 compatibility of w25qxxxjv
Correct various style issues

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Petro Karashchenko 1be4066b3c wireless/bluetooth: fix style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Petro Karashchenko dfa1eb2f54 include/sys: fix definition of __BYTE_ORDER
Fix style issues

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Zhe Weng e7043828a7 netdb: Regard hosts file prior to DNS when resolving
- Linux: What inside /etc/hosts comes first.
- NuttX: Even if we write a domain in /etc/hosts, we still use DNS
         result instead of hosts lines. This patch change this behavior.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-05-18 14:50:08 -03:00
raiden00pl 3930c70954 nrf5340-dk: cosmetic 2023-05-19 01:03:18 +08:00
raiden00pl 444488fcf2 nrf5340-audio-dk: cosmetic 2023-05-19 01:03:18 +08:00
zhangyuan21 4466c3d6e9 arm64/cache: Support unalign cache clean.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-18 15:45:42 +03:00
Xiang Xiao cff40aa34c net: Remove some minor #warning since it compiler specific
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-18 15:44:28 +03:00
Xiang Xiao 8d56a9bbcb Remove #warning if the code already return the error code or value
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-18 15:44:28 +03:00
Xiang Xiao bf391eaec2 libm/arm: Remove the compiler specific #warning
let ld report the error instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-18 15:44:28 +03:00
simbit18 ba94a24c8b libs\libc\stdlib\Kconfig: Fix indentation
Remove TABs
2023-05-18 15:43:22 +03:00
simbit18 3554c5f9a5 libs\libc\misc\Kconfig: Fix indentation
Remove TABs
2023-05-18 15:43:22 +03:00
simbit18 ca026a5b0f drivers\power\supply\Kconfig: Fix indentation
Remove TABs
2023-05-18 15:43:22 +03:00
simbit18 c2779e5171 arch\arm\src\lpc54xx\Kconfig: Fix indentation
Remove TABs
2023-05-18 15:43:22 +03:00
simbit18 0b97979378 arch/arm/src/stm32h7/stm32_usbhost.c: Fix nxstyle errors
error: Long line found
2023-05-18 20:14:45 +08:00
chao an 064c75aa92 elf/coredump: correct register offset after xcp.regs update
The offset should be calculated from pointer xcp.regs

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-18 20:13:05 +08:00
simbit18 0b6d51a3b2 libs/libm/bin/Makefile: fix nxstyle
fix error: Relative file path does not match actual file
2023-05-18 19:31:12 +08:00
simbit18 3208519f93 libs/libm/kbin/Makefile: fix nxstyle
fix error: Relative file path does not match actual file
2023-05-18 19:31:12 +08:00
simbit18 a51412ea6e libs/libm/Makefile: fix nxstyle
fix error: Relative file path does not match actual file
2023-05-18 19:31:12 +08:00
zhangyuan21 077c16fc71 arch/xtensa: only cmp fpu coprocessor for fpu test
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-18 17:30:38 +08:00
zhangyuan21 3d47505ec7 arch/arm: Add a "cc" flag to instructions that may modify condition flag.
Notify the compiler that the condition flag has changed to prevent the
compiler from optimizing and reordering instructions, which may cause exceptions.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-18 17:23:16 +08:00
qiaohaijiao1 f67e50e920 sim/sim_alsa: modify buffer_size in GET_BUFFERINFO when offload capture.
1. when offload capture, apb buffer must big enough to fill
samples of encoder.
2. pass samplerate, channels to encoder.
2023-05-18 17:22:46 +08:00
Lwazi Dube 9948b5e701 usbhost: Make unplugging hubs more reliable.
USB drivers should not try control devices in the usbhost_disconnected
function. The control endpoint is NULL at this point because the device
has already been disconnected.

Before this change, the hub driver crashed when the child called
usbhost_hubpwr after the parent had already deactivated the control
pipe and set hport->ep0 to NULL.
2023-05-18 13:47:15 +08:00
zhangyuan21 150680d677 arch/arm: set arm_testset to weak function
Some chips require the implementation of
their own unique test set function.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-18 13:46:27 +08:00
liqinhui a9640bad1a net: Add the check that socket domain is equal to bound address type, when do bind.
When do socket bind, if the connection domain is not equal to the bound address type, this will cause the stack-buffer-overflow.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-05-18 01:08:38 +03:00
Xiang Xiao 7dc0d70092 arch: Save sigdeliver into xcp in the case of signal self delevery
to avoid the infinite recusive dispatch:
*0  myhandler (signo=27, info=0xf3e38b9c, context=0x0) at ltp/testcases/open_posix_testsuite/conformance/interfaces/sigqueue/7-1.c:39
*1  0x58f1c39e in nxsig_deliver (stcb=0xf4e20f40) at signal/sig_deliver.c:167
*2  0x58fa0664 in up_schedule_sigaction (tcb=0xf4e20f40, sigdeliver=0x58f1bab5 <nxsig_deliver>) at sim/sim_schedulesigaction.c:88
*3  0x58f19907 in nxsig_queue_action (stcb=0xf4e20f40, info=0xf4049334) at signal/sig_dispatch.c:115
*4  0x58f1b089 in nxsig_tcbdispatch (stcb=0xf4e20f40, info=0xf4049334) at signal/sig_dispatch.c:435
*5  0x58f31853 in nxsig_unmask_pendingsignal () at signal/sig_unmaskpendingsignal.c:104
*6  0x58f1ca09 in nxsig_deliver (stcb=0xf4e20f40) at signal/sig_deliver.c:199
*7  0x58fa0664 in up_schedule_sigaction (tcb=0xf4e20f40, sigdeliver=0x58f1bab5 <nxsig_deliver>) at sim/sim_schedulesigaction.c:88
*8  0x58f19907 in nxsig_queue_action (stcb=0xf4e20f40, info=0xf4049304) at signal/sig_dispatch.c:115
*9  0x58f1b089 in nxsig_tcbdispatch (stcb=0xf4e20f40, info=0xf4049304) at signal/sig_dispatch.c:435
*10 0x58f31853 in nxsig_unmask_pendingsignal () at signal/sig_unmaskpendingsignal.c:104
*11 0x58f1ca09 in nxsig_deliver (stcb=0xf4e20f40) at signal/sig_deliver.c:199
*12 0x58fa0664 in up_schedule_sigaction (tcb=0xf4e20f40, sigdeliver=0x58f1bab5 <nxsig_deliver>) at sim/sim_schedulesigaction.c:88
*13 0x58f19907 in nxsig_queue_action (stcb=0xf4e20f40, info=0xf40492d4) at signal/sig_dispatch.c:115
*14 0x58f1b089 in nxsig_tcbdispatch (stcb=0xf4e20f40, info=0xf40492d4) at signal/sig_dispatch.c:435
*15 0x58f31853 in nxsig_unmask_pendingsignal () at signal/sig_unmaskpendingsignal.c:104
*16 0x58f1ca09 in nxsig_deliver (stcb=0xf4e20f40) at signal/sig_deliver.c:199
*17 0x58fa0664 in up_schedule_sigaction (tcb=0xf4e20f40, sigdeliver=0x58f1bab5 <nxsig_deliver>) at sim/sim_schedulesigaction.c:88
*18 0x58f19907 in nxsig_queue_action (stcb=0xf4e20f40, info=0xf40492a4) at signal/sig_dispatch.c:115
*19 0x58f1b089 in nxsig_tcbdispatch (stcb=0xf4e20f40, info=0xf40492a4) at signal/sig_dispatch.c:435
*20 0x58f31853 in nxsig_unmask_pendingsignal () at signal/sig_unmaskpendingsignal.c:104
*21 0x58f1ca09 in nxsig_deliver (stcb=0xf4e20f40) at signal/sig_deliver.c:199
*22 0x58fa0664 in up_schedule_sigaction (tcb=0xf4e20f40, sigdeliver=0x58f1bab5 <nxsig_deliver>) at sim/sim_schedulesigaction.c:88
*23 0x58f19907 in nxsig_queue_action (stcb=0xf4e20f40, info=0xf4049274) at signal/sig_dispatch.c:115
*24 0x58f1b089 in nxsig_tcbdispatch (stcb=0xf4e20f40, info=0xf4049274) at signal/sig_dispatch.c:435
*25 0x58f31853 in nxsig_unmask_pendingsignal () at signal/sig_unmaskpendingsignal.c:104
*26 0x58f1ca09 in nxsig_deliver (stcb=0xf4e20f40) at signal/sig_deliver.c:199
*27 0x58fa0664 in up_schedule_sigaction (tcb=0xf4e20f40, sigdeliver=0x58f1bab5 <nxsig_deliver>) at sim/sim_schedulesigaction.c:88
*28 0x58f19907 in nxsig_queue_action (stcb=0xf4e20f40, info=0xf4049244) at signal/sig_dispatch.c:115
*29 0x58f1b089 in nxsig_tcbdispatch (stcb=0xf4e20f40, info=0xf4049244) at signal/sig_dispatch.c:435
*30 0x58f31853 in nxsig_unmask_pendingsignal () at signal/sig_unmaskpendingsignal.c:104
*31 0x58f1ca09 in nxsig_deliver (stcb=0xf4e20f40) at signal/sig_deliver.c:199

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-17 11:53:18 -06:00
Gregory Nutt 8cca30b44c Signal must be masked when it is delivered to a signal handler
Signal must be masked when it is delivered to a signal handler per:

https://pubs.opengroup.org/onlinepubs/007904875/functions/sigaction.html:

When a signal is caught by a signal-catching function installed by sigaction(), a new signal mask is calculated and installed for the duration of the signal-catching function (or until a call to either sigprocmask() or sigsuspend() is made). This mask is formed by taking the union of the current signal mask and the value of the sa_mask for the signal being delivered [XSI] [Option Start] unless SA_NODEFER or SA_RESETHAND is set, [Option End] and then including the signal being delivered. If and when the user's signal handler returns normally, the original signal mask is restored.

Any action queued for that signal while the signal is masked should be deferred. It should go into the group pending signal list and should not be processed until until the signal is unmasked (which should occur when the signal handler returns).
2023-05-18 01:19:12 +08:00
Michal Lenc cf04f2e555 w25qxxxjv: add dual die support for 1 Gbit flash
1 Gbit W25Q01JV flash uses two 512 Mbit dies. This requires specific
operations in the driver in order to support the entire 1 Gbit region.
This commit adds dual die support for W25Q01JV flash.

Generally the driver has to switch active dies when die specific read from
status register is required (therefore before read, write, erase and when
checking if write status register was successful).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-18 01:10:55 +08:00
Liyu Wang d7d6fa4d82 Fix windows compile errors because of double quotes in config
The "CONFIG_APPS_DIR" generated in .config has double quotes and is not recognized as a path by most make systems. This commits removes these double quotes to make the compile successfully.
2023-05-17 11:56:29 -03:00
Tiago Medicci Serrano 496a77653a arch/xtensa/esp32_esp32s3: prevent arch's libc in the userspace
ESP32 and ESP32-S3 should use the ROM-defined versions of the libc
in flat build and, when building the protected mode, in the kernel.

The ROM-defined version of the libc functions can't be used in the
userspace, however, because it isn't allowed to access the memory
region in flash directly from the userspace. That being said,
`LIBC_PREVENT_STRING_KERNEL` should be selected to avoid building
any implementation of the libc, being the ROM-defined versions
linked instead.

NuttX's software implemented version of the libc will be built in
the userspace. Also, the assembly-defined version of some of the
libc functions (`XTENSA_xxx`) may also be selected to be used in
the userspace.
2023-05-17 13:58:48 +08:00
Tiago Medicci Serrano 58e97e521c libc/string: prevent libc in the kernel/userspace optionally
Add the `LIBC_PREVENT_STRING_KERNEL` and `LIBC_PREVENT_STRING_USER`
that are meant to be selected by the chip if no libc implementation
is going to be built. If selected, neither NuttX's software version
of the libc nor any architecture-specific implementation will be
built in the kernel or in the userspace, respectively. In this
case, the linker may provide a ROM-defined version of the libc
functions instead.
2023-05-17 13:58:48 +08:00
chao an 6be363ff35 drivers/serial: fix race condition in multi-thread write
if multiple threads are doing serial read/write at the same time,
the driver will only wake up one of the thread, which will cause
other threads fail to be woken up in time and cause blocking

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-17 07:56:08 +02:00
Huang Qi 23ad4700a9 drivers/serial/pty.c: Fix coverity issue
Coverity report that `ntotal` may be a negative value.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-17 07:44:26 +02:00
guoshichao e1096bd35c libc/regex: add regex implementation
add regex implementation for libc, the implementation are ported from
musl project

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-05-17 10:25:18 +08:00
hujun5 81bdb97536 libc/misc: add fdsan api doc
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-17 10:24:42 +08:00
hujun5 90387a5b41 libc/misc: add fdsan module
FD (file descriptor) is widely used in system software development,
and almost all implementations of posix os (including nuttx) use FD as an index.
the value of fd needs to be allocated starting from the minimum available value of 3, and each process has a copy,
so the same fd value is very easy to reuse in the program.

In multi threaded or multi process environments without address isolation,
If the ownership, global variables, and competition relationships of fd are not properly handled,
there may be issues with fd duplication or accidental closure.
Further leading to the following issues, which are difficult to troubleshoot.

1. Security vulnerability: the fd we wrote is not the expected fd and will be accessed by hackers to obtain data
2. Program exceptions or crashes: write or read fd failures, and program logic errors
3. The structured file XML or database is damaged: the data format written to the database is not the expected format.

The implementation principle of fdsan is based on the implementation of Android
https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-17 10:24:42 +08:00
Nathan Hartman 242127556c Documentation: Add "High Performance, Zero Latency Interrupts"
* Documentation/guides/zerolatencyinterrupts.rst: New. This document is
  converted from CWIKI (see [1]) to reStructuredText and brought into
  the Documentation tree in the repo.

[1] https://cwiki.apache.org/confluence/display/NUTTX/High+Performance%2C+Zero+Latency+Interrupts
2023-05-17 02:23:19 +08:00
liqinhui f61dc72892 net/tcp:Add NewReno congestion control.
- NewReno congestion control algorithm is used to solve the problem
  of network congestion breakdown. NewReno congestion control includes
  slow start, collision avoidance, fast retransmission, and fast
  recovery. The implementation refers to RFC6582 and RFC5681.

- In addition, we optimize the congestion algorithm. In the conflict
  avoidance stage, the maximum congestion window max_cwnd is used to
  limit the excessive growth of cwnd and prevent network jitter
  caused by congestion. Maximum congestion window max_cwnd is updated
  with the current congestion window cwnd and the update weight is
  0.875 when an RTO timeout occurs.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-05-16 12:35:01 -03:00
Xiang Xiao 7a8cf7ff70 Indent the include statement by two spaces
follow the coding style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-16 12:34:32 -03:00
chao an 26361ee1d2 tools/nuttx-gdbinit/armv7-a: add fpu support
The offset of the relevant registers in xcp will change after
enabling the FPU, this PR will add fpu offset correct the register offset

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 21:40:43 +08:00
Zhe Weng eb47312518 netdev_upper: Protect quota by spin lock to allow netpkt_xxx be called in interrupt context
Before atomic is ready on every platform, we need a way to protect
quota, previously it's protected by net_lock, but this makes netpkt_xxx
interfaces unable to be called under interrupt context, so changed to
spin lock. Also, we can easily change them into atomic under this
implementation.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-05-16 21:39:05 +08:00
chao an 36591af615 net/rpmsg: initialize semaphore count before wait
recvmsg() will incorrectly return 0 if the count of sema before waiting is greater than 0,
This commit will reinitialize the sema count before waiting:

1181 static ssize_t rpmsg_socket_recvmsg(FAR struct socket *psock,
1182                                     FAR struct msghdr *msg, int flags)
1183 {
...
1255   ret = net_sem_timedwait(&conn->recvsem,
1256                       _SO_TIMEOUT(conn->sconn.s_rcvtimeo)); // recvsem.sem_count == 1; return 0
...
1264   if (!conn->recvdata)              // recvdata not consumed; goto else
1265     {
1266       ret = conn->recvlen;
1267     }
1268   else
1269     {
1270       conn->recvdata = NULL;
1271     }
...
1282   return ret;                        // BUGON! incorrectly return 0 to user
1283 }

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 17:15:42 +08:00
chao an 50cf3d8577 tools/nxstyle: add "_NSGetExecutablePath" into ignore list
sim/posix/sim_hostmisc.c:128:6: error: Mixed case identifier found

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 17:05:42 +08:00
chao an 150e5a1a0f sim/posix/backtrace: process host backtrace with critical section
backtrace() is not a signal safe

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-16 17:05:42 +08:00
Brennan Ashton 6417ca79ad CI: set-output command is deprecated
CI currently runs with the warning:

The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2023-05-16 15:56:01 +08:00
Brennan Ashton 9a654b658e docs: Generate pdf version of docs for #9095
This implements the changes required to genreate the pdf version
of the documentation. The pdf will be generated as a build artifact
attached to the build. This is the first patch to enable this
a follow on patch to the website repo will publish the pdf to the
NuttX website.
2023-05-16 15:12:10 +08:00
hujun5 6da335cd81 driver/uart_16550: serial output can cause deadlock
All interrupts must be disabled to prevent re-entrancy and to prevent
interrupts from firing in the serial driver code.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-16 15:11:38 +08:00
Lwazi Dube 555506a584 arch/arm/sama5: Make EHCI work with slow devices.
Make low/full speed devices work with EHCI while OHCI is disabled. A
high speed USB hub has to be plugged into the root hub. This change
will also allow the optional use of a full speed hub between the
high speed hub and the low/full speed device. A recursive mutex is
used to avoid deadlocks.
2023-05-16 08:14:54 +02:00
raiden00pl 7986a28216 boards/stm32h7: enable HSI48 if OTG clock is HSI48 2023-05-16 03:11:29 +08:00