Commit Graph

52092 Commits

Author SHA1 Message Date
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
Lee Lup Yuen
31ef9cd13c risc-v/bl808: Implement Timer with OpenSBI
The implementation of the RISC-V Timer for BL808 SoC is incomplete. This PR implements the BL808 RISC-V Timer by calling OpenSBI. The code is derived from NuttX for RISC-V QEMU.

The implementation of `up_timer_initialize` with OpenSBI is explained in this article: https://lupyuen.github.io/articles/nim#appendix-opensbi-timer-for-nuttx
2024-01-04 16:27:37 +01:00
YAMAMOTO Takashi
fc53497ea2 arch/arm/src/cmake/Toolchain.cmake: fix inverted conditions for C++ features
Fix inverted CONFIG_CXX_EXCEPTION/CONFIG_CXX_RTTI checks.
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi
05b8655bdd arch/sim/src/cmake/Toolchain.cmake: fix inverted conditions for C++ features
Fix inverted CONFIG_CXX_EXCEPTION/CONFIG_CXX_RTTI checks.
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi
7d6612d0e5 libcxxabi.cmake: fix build error
This tries to mirror the following change.
```
commit c260fee516
Author: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Date:   Tue Aug 31 14:47:13 2021 -0300

    libs/libxx: Enforce RTTI for building libcxxabi

    It is okay for the application to be built without RTTI (-fno-rrti), but
    libcxxabi requires RTTI at least for the library.

    Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
```
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi
bb053f137d libcxxabi.cmake: remove a patch which no longer exists
the patch has been removed in the following change.
```
commit 4f90a6140c
Author: Stuart Ianna <stuart.ianna@motec.com.au>
Date:   Mon Jan 23 09:08:00 2023 +1100

    libcxx: Remove exiting patches and update libcxx version to 15.0.7

     - Add __config_site for NuttX.
       In libcxx 12.0.0. CMake concatenated __config_site with _config,
       which enabled NuttX to build without its inclusion. In 15.0.7, this
       file is configured by CMake and included explicitly in __config.
     - Add additional include directories.
     - Mute always_inline warning.
     - Make the download of libcxx/libcxxabi configurable
```
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi
23db901bb3 libcxxabi.cmake: fix download
don't forget to expand CONFIG_LIBCXXABI_VERSION
2024-01-04 07:20:04 -08:00
Peter van der Perk
40f4cde8f5 armv7-m: Expose section name to allow relocation 2024-01-04 15:07:18 +01:00
YAMAMOTO Takashi
3e4bc9bcef libcxx.defs: appease "expr: syntax error" messages with clang 2024-01-04 13:01:42 +01:00
Yanfeng Liu
31f9dcdaa4 risc-v/k230: revise canmv230 docmentations
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-01 04:01:28 -08:00
Yanfeng Liu
7cb8e590a1 risc-v/k230: kernel build for CanMV-K230 board
Changes:

- Documentation/platforms/risc-v/k230  revised for both modes
- arch/risc-v/include/k230/irq.h       add S-mode IRQs
- under arch/risc-v/src/k230 folder:
  - Make.defs                          drop use of k230_exception_m.S
  - hardware/k230_clint.h              add S-mode defs, revised freq
  - k230_head.S                        unified flat/kernel mode support
  - k230_irq.c                         add S-mode support with debug dump
  - k230_mm_init.c                     revised for K230 S-mode
  - k230_start.c                       revised for flat/s-mode,
- arch/risc-v/src/k230/k230_timerisr.c unified flat/s-mode support.
- under boards/risc-v/k230/canmv230 folder:
  - configs/nsh/defconfig              fix RAM size
  - include/board_memorymap.h          cleanup for S-mode
  - src/.gitignore                     ignore romfs_boot.c
  - src/Makefile                       add romfs support

Renames:

- under boards/risc-v/k230/canmv230/src/ folder:
  - canmv_init.c from k230_appinit.c   making room for more k230 devices

Dropped:

- under arch/risc-v/src/k230/
  - k230_exception_m.S                 as hybrid mode not ready yet.

New files in boards/riscv/k230/canmv230:

- configs/knsh/defconfig                S-mode config
- scripts/ld-kernel.script              S-mode linker script
- src/romfs.h                           User space ROMFS defs needed in S-mode
- src/romfs_stub.c                      Stub ROMFS image

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-31 07:26:45 -08:00
Yanfeng Liu
0ef16794eb arch/risc-v: fix a few typos in comments
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-31 07:25:51 -08:00
YAMAMOTO Takashi
c1c723b162 sim: add assertions on hostfs copy of structures
hostfs has its copies of some of nuttx definitions with different
names to avoid conflicting with the host OS definitions.
sometimes people only modifies one of them and forgets updating
another. eg. https://github.com/apache/nuttx/pull/11445
this commit introduces some assertions to detect that kind of
mistakes.
2023-12-30 19:02:03 -08:00
YAMAMOTO Takashi
1ec63e1701 make 64-bit time_t back to unsigned
it has been changed by https://github.com/apache/nuttx/pull/10303
without any explicit mentions. i suppose it was a mistake.

see https://github.com/apache/nuttx/pull/8201 and referenced PRs
for previous discussions.
2023-12-30 08:48:43 -08:00
Yanfeng Liu
9b439a5c72 add missing dependency to MM_KMAP for ARCH_KMAP_VBASE
This is to align with ARCH_KMAP_VBASE by source codes.
It also fixes fake warnings from `tools/refresh.sh`.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-29 17:04:18 -03:00
Yanfeng Liu
675f775494 log messages of binfmt are very much.
this is to adjust levels of a few of them based on debugging
experiences. These non-critical logs were marked as errors. So we
likely can adjust them as warnings so that real errors can
stand out easily.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2023-12-29 17:36:47 +08:00
YAMAMOTO Takashi
f7fb816235 sim: make the cmake version of hostfs build similar to the Makefile one 2023-12-29 08:23:03 +08:00
xuxin19
1768e7868b tools/Unix.mk:change incdir to a Make target
after the CI environment is upgraded to Ubuntu 22 and GNU make is upgraded to 4.3,
`warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.` warning appears.
this because when executing a shell in Make, the new shell created will not inherit the parallel environment of the parent shell(jobserver).

in our case:
```
$ make olddefconfig

this execute into Unix.mk twice,
because it will call make clean_context in its target

olddefconfig:
	$(Q) $(MAKE) clean_context
```
We replace the shell call with the target of the Makefile

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-12-28 10:56:01 -08:00
Xiang Xiao
087c519dd6 arch/armv7-a: Change space to tab in arm_smccc.S
follow the coding style from other assembler source files

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-28 11:09:09 +08:00
Xiang Xiao
770d579630 arch/arm: Move arm_vectoraddrexcptn into arm_vectors.S
and remove arm_vectoraddrexcptn.S like other exception handler

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-28 11:09:09 +08:00
Xiang Xiao
b9bd88d9d3 rptun: Select OPENMAP under RPTUN
to simplify the IPC related configuration

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-28 11:08:57 +08:00
zhanghongyu
009a1eba7c bcmf_driver: add ioctl_mutex to restrict ioctl from reentrant
avoiding resource race conditions

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-27 10:20:37 -08:00
YAMAMOTO Takashi
518f130ad3 arch/sim/src/sim/CMakeLists.txt: update a few file names 2023-12-27 10:10:52 -08:00
xuxin19
7207e5d1e9 tools/ci:enable arm64 CMake ci build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-12-27 07:27:17 -08:00