Commit Graph

50988 Commits

Author SHA1 Message Date
yinshengkai
a0cc455922 tools: add support for merge_config
Usage example:
./tools/merge_config.py -o defconfig .config1 .config2

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-09-14 14:33:30 +08:00
yinshengkai
d0ca0d422e tools: defconfig supports the include command
We support search directory structure as follows:
Current directory
stm32/configs/common
stm32/common/configs

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-09-14 14:33:30 +08:00
Zhe Weng
7c422381ca net/tcp: Set SO_ERROR for poll error in setup
Normally, `SO_ERROR` for disconn events will be set by `tcp_poll_eventhandler`, but when the socket is closed before poll, we should also set the `SO_ERROR`.

On Linux, `tcp_poll` returns `EPOLLERR` event when `sk->sk_err` has value but doesn't let `poll` fail (doesn't set `errno`). https://github.com/torvalds/linux/blob/v6.5/net/ipv4/tcp.c#L594-L596
Note: `sk->sk_err` can be get by socket option `SO_ERROR` on Linux, so `POLLERR` will always be together with `SO_ERROR`.

Common libs like curl may try to read `SO_ERROR` on `POLLERR`.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-09-14 14:32:56 +08:00
Zhe Weng
e4721cef5c usrsock_rpmsg_server: Add net_lock to combine get_tx_payload and recvfrom in recvfrom_handler
A dead lock may happen before this patch:
rptun thread (usrsock_rpmsg_recvfrom_handler):
 Gets all tx payload but waiting net_lock in psock_recvfrom
net driver thread (higher priority):
 Receives a packet, holding net_lock, calling usrsock_rpmsg_send_event
 But no tx buffer left, so rpmsg_send blocks, and won't release net_lock

In short:
Rptun: Hold all `tx_payload_buffer` -> want `net_lock`
Driver: Hold `net_lock` -> want `tx_payload_buffer`

This patch use net_lock to combine get_tx_payload and recvfrom together,
then:
- If it's waiting net_lock, tx payload will not be held, other threads
  may get tx buffer and do their work.
- If net_lock is got, it won't be disturbed before finish receiving,
  then tx payload won't have chance to be blocked before releasing.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-09-14 14:32:40 +08:00
simbit18
50e6dcb1e0 Fix nuttx coding style
Correct forming guard names
2023-09-13 22:49:38 +08:00
Ville Juven
c178fa3260 stdio/lib_libfread: Fix buffer overflow issue
If the gulp size in the stdio buffer the remaining user buffer size it will:
- Corrupt memory in dest (user memory) and
- Keep corrupting KERNEL memory via the stdio character buffer until the
  whole system crashes, as the 'remaining' count underflows

This patch fixes this behavior.
2023-09-13 21:52:57 +08:00
xuxin19
7a9d3c03e4 cmake:complete missing changes during reforming for net
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-09-13 21:51:20 +08:00
wanggang26
dcadd87919 pm: fix issue that system crash when passed invalid relpath value
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-13 21:47:27 +08:00
simbit18
b3973496cd Fix Kconfig style
Remove spaces from Kconfig
Add comments
2023-09-13 21:39:49 +08:00
wangming9
72cf51faf3 arm/psci: Fixed arm psci related compilation errors
Summary
include/arch/syscall.h: Assembler messages:
include/arch/syscall.h:133: Error: bad instruction `struct arm_smccc_res'
include/arch/syscall.h:134: Error: junk at end of line, first unrecognized character is `{'
include/arch/syscall.h:135: Error: bad instruction `unsigned long a0'
include/arch/syscall.h:136: Error: bad instruction `unsigned long a1'
include/arch/syscall.h:137: Error: bad instruction `unsigned long a2'
include/arch/syscall.h:138: Error: bad instruction `unsigned long a3'
include/arch/syscall.h:139: Error: bad instruction `unsigned long a4'
include/arch/syscall.h:140: Error: bad instruction `unsigned long a5'
include/arch/syscall.h:141: Error: bad instruction `unsigned long a6'
include/arch/syscall.h:142: Error: bad instruction `unsigned long a7'
include/arch/syscall.h:143: Error: junk at end of line, first unrecognized character is `}'
include/arch/syscall.h:145: Error: bad instruction `typedef struct arm_smccc_res

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-09-13 21:06:51 +08:00
fangxinyong
a73f5f86dc sched: do not crash for priority multi-boost
aio client will queue asynchronous io requests to the worker threads.
if PRIORITY_INHERITANCE is enabled, client thread's priority will be
set to worker threads. There will be multi-boost/restore of worker
threads' priority and assert the system.

No need priority multi-boot/restore to worker thread because client
thread's priority is alway the same.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-09-12 23:02:10 +03:00
Zhe Weng
33da959fbc usrsock_rpmsg_server: Clear revents for POLLHUP and POLLERR
Note:
tcp_poll_eventhandler have logic after poll_notify, if we teardown poll
inside poll callback without clearing revents, use-after-free will
happen.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-09-12 22:12:31 +08:00
Jukka Laitinen
bd52ae1ad9 arch/risc-v/src/mpfs/mpfs_i2c.c: Clean up using priv->status and STOP interrupts
- There are occasional extra STOPs being sent due to an IP bug when using an
  FPGA based I2C. Add a flag "inflight" to mask out extra STOP interrupts when
  using the FPGA based implementation
- There are no MPFS_I2C_ST_STOP_SENT irq's "initally". It is just already
  either success or still in progress

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-09-12 22:11:24 +08:00
jianglianfang
bbf5b0bb6d driver/video: adapting Goldfish FB to VSync optimized FB driver
The circbuf part is implemented by the fb driver, and goldfish needs to
delete the part related to circbuf and adapt to the interface of the fb
driver.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-09-12 22:10:10 +08:00
jianglianfang
479bfd5414 sim_framebuffer: add double buffer for sim
support double framebuffer mode and adapter to the new vsync queue.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-09-12 22:10:10 +08:00
pengyiqiang
e578f3b20d video/fb: add vsync queue
refact vsync queue to support multi fb poll and overlay poll.

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-09-12 22:10:10 +08:00
jianglianfang
43ea7e65e1 driver/fb: add fb_get_planeinfo and initialize local variable pinfo
VELAPLATFO-11808

Change-Id: I32db03d52b778cc7dd1784adea0a432976fde6bf
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-09-12 22:10:10 +08:00
pengyiqiang
6536ddcdcf sim/framebuffer: remove duplicate poll notify
The framebuffer of the emulator is a single buffer mode, and the pan_display method is not implemented, so as long as the fb device is created and poll notify once, the fb can be kept in a writable state.

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2023-09-12 22:10:10 +08:00
pengyiqiang
7485816d6f video/fb: use counter record the num of poll ready
add a count to record the number of pollready.

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2023-09-12 22:10:10 +08:00
Xuxingliang
b9e59ad0a7 mm: add macro to judge if node/prenode is free
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-09-12 22:09:36 +08:00
Xuxingliang
c9f33b7ee5 mm: use unified naming style for macros
Make all macro name starts with prefix MM_
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-09-12 22:09:36 +08:00
Stanley
4d13ac0a87 queue.h: Implement double link list queue split 2023-09-12 22:09:00 +08:00
liaoao
a2b9cbffc2 qemu: get reg and irq from devicetree node rather than macro
fdt address is at 0x4000000, so it needs to be reserved at ld script.

Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-09-12 21:59:26 +08:00
Shanmin Zhang
b9fb9bea1d arm: support reboot / poweroff for qemu virt arm
Signed-off-by: Shanmin Zhang <zhangshanmin@xiaomi.com>
2023-09-12 21:57:13 +08:00
chao an
9f10ddc9b0 nuttx/build: Restore ARLOCK to improve compile speed in incremental case
To solve the issue of carrying object files from previous builds,
Matias changed the archiving process to re-archive libapps.a on every compilation,
if libapps.a carries more object files, incremental compilation will waste too
many time in re-archiving, compared with the previous implement, this is a degradation
of the build system.  Referring to mature engineering projects such as cmake, if there
is configuration or source file changed, the best solution should be to reconfigure
the environment.

Revert this PR to ensure the compilation speed during incremental compilation.

|  commit 34b34e2d45 (tag: nuttx-20200914-172150)
|  Author: Matias N <matias@protobits.dev>
|  Date:   Fri Sep 11 22:31:38 2020 -0300
|
|      Fix: ensure archive files do not carry object files from prior builds
|
|      In some cases, when NuttX configuration changes and this makes the
|      object list used to build one of the .a libraries change as well,
|      since the command used to build it is "ar crs" and this simply appends
|      the list of object files, the library could still include object
|      files from prior builds. This commit modifies the ARCHIVE macro to
|      erase the .a file if it already exists.
|
|      Since in some cases this behavior was actually expected (object
|      files from a subdirectory were appended to a library created one
|      level above) I added a ARCHIVE_ADD which works as ARCHIVE did.
|
|      This change should greatly improve behavior of building after
|      configuration changes.

Testing:

sim:nsh
-------------------------------
|   Patched    |  Current
-------------------------------
|$ time make   |  $ time make
|real 0m1.270s |  real 0m1.728s
|user 0m0.971s |  user 0m1.276s
|sys  0m0.363s |  sys  0m0.530s
-------------------------------

Private project (20+ 3rd library needs archive to libapps.a)
-------------------------------
|   Patched     |  Current
-------------------------------
|$ time make    |  $ time make
|real 0m21.181s |  real 0m39.721s
|user 0m14.638s |  user 0m24.837s
|sys  0m6.919s  |  sys  0m14.394s
-------------------------------

Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-12 21:55:23 +08:00
dlstjq7685
74885b1d48 fix correct spell Cirectory -> directory 2023-09-12 21:54:54 +08:00
xuxin19
225bd13381 change Mac sim archive operate from replace to quick insertion
'rcS' will case files that has duplicate name been replaced.
so on the Mac platform we use 'q' instead of 'r' to achieve an
effect similar to '-P'

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-09-12 16:15:19 +03:00
Xiang Xiao
4aa3c9cd73 boards/x86_64: Change up_netinitialize to x86_64_netinitialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-12 15:56:36 +03:00
Tomáš Pilný
98b43752d5 esp32/rmt: fix bug in rmt_reset 2023-09-12 17:44:42 +08:00
Tomáš Pilný
80ac78e782 Documentation/esp32: Describe RTM support
Added RMT to perihperal support overview
2023-09-12 17:44:42 +08:00
Tomáš Pilný
103270be1d esp32/rmt: Improve comments in ESP32's RMT peripheral 2023-09-12 17:44:42 +08:00
Tomáš Pilný
b5a1dd2eec boards/esp32-devkitc: Renamed wifi_smp_rmt to rmt
Removed wifi_smp_rmt config for ESP32

Replaced RMT defconfig with generated file
2023-09-12 17:44:42 +08:00
yangsen5
f8b19c2030 drivers/video: Modify the properties of the goldfish camera driver kthread_create
1. priority   = SCHED_PRIORITY_DEFAULT
2. stack_size = DEFAULT_TASK_STACKSIZE

Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2023-09-12 16:28:16 +08:00
zhangyuan21
fb7c36978f usbdev: support usb adb fastboot
Enable CONFIG_USBFASTBOOT to support fastboot driver.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-12 16:27:49 +08:00
yinshengkai
573317cada tools: checkpach supports python files
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-09-12 16:25:45 +08:00
chao an
8a55ab680a boards: Refresh MM_IOB related config
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-12 16:24:52 +08:00
chao an
8767a84e13 net/arp: arp should depends on MM_IOB
Implementation of arp depends on MM_IOB

Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-12 16:24:52 +08:00
pengyiqiang
76c214bd00 tools/showstack: add configurable rank parameters
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2023-09-12 16:23:20 +08:00
Tiago Medicci Serrano
1f1c793fd5 boards/esp32s3-devkit: Add board GPIO support
The board-level GPIO support is different from the already existing
button and LEDC support because it enable us to register the GPIO
pins as devices in `/dev/gpioX`. Some applications are able to use
this interface to read and write the GPIO pins.

Documentation was added regarding its usage. Please check
`Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst`
2023-09-12 16:22:15 +08:00
Xiang Xiao
c27b470d39 Fix error: implicit declaration of function 'arc4random'; did you mean 'random'? [-Werror=implicit-function-declaration]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-12 10:02:50 +08:00
Xiang Xiao
78728fc5eb Fix error: spi/qspi_flash.c:576:45: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-12 10:02:50 +08:00
Xiang Xiao
d4fd9f53cd Fix error: arch/sim/src/sim/posix/sim_alsa.c:290:18: error: 'flags' undeclared
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-12 10:02:50 +08:00
makejian
4fef475825 sim/crypto: support MBEDTLS_MD5_ALT config
Signed-off-by: makejian <makejian@xiaomi.com>
2023-09-12 10:01:28 +08:00
dongjiuzhu1
36e3d32740 mm/heap: add coloration after free to detect use after free issue
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-11 15:28:34 -04:00
Philippe Leduc
a7d0b6c120 Do not let CMake check the compiler with en executable as the entry point is not always main() 2023-09-12 01:17:30 +08:00
daniellizewski
a75b3bad15 Fixed typo in CRC define 2023-09-12 00:41:59 +08:00
Petro Karashchenko
a003a7ea36 arch/xtensa/esp32s3: add UART RS485 support
This commit adds support of RS485 support in ESP32-S3 serial driver

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-11 23:20:49 +08:00
Pavel Pisa
b9472129c8 arch/arm/samv7: fix typos in quadrature encoder and timer drivers
The typo s/.timid/.tcid prevents to compile NuttX with
quadrature encoder configured for timer1 (CONFIG_SAMV7_TC1_QE)
and s/SAM_TC789_BASE/SAM_TC678_BASE prevented use of the
of the timer 2.

Signed-off-by: Pavel Pisa <ppisa@pikron.com>
2023-09-11 23:11:43 +08:00
xuxin19
e5ee8f7470 Fix error: procfs/fs_procfscritmon.c:184:10: error: variable 'remaining' set but not used [-Werror,-Wunused-but-set-variable]
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-09-11 20:34:46 +08:00
yintao
9e43a4d31c sim: To avoid system calls being interrupted when use host api
Signed-off-by: yintao <yintao@xiaomi.com>
2023-09-11 20:33:49 +08:00