2021-12-05 21:41:44 +08:00
|
|
|
1. Download and install toolchain
|
|
|
|
|
|
|
|
$ curl https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
|
|
|
|
|
|
|
|
2. Build and install qemu
|
|
|
|
|
|
|
|
$ git clone https://github.com/qemu/qemu
|
|
|
|
$ cd qemu
|
2022-01-14 17:18:29 +08:00
|
|
|
$ ./configure --target-list=riscv32-softmmu,riscv64-softmmu
|
2021-12-05 21:41:44 +08:00
|
|
|
$ make
|
|
|
|
$ sudo make install
|
|
|
|
|
2022-10-17 16:48:05 +08:00
|
|
|
3.1. Configure and build NuttX for BUILD_FLAT
|
2021-12-05 21:41:44 +08:00
|
|
|
|
|
|
|
$ mkdir ./nuttx; cd ./nuttx
|
2022-11-23 02:59:48 +08:00
|
|
|
$ git clone https://github.com/apache/nuttx.git nuttx
|
|
|
|
$ git clone https://github.com/apache/nuttx-apps.git apps
|
2021-12-05 21:41:44 +08:00
|
|
|
$ cd nuttx
|
|
|
|
$ make distclean
|
2022-01-14 17:18:29 +08:00
|
|
|
$ ./tools/configure.sh rv-virt:nsh
|
2022-10-17 16:48:05 +08:00
|
|
|
$ make V=1 -j7
|
|
|
|
|
2023-03-27 07:01:47 +08:00
|
|
|
3.2 Configure and build NuttX for BUILD_KERNEL, 64-bit or 32-bit
|
2022-10-17 16:48:05 +08:00
|
|
|
|
|
|
|
$ mkdir ./nuttx; cd ./nuttx
|
2022-11-23 02:59:48 +08:00
|
|
|
$ git clone https://github.com/apache/nuttx.git nuttx
|
|
|
|
$ git clone https://github.com/apache/nuttx-apps.git apps
|
2022-10-17 16:48:05 +08:00
|
|
|
$ cd nuttx
|
|
|
|
$ make distclean
|
2023-03-27 07:01:47 +08:00
|
|
|
$ # For 64-bit build.
|
|
|
|
$ ./tools/configure.sh rv-virt:knsh64
|
|
|
|
$ # For 32-bit build.
|
|
|
|
$ ./tools/configure.sh rv-virt:knsh32
|
2022-10-17 16:48:05 +08:00
|
|
|
$ 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
|
2021-12-05 21:41:44 +08:00
|
|
|
|
|
|
|
4. Run the nuttx with qemu
|
|
|
|
|
2022-10-07 16:20:39 +08:00
|
|
|
$ qemu-system-riscv32 -semihosting -M virt,aclint=on -cpu rv32 -smp 8 -bios none -kernel nuttx -nographic
|
2021-12-05 21:41:44 +08:00
|
|
|
|
2022-01-14 17:18:29 +08:00
|
|
|
or
|
|
|
|
|
2022-10-07 16:20:39 +08:00
|
|
|
$ qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -smp 8 -bios none -kernel nuttx -nographic
|
2022-05-02 17:03:55 +08:00
|
|
|
|
|
|
|
NuttShell (NSH) NuttX-10.3.0-RC1
|
|
|
|
nsh> mount -t hostfs -o fs=. /host
|
|
|
|
nsh> cat /host/AUTHORS
|
|
|
|
This is a list of all the contributors that have submitted ICLA, SGA
|
|
|
|
If you are not on this list and believe you should be, please inform us.
|
|
|
|
|
|
|
|
ICLA
|
|
|
|
====
|
|
|
|
...
|
|
|
|
nsh>
|
2022-01-14 17:18:29 +08:00
|
|
|
|
2022-11-23 19:56:53 +08:00
|
|
|
4. Run the nuttx network with qemu
|
|
|
|
|
|
|
|
$ qemu-system-riscv32 -semihosting -M virt,aclint=on -cpu rv32 -smp 8 \
|
|
|
|
-global virtio-mmio.force-legacy=false \
|
|
|
|
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23,hostfwd=tcp:127.0.0.1:15001-10.0.2.15:5001 \
|
|
|
|
-device virtio-net-device,netdev=u1,bus=virtio-mmio-bus.0 \
|
|
|
|
-bios none -kernel nuttx -nographic
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
$ qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -smp 8 \
|
|
|
|
-global virtio-mmio.force-legacy=false \
|
|
|
|
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23,hostfwd=tcp:127.0.0.1:15001-10.0.2.15:5001 \
|
|
|
|
-device virtio-net-device,netdev=u1,bus=virtio-mmio-bus.0 \
|
|
|
|
-bios none -kernel nuttx -nographic
|
|
|
|
|
2021-12-05 21:41:44 +08:00
|
|
|
5. TODO
|
|
|
|
|
|
|
|
Support FPU
|
|
|
|
Support RISC-V User mode
|