Commit Graph

49995 Commits

Author SHA1 Message Date
Michal Lenc
49f153abb1 samv7/sam_xdmac.c: use sam_freelinklist only if circular buffer not used
Circular buffer does not use DMA linked list therefore function
sam_freelinklist() cannot be called as it would fail on assertion (csa
not defined). Peripheral that calls DMA should care of buffer invalidation
instead.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-07-03 17:09:20 +03:00
liuwei35
63ac8fbdfd sim/audio register mixer device
add amixer register code

Signed-off-by: liuwei35 <liuwei35@xiaomi.com>
2023-07-03 10:18:37 -03:00
zhanghongyu
27d6f1e0c4 documentation: correct the nfs command format
Change the command format to the actual one in the system

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-03 10:18:00 -03:00
Nicolas Caramelli
e82b762fb7 input/touchscreen: Translate raw X/Y data into pixel coordinates 2023-07-03 10:17:04 -03:00
qiaohaijiao1
de5c35382a sim/sim_alsa.c: add paused variable instead of snd_pcm_pause.
snd_pcm_hw_params_can_pause return false on sim.
add paused variable to support pause.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2023-07-03 13:51:09 +08:00
Zhe Weng
210c72a651 errno: Adjust help string for EALREADY and ESTALE
EALREADY:
Both Linux(asm-generic/errno.h) and FreeBSD(sys/sys/errno.h) regard it as "Operation already in progress"

ESTALE:
Linux specifically removed the "NFS" description, and we may not only use it for NFS
0ca4343518

The ECANCELED and EOWNERDEAD also use different strings from Linux's header, but their meanings are same, and NuttX's description are more likely to obey POSIX 1003.1-2008, so not changing them.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-03 13:38:02 +08:00
guoshichao
af53d7a178 libs/libc/aio/lio_listio: fix the heap use-after-free bug
1. the lio_sigsetup() method use a universal sighand instance across all
aiocb instances, but inside the lio_sighandler() method, if one aiocb is
handle finished, then this method will free the sighand instance that
come along with current aiocb instance. thus when handle next aiocb
instance, use-after-free crash will happen. in order to solve this
problem, we make each aiocb instance have their own sighand instance
2. make the lio_listio implementation can pass the
ltp/open_posix_testsuite/lio_listio testcases
3. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/lio_listio.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-03 13:37:34 +08:00
Petro Karashchenko
b1dd5d1189 drivers/wireles/gs2200m: add NET_TCP dependency to NFS_DONT_BIND_TCP_SOCKET option
The NFS_DONT_BIND_TCP_SOCKET should be selected only TCP networking is enabled

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-03 13:32:31 +08:00
wanggang26
57d521cc59 binfmt: Immediately exit from elf_loadbinary if elf format isn't supported 2023-07-03 00:52:16 +08:00
raiden00pl
76cf66165a arch/nrf91: simplyfy modem option names 2023-07-03 00:52:01 +08:00
raiden00pl
1a6d507422 arch/{nrf52|nrf53|nrf91}: rename NRFxx to nRFxx to be compatible with the manufacturer's nomenclature 2023-07-03 00:52:01 +08:00
raiden00pl
cfdc305297 Documentation: initial doc for NRF91 2023-07-02 10:10:35 -03:00
raiden00pl
3d9a64ce27 boards: initial support for nrf9160-dk 2023-07-02 10:10:35 -03:00
raiden00pl
56961d9f34 arch/arm: initial support for NRF91
Port based on arch/arm/nrf53.

Modem not fully supported yet. At the moment, initialization and AT interface work.
Sockets and GNSS interface will be added later.
2023-07-02 10:10:35 -03:00
guoshichao
4af8c58b93 libs/libc/locale/langinfo: implement the nl_langinfo function
1. the nl_langinfo can help to pass the
ltp/open_posix_testsuite/strftime testcases
2. the implementation are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/nl_langinfo.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-02 13:57:36 +08:00
Petro Karashchenko
46facd44b3 drivers/net/netdev: improve granularity of 'quota' locking
There is no need to use global spinlock to protect netdev
specific data counters. Allocate per-netdev specific spinlock
to get better locking granularity.

Move C/C++ atomic support checking to compiler.h

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-01 15:27:09 -03:00
Masayuki Ishikawa
e78eade641 boards: qemu-armv8a: Add defconfigs for hypervisor
Summary:
- This commit adds netnsh_hv and netnsh_smp_hv to run the NuttX
  with hypervisor environments
- Also updates README.txt

Impact:
- None

Testing:
- Tested with qemu=7.1 + kvm on raspi3b+ (ubuntu server 20.04)
- Tested with qemu-7.1 + hvf on M1/MBP (macOS 12.6.1)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-07-01 10:22:00 -03:00
tjwu1217
4969f8faf9 risc-v Toolchain.defs compatibility.
Reference:https://xpack.github.io/blog/2022/05/18/riscv-none-elf-gcc-v12-1-0-2-released/

RISC-V ISA updates

Compared to previous releases, starting from 12.x, the compiler implements the new RISC-V ISA, which introduces an incompatibility issue, and builds might throw error messages like unrecognized opcode csrr.

The reason is that csr read/write (csrr*/csrw*) instructions and fence.i instruction were separated from the I extension, becoming two standalone extensions: Zicsr and Zifencei.

The solution is to add _zicsr and/or _zifencei to the -march option, e.g. -march=rv32imac becomes -march=rv32imac_zicsr_zifencei.
2023-07-01 13:19:30 +08:00
Masayuki Ishikawa
248fe7529a drivers: wireless: select NFS_DONT_BIND_TCP_SOCKET for GS2200M
Summary:
- https://github.com/apache/nuttx/pull/3707

Impact:
- None

Testing:
- Tested with spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-07-01 13:18:27 +08:00
Masayuki Ishikawa
c2af551355 fs: nfs: Introduce CONFIG_NFS_DONT_BIND_TCP_SOCKET
Summary:
- Some network drivers such as GS2200M do not support to bind
  a local port for TCP client socket. In this case, this config
  disables to bind the port.
- See also https://github.com/apache/nuttx/pull/3707

Impact:
- None

Testing:
- Tested with spresense:wifi_smp (Kconfig will be updated later)
- Tested with sabre-6quad:netnsh_smp (QEMU)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-07-01 13:18:27 +08:00
Masayuki Ishikawa
221d919b77 Revert "fs: nfs: Do not bind to a local port in TCP mode"
This reverts commit e1b14271c8.
2023-07-01 13:18:27 +08:00
Alan Carvalho de Assis
245db6742c esp32s2: Fix UART1 default pins
The default pins to UART1 should be 17 (TXD) and 18 (RXD).
2023-07-01 13:11:39 +08:00
Masayuki Ishikawa
8bbe7a8825 boards: Enable virtio-blk and FAT for virt configurations
Summary:
- I noticed that virtio-blk and FAT are not enabled for some
  virt configurations.
- This commit enables them for testing.

Impact:
- None

Testing:
- Tested with qemu-7.1
- NOTE: file copy with rv-virt:knetnsh64 is sometimes unstable.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-07-01 13:10:40 +08:00
guoshichao
1466a9e2b6 libs/libc/aio: refactor the fd flags check procedure
1. make the implementation compatible with c89

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-30 20:23:09 -03:00
Xiang Xiao
5af99c65de fs: Define __USE_FILE_OFFSET64 when CONFIG_FS_LARGEFILE is enabled
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-30 20:22:10 -03:00
Jani Paalijarvi
78a2c91a04 risc-v/mpfs: cache: Fix cache and scratchpad init
Initialize ICACHE way with correct mask.
Initialize scratchpad with constant g_init_marker as it has been done in HSS

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
2023-06-30 20:19:54 -03:00
ThomasNS
f51d6b8c72 add userled driver initialization 2023-06-30 10:29:33 -03:00
ThomasNS
7864bf4870 spi4 working xmc4700-relax 2023-06-30 10:29:33 -03:00
Junbo Zheng
0d3252ba06 libs/libc: fix locale/lib_iconv.c:538:23: warning: dereference of NULL ‘scd’ [CWE-690] [-Wanalyzer-null-dereference] by -fanalyzer
CC:  signal/sig_queue.c locale/lib_iconv.c: In function ‘iconv’:
locale/lib_iconv.c:538:23: warning: dereference of NULL ‘scd’ [CWE-690] [-Wanalyzer-null-dereference]
  538 |               if (!scd->state)
      |                    ~~~^~~~~~~
  ‘iconv’: events 1-5
    |
    |  413 |   x = 0;
    |      |   ~~^~~
    |      |     |
    |      |     (1) ‘scd’ is NULL
    |  414 |   scd = NULL;
    |  415 |   if (((size_t)cd & 1) == 0)
    |      |      ~
    |      |      |
    |      |      (2) following ‘false’ branch...
    |......
    |  421 |   to = extract_to(cd);
    |      |        ~~~~~~~~~~~~~~
    |      |        |
    |      |        (3) ...to here
    |......
    |  428 |   if (in == NULL || *in == NULL || *inb == 0)
    |      |      ~              ~~~
    |      |      |              |
    |      |      |              (5) ...to here
    |      |      (4) following ‘false’ branch (when ‘in’ is non-NULL)...
    |
  ‘iconv’: events 6-8
    |
    |  428 |   if (in == NULL || *in == NULL || *inb == 0)
    |      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                  |              |  |
    |      |                  |              |  (7) ...to here
    |      |                  |              (8) following ‘false’ branch...
    |      |                  (6) following ‘false’ branch...
    |
  ‘iconv’: event 9
    |
    |cc1:
    | (9): ...to here
    |
  ‘iconv’: events 10-14
    |
    |  433 |   for (; *inb; *in += l, *inb -= l)
    |      |   ^~~
    |      |   |
    |      |   (10) following ‘true’ branch...
    |  434 |     {
    |  435 |       c = *(FAR unsigned char *)*in;
    |      |            ~~~~~~~~~~~~~~~~~~~~~~~~
    |      |            |
    |      |            (11) ...to here
    |......
    |  438 |       switch (type)
    |      |       ~~~~~~
    |      |       |
    |      |       (12) following ‘case 200:’ branch...
    |......
    |  529 |           case UCS2:
    |      |           ~~~~
    |      |           |
    |      |           (13) ...to here
    |......
    |  538 |               if (!scd->state)
    |      |                    ~~~~~~~~~~
    |      |                       |
    |      |                       (14) dereference of NULL ‘scd’
    |
locale/lib_iconv.c:565:23: warning: dereference of NULL ‘scd’ [CWE-690] [-Wanalyzer-null-dereference]
  565 |               if (!scd->state)
      |                    ~~~^~~~~~~
  ‘iconv’: events 1-5
    |
    |  413 |   x = 0;
    |      |   ~~^~~
    |      |     |
    |      |     (1) ‘scd’ is NULL
    |  414 |   scd = NULL;
    |  415 |   if (((size_t)cd & 1) == 0)
    |      |      ~
    |      |      |
    |      |      (2) following ‘false’ branch...
    |......
    |  421 |   to = extract_to(cd);
    |      |        ~~~~~~~~~~~~~~
    |      |        |
    |      |        (3) ...to here
    |......
    |  428 |   if (in == NULL || *in == NULL || *inb == 0)
    |      |      ~              ~~~
    |      |      |              |
    |      |      |              (5) ...to here
    |      |      (4) following ‘false’ branch (when ‘in’ is non-NULL)...
    |
  ‘iconv’: events 6-8
    |
    |  428 |   if (in == NULL || *in == NULL || *inb == 0)
    |      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                  |              |  |
    |      |                  |              |  (7) ...to here
    |      |                  |              (8) following ‘false’ branch...
    |      |                  (6) following ‘false’ branch...
    |
  ‘iconv’: event 9
    |
    |cc1:
    | (9): ...to here
    |
  ‘iconv’: events 10-14
    |
    |  433 |   for (; *inb; *in += l, *inb -= l)
    |      |   ^~~
    |      |   |
    |      |   (10) following ‘true’ branch...
    |  434 |     {
    |  435 |       c = *(FAR unsigned char *)*in;
    |      |            ~~~~~~~~~~~~~~~~~~~~~~~~
    |      |            |
    |      |            (11) ...to here
    |......
    |  438 |       switch (type)
    |      |       ~~~~~~
    |      |       |
    |      |       (12) following ‘case 202:’ branch...
    |......
    |  557 |           case UTF_32:
    |      |           ~~~~
    |      |           |
    |      |           (13) ...to here
    |......
    |  565 |               if (!scd->state)
    |      |                    ~~~~~~~~~~
    |      |                       |
    |      |                       (14) dereference of NULL ‘scd’
    |

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2023-06-30 16:11:10 +08:00
Masayuki Ishikawa
9861d49cd4 arch: arm64: Add arm64_gic_raise_sgi() for SMP
Summary:
- I noticed that arm64_gic_raise_sgi() is not implemented for
  GICv2 which is used for SMP + hypervisor such as qemu + kvm.
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with qemu-7.1 + kvm (linux) and qemu-7.1 + hvf (macOS)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-06-30 16:10:26 +08:00
Masayuki Ishikawa
745f443cbf arch: arm64: Fix to access psci with hypervisor
Summary:
- I noticed that pcsi version can not be obtained with qemu + kvm.
- Also, pci_detect hangs with qemu + hvf.
- This commit fixes this issue by using hvc (hypervisor call).

Impact:
- None

Testing:
- Tested with qemu-7.1 + kvm (linux) and qemu-7.1 + hvf (macOS)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-06-30 16:10:26 +08:00
guoshichao
083c11ef1a libs/libc/time/strftime: complete the strftime implementation
1. make the strftime implementation can pass the
ltp/open_posix_testsuite/strftime/1-1 testcase
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-30 12:02:23 +08:00
Jorge Rodriguez Herranz
a40f07640f Fix gpio outputs from being configured as interrupts in stm32f0l0g0 gpio driver 2023-06-30 02:28:37 +08:00
guoshichao
d5f45dc33b libs/libc/aio: fix aio_cancel compatible issue
1. make the aio_cancel implementation can pass the
ltp/open_posix_testsuite/aio_cancel testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_cancel.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 23:25:33 +08:00
Masayuki Ishikawa
cf6a134684 arch: arm64: Do not set cntfrq_el0 in qemu_boot.c
Summary:
- During testing with qemu + kvm, I noticed that nuttx hangs
  when setting cntfrq_el0. With qemu + kvm, it starts from
  EL1 because we can not specify virtualization=on
- However, I noticed that it works without setting cntfrq_el0
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with qemu-7.1 (both with kvm and without kvm)
- NOTE: to work with kvm, GICv2 must be used.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-06-29 20:11:29 +08:00
Alexander Lunev
7af151aa51 arch/arm: move -mthumb option back to ARCHCPUFLAGS
CONFIG_ARM_TOOLCHAIN_GNU_EABI build got broken when -mthumb option was moved
from ARCHCPUFLAGS to ARCHOPTIMIZATION variable:

arm-none-eabi-ld: error: .../build/nuttx/nuttx uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_fixunsdfdi.o) does not
arm-none-eabi-ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_fixunsdfdi.o)
arm-none-eabi-ld: error: .../build/nuttx/nuttx uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_udivmoddi4.o) does not
arm-none-eabi-ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/5.4.1/libgcc.a(_udivmoddi4.o)
2023-06-29 18:18:23 +08:00
guoshichao
d4dc0f6ec7 libs/libc/aio: fix aio_fsync compatible issue
1. make the aio_fsync implementation can pass the
ltp/open_posix_testsuite/aio_fsync testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_fsync.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 18:15:48 +08:00
Mingjie Shen
f5a2741ec2 libc/lib_remove: fix TOCTOU race condition
Separately checking the state of a file before operating on it may allow
an attacker to modify the file between the two operations.

Reference:
  CWE-367
  4290aed051/sysdeps/posix/remove.c (L29-L41)

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-29 18:15:06 +08:00
guoshichao
dc69b108b8 libs/libc/aio: fix aio_write compatible bug
1. make the aio_write implementation can pass the
lpt/open_posix_testsuite/aio_write testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_write.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 00:59:27 +08:00
Mingjie Shen
7d13f5eb78 fs/fat: Fix undefined behavior in signed integer overflow check
Testing for overflow by adding a value to a variable to see if it "wraps
around" works only for unsigned integer values, because signed overflow
has undefined behavior according to the C and C++ standards.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-28 23:02:25 +08:00
Alin Jerpelea
669ccfaa32 documentation: Add release notes for 12.2.0 release
This is a local copy taken from the confluence notes
https://cwiki.apache.org/confluence/display/NUTTX/NuttX+12.2.0

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2023-06-28 23:00:21 +08:00
Alin Jerpelea
3003236e3f ReleaseNotes: cleanup
remove double and trailing spaces

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2023-06-28 23:00:21 +08:00
Xiang Xiao
987b01221c fs/rpmsgfs: Zero dirs after realloc to avoid stale data
since many places assume the null pointer as an unused entry

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-28 10:29:21 -03:00
guoshichao
d33f90b78c libs/libc/aio: fix aio_read compatible bug
1. make the aio_read implementation can pass the
ltp/open_posix_testsuite/aio_read testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_read.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-28 10:28:28 -03:00
Huang Qi
f48a92810b libc.csv: Correct return type of strchr
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-06-28 18:23:52 +08:00
chao an
a2c4027da6 mm/kasan: replace load/store methods to marco
Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-28 15:18:04 +08:00
guoshichao
0d9e7be323 libs/libc/aio: fix aio_return compatible bug
1. make the aio_return implementation can pass the
ltp/open_posix_testsuite/aio_return testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_return.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-28 15:17:35 +08:00
fangxinyong
d08b81db9d sched: fix pthread_exit crash
A normal user task calls pthread_exit(), will crash at DEBUGASSERT.
Cause pthread_exit limit in user pthread task.

test case:
int main(int argc, FAR char *argv[])
{
  pthread_exit(NULL);
  return 0;
}
>> test
>> echo $?
>> 0

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-06-28 15:17:17 +08:00
Mingjie Shen
1d6e51220d cxd56_dmac, lcd_dev: fix null pointer dereference
Check return values of following functions for null:
   - board_lcd_getdev
   - get_device

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-28 10:16:38 +03:00
Stuart Ianna
5b00c31396 boards/litex/arty_a7: Support building fully linked executables.
Changes the executable type built against the `make export` target fully linked by default. This greatly improves performance when loading applications, as relocations no longer need to be processed.
2023-06-28 15:16:28 +08:00