Commit Graph

52165 Commits

Author SHA1 Message Date
wangyongrong 5a39935d4f rpmsgmtd: use fixed length struct to transfer between two cpus
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-11 08:33:15 +01:00
Yanfeng Liu da365c1cb0 risc-v/canmv230: enable fully linked apps for kernel build
Previously apps in kernel build are partially linked, thus are
big and inefficient. This enables full link for kernel mode apps
to reduce size and speed up loading.

Changes:

- arch/risc-v/Kconfig          select HAVE_ELF_EXECUTABLE for K230
- boards/../scripts/Make.defs  adjust LDELFLAGS
- boards/../knsh/defconfig     enable BINFMT_ELF_EXECUTABLE

Additions:
- boards/../scripts/gnu-elf.ld apps linker script

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-10 23:27:46 -03:00
chenwen@espressif.com a774587088 esp32s3/rt_timer: Adjust spinlock position to avoid deadlock 2024-01-11 09:22:52 +09:00
Tiago Medicci Serrano f4485a58e3 esp32s3_devkit/sta_softap: Reenable SMP on `defconfig`.
This reverts commit e25fcb3bd5.
The issue - related to a deadlock in the RT-Timer - was properly
solved.
2024-01-11 09:22:52 +09:00
Tiago Medicci Serrano 823a183c17 esp32s3/rt_timer: Fix deadlock on RT-Timer thread.
The RT-Timer thread may call the `start_rt_timer` function. This
function gets the spinlock with interrupts disabled to ensure
exclusive access. However, this was already being performed in the
RT-Timer thread, causing a deadlock.
2024-01-11 09:22:52 +09:00
Roy Feng 4761af7069 esp32[s2|s3] Following up update interrupt type constants.
Following up the 'Espressif HAL fullly integration for ESP32s2/s3'
changes in https://github.com/apache/nuttx/pull/11428
There are few missing interrupt type constants need update. So
update them to avoid the build error.
2024-01-10 09:54:55 -08:00
zhanghongyu b3dcebce07 linux/Dockerfile: Add the python3 coloredlogs package for the matter build
Depend on this package when we compile using the build_examples.py script that comes with matter.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-01-10 09:47:54 -08:00
fangxinyong f2bcb0d2d8 tools/ci: revert tmp change
for apache/nuttx#11498 to pass ci, need revert after all commits are merged

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-01-10 01:58:53 -08:00
fangxinyong c479ccb8aa sched: move etc romfs mount from nsh to sched/init
Usually the startup script is placed under /etc. The contents of the etc directory
are compiled and linked with Nuttx binary in the form of romfs. After startup,
it will be  mounted by Nsh.

etc is generated by the different boards, that use genromfs and xxd tools to generate
and compile it into the Nuttx, for example: boards/arm/at32/at32f437-mini/tool/mkromfs.sh
The more common method is etc image generated from the content in the corresponding
board/arch/board/board/src/etc directory, and added by Makefile for example:
boards/sim/sim/sim/src/etc.

But in kernel/protected mode, Nuttx kernel and apps are run in different privileged/
non-privileged mode or the isolated binarys, so as that nsh should use syscall to
access Nuttx kernel by exported API. In this scenario, nsh can not mount the etc image
content, because that is generated in board and as a part of Nuttx kernel.

changes:

- move etc romfs mount from nsh to Nuttx, but keep the script to parse and execute.
- move and rename the related CONFIG, move customized nsh_romfsimg.h to etc_romfs.c
  in boards, and no need declaration for romfs_img/romfs_img_len.

This commit changes and updates all configurations in Nuttx arch/board as much as possible,
but if any missing, please refer to the following simple guide:

- rename CONFIG_NSH_ROMFSETC to CONFIG_ETC_ROMFS, and delete CONFIG_NSH_ARCHROMFS in defconfig
- rename the etc romfs mount configs, for example CONFIG_NSH_FATDEVNO to CONFIG_ETC_FATDEVNO
- move customized nsh_romfsimg.h to etc_romfs.c in board/arch/board/board/src and no need
  declaration for romfs_img/romfs_img_len.
- delete default nsh_romfsimg.h, if ROMFSETC is enabled, should generate and compile etc_romfs.c
  in board/arch/board/board/src.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-01-09 21:29:46 -03:00
wangyongrong 62698051c7 rptun ping: fix data format warning
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-09 06:06:40 -08:00
wangyongrong 661171661f rptun ping: fix code format in rptun ping
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-09 06:06:40 -08:00
wyr8899 df09e40e3a rptun ping: support data checksum and data transfer rate calculation
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-09 06:06:40 -08:00
Zhe Weng 3b74cfecc2 net/route: Support longest prefix match for routing
Support longest prefix match routing described as "Longest Match" in
RFC 1812, Section 5.2.4.3, Page 75.

Introduced `prefixlen` to indicate the prefix length of currently
founded route, and only looks up for longer prefix in all later steps.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-09 05:58:10 -08:00
Zhe Weng 54f3452293 net/route: Fix null pointer access when ramroute is full
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-09 05:58:10 -08:00
Zhe Weng 688f0e9117 net: Only call arp_send for PF_INET and icmpv6_neighbor for PF_INET6
If we only enable one of `CONFIG_NET_ARP_SEND` and
`CONFIG_NET_ICMPv6_NEIGHBOR`, both IPv4 and IPv6 traffic will send
ARP or NDP, which causes problem.

Example:
`CONFIG_NET_ARP_SEND=n`
`CONFIG_NET_ICMPv6_NEIGHBOR=y`

Wrong:
IPv4 traffic (`PF_INET`) goes into `icmpv6_neighbor`, which
definitely causes problem.

Correct:
IPv4 traffic doesn't call anything, IPv6 traffic calls `icmpv6_neighbor`

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-09 05:56:28 -08:00
simbit18 eaf1d07809 tools/ci: add initial support for MSYS2
removed uname from msys2 job
2024-01-09 05:50:09 -08:00
wangyongrong 540e7f475f rpmsgfs: synchronous message transfer format
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-09 05:49:03 -08:00
Philippe Leduc e59c95bc9b Fix mx8mp ecspi interruption management. 2024-01-09 05:48:12 -08:00
Alin Jerpelea c04118309c Documentation: add NuttX-12.4.0 release notes
Add release notes for 12.4.0 release

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-01-09 05:47:24 -08:00
simbit18 39e01289b6 .gitignore: Added ignore file .fakelnk
Added ignore file .fakelnk for make distclean in MSYS2
2024-01-08 17:38:27 -08:00
simbit18 8b0bc64903 tools/link.sh: fix an incorrect variable
fix ${desg} ->  ${dest}
2024-01-08 19:46:59 -03:00
Yanfeng Liu dd1365ef85 risc-v/canmv230: add PROTECTED build support
Additions:

- In arch/risc-v/src/k230/
  - k230_userspace.c      add user space initialization
  - k230_userspace.h      headers for user space initialization
- In boards/risc-v/k230/canmv230/kernel/
  - k230_userspace.c      userspace_s const data definition
  - Makefile              pass1 Makefile
- In boards/risc-v/k230/canmv230/scripts/
  - ld-protected.script   linker script for protected build kernel
  - ld-userland.script    linker script for protected build userspace
- In boards/risc-v/k230/canmv230/configs
  - pnsh/defconfig        defconfig for protected build

Changes:

- In arch/risc-v/src/k230/
  - k230_start.c          add protected build handling logic
  - Make.defs             add protected build support
- In boards/risc-v/k230/canmv230/scripts/
  - Make.defs             add protected build support
- In Documentation/platforms/risc-v/k230/boards/canmv230/
  - index.rst             add protected build usage

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-08 19:46:42 -03:00
Bowen Wang 514f020ace nucleo-h745zi/stm32_bringup.c: the cpuname should be the remote cpu name
The share memory name should be same, and the cpuname is the remote
cpu name.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-08 19:53:54 +01:00
Rodrigo Sim 21b02f176f stm32f401rc-rs485: Add rs-485 support 2024-01-07 17:15:59 -08:00
Rodrigo Sim 7b9b630073 nucleo-l432kc: Fix board configuration for USART2 2024-01-07 17:12:15 -08:00
Yanfeng Liu b516b29efc risc-v/k230: revise CanMV230 kernel build support
changes:
- under boards/risc-v/k230/canmv230/scripts/:
  - Make.defs           add POSTBUILD actions
  - ld-flat.script      minor reformating
  - ld-kernel.script    minor reformating
- under boards/risc-v/k230/canmv230/src/:
  - Makefile            add clean of generated ROMFS source
  - canmv_init.c        use `ferr` and drop too late runtime warning
  - romfs_stub.c        use const for romfs_img_len

The POSTBULD actions can warn stub ROMFS usage at build time, thus
the too late warning in canmv_init.c can be removed.
The cleaning of `libboard.a` in POSTBUILD can also ensure real ROMFS
is in use, as some times weak_data is still in use.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-07 06:40:10 -08:00
David Sidrane 73bfeccc3f imxrt:ENET Use multi PHY
Allow a board to specify a list of PHYs.
  Then use this list, at run-time, to select and use the
  PHY populated on the board.
2024-01-06 04:26:12 -08:00
David Sidrane 93f37ab1da net:Add support for multi PHY
Support runtime phy selection based on a list
   supplied by board.h
   For Example:

   #define BOARD_ETH0_PHY_LIST                   \
	{                                        \
		"LAN8742A",                      \
		MII_PHYID1_LAN8742A,             \
		MII_PHYID2_LAN8742A,             \
		MII_LAN8740_SCSR,                \
		0,                               \
		0xffff,                          \
		MII_LAN8720_SPSCR_10MBPS,        \
		MII_LAN8720_SPSCR_100MBPS,       \
		MII_LAN8720_SPSCR_DUPLEX,        \
		22,                              \
	},                                       \
	{                                        \
		"TJA1103",                       \
		MII_PHYID1_TJA1103,              \
		MII_PHYID2_TJA1103,              \
		0xffff,                          \
		18,                              \
		0xffff,                          \
		0,                               \
		MII_LAN8720_SPSCR_100MBPS,       \
		MII_LAN8720_SPSCR_DUPLEX,        \
		45,                              \
	},                                       \
2024-01-06 04:26:12 -08:00
Bowen Wang e9a146bbfc virtio-mmio: use byte to byte in read/write config when length != 1,2,4,8
The length of some config elements are not equal to 1,2,4,8, so we can't
assert in virtio_mmio_config_read/write() direclty when length != 1,2,4,8

For example, in virtio_net_config from virtio spec v1.2
struct virtio_net_config {
	u8 mac[6];
	le16 status;
	le16 max_virtqueue_pairs;
	le16 mtu;
	le32 speed;
	u8 duplex;
	u8 rss_max_key_size;
	le16 rss_max_indirection_table_length;
	le32 supported_hash_types;
};

The mac length is 6 and not equal to 1,2,4,8

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-06 04:23:05 -08:00
YAMAMOTO Takashi d0335f089f cmake: fix CONFIG_HAVE_CXXINITIALIZE on macOS
Note: This implementation is a bit more relaxed than what we do for
non-cmake builds. Mainly because I'm not familiar enough with cmake
to mirror what the non-cmake version does.
2024-01-06 04:21:52 -08:00
YAMAMOTO Takashi 32ea2914c0 cmake: use -fvisibility=default for "arch"
so that macos build can find "_sim_netdriver_setmacaddr" etc.
2024-01-06 04:21:52 -08:00
YAMAMOTO Takashi 6eb7aa04bd cmake: use -fvisibility=default for sim_head
So that macos build can find _main and _sim_doirq.
2024-01-06 04:21:52 -08:00
YAMAMOTO Takashi 595a0aa5fb cmake: Use CMAKE_LINKER to link nuttx.rel for macOS
Otherwise, it produces a lot of warnings like:
```
ld: warning: object file (/Users/yamamoto/git/nuttx/nuttx/build/libs/libxx/liblibcxx.a(d2s.cpp.o)) was built for newer macOS version (12.7) than being linked (12.0)
```
2024-01-06 04:21:52 -08:00
YAMAMOTO Takashi e0c4e292bf cmake: do not run objcopy for macOS
The mach-o support of objcopy is fragile at best and often results
in a broken output. It's better not to rely on it.
This matches what the non-cmake version does.
2024-01-06 04:21:52 -08:00
Zhe Weng 1adfc1ae79 net/can: Release IOB when failed to queue in datahandler
If we just clear the IOB when failed to queue, we'll leak it.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-06 04:20:36 -08:00
Yanfeng Liu af15cd40aa risc-v/litex: fix typo in litex/irq.h
Current LITEX_LAST_IRQ looks like a typo that blocks compilation of
`arty_a7/knsh` configuration.

This fixes the build  but I have no such device for test.
Found it was LITEX_IRQ_LAST before commit #ee84ea3 so likely typo was
introduced by then.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-06 04:15:52 -08:00
Ville Juven 14b6f31c8c mpfs_mpu: Add driver to set MPUCFG registers
MPUCFG registers are used to enforce memory protection for DMA master
devices.
2024-01-06 04:15:22 -08:00
Yanfeng Liu 207efa047b risc-v/rv-virt: revise mstatus operations
- drop set of SUM as it is done in  riscv_set_idleintctx()
- fix the CLEAR_CSR() before setting MPP field

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-06 04:04:33 -08:00
TimJTi 438439c1a6 SAMA5 - add LCD backlight PWM cLock source selection 2024-01-05 12:56:27 -03:00
Bowen Wang 3bac449286 assert: fix flags type, should be irqstate_t
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 22:16:54 -08:00
Bowen Wang fe0cd18cc5 rpmsgdev_server: do not notify the client when the fds has teardown
Donothing instead assert when poll notify is called after teardown.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:30:49 -08:00
Bowen Wang df3f95ee1f armv7a/qemu: add QEMU_TRUSTZONE config and default n
Add ARCH_CHIP_QEMU_TRUSTZONE to enable/disable the TrustZone
support beacause qemu also support enable/disable Arm Security
Extensions: https://qemu-project.gitlab.io/qemu/system/arm/virt.html
when launch.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:29:06 -08:00
Bowen Wang a8d21c3876 virtio-mmio: avoid output error log when not found mmio device
Not found the mmio device is a normal case, so should not print the
error log.
This commit change the log level to info when not found the mmio
device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:28:21 -08:00
Bowen Wang e2cf0cad39 rpmsg_sockif: recv/recvmsg return 0 when peer close
Follow the posix standard:
If no messages are available to be received and the peer has
performed an orderly shutdown, recv() shall return 0.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:07:43 -08:00
Bowen Wang 7a9aa9539c local_sendmsg: fix peer->lc_cfps[] array out-of-range write
When peer->lc_cfpcount == LOCAL_NCONTROLFDS,
Line 122: peer->lc_cfps[peer->lc_cfpcount++] = filep2; access
out-of-range

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:07:06 -08:00
Bowen Wang ce16288494 qemu_bringup: add tmppfs mount for qemu-armv8a
tmpfs can be used for the rpmsgfs test after the qemu rptun driver
added.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:06:11 -08:00
Bowen Wang 409431b2ad virtio-mmio: ack the interrupt as soon as possible
Follow the linux does, avoid miss mmio interrupt

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:05:29 -08:00
TimJTi 222ca5b040 Add MTD for AT25 eeprom 2024-01-04 09:25:52 -08:00
yinshengkai 97096bed83 libs: fix the problem that the address obtained in thumb mode cannot be executed.
The lowest bit of the thumb instruction is 1 by default, which is used to distinguish arm instructions and thumb instructions.
Fixed the problem of misalignment of symbol table when performing binary search

In arm, the lowest bit of the instruction is 1, which is a thumb instruction, and 0, which is an arm instruction.
The nm command was used in mkallsym.sh before, and the result it will return will set the lowest bit of the thumb instruction to 0. There will be a one-byte deviation during binary search, so mkallsyms.py will also set the lowest bit to 0 according to the previous format.
```sh
arm-none-eabi-nm -Cn nuttx | grep hello
0801c384 T hello_main
arm-none-eabi-objdump nuttx -t |grep hello
0801c384 g F .text 0000004c hello_main
arm-none-eabi-readelf nuttx -s |grep hello
4558: 0801c385 76 FUNC GLOBAL DEFAULT 1 hello_main
```

However, in the following case, when you need to find the function address according to the symbol name and execute the corresponding function, the lowest address obtained is 0. It will follow the arm instruction, causing an exception.
```c
void sym_test(void)
{
   printf("call sym_test\n");
}

int main(int argc, FAR char *argv[])
{
   FAR void *addr = sym_test;
   printf("sym_test:%p %pS\n",addr, addr);
   printf("sym_test - 1: %pS\n", (char *)addr - 1);
   printf("sym_test + 1: %pS\n", (char *)addr + 1);

   size_t size;
   void (*func)(void);
   const struct symtab_s *sym = allsyms_findbyname("sym_test", &size);
   printf("sym_test:%p %pS\n",sym, sym);
   func = sym->sym_value;
   func();

   return 0;
}
```

Therefore, you need to change mkallsyms.py back to the correct result and correct the binary search.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-01-04 09:22:57 -08:00
yinshengkai 9d436b624b tools: support sorting symbol tables by name
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-01-04 09:22:57 -08:00