Closed TaiJuWu closed 7 months ago
Hi: Thank you so much for your sponsorship, it really means a lot to me :-)
May I know which operation failed for NuttX on QEMU? A screenshot or log capture would be helpful too. Thanks!
Thanks for your reply and hope you can write more excellent article to help others.
You can see there is a program named hello.
But this program does not show at help command and we can't run hello program.
Ah OK, this happens because the hello
app is disabled. To enable it:
make menuconfig
Application Configuration > Examples > "Hello World" Example
M
" turns to "*
"make
Lemme know if it works. Thanks :-)
enable
It's already set as below.
Hi: Could you confirm that these are the steps we ran:
mkdir nuttx
cd nuttx
git clone https://github.com/apache/nuttx nuttx
git clone https://github.com/apache/nuttx-apps apps
cd nuttx
tools/configure.sh rv-virt:nsh64
grep HELLO= .config
## Shows: CONFIG_EXAMPLES_HELLO=m
make menuconfig
## Browse to `Application Configuration > Examples > "Hello World" Example`
## Press Space to select, until "M" turns to "*"
## Save and Exit
grep HELLO= .config
## Shows: CONFIG_EXAMPLES_HELLO=y
make
qemu-system-riscv64 \
-semihosting \
-M virt,aclint=on \
-cpu rv64 \
-smp 8 \
-bios none \
-kernel nuttx \
-nographic
When I run this with the latest version of NuttX, the hello
app works OK. Wonder if there's something different about the build environment? (I'm using macOS x64)
NuttShell (NSH) NuttX-12.3.0-RC1
nsh> uname -a
NuttX 12.3.0-RC1 d92a701 Nov 14 2023 08:11:31 risc-v rv-virt
nsh> help
help usage: help [-v] [<cmd>]
. cp exit mkrd set unset
[ cmp false mount sleep uptime
? dirname fdinfo mv source usleep
alias dd free pidof test xd
unalias df help printf time
basename dmesg hexdump ps true
break echo kill pwd truncate
cat env ls rm uname
cd exec mkdir rmdir umount
Builtin Apps:
hello nsh ostest sh
nsh> hello
Hello, World!!
Hi: Could you confirm that these are the steps we ran:
mkdir nuttx cd nuttx git clone https://github.com/apache/nuttx nuttx git clone https://github.com/apache/nuttx-apps apps cd nuttx tools/configure.sh rv-virt:nsh64 grep HELLO= .config ## Shows: CONFIG_EXAMPLES_HELLO=m make menuconfig ## Browse to `Application Configuration > Examples > "Hello World" Example` ## Press Space to select, until "M" turns to "*" ## Save and Exit grep HELLO= .config ## Shows: CONFIG_EXAMPLES_HELLO=y make qemu-system-riscv64 \ -semihosting \ -M virt,aclint=on \ -cpu rv64 \ -smp 8 \ -bios none \ -kernel nuttx \ -nographic
When I run this with the latest version of NuttX, the
hello
app works OK. Wonder if there's something different about the build environment? (I'm using macOS x64)NuttShell (NSH) NuttX-12.3.0-RC1 nsh> uname -a NuttX 12.3.0-RC1 d92a701 Nov 14 2023 08:11:31 risc-v rv-virt nsh> help help usage: help [-v] [<cmd>] . cp exit mkrd set unset [ cmp false mount sleep uptime ? dirname fdinfo mv source usleep alias dd free pidof test xd unalias df help printf time basename dmesg hexdump ps true break echo kill pwd truncate cat env ls rm uname cd exec mkdir rmdir umount Builtin Apps: hello nsh ostest sh nsh> hello Hello, World!!
This method can work. Thank you a lot.
Ah yes NuttX Kernel Mode requires a few more steps, as explained here: https://nuttx.apache.org/docs/latest/platforms/risc-v/qemu-rv/boards/rv-virt/index.html
NuttX Kernel Mode uses Semihosting to access the apps, so we need to build the NuttX Apps Filesystem: https://lupyuen.github.io/articles/semihost#nuttx-calls-semihosting
Here are the steps I tested:
mkdir nuttx
cd nuttx
git clone https://github.com/apache/nuttx nuttx
git clone https://github.com/apache/nuttx-apps apps
cd nuttx
## Configure NuttX for QEMU Kernel Mode
tools/configure.sh rv-virt:knsh64
grep HELLO= .config
## Shows: CONFIG_EXAMPLES_HELLO=m
## This is OK for Kernel Mode
## Build the NuttX Kernel
make
## Build the NuttX Apps Filesystem
make V=1 -j7
make export V=1
cd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import V=1
cd ../nuttx
## Start NuttX in QEMU
## (Uses Semihosting to access the NuttX Apps Filesystem)
qemu-system-riscv64 \
-semihosting \
-M virt,aclint=on \
-cpu rv64 \
-smp 8 \
-bios none \
-kernel nuttx \
-nographic
And the hello
app runs OK (without setting menuconfig):
→ qemu-system-riscv64 \
-semihosting \
-M virt,aclint=on \
-cpu rv64 \
-smp 8 \
-bios none \
-kernel nuttx \
-nographic
ABC
NuttShell (NSH) NuttX-12.3.0-RC1
nsh> uname -a
NuttX 12.3.0-RC1 479dda9 Nov 16 2023 19:50:58 risc-v rv-virt
nsh> help
help usage: help [-v] [<cmd>]
. cp exit mkrd set unset
[ cmp false mount sleep uptime
? dirname fdinfo mv source usleep
alias dd free pidof test xd
unalias df help printf time
basename dmesg hexdump ps true
break echo kill pwd truncate
cat env ls rm uname
cd exec mkdir rmdir umount
nsh> hello
Hello, World!!
The hello
executable is located here:
nsh> ls -l /system/bin/hello
-rwxrwxrwx 534672 /system/bin/hello
nsh> /system/bin/hello
Hello, World!!
Ah yes NuttX Kernel Mode requires a few more steps, as explained here: https://nuttx.apache.org/docs/latest/platforms/risc-v/qemu-rv/boards/rv-virt/index.html
NuttX Kernel Mode uses Semihosting to access the apps, so we need to build the NuttX Apps Filesystem: https://lupyuen.github.io/articles/semihost#nuttx-calls-semihosting
Here are the steps I tested:
mkdir nuttx cd nuttx git clone https://github.com/apache/nuttx nuttx git clone https://github.com/apache/nuttx-apps apps cd nuttx ## Configure NuttX for QEMU Kernel Mode tools/configure.sh rv-virt:knsh64 grep HELLO= .config ## Shows: CONFIG_EXAMPLES_HELLO=m ## This is OK for Kernel Mode ## Build the NuttX Kernel make ## Build the NuttX Apps Filesystem make V=1 -j7 make export V=1 cd ../apps ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz make import V=1 cd ../nuttx ## Start NuttX in QEMU ## (Uses Semihosting to access the NuttX Apps Filesystem) qemu-system-riscv64 \ -semihosting \ -M virt,aclint=on \ -cpu rv64 \ -smp 8 \ -bios none \ -kernel nuttx \ -nographic
And the
hello
app runs OK (without setting menuconfig):→ qemu-system-riscv64 \ -semihosting \ -M virt,aclint=on \ -cpu rv64 \ -smp 8 \ -bios none \ -kernel nuttx \ -nographic ABC NuttShell (NSH) NuttX-12.3.0-RC1 nsh> uname -a NuttX 12.3.0-RC1 479dda9 Nov 16 2023 19:50:58 risc-v rv-virt nsh> help help usage: help [-v] [<cmd>] . cp exit mkrd set unset [ cmp false mount sleep uptime ? dirname fdinfo mv source usleep alias dd free pidof test xd unalias df help printf time basename dmesg hexdump ps true break echo kill pwd truncate cat env ls rm uname cd exec mkdir rmdir umount nsh> hello Hello, World!!
The
hello
executable is located here:nsh> ls -l /system/bin/hello -rwxrwxrwx 534672 /system/bin/hello nsh> /system/bin/hello Hello, World!!
This is I need!!!! Thanks a lot.
Cool! Lemme know if you have any questions :-)
First I want to thanks your articles, they help me to start up this project a lot and it's really excellent.
Currently, I read this article and build Nuttx for RISC-V successfully. But there is a little problem, when I run Nuttx with Qemu, it should can run hello example but this operation failed.