Commit Graph

52080 Commits

Author SHA1 Message Date
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
xuxin19 524425573e CMake:init arm64 CMake qemu-armv8a build
this patch contains arm64 Toolchain, arch common, qemu board and arm64 libc modifications.
support using CMake to compile the qemu executable file.

```
 cmake -B build -DBOARD_CONFIG=qemu-armv8a:nsh -GNinja
 cmake --build build -t menuconfig
 cmake --build build
 qemu-system-aarch64 -cpu cortex-a53 -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: xuxin19 <xuxin19@xiaomi.com>
2023-12-27 07:27:17 -08:00
zhanghongyu e1a1f7b5f4 net/udp: set ipv6 remote addr before udpip_hdrsize
In this case, remote addr is all zero, and the length of the
ip header is not recognized as ipv6_is_ipv4, This will cause
problems in subsequent data filling.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-27 12:24:59 +01:00
yinshengkai 9852428953 fs: procfs add poll support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 19:23:13 -08:00
yinshengkai ca99e69c28 fs: update hostfs structure definition
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 17:41:12 -08:00
yinshengkai 9b10255088 fs: fix structure layout inconsistency in hostfs
Use the following command to view the structure layout:
pahole nuttx > struct_size.h

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 17:41:12 -08:00
Takumi Ando dde0872b63 fs: smartfs: Add necessary aligned access in smartfs_rename()
smartfs_rename() was stuck on the boards they need
CONFIG_SMARTFS_ALIGNED_ACCESS.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-12-25 23:41:25 -08:00
YAMAMOTO Takashi 992719730f Fix hostfs after uid/gid changes
This fixes a regression in https://github.com/apache/nuttx/pull/10869
2023-12-25 19:40:47 -08:00
zhanghongyu d50b1778f7 net/local: make the call return of each process consistent with linux
move the accept logic into connect flow.

In order to successfully establish a blocking connection between
the client and server on the same thread.

nonblock is not affected, and the block connect is now the same
as the nonblock flow, other apis are not affected.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-25 16:53:46 -08:00
yinshengkai 81fccf96db libc/stream: add file out stream
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-25 16:54:16 -03:00
yinshengkai 0c95bf73dc libc/stream: provide lowerout_stream default initialization function
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-25 16:54:16 -03:00
Tiago Medicci Serrano b58cd6ad34 risc-v/espressif: Update HAL version
This update has no impact on devices. The update aims to update all
HAL-based devices to the same version.
2023-12-24 16:38:06 -08:00
Tiago Medicci Serrano 47e71fc449 esp32s2/rmt: Use the Espressif's common RMT driver.
This commit use the new common RMT driver for all Espressif's
xtensa-based chips on ESP32-S2.
2023-12-24 16:38:06 -08:00