Commit Graph

47235 Commits

Author SHA1 Message Date
chao an
81325a8a3d net/arp: add link layer check for arp_out/arp_ipin
ARP support is only built if the Ethernet link layer is supported.
Continue and send the ARP request only if this device uses the
Ethernet link layer protocol.

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:13:45 +08:00
chao an
8850dee746 net/devif: move preprocess of txpoll into common code
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:11:12 +08:00
chao an
db88554d7d net/devif: add common funtion to build L2 headers before sending
Generic callback before device output to build L2 headers before sending

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:11:12 +08:00
Nathan Hartman
03802dad13 NuttX graduated the Incubator; update repository links 2022-11-26 11:58:15 -08:00
SuGliger
83a4b45dd4 boards/esp32-wrover-kit: Fix GPIO conflicts 2022-11-26 11:58:58 +08:00
SuGliger
9cdb865c9c boards/esp32-wrover-kit: Add Lua Interpreter defconfig 2022-11-26 11:58:58 +08:00
wangbowen6
a0ded9d0d4 fs_epoll: [bug fix] epoll node use-after-free in epoll extend list
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-26 11:56:58 +08:00
yinshengkai
377bf97613 stream: replace the stream function pointer with a macro
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-25 21:41:51 +08:00
yinshengkai
511070c300 include: unified stream read and write interface
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-25 21:41:51 +08:00
wangbowen6
2f2176151e fs_epoll: [bug fix] EPOLL_CTL_ADD/MOD consider the teardown list too
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-25 21:34:09 +08:00
TimJTi
4075509579 4 byte read mode bit position
GG25Q devices have the 4 byte read mode in bit 0 not bit 3 of the status register. This changes allows for both depending on the JEDEC DEVICE ID that is read back.
2022-11-25 10:11:11 -03:00
zouboan
b45f113943 boards/sparc add initial support of s698pm-dkit board 2022-11-25 08:54:28 -03:00
Lee Lup Yuen
c2d083e3c1 Update boards/arm64/a64/pinephone/src/pinephone_boardinit.c
Co-authored-by: hartmannathan <59230071+hartmannathan@users.noreply.github.com>
2022-11-25 17:19:48 +08:00
Lee Lup Yuen
b31054b1e3 arch/arm64: Add support for PINE64 PinePhone
This PR adds support for PINE64 PinePhone and the Allwinner A64 SoC (based on Arm Cortex-A53).

With this PR, PinePhone boots successfully to nsh (via microSD Card) and runs console apps.

-   `arch/arm64/Kconfig`: Added Allwinner A64 SoC

-   `boards/Kconfig`: Added PINE64 PinePhone

-   `arch/arm64/src/a64/Kconfig`: New Kconfig for Allwinner A64 SoC

-   `boards/arm64/a64/pinephone/Kconfig`: New Kconfig for PINE64 PinePhone

-   `src/a64/a64_boot.c`, `a64_boot.h`: Boot functions for Allwinner A64

-   `src/a64/a64_lowputc.S`: Low-level console output

-   `src/a64/a64_serial.c`, `a64_serial.h`: A64 Serial Driver

-   `src/a64/chip.h`: A64 SoC Definitions

-   `include/a64/chip.h`: A64 Memory Map, Generic Interrupt Controller

-   `include/a64/irq.h`: A64 Interrupts

-   `src/a64/Make.defs`: Source files for A64

-   `configs/nsh/defconfig`: Board Configuration for `pinephone:nsh`

-   `src/pinephone_appinit.c`: Init PinePhone

-   `src/pinephone_boardinit.c`: Init PinePhone

-   `src/pinephone_bringup.c`: Start PinePhone Drivers

-   `src/pinephone.h`: PinePhone Declarations

-   `include/board_memorymap.h`: PinePhone Memory Map

-   `scripts/dramboot.ld`: PinePhone Linker Script

-   `scripts/Make.defs`: Source files for PinePhone

-   `src/Makefile`: PinePhone Makefile

-   `platforms/arm/a64/boards/pinephone/index.rst`: Building and booting NuttX on PinePhone

-   `platforms/arm/a64/index.rst`: Overview of Allwinner A64

-   `introduction/supported_platforms.rst`: Added Allwinner A64

-   `introduction/detailed_support.rst`: Added Allwinner A64
2022-11-25 17:19:48 +08:00
Xiang Xiao
9bfc91e6f1 libc/stream: Remove \n special handle from syslogstream_putc
since \r\n process is already done in up_putc or serial driver level

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-25 09:10:05 +01:00
chao an
1815c2e1e1 tools/nuttx-gdbinit: restore the context at the end of each command
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-25 11:32:42 +09:00
Alan Carvalho de Assis
0e57e69b08 Add libc_stubs functions to get hmac_md5()
Co-author: Gustavo Nihei <gustavo.nihei@espressif.com>
Co-author: Lucas Vaz <lucas.vaz@espressif.com>
2022-11-25 10:26:37 +08:00
Xiang Xiao
5fd1379d3f syslog: Move syslog stream to libc like other stream implementation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-25 01:46:31 +08:00
Xiang Xiao
90c641d4c1 libc/streams: Add lib_[si]gets_t callback
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-25 01:07:12 +08:00
Xiang Xiao
5ee1da4211 libc/streams: Ensure the different stream type has the common layout
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-25 01:07:12 +08:00
Zhe Weng
869c93638d net/icmpv6: Fix ipv6->len in icmpv6_reply
The `ipv6->len` is the length excluding the IPv6 header, so need to be `dev->d_len - IPv6_HDRLEN`.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-11-24 23:19:10 +08:00
Zhe Weng
a26ea96f3b net/icmpv6: Fix datalen in icmpv6_reply
The `datalen` indicates the whole len of original packet, which will become the payload inside icmpv6 packet.

Using `datalen = (ipv4->len[0] << 8) + ipv4->len[1]` in icmp_reply is correct, because it includes IPv4 header, but when coming to IPv6, the `len` does not include the header, so we need to add it back.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-11-24 23:19:10 +08:00
Zhe Weng
233974b327 net/icmpv6: Fix icmpv6 checksum calculation in icmpv6_reply
The second param of icmpv6_chksum is `iplen`, which indicates `The size of the IPv6 header`.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2022-11-24 23:19:10 +08:00
nietingting
6368b29751 test: update usrsocktest script
Signed-off-by: nietingting <nietingting@xiaomi.com>
2022-11-24 23:14:31 +08:00
flyingfish89
4b87a8b079 lib_libvsprintf: fix the float point print bug
such as code: double value = +0x1.000000000000080000000000p-600;
              printf("Hello, World!! %.7g:f64\n", value);
expected output : Hello, World!! 2.40992e-181:f64
but real output : Hello, World!! 2.40992e-B1:f64
the reason: we want printf "18", but the flag of character is 'B'
            and 'B' is '0'+18,so printf 'B';
2022-11-24 12:02:03 -03:00
chao an
3caa551ff4 net: remove psock reference from connect
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-24 22:57:42 +08:00
chao an
f2a7711ef8 net/soerr: add new _SO_CONN_SETERRNO() macro
support so error code set from conn instance

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-24 22:57:42 +08:00
chao an
6d8c28a83c boards/citest: disable NET_ARP for usrsocktest
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-24 20:54:18 +08:00
wangbowen6
c37d90c194 net/local: support FIONWRITE for domain socket ioctl
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-24 19:47:08 +08:00
田昕
28739b8b8a libc/stream:Add mtd backend stream.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-11-24 12:07:10 +08:00
liangchaozhong
0ec4b0a149 tcp: recv returns 0 without set errno
Issue:
recv return 0  means peer side has already closed the connection according to
man page's description.
0 is returned without set errno when TCP rx timeout happens with current
design.

Solution:
return result instead of ir_result when ir_result is 0, then -1 will be
returned with errno set to EAGAIN for tcp rx buffer empty case.

Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
2022-11-23 23:23:44 +08:00
Ville Juven
39a567db20 mm/circbuf.c: Fix incorrect usage of void* arithmetics 2022-11-23 23:22:06 +08:00
Ville Juven
4781379ee2 obstack/obstack_free: Fix incorrect usage of void* for arithmetics
Using void* for arithmetics is a GCC extension, and thus should not be
used for portable code.
2022-11-23 23:22:06 +08:00
Ville Juven
52228fd222 stm32f7: Fix compliation of stm32_flash.c (add stm32_waste.c)
/arch/arm/src/libarch.a(stm32_flash.o): in function `up_progmem_write':
/arch/arm/src/chip/stm32_flash.c:419: undefined reference to `stm32_waste'

Seems like the symbol definition + declaration were completely missing
2022-11-23 20:30:26 +08:00
dongjiuzhu1
d5b08a7ef1 net/usrsock: fix get/setsockopt issue about usrsock protocol
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-11-23 21:27:15 +09:00
Robert-Ionut Alexa
9c6971279d esp32-sparrow-kit: enable support for MMCSD-SPI
Add the necessary configs to the default nsh config file in order to enable
support for MMCSD-SPI.

Signed-off-by: Robert-Ionut Alexa <robertalexa2000@gmail.com>
2022-11-23 19:52:34 +08:00
Robert-Ionut Alexa
e0374c30e4 esp32-sparrow-kit: add support for the LTR308 light sensor
Add support to esp32-sparrow-kit for the LTR308 sensor. This patch also
enables the sensor in the default nsh config file.

Signed-off-by: Robert-Ionut Alexa <robertalexa2000@gmail.com>
2022-11-23 19:52:34 +08:00
Robert-Ionut Alexa
3351146c0b boards/xtensa/esp32: add initial commit for the ESP32-SPARROW-KIT
ESP32-SPARROW-KIT is built upon ESP32-WROVER-KIT by adding various
peripherals. This is an initial commits that only backports the code
as it is, without further changes.

Signed-off-by: Robert-Ionut Alexa <robertalexa2000@gmail.com>
2022-11-23 19:52:34 +08:00
Xiang Xiao
98a9762e2a rptun: fix rptun don't wait issue when get tx patyload
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-23 19:42:30 +09:00
Ville Juven
321b9ea732 stm32f7/stm32_bbsram.c: Fix build error due to changed include path
Use correct path to include mutex.h

Fixes:

chip/stm32_bbsram.c:42:10: fatal error: mutex.h: No such file or directory
   42 | #include <mutex.h>
      |          ^~~~~~~~~
2022-11-23 18:20:29 +08:00
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