Commit Graph

47345 Commits

Author SHA1 Message Date
dongjiuzhu1
ccf0c3566e net/local: support cmd SO_PEERCRED
the credentials of the peer process connected to this socket.
refs:https://man7.org/linux/man-pages/man7/unix.7.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-11-23 15:01:54 +08:00
dongjiuzhu1
e6f8ccda4a net/get/setsockopt: add si_get/setsockopt interface to simply get/setsockopt
move private option to protocol sockif

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-11-23 15:01:54 +08:00
Xiang Xiao
c5704eb1e7 tools/ci/testlist: Switch half build to clang
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-23 07:27:48 +01:00
Xiang Xiao
04f887b56d Fix Error: chip/stm32_eth.c:1892:7: error: variable 'i' set but not used
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-23 07:27:48 +01:00
Xiang Xiao
c66ba22812 Fix Error: netdev/netdev_findbyindex.c:59:7: error: variable 'i' set but not used
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-23 07:27:48 +01:00
wangbowen6
f7dec2c250 mm_size2ndx: using flsl to calculate the ndx
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-23 13:19:41 +08:00
zouboan
b96ced8f4b tools/Config:Fix some error caused by double quotation in Windows native build 2022-11-23 10:02:05 +08:00
Xiang Xiao
79d02c0e29 arch/sim: Unify the host soruce file naming
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 19:37:48 +01:00
Tiago Medicci Serrano
d3ffeb40a7 libc/machine/xtensa: make longjmp safe against context switch
In order to turn longjmp context-switch safe, it's necessary
to disable interrupts before modifying windowbase and windowstart.
Otherwise, after a context switch, windowstart and windowbase
would be different, leading to a wrongly set windowstart bit due to
longjmp writing it based on the windowbase before the context switch.
This corrupts the registers at the next window overflow reaching
that wrongly set bit.

*Background:*
This PR is related to an issue first observed on ESP-IDF
https://github.com/espressif/esp-idf/issues/5229 and it was, then,
checked on NuttX using a test application.

*The test application:*
To check if the problem affects ESP32, ESP32-S2 and ESP32-S3 on
NuttX, it was created an application based on:
https://en.cppreference.com/w/c/program/longjmp

The application creates 16 tasks (`#define NUMBER_OF_TASKS  16`)
that implements the following daemon:

```
static int setjmp_longjmp_daemon(int argc, char *argv[])
{
  for (int i = 0; i < NUMBER_OF_TASKS * 2; i++)
    {
      jmp_buf env;

      volatile int count = 0;
      if (setjmp(env) != UINT16_MAX)
        {
          foo(&env, ++count);
        }
    }

  sem_post(&g_sem);

  return EXIT_SUCCESS;
}
```

The main function also initializes a semaphore to avoid application
exiting before tasks return successfully:

```
  sem_init(&g_sem, 0, -NUMBER_OF_TASKS);
```

Finally, the round-robin interval was lowered to 1ms to raise the
chances of the longjmp being interrupted by a context switch
(`CONFIG_RR_INTERVAL=1).

This setup was able to reproduce the problem prior to this patch
being applied.
2022-11-22 19:34:44 +01:00
chao an
f23ec0f995 Revert "tools/ci/arm/llvm/clang: bump up LLVMEmbeddedToolchainForArm to release-15.0.2"
This reverts commit b4bab51e86.

Issue:
Builtin math symbols are missing on llvm 15.0.2(libm.a):
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/issues/158

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 07:43:02 -08:00
zhangyuan21
d8051ba979 nuttx/sched: merge up_block_task and up_unblock_task 2022-11-22 22:59:08 +08:00
wangbowen6
25bfd437fe fs_epoll: support extend the epoll dynamicly.
1. epoll_ctl(EPOLL_CTL_ADD) support extend the epoll
   events dynamicly;
2. enhance the epoll performance by moving some poll setup
   and teardown process to the EPOLL_CTL_ADD/DEL/MOD;

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-22 21:08:56 +08:00
Xiang Xiao
39338ce96c boards: Refresh ursock related config
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 20:45:26 +09:00
Xiang Xiao
b170e4cc9f net/usrsock: Split NET_USRSOCK_OTHER to NET_USRSOCK_ICMP[v6]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 20:45:26 +09:00
Xiang Xiao
8bbb477316 net/usrsock: Should select NET_[UDP|TCP]_NO_STACK instead NET_[UDP|TCP]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 20:45:26 +09:00
Xiang Xiao
0d516c7ff6 net/tcp: Remove the dependence on SCHED_WORKQUEUE
since it isn't required in case of NET_TCP_NO_STACK

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 20:45:26 +09:00
Xiang Xiao
7f380533a3 net/udp: NET_BROADCAST shouldn't configurable if NET_UDP_NO_STACK enable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 20:45:26 +09:00
Xiang Xiao
c2f566afcb net/usrsock: Remove NET_USRSOCK_NO_INET[6]
let the remote peer do all final decision

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 20:45:26 +09:00
chao an
b4bab51e86 tools/ci/arm/llvm/clang: bump up LLVMEmbeddedToolchainForArm to release-15.0.2
Upstream:
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/tag/release-15.0.2

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 19:07:13 +08:00
zhangyuan21
f1837e7e96 tools/nxstyle: add more white list for sim arch 2022-11-22 16:27:56 +08:00
zhangyuan21
a8fa51e6bf arch: rename arch special function name 2022-11-22 16:27:56 +08:00
chao an
fc65e6969d arm/llvm/clang: add support for LLVMEmbeddedToolchainForArm release-15.0.2
Upstream:
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/tag/release-15.0.2

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 08:56:20 +01:00
Ville Juven
f8a6ec2cdf mm/shm: Fix ARCH_SHM_VEND
The last address is base+size-1
2022-11-22 08:54:34 +01:00
Ville Juven
48b9a8d6f4 mm/shm: Move the vma allocators to separate functions
This will allow changing the underlying backend, i.e. granule allocator,
to something more efficient, if this is needed later.

Also, it gives easier access to the common SHM book keeping.
2022-11-22 08:54:34 +01:00
Ville Juven
458ff380e5 mm/gran: Allow run-time execution of gran_reserve
User can ask for specific granules to be allocated.

This is useful for one thing only: when mmap() is called for a specific
vaddr. The parameter itself is non-sensical, this is just to satisfy
the POSIX standard.
2022-11-22 08:54:34 +01:00
zhangyuan21
5c1b518314 nuttx/sched: move reprioritize process to public function 2022-11-22 15:29:00 +09:00
zhangyuan21
08f7152d9f nuttx/sched: remove nxsched_remove_readytorun from up_block_task
It takes about 10 cycles to obtain the task list according to the task
status. In most cases, we know the task status, so we can directly
add the task from the specified task list to reduce time consuming.
2022-11-22 15:29:00 +09:00
zhangyuan21
e54b602208 nuttx/sched: remove nxsched_remove_blocked from up_unblock_task
It takes about 10 cycles to obtain the task list according to the task
status. In most cases, we know the task status, so we can directly
delete the task from the specified task list to reduce time consuming.
2022-11-22 15:29:00 +09:00
zhanghongyu
ae46cd4fa1 usrsock: add REMOTE_CLOSED event handler to connect
when usrsock client try to connect usrsock server local_loop
socket with an invalid port, server cannot find a listener conn
to handle this connet request, then it will response a TCP_RESET
packet via nuttx existing processing, when before conn recv this
RESET packet, it will trigger usrsock_rpmsg_server poll return
and send REMOTE_CLOSE event to usrsock client.
so usrsock connect_event fucntion need handle this event.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-11-22 15:18:15 +09:00
Xiang Xiao
12b3a1ae56 Fix Error: board/stm32_ssd1289.c:310:12: error: converting the result of '<<' to a boolean always evaluates to true
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 11:38:41 +08:00
Xiang Xiao
88649d03ba Fix Error: stm32_wm8994.c:198:54: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 11:38:41 +08:00
Xiang Xiao
af2aa13873 phtread: Change stacksize type from long to size_t
follow the standard prototype:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_getstack.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-22 08:23:37 +09:00
chao an
624d69ee05 boards: enter/leave critical section should in pairs
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 08:19:24 +09:00
chao an
52235b468b spresense/wifi: icmp/arp message should talk to GS2200M through usrsock
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-22 03:11:26 +08:00
Karel Kočí
221b098846 drivers/lcd/st7789: fix invalid displayed color
The write has to be in number of bytes per pixel as single SPI exchange
is used to identify single pixel write by the ST7789 driver. By issuing
only byte writes the displayed color is corrupted as it is stripped.

This fix consist of setting SPI to correct number of exchanged bytes and
then passing correctly number of words to the SPI exchange.

This also covers usage of st7789_wrram in st7789_putrun as that one was
passing just number of pixels as size but the correct is now number of
bytes.
2022-11-21 14:43:12 -03:00
Robert-Ionut Alexa
039262484a drivers/sensors: add LTR308 ambient light sensor
Add support for the LTR308 ambient light sensor through I2C. Currently,
the interrupt-driven mode of operation is not supported.

Signed-off-by: Robert-Ionut Alexa <robertalexa2000@gmail.com>
2022-11-21 23:48:52 +08:00
Tiago Medicci Serrano
5f82e2aeac documentation: update ESP32-S2's docs about the I2S RX mode 2022-11-21 23:46:47 +08:00
Tiago Medicci Serrano
d492a5b092 esp32s2/i2s: implement I2S receiver module
- Add ioctl method to enable allocating the apb buffer.
- Add RX methods to set data width, sample rate, channels and
for receiving data from the I2S peripheral.
- Update the i2schar defconfig to enable the I2S receiver.
- Add nxlooper defconfig to enable testing the RX interface.
- Add specific bindings on ESP32-S2  bringup to enable nxlooper
to work without the need of any specific codec.
2022-11-21 23:46:47 +08:00
Karel Kočí
f0321d6bae arch/arm/src/samv7: fix missing sam_pendsv
The commit d1a3f5e47f invalidly removed
`sam_pendsv` instead of `sam_busfault`.
2022-11-21 23:45:24 +08:00
chao an
01ec02380d stm32f4discovery/wifi: icmp/arp message should talk to GS2200M through usrsock
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-21 22:13:52 +08:00
Eero Nurkkala
6596f0e99a risc-v/mpfs: fix compile warning
After commit b7d2b38, the system suffers from -Warray-bounds warning with -Wall:

chip/mpfs_opensbi.c: In function 'mpfs_hart_to_scratch':
chip/mpfs_opensbi.c:251:26: warning: array subscript hartid is outside array bounds of 'sbi_scratch_holder_t[0]' {aka 'struct sbi_scratch_holder_s[]'} [-Warray-bounds]
  251 |   return (unsigned long)(&g_scratches[hartid].scratch);

Fix it by reverting back to what is was earlier. g_scratches shouldn't be in the bss
region that would be zeroed out.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-11-21 14:43:34 +01:00
flyingfish89
f420b4dce7 esp32c3:fix i2c bug of timout
Signed-off-by: flyingfish89 <2914061332@qq.com>
2022-11-21 12:02:21 +01:00
Xiang Xiao
30a01ab551 Fix Error: board/stm32_selectsram.c:163:13: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
FSMC_BTR_ADDHLD(SRAM_ADDRESS_HOLD_TIME) |
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/github/workspace/sources/nuttx/arch/arm/src/chip/hardware/stm32_fsmc.h:164:42: note: expanded from macro 'FSMC_BTR_ADDHLD'
                                         ^
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:135:54: note: expanded from macro 'putreg32'
                                                     ^
Error: board/stm32_selectsram.c:166:13: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            FSMC_BTR_CLKDIV(SRAM_CLK_DIVISION) |
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/github/workspace/sources/nuttx/arch/arm/src/chip/hardware/stm32_fsmc.h:176:42: note: expanded from macro 'FSMC_BTR_CLKDIV'
                                         ^
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:135:54: note: expanded from macro 'putreg32'
                                                     ^
Error: board/stm32_selectsram.c:167:13: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            FSMC_BTR_DATLAT(SRAM_DATA_LATENCY) |
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/github/workspace/sources/nuttx/arch/arm/src/chip/hardware/stm32_fsmc.h:180:42: note: expanded from macro 'FSMC_BTR_DATLAT'
                                         ^
/github/workspace/sources/nuttx/arch/arm/src/common/arm_internal.h:135:54: note: expanded from macro 'putreg32'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
81b9df53fc Fix Error: board/dfu_signature.c:53:16: error: unknown attribute 'externally_visible' ignored
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
a34230c954 Fix Error: chip/stm32_qencoder.c:989:46: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
ab31236905 Fix Error: chip/stm32_tim_lowerhalf.c:479:54: error: format specifies type 'unsigned long' but the argument has type 'uint32_t'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
ea171d6e5d Fix Error: chip/stm32_spi.c:571:23: error: unused function 'spi_getreg8'
and unused function 'spi_putreg8'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
6386596731 Fix Error: chip/stm32_qencoder.c:989:46: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
7bda8747b2 Fix Error: audio/wm8994.c:485:26: error: result of comparison of constant 65536 with expression of type 'uint16_t' (aka 'unsigned short') is always false
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00
Xiang Xiao
27629b74c9 Fix Error: chip/stm32_serial.c:1542:20: error: unused function 'up_serialmod'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-21 17:39:04 +08:00