Commit Graph

54630 Commits

Author SHA1 Message Date
wanggang26
2c24e5b430 arch/arm-m: Clear lr before jump to __start
to fix issue about https://github.com/apache/nuttx/issues/12687

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-15 17:31:12 +08:00
dongjiuzhu1
1bad603fe7 drivers/gpio: save memory if dont support signal
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-15 11:29:55 +08:00
dongjiuzhu1
28815fb7c5 drivers/gpio: add poll function for gpio device
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-15 11:29:55 +08:00
xuxin19
997be40003 cmake:bugfix fix sim CMake build break
fix lim CMake config prefix error

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
xuxin19
ec99359812 cmake:add mtd driver dhara cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
xuxin19
5b3275c07b cmake:add libmcs cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
xuxin19
21c68b44da cmake:support openlibm cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
xuxin19
a3e7fee595 cmake:add missing libc regex CMake support
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
wangzhi16
129b738e6b [Bug-Fix] Resource leaks
In file "nuttx/libs/libc/modlib/modlib_bind.c", line656 not check return value of lib_malloc(), and line661 not free dyn.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2024-09-15 10:26:21 +08:00
anjiahao
63db77628e stack record: fix ps can't show stack used
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-15 10:25:48 +08:00
anjiahao
632b13fe03 stack recored:Fixed the problem of missing the 0th data in statistics
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-15 10:25:48 +08:00
Kevin Zhou
d6ae4a0342 xtensa/esp32s3: Adjust I2C clock timing 2024-09-15 10:23:19 +08:00
wangjianyu3
1af4cdf500 driver/ftl: Read the consecutive eraseblocks
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:21:45 +08:00
wangjianyu3
a6080e4502 Revert "driver/ftl: Read the current eraseblock only"
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:21:45 +08:00
wangjianyu3
c40f9b8d9f driver/ftl: Read the current eraseblock only
case: The next eraseblock is bad

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:21:45 +08:00
wangjianyu3
b2221806cb rpmsgdev_server: Support oneway polling
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:18:08 +08:00
wangjianyu3
f2ca3753dd rpmsgdev_server: Support exporting devices
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:18:08 +08:00
wangjianyu3
ae6a7a4526 libs/libc/sscanf: Support pointer format
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
wangjianyu3
9320638848 libc/stdlib: Refine octal check of lib_checkbase()
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
wangjianyu3
02f1503f9f libc/stdlib: If there were no digits at all, strtoul() stores the original value of nptr in *endptr (and returns 0).
Reference: STRTOUL(3)

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
wangjianyu3
9773fb9867 libc/stdlib: Check if there is next char before assuming octal
When *pptr/ptr is "0" and base is 0, lib_checkbase() returns the error base 8(should be 10).
e.g. `strtoul("0", &endptr, 0);`

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
wangjianyu3
1bb0f19fd5 fs/rename: Do not send notify if the same
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
xuxin19
ddc3119c4e build depend:Revert Make.dep intermediate ddc file
Revert "Parallelize depend file generation"
This reverts commit d5b6ec450f.

parallel depend ddc does not significantly speed up compilation,
intermediately generated .ddc files can cause problems if compilation is interrupted unexpectedly

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:58 +08:00
xuxin19
ab488800bb cmake:enhance the module for adding extra libraries
change the extra library from a file to an import target;
this will avoid differences in the handling of static libraries
between different versions of cmake and different platforms.

after unifying as a target, extra libraries can be
handled as the same as other compiled libraries

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
xuxin19
1603e40607 cmake:bugfix refine gen sim link script to independent cmake module
fix SIM start crash on Ubuntu22,
becase the previous CMake linker script has missing handling of
C++ global constructor sections in the new Glibc version on ubuntu22

it will cause a prior c++ constructor call error:
0x00000000400317f6 in nxsched_get_stackinfo (pid=0, stackinfo=0x7fffffffdbc0) at /media/liujinye/ssd/vela-dev/nuttx/sched/sched/sched_get_stackinfo.c:101
0x000000004002de0d in tls_get_info () at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/tls/tls_getinfo.c:61
0x000000004002ddc8 in task_get_info () at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/tls/task_getinfo.c:50
0x000000004002c74e in atexit_register (type=4, func=0x40044eac <CHelloWorld::~CHelloWorld()>, arg=0x40061418 <g_HelloWorld>, dso=0x40060000)
 at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/stdlib/lib_atexit.c:68
0x000000004002ca34 in __cxa_atexit (func=0x40044eac <CHelloWorld::~CHelloWorld()>, arg=0x40061418 <g_HelloWorld>, dso_handle=0x40060000)
 at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/stdlib/lib_atexit.c:268
0x000000004004502b in __static_initialization_and_destruction_0 () at /media/liujinye/ssd/vela-dev/apps/examples/helloxx/helloxx_main.cxx:93
0x000000004004503e in _GLOBAL__sub_I_helloxx_main () at /media/liujinye/ssd/vela-dev/apps/examples/helloxx/helloxx_main.cxx:129
0x00007ffff7829ebb in call_init (env=<optimized out>, argv=0x7fffffffdd18, argc=1) at ../csu/libc-start.c:145
 __libc_start_main_impl (main=0x40004dc8 <main>, argc=1, argv=0x7fffffffdd18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fffffffdd08) at ../csu/libc-start.c:379
0x0000000040004285 in _start ()

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
xuxin19
9cbdf69fb0 cmake:refactor cmake binary include_arch dir into include
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
wangjianyu3
6013591cb1 dev_mem: Fix config judgment
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 09:58:55 +08:00
wangjianyu3
3c0befbdbd dev_mem: Add config for segment regions
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 09:58:55 +08:00
wangjianyu3
9553506b1f dev_mem: Fix range and pos of region
Test:
  fastboot oem filedump /dev/mem 0 748544
  fastboot get_staged mem1.txt
  fastboot oem memdump 0x44000000 0xb6c00
  fastboot get_staged mem2.txt
  diff mem1.txt mem2.txt

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 09:58:55 +08:00
Nonpawit Ekburanawat
10ee7ffb46 Add new line to defconfig
Signed-off-by: Nonpawit Ekburanawat <nonpawit.ek@gmail.com>
2024-09-15 09:56:29 +08:00
Nonpawit Ekburanawat
46ef3f4f88 boards/arm/stm32h7/stm32h745i-disco: Add RPTUN support
- Edited linker script for shmem to have condition according to cores selected.
- Added new configuration for nsh_cm7_rptun and nsh_cm4_rptun.
- Appended RPTUN bringup code in stm32_bringup.c

Signed-off-by: Nonpawit Ekburanawat <nonpawit.ek@gmail.com>
2024-09-15 09:56:29 +08:00
p-szafonimateusz
51909ed59f drivers: fix gcc14 errors for PCI
fix gcc14 errors for PCI

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
60b0f44369 boards/x86_64/qemu-intel64: add configs with PCI serial console
add configs with PCI serial console for qemu-intel64 so we can run NuttX on bare
metal Intel HW with serial port card

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
2890232f3d arch/intel64: add support for PCI serial
intel64 can work with PCI serial cards now

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
8ab0785d71 drivers: add UART 16550 compatible PCI device support
add support for UART 16550 compatible PCI device.
For now we support qemu serial PCI devices and AX99100 based cards.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
ceb2921d79 drivers: prepare 16550 UART driver to support PCI
prepare 16550 UART driver to support PCI:

- [breaking change] change argument of uart_ioctl() from `struct file *filep` to `FAR struct u16550_s *priv`
  Also fix moxart_16550.c build related to this change

- [breaking change] change argument of uart_getreg() and uart_putreg from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`
  Also fix arch/x86/src/qemu/qemu_serial.c and arch/x86_64/src/intel64/intel64_serial.c related to this change

- [breaking change] change argument of uart_dmachan() from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`

- move `struct u16550_s` to public header

- generalize UART_XXX_OFFSET so we can use it with any register increment

- make u16550_bind(), u16550_interrupt(), u16550_interrupt() public

- remove arch/or1k/src/common/or1k_uart.c and use common 16550 MIMO interfacve

- change irq type in `struct u16550_s` from uint8_t to int to match MSI API

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
c7e8fd43a4 drivers/uart_16550: configure MCR_OUT2 bit from Kconfig
move MCR_OUT2 configuration from qemu-intel64/src/qemu_boot.c to common code
also leave this option disabled for qemu-intel64 as it's not required

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
a0e00b993a intel64: register PCI controller early but postpone PCI drivers init
Some of PCI drivers require OS interfaces that can't be executed in the INIT context.
In that case we have to postpone PCI drivers probing and call it for example
in board initialization logic.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz
393ed71d81 pci_drivers.c: initialize ret to avoid compiler warnings
initialize ret to avoid compiler warnings in pci_drivers.c

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
Xiang Xiao
1d586c3bee pci: Add driver_data to pci_device_id_s
so driver writer could save the private data here
and get it back in the probe function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-15 03:37:58 +08:00
wangyongrong
639843ade3 virtio-pci: fix set virtio device features error
Should assgin back the feature to the vdev->features

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-15 02:22:16 +08:00
wangyongrong
b0d70b76cb virtio-pci.c: polling mode support
1. Some platforms do not support interrupt mode (PCI_MSI/MSIX),
so add polling mode support, so these platforms can also use virtio-pci;
2. In some cases, we do not want to use the interrupt for virtio driver
to avoid time jitter, so add the polling mode support;
3. If CONFIG_DRIVERS_VIRTIO_PCI_POLLING_PERIOD <= 0, interrupt mode.
   if CONFIG_DRIVERS_VIRTIO_PCI_POLLING_PERIOD > 0, polling mode.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-15 02:22:16 +08:00
wangyongrong
ee6bc2e7df virtio-pci: extract common part of virtio pci modern and leagcy
Extrace common part of virtio pci modern and legacy to virtio-pci to
reduce the duplicated code.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-15 02:22:16 +08:00
wangyongrong
d54d07b62c virtio-pci: add virtio pci legacy support
Follow the virtio spec, support the virtio pci Legacy

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
Signed-off-by: andi <andi6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-15 02:22:16 +08:00
wangyongrong
decfc9ad65 virtio-pci-modern: replace pci_read/write_mmio_xxx with pci_read/write_io_xxx
Use IO api to access the io region

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-15 02:22:16 +08:00
wangyongrong
877e462990 vitrio-pci.c: add virtio-pci transport support for Nuttx
1. only support pci modern device;
2. need the pci controller support MSI/MSI-X;
It has been verified based on virtio-rng and virtio-net.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-15 02:22:16 +08:00
ligd
fab9369093 poll: fix thread_cancel() caused poll used after free
pthread 0          pthread1
fd 0
poll_setup
wait
                   cancel(thread 0)
                   fd 0 close
                   fd 0 notify (sem used after free)
poll_teardown

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 20:15:12 +08:00
ligd
ff1b54bff3 pthread_cleanup: move clenup down to tls
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 20:15:12 +08:00
yintao
38af7001b6 drivers/rpmsg: fix the race condtion about rpmsg_device_created
xxx_rpmsg_device_created may be called repeatedly.

rptun thread				app thread

rptun_dev_start				xxx_rpmsg_init

...					rpmsg_register_callback
priv->...= rpmsg_ns_unbind;
priv->..= rptun_notify_wait;
					if (ns_unbind_cb)
(switch app thread)				device_created()
						xxx_rpmsg_device_created

					metal_list_add_tail(g_cb);
...
rpmsg_device_created();
	cb->device_created
	xxx_rpmsg_device_created;

Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-14 17:34:52 +08:00
wangyongrong
00b6495419 rpmsg/CMakeLists.txt: add rpmsg_virtio_ivshmem.c in this file
rpmsg_virtio_ivshmem support Cmake compile too

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-14 17:34:52 +08:00