Commit Graph

120 Commits

Author SHA1 Message Date
ligd ff1b54bff3 pthread_cleanup: move clenup down to tls
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 20:15:12 +08:00
yinshengkai cec3b5c0fb boards: Add TLS_NELEM dependency to libcxxabi
Refresh all defconfig

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-06 09:52:33 +08:00
Matheus Catarino 1936e68f40 risc-v/qemu-rv: Add Build Config for leds64_zig
This PR adds a new Build Config `rv-virt:leds64_zig` that builds the Zig App `leds_zig` for QEMU RISC-V 64-bit.
ref.: https://github.com/apache/nuttx-apps/pull/2534
2024-09-05 11:28:12 +08:00
guoshichao 4c01594d5b nuttx: remove the unnecessary -pipe build option
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-31 10:22:20 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Yanfeng Liu b9fde453ce riscv/qemu-rv: add RPTUN support
This adds initial RPTUN support for qemu-rv and rv-virt device.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-18 19:55:27 +08:00
Yanfeng Liu 83932d115b boards/rv-virt: unify rv32 config names
This renames a few RV32 configs to follow the convention that names w/o
numbers are for RV32, so that to be in line with majority RV32 configs.

As a result, we have:  `nsh` vs `nsh64`, `knsh` vs `knsh64`, `pnsh`
vs `pnsh64`,`flats` vs `flats64`, `nsbi` vs `nsbi64`, `libcxx` vs
`libcxx64` etc. This helps us pick the right config name w/o checking
file contents.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-09 23:44:40 +08:00
Yanfeng Liu 46f4a24d59 riscv/qemu: add CMake for PROTECTED
This adds CMake support for PROTECTED build mode on rv-virt target.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-09 23:43:31 +08:00
Yanfeng Liu 34a30e577e riscv/qemu: add CMake for NuttSBI
This allows building NuttSBI based kernel image with CMake so that
to support out-of-tree building.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-09 23:43:31 +08:00
Lup Yuen Lee 3862b71728 risc-v/qemu-rv: Add Build Config for leds64_rust
This PR adds a new Build Config `rv-virt:leds64_rust` that builds the Rust App `leds_rust` for QEMU RISC-V 64-bit. The build requires the [Rust Target `riscv64gc-unknown-none-elf`](https://github.com/apache/nuttx/pull/12858):

```bash
rustup target add riscv64gc-unknown-none-elf
```

New Files:

`boards/risc-v/qemu-rv/rv-virt/configs/leds64_rust/defconfig`: Add new Build Config `rv-virt:leds64_rust`

Updated Docs:

`applications/examples/leds_rust/index.rst`: Add `leds_rust` example app

`platforms/risc-v/qemu-rv/boards/rv-virt/index.rst`: Add `rv-virt:leds64_rust` config
2024-08-08 12:19:25 +08:00
Ville Juven 2eb26d04f4 rv-virt/pnsh: Refresh PROTECTED mode configs 2024-08-07 02:41:14 +08:00
Yanfeng Liu 5848a8e77c riscv/qemu-rv: revise PROTECTED mode
This revises PROTECTED build for qemu-rv mainly to avoid hard-coded
addresses in linker scripts. It also added rv32 support, cleaned up
config `pnsh64` and added config `pnsh`.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-04 11:09:26 +08:00
Ville Juven 1f928b2338 qemu-rv: Add test target pnsh64 for BUILD_PROTECTED
This adds BUILD_PROTECTED target for rv-virt (rv-virt:pnsh64).
2024-08-02 20:29:11 +08:00
Yanfeng Liu 918ad10859 riscv/qemu: add NuttSBI support
This adds NuttSBI support for rv-virt device so that to enable CI
checks for NuttSBI later. It allows using `-bios nuttx` option to
run NuttX with QEMU v6.2 w/o OpenSBI.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-01 23:32:01 +08:00
Yanfeng Liu c2132bb88e risc-v/rv-virt: use RAM_START in ld.script
This revises FLAT build ld.script so that to use CONFIG_RAM_START
instead of hard coded address to increase flexibility.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-07-26 10:28:02 +02:00
Yanfeng Liu 4038abd3ab riscv/virt: add virt_nsh with docs
This adds `rv-virt:virt_nsh` config w/ docs for using virtio serial
as NuttX console.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-07-26 12:01:29 +08:00
Yanfeng Liu 4f66b188cd riscv/virt: probe virtio earlier
This allows virtio devices to be probed upon board_early_init, thus
making virito-serial ready earlier for console use.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-07-26 12:01:29 +08:00
Rushabh Gala 76bf6285c1 risc-v/qemu-rv: Add LED Driver for QEMU RISC-V 32-bit and 64-bit
- This PR adds the LED Driver for QEMU RISC-V 32-bit and 64-bit (User LEDs and Auto LEDs)
- QEMU RISC-V LED Driver will be used by the Rust Blinky App for Google Summer of Code
- Blinking the LED is probably the most common Embedded Demo, and now it's supported by QEMU RISC-V
- We added NuttX Configs `rv-virt:leds` and `rv-virt:leds64` to support User LEDs for 32-bit and 64-bit RISC-V
- Turning on/off a Simulated User LED will print a log message: "LED 1 set to 1"
- The code is derived from NuttX PinePhone LED Driver
2024-07-25 17:56:46 -03:00
Alan Carvalho de Assis 82946d0d5f net: Enable ICMP by default if IPv4 is enabled
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2024-07-09 17:08:27 +08:00
Inochi Amaoto 5f1201ede6 boards: rv-virt: Add example S mode flat build config
Add "flats" and "flats64" config to test S mode flat build.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
2024-06-14 19:52:00 +08:00
Inochi Amaoto e37348aeba arch/risc-v: Add support for S-mode flat build
There is no need to use kernel build for S-mode all the time. As cpu
scratch is supported for non kernel mode build, it is possible to use
flat build for S-mode.

Add flat build support for risc-v S mode.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
2024-06-14 19:52:00 +08:00
Ville Juven 74702085f0 defconfigs: Add SCHED_HAVE_PARENT=y to configs with WAITPID && BUILD_KERNEL
The added depencendy broke some of the defconfigs
2024-06-03 18:00:40 +02:00
Yanfeng Liu 3bfdb14f4d ci/riscv: fix rv-virt/kfb64 CI issue
This fixes `Linux(risc-v)` CI issue
`section .data LMA [0000000080200000,000000008020046f] overlaps
 section .text LMA [0000000080200000,000000008021b2f3]`

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-22 16:40:13 +08:00
Inochi Amaoto 44bed119f0 boards: rv-virt: Use config to compute memory layout for kernel build
rv-virt support different size of ksram and pgmem region, but the
fixed value in the link script limits this function. As nuttx supports
preprocessing the link script. It is better to use the config value
to compute the memory layout. This also make all kernel build use the
same script.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
2024-05-20 10:14:14 +08:00
Yanfeng Liu 8eadde89f1 riscv/qemu: enable debug features
This enables debug features in `rv-virt/nsh` and `rv-virt/nsh64` to
help debugging with QEMU targets.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-09 17:31:33 +08:00
Yanfeng Liu ef15b5296d riscv/virt: M-mode poweroff support
This adds poweroff support to `rv-virt/nsh` and `rv-virt/nsh64`.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-08 15:39:26 +08:00
Yanfeng Liu c9a2e4a6c5 risc-v/virt: enable gradeful shutdown in kernel build
This enables graceful shutdown via `poweroff` command in `knsh64`
and `knsh32` configs.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-07 21:02:49 +08:00
Yanfeng Liu 339da96469 risc-v/virt: update `kfb64` config
This updates `rv-virt/kfb64` to support new S-mode in patch 12178

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-05 22:01:26 +08:00
Yanfeng Liu 03446fb4e3 riscv/rv-virt: fix kernel build booting issue
This patch can boot `rv-virt/knsh64` and `rv-virt/knsh32` reported in
issue #12275 with qemu 6.2 target and OpenSBI v1.0 firmware on Ubuntu
22.04 host.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-04 22:46:32 +08:00
Yanfeng Liu 041ef1d9ea video/fb: kernel build framebuffer support
This supports running fb demo app in kernel build with new
config `rv-virt/kfb64`. The demo shows colored rectangles
in graphic window with the following console logs:

```
nsh> cat /proc/version
NuttX version 12.4.0 1ea10ddacc-dirty May  3 2024 07:03:59 rv-virt/kfb64
nsh> fb
VideoInfo:
      fmt: 13
     xres: 640
     yres: 480
  nplanes: 1
PlaneInfo (plane 0):
    fbmem: 0x80218010
    fblen: 1228800
   stride: 2560
  display: 0
      bpp: 32
Mapped FB: 0xc2000010
 0: (  0,  0) (640,480)
 1: ( 58, 43) (524,394)
 2: (116, 86) (408,308)
 3: (174,129) (292,222)
 4: (232,172) (176,136)
 5: (290,215) ( 60, 50)
Test finished
```

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-03 23:58:39 +08:00
Inochi Amaoto 49b3f52db1 arch/riscv/qemu-rv: replace M-mode init code with SBI in kernel build
The qemu-rv use a small init code for M mode in kernel build.
It is hard-coding and is difficult to change. Due to the fact,
introduce a already mature SBI implement (e.g OpenSBI) to
replace existing code is a better choice.

This patch introduce some change for qemu-rv:
1. use SSTC to provide time interrupt in kernel build
2. remove uncessary M mode trap.

For simplicity, this patch does not add support for booting
nuttx for any core, but force boot core to start core 0 and
let core 0 do the initialization.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
2024-04-27 22:09:22 -03:00
Inochi Amaoto a33313413d arch/risc-v: introduce dynamic stack allocation.
It is misleading to allocate stack from static array and heap,
make all stack allocated from heap area.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
2024-04-27 22:09:22 -03:00
chao an 28044f7d5a arch/risc-v: add support of save/restore vector registers
Reference:
https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc
https://github.com/torvalds/linux/blob/master/arch/riscv/include/asm/vector.h

Signed-off-by: chao an <anchao@lixiang.com>
2024-04-23 16:18:46 -03:00
Yanfeng Liu 7a9690dee7 rv-virt/knsh32: enable debugging options
This enables debugging options for `rv-virt/knsh32` as it is more
convenient for debugging and testing.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-04-16 19:09:31 +08:00
vela-mib 9847c6219d add libuv and cmocka test cases with file system on sim and qemu on CI
Signed-off-by: vela-mib <vela-mib@xiaomi.com>
2024-04-10 14:46:53 +08:00
W-M-R 0ede3fc377 kasan: Implementing global variable out of bounds detection
Extracting global variable information using scripts:
kasan_global.py:
1. Extract the global variable information provided by the -- param asan globals=1 option
2. Generate shadow regions for global variable out of bounds detection
Makefile:
1. Implement multiple links, embed the shadow area into the program, and call it by the Kasan module

Signed-off-by: W-M-R <mike_0528@163.com>
2024-04-07 23:31:13 +08:00
Alan Carvalho de Assis 46b1eb44b6 boards: Fix board configs after disabling NSH_DISABLE_HELP 2024-04-04 12:27:03 +08:00
vela-mib 8ff3b90742 add open posix test cases on qemu and sim on CI
Signed-off-by: vela-mib <vela-mib@xiaomi.com>
2024-03-21 18:42:47 +08:00
Tiago Medicci Serrano c67502d9b4 riscv: Implement page-fault exception and on-demand paging
When an application is being loaded `up_addrenv_create ` calls
`create_region` to create the address environment. Only the first
entry is mapped when the region is created. Virtual memory that is
not mapped will trigger an exception when accessed. Other memory
pages are allocated and mapped on-demand. This enables setting
larger heap and stack for the process without compromising the
overall system memory.
2024-03-05 09:45:49 +08:00
Huang Qi 561378ba6b rv-virt: Add libcxx to configs
Basic configs for libcxx and cxxtest on rv32/rv64.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-02-27 21:25:20 +08:00
Huang Qi fdaacb9408 rv-virt: Add .init_section to linker script
Provide _sinit/_einit to make it possible to enable
libcxx on rv-virt platform.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-02-27 21:25:20 +08:00
Tiago Medicci Serrano cb32e6d50a risc-v/qemu-rv/rv-virt: Add support to loader ROMFS image in kernel
Use ROMFS to load user applications in kernel mode instead of using
hostfs.
2024-02-07 19:46:42 -08:00
Masayuki Ishikawa 38f8aae3be boards: rv-virt: Add nxrecorder to defconfigs
Summary:
- This commit adds nxrecorder to netnsh/netnsh_smp/netnsh64/
  netnsh64_smp defconfigs.

Impact:
- None

Testing:
- Tested with qemu-8.2.0 on Raspi4B with USB Audio

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2024-02-06 00:41:44 -08:00
Huang Qi bff298ae09 rv-virt: Guard procfs mount with CONFIG_FS_PROCFS
Don't mount procfs if it is not enabled in the kernel configuration.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-02-01 16:15:45 -03:00
Huang Qi dce459767e rv-virt: Add tmpfs mount points
This commit add mount point for tmpfs in the
board_app_initialize function.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-02-01 16:15:45 -03:00
Masayuki Ishikawa 78d22b997c boards: rv-virt: Fix the hello app crash with nsh64
Summary:
- I noticed that the hello app crashes due to
  https://github.com/apache/nuttx/pull/11576
- This is a tentative fix to avoid the crash

Impact:
- None

Testing:
- Tested with qemu-8.2.0

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2024-01-22 23:18:43 -08:00
Yanfeng Liu b46ee08230 rv-virt/configs: avoid build errors
- disable NSH_SYMTAB to avoid build errors with cmake.
- enable LIBM to avoid build errors with Ubuntu stock
  gcc-riscv64-unknown-elf toolchain.
- use HELLO=y for easy use within qemu console.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-22 08:18:04 +01:00
Yanfeng Liu a9372627d8 risc-v/rv-virt: use fully linked apps for kernel build
Fully linked apps take less storage and are efficient to load. This
is to enable them for rv-vrit configurations in KERNEL build.

Changes:

- arch/risc-v/Kconfig       select BINFMT_ELF_EXECUTABLE for QEMU-RV
- boards/risc-v/qemu-rv/rv-virt/configs
  - knsh32/defconfig        enable ELF_EXECUTABLE, LIBM, OSTEST
  - knsh64/defconfig        enable ELF_EXECUTABLE, LIBM, OSTEST
  - ksmp64/defconfig        enable ELF_EXECUTABLE, LIBM, OSTEST
  - knetnsh64/defconfig     enable ELF_EXECUTABLE, LIBM, OSTEST
  - knetnsh64_smp/defconfig enable ELF_EXECUTABLE, LIBM, OSTEST

Additions:
- boards/risc-v/qemu-rv/rv-virt/scripts/
  - gnu-elf.ld              apps linker script

The ARCH_TEXT_VBASE of knsh32 is set to same as that of 64bit to reuse
the apps linker script.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-11 00:51:07 -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
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