Commit Graph

54155 Commits

Author SHA1 Message Date
yinshengkai
a9afed96b9 mm/kasan: print memory around poisoned address
Print shadow memory following asan format.
==3118004==ERROR: AddressSanitizer: global-buffer-overflow on address 0x5618ac32a100 at pc 0x5618ac32727f bp 0x7ffe5f3e66f0 sp 0x7ffe5f3e66e0
WRITE of size 4 at 0x5618ac32a100 thread T0

#0 0x5618ac32727e in main /home/baerg/vela/x4b/asan_test.c:12
#1 0x7f221ce29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#2 0x7f221ce29e3f in __libc_start_main_impl ../csu/libc-start.c:392
#3 0x5618ac327144 in _start (/home/baerg/vela/x4b/asan_test+0x1144)
0x5618ac32a100 is located 0 bytes to the right of global variable 'buffer' defined in 'asan_test.c:5:6' (0x5618ac32a0e0) of size 32
SUMMARY: AddressSanitizer: global-buffer-overflow /home/baerg/vela/x4b/asan_test.c:12 in main
Shadow bytes around the buggy address:
0x0ac39585d3d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d3e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d3f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d400: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 f9
0x0ac39585d410: f9 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
=>0x0ac39585d420:[f9]f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac39585d470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-30 01:35:09 +08:00
yangsong8
5a39e83c05 usbdev: extend the usb req len to size_t
Some USB controllers can receive or send multiple data packets then
generate one interrupt. This mechanism can reduce the number of data
copies. Extend req buf to accommodate this.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-30 01:32:02 +08:00
simbit18
75eea1b74e tools/ci/docker/linux/Dockerfile: image cleaned of unnecessary files and folders
Trying to reduce the size of the docker image, I found files and folders to be deleted.

For now, I have commented Swift from the  Dockerfile because the package is too large.
2024-08-30 01:19:55 +08:00
raiden00pl
55170d2ca2 Documentation: replace m2r2 with myst-parser
sphinx recommends myst-parser for markdown conversion:
https://www.sphinx-doc.org/en/master/usage/markdown.html

m2r2 is not supported for Python versions >= 3.12 so
we can't build Documentation for example on latest Arch Linux

by the way myst-parser detected a bad link to SECURITY.md that is now fixed
2024-08-30 01:14:36 +08:00
Ville Juven
23e0bf5953 imx9_usdhc.c: Fix build error when CONFIG_ARM64_DCACHE_DISABLE=y
priv->rxbuffer does not exist when CONFIG_ARM64_DCACHE_DISABLE=y so
references to it will create a build error -> flag / remove accesses
to it.
2024-08-30 01:13:26 +08:00
YAMAMOTO Takashi
52baca0a89 Increase the chance for _assert to work early in the boot 2024-08-30 01:12:45 +08:00
chenzhijia
1086a05e50 libc/sysconf: add _SC_GETPW_R_SIZE_MAX
pass tlpi example: https://man7.org/tlpi/code/online/dist/users_groups/t_getpwnam_r.c.html

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-08-29 09:05:45 +08:00
Tiago Medicci Serrano
a763ed1e07 espressif: Fix build with RTC
This commit ensures that RTC data is properly allocated in the RTC
segment in the linker. This fixes the reported problem about using
the legacy bootloader and RTC.
2024-08-29 09:05:17 +08:00
pangzhen1
c8e56ff63a CMake: fix CMake compile errors during the protected build mode
There are 2 CMake compile errors during the protected build mode. One is forget to add library for nuttx_user, another is the wrong macro used when compile wqueue.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2024-08-29 01:59:29 +08:00
chenzhijia
f526b91165 nuttx/drivers:Modify errcode returned by relay_ioctl
Fixed system function call failure due to return errcode error

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-08-29 01:04:03 +08:00
Felipe Moura
37e1f5db47 Add spi slave dev to esp32 xtensa 2024-08-29 01:01:04 +08:00
Ville Juven
a0a85e5c10 arch/arm64: Move ELF_64BIT selection to arch/Kconfig
Unify the elf file format for the whole arm64 architecture
2024-08-28 07:45:36 -04:00
yinshengkai
263f8955da fs/procfs: Supports any number of thread displays
After the number of threads exceeds the array size, it will not be displayed.
Any number of threads can be displayed using dynamic adaptation

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-28 14:01:25 +08:00
yangguangcai
efbf43cdfa driver/mem:add Mem Driver.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-28 13:59:04 +08:00
yangsong8
a2e7265adb cdcacm: align cdcacm_epconfigure function parameters
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-28 13:48:55 +08:00
Lup Yuen Lee
4c35bde3ba risc-v/bl808: Configure MMU to cache User Text, Data and Heap
This PR configures the BL808 MMU to cache the the User Text, Data and Heap. We enable the T-Head MMU Flags for Shareable, Bufferable and Cacheable, as explained in the previous PR: https://github.com/apache/nuttx/pull/13199

This PR fixes the Slow Memory Access for NuttX Apps on Ox64 BL808 SBC: https://github.com/apache/nuttx/issues/12696. With this fix, Ox64 NuttX CoreMark jumps from 19 to 1,104. (Close to Buildroot Linux CoreMark)

Modified Files:

`arch/risc-v/Kconfig`: Enabled `ARCH_MMU_EXT_THEAD` for BL808 SoC.
2024-08-28 13:47:41 +08:00
yangguangcai
45625cbe3b timer driver:support poll.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-28 13:46:47 +08:00
pangzhen1
dee4c63adb protected build: userspace threads will unexpectly work in privileged mode after syscall
In protected build mode, the syscall returns without setting correct value for the CONTROL register, which causes the userspace threads working in privileged mode after syscall.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2024-08-28 13:44:37 +08:00
LuchianMihai
d59fbfdbdc tools/nxstyle: fix wrong error reports for if statements
* Fix nxstyle check so it does not report error on comments on the same
line as if statements
* Rework if statement checks
* Report warning instead of error for is statements check fail
2024-08-28 09:08:42 +08:00
Lup Yuen Lee
b14dc8f8ae risc-v/mmu: Configure T-Head MMU to cache User Text, Data and Heap
This PR configures the T-Head MMU to cache the the User Text, Data and Heap. We enable the MMU Flags for Shareable, Bufferable and Cacheable, as explained in this article: https://lupyuen.github.io/articles/plic3#appendix-mmu-caching-for-t-head-c906

This PR fixes the Slow Memory Access for NuttX Apps on BL808 and SG2000 SoCs: https://github.com/apache/nuttx/issues/12696. With this fix, SG2000 NuttX CoreMark jumps from 21 to 2,423. (Close to SG2000 Debian CoreMark)

We introduce a Kconfig Option: `ARCH_MMU_EXT_THEAD` ("System Type > Enable T-Head MMU extension support"). Enabling this Kconfig Option will configure the T-Head MMU to cache the User Text, Data and Heap.

This PR enables the MMU cache for only SG2000 SoC (Milk-V Duo S SBC). The next PR will apply the same settings to BL808 SoC (Pine64 Ox64 SBC).

Modified Files:

`arch/risc-v/Kconfig`: Added Kconfig Option `ARCH_MMU_EXT_THEAD` that will configure the T-Head MMU. Enabled `ARCH_MMU_EXT_THEAD` for SG2000 SoC.

`arch/risc-v/src/common/riscv_mmu.h`: Set the T-Head MMU Flags (Shareable, Bufferable and Cacheable) for User Text, Data and Heap, if `ARCH_MMU_EXT_THEAD` is enabled

`arch/risc-v/src/common/riscv_addrenv.c`: Extended the MMU Flags from 32 bits to 64 bits, to accommodate the T-Head MMU Flags

`arch/risc-v/src/common/riscv_exception.c`: Extended the MMU Flags from 32 bits to 64 bit, to accommodate the T-Head MMU Flags. This code is enabled only for MMU Paging (`CONFIG_PAGING`).
2024-08-27 19:54:58 -04:00
guoshichao
2d7c47ce16 greenhills: fix the build option warning
Warning: Unknown option "-fno-optimize-sibling-calls" ignored.  Did you mean "-mno-long-calls"?

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-28 01:22:03 +08:00
yangsong8
fa1c094e65 usbdev: add usb3.0 ep companion struct and descriptor
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
1dd38fe974 usbdev: unify the parameter of mkconfdesc function
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
07aa8a5c57 usbdev: modify usb device support USB3.0 MaxPacketSize
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
0788e68285 usbdev: usb device descriptor support USB3.0
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
af017a5c30 usbdev: fix usb cdcecm build error
usbdev/cdcecm.c:295:3: error: invalid type argument of '->' (have 'struct net_driver_s')
  295 |   NETDEV_TXPACKETS(self->dev);
      |   ^~~~~~~~~~~~~~~~
usbdev/cdcecm.c: In function 'cdcecm_txdone':
usbdev/cdcecm.c:495:3: error: invalid type argument of '->' (have 'struct net_driver_s')
  495 |   NETDEV_TXDONE(priv->dev);
      |   ^~~~~~~~~~~~~

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
jinxiuxu
575c9b12ab drivers/audio: fix samp rate conversion issue
use ac_controls.hw to get the correct sample rate intead of ac_controls.b

Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2024-08-27 22:00:39 +08:00
Masayuki Ishikawa
ec4d31515a fs: nfs: Fix nfsmount error
Summary:
- I noticed that nfsmount does not work due to the recent
  changes on sockaddr_storage alignment.
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested with sabre-6quad:netnsh_smp (QEMU)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2024-08-27 21:57:18 +08:00
pengyinjie
6b21bebcd1 [env]:Fixed spacing and typo issues in code comment descriptions
[Desc]: as title

Signed-off-by: pengyinjie <pengyinjie@xiaomi.com>
2024-08-27 21:52:56 +08:00
pengyinjie
cbc9b98075 [FS]:Fixed spacing and typo issues in code comment descriptions
[Desc]:as title

Signed-off-by: pengyinjie <pengyinjie@xiaomi.com>
2024-08-27 21:52:56 +08:00
hujun5
572daf46c2 irq: add isr thread
purpose:
To improve the real-time performance of the system, we prefer to perform
as few operations as possible within the interrupt function.
We have designed an interrupt thread for each interrupt,
where all the operations that are not necessary to be handled
in the interrupt function are delegated to be processed by the interrupt thread.
Up_enable_irq will be invoked after isrthread started.

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-08-27 21:49:53 +08:00
pangzhen1
8bb62e532c nuttx/syscall: delete getrandom in syscall.csv
delete getrandom in syscall.csv, because it has been moved to libc.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2024-08-27 21:44:33 +08:00
likun17
7913b249ca drivers/regmap: add exit function interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-08-27 21:43:58 +08:00
simbit18
1661a66843 [cmake]: added initial support for MSYS2
Currently concerns only arm.

tools/ci/testlist/msys2.dat:
At the moment I only added the board nucleo-l152re:nsh

.github/workflows/build.yml:
Enabled cmake for msys2
2024-08-27 21:36:12 +08:00
yangguangcai
3fa6cfc41e rpmsg_rtc:Update g_basetime from rpmsg.
When ipc is busy, g_basetime may be inconsistent
on different cores.

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-27 21:35:17 +08:00
Ville Juven
12ba2eeb23 arm64_checkstack.c: Fix traversing of user stack when ARCH_ADDRENV=Y
Need to instantiate the correct address environment when reading from
user stack, otherwise the result is very likely a crash
2024-08-27 21:34:43 +08:00
Mingjie Shen
51c4a5c2d6 gd32f4xx_at24: Fix uninitialized use of local variables i2c and at24
Prior to this commit, i2c and at24 may be used uninitialized on line
113, 117, 129, and 143 when gd32_at24_wr_test() is called the second
time because these two variables are not static. I don't think making
them static is the correct fix because i2c is released at the end of
this function. Fixed by removing the `if (!initialized)` condition
surrounding the initialization of i2c and at24, making them initialized
at every call to this function.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2024-08-27 21:32:28 +08:00
yangguangcai
234c7d58bf rtc alarm:fix doesn't call nxsig_notification
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-27 10:18:10 -03:00
makejian
8de247543f crypto: export interfaces abort aes-cmac
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
makejian
28974b8a21 crypto: export crc32 from /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
Ville Juven
963c5e8e52 arm64/imx9: Force 64-bit ELF format
The format is always 64-bits
2024-08-27 07:39:26 -04:00
guoshichao
599d41d806 greenhills: fix the pointless comparison build warning
"ioexpander/gpio.c", line 529: warning #186-D: pointless comparison of
          unsigned integer with zero
            if (pintype < GPIO_INPUT_PIN || pintype >= GPIO_NPINTYPES)
                        ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 07:33:09 -04:00
SPRESENSE
2cc9221c09 arch: cxd56xx: Add logic for i2c reset
Add ARCH_HAVE_I2CRESET configration to ARCH_CHIP_CXD56XX
and implement i2c reset function.
2024-08-27 12:29:46 +02:00
SPRESENSE
de8829f8cd arch: cxd56xx: Fix SCU sensor data format
Add offset setting for sensor data to be written to SCU math function.
Fix comments in function descriptions.
2024-08-27 12:28:50 +02:00
Samuel Martinez
a6df724b4f BlackPill buttons example
Description:
Example to interact with KEY button and user external button connected to PA1.
For KEY button pull-up resistor is active, board schematic does not show any pull-up or pull-down resistor.

Results: Example working as expected.

BlackPill PWM example

Description:
PWM example using PB0 - Timer3 - Channel 3
Create default configuration for the example.

Controlling_RGB_LED

Description: Controlling a RGB LED on NuttX for Black Pill board [STM32F411]

Note: Example currently not working as expected.
2024-08-27 09:13:35 +08:00
Samuel Martinez
447f03cfd0 Led and buttons examples
Description:
Test LED examples on freedom-k66f, nucleo-f401re and blackpill-f411ce boards.
Update linker file for bluepill-f103c6.
2024-08-27 09:13:35 +08:00
zhaoxingyu1
517d55a2ce nvs: modify nvs block size and block numbers
mtd_config_fs/Kconfig: update nvs block size and block number to configurable

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2024-08-26 20:55:24 -04:00
yangguangcai
352e3a6873 armv7-a timer:fix timer overflow.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-26 17:50:47 -04:00
wanggang26
dfffaee706 mmcsd: add write ext csd reg support
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-08-26 17:45:43 -04:00
Zhe Weng
90c0acce05 net/tun: Support changing carrier state of TUN/TAP
Add TUNSETCARRIER ioctl, then we may change the carrier state of TUN dynamically. Note that we don't need an ioctl for getting carrier, it can be done by SIOCGIFFLAGS already.

Ref: https://github.com/torvalds/linux/blob/v6.10/drivers/net/tun.c#L3374-L3380

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-26 17:34:23 -03:00