Releases: lupyuen2/wip-nuttx
Apache NuttX RTOS for Pine64 Ox64 BL808 RISC-V SBC
UART Interrupt works OK but UART Input is null.
Build Script:
#!/usr/bin/env bash
# Build NuttX for Ox64
## TODO: Set PATH
export PATH="$HOME/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-apple-darwin/bin:$PATH"
rm init.S
rm initrd
rm -r boards/risc-v/jh7110/star64/src/etctmp
set -e # Exit when any command fails
set -x # Echo commands
## Build NuttX
function build_nuttx {
## Go to NuttX Folder
pushd ../nuttx
## Build NuttX
make -j 8
## Return to previous folder
popd
}
## Build Apps Filesystem
function build_apps {
## Go to NuttX Folder
pushd ../nuttx
## Build Apps Filesystem
make -j 8 export
pushd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make -j 8 import
popd
## Return to previous folder
popd
}
## Download the WIP NuttX Source Code
git clone \
--branch ox64b \
https://github.com/lupyuen2/wip-pinephone-nuttx \
nuttx
git clone \
--branch ox64b \
https://github.com/lupyuen2/wip-pinephone-nuttx-apps \
apps
cd nuttx
## Pull updates
git pull && git status && hash1=`git rev-parse HEAD`
pushd ../apps
git pull && git status && hash2=`git rev-parse HEAD`
popd
echo NuttX Source: https://github.com/apache/nuttx/tree/$hash1 >nuttx.hash
echo NuttX Apps: https://github.com/apache/nuttx-apps/tree/$hash2 >>nuttx.hash
## Show the version of GCC
riscv64-unknown-elf-gcc -v
## TODO: Configure build
## tools/configure.sh star64:nsh
## Build NuttX
build_nuttx
## Build Apps Filesystem
build_apps
## Generate Initial RAM Disk
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
## Show the size
riscv64-unknown-elf-size nuttx
## Export the Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Insert 64 KB of zeroes after Binary Image for Kernel Stack
head -c 65536 /dev/zero >/tmp/nuttx.zero
## Append Initial RAM Disk to Binary Image
cat nuttx.bin /tmp/nuttx.zero initrd \
>Image
## Copy the config
cp .config nuttx.config
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
../apps/bin/init \
>init.S \
2>&1
## Dump the hello disassembly to hello.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
../apps/bin/hello \
>hello.S \
2>&1
echo ----- Wait for microSD
set +x # Don't echo commands
echo "***** Insert microSD into computer"
while : ; do
if [ -d "/Volumes/NO NAME" ]
then
break
fi
sleep 1
done
sleep 1
set -x # Echo commands
echo ----- Copy to microSD
cp Image "/Volumes/NO NAME/"
ls -l "/Volumes/NO NAME/Image"
## TODO: Verify that /dev/disk2 is microSD
echo ----- Unmount microSD
diskutil unmountDisk /dev/disk2
## Run the firmware
open -a CoolTerm
Apache NuttX RTOS for Pine64 Ox64 BL808 RISC-V SBC
Read the article...
Console Input and Interrupts not working yet.
Build Script:
#!/usr/bin/env bash
# Build NuttX for Ox64
## TODO: Set PATH
export PATH="$HOME/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-apple-darwin/bin:$PATH"
rm init.S
rm initrd
rm -r boards/risc-v/jh7110/star64/src/etctmp
set -e # Exit when any command fails
set -x # Echo commands
## Build NuttX
function build_nuttx {
## Go to NuttX Folder
pushd ../nuttx
## Build NuttX
make -j 8
## Return to previous folder
popd
}
## Build Apps Filesystem
function build_apps {
## Go to NuttX Folder
pushd ../nuttx
## Build Apps Filesystem
make -j 8 export
pushd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make -j 8 import
popd
## Return to previous folder
popd
}
## Download the WIP NuttX Source Code
git clone \
--branch ox64a \
https://github.com/lupyuen2/wip-pinephone-nuttx \
nuttx
git clone \
--branch ox64a \
https://github.com/lupyuen2/wip-pinephone-nuttx-apps \
apps
cd nuttx
## Pull updates
git pull && git status && hash1=`git rev-parse HEAD`
pushd ../apps
git pull && git status && hash2=`git rev-parse HEAD`
popd
echo NuttX Source: https://github.com/apache/nuttx/tree/$hash1 >nuttx.hash
echo NuttX Apps: https://github.com/apache/nuttx-apps/tree/$hash2 >>nuttx.hash
## Show the version of GCC
riscv64-unknown-elf-gcc -v
## TODO: Configure build
## tools/configure.sh star64:nsh
## Build NuttX
build_nuttx
## Build Apps Filesystem
build_apps
## Generate Initial RAM Disk
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
## Show the size
riscv64-unknown-elf-size nuttx
## Export the Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Insert 64 KB of zeroes after Binary Image for Kernel Stack
head -c 65536 /dev/zero >/tmp/nuttx.zero
## Append Initial RAM Disk to Binary Image
cat nuttx.bin /tmp/nuttx.zero initrd \
>Image
## Copy the config
cp .config nuttx.config
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
../apps/bin/init \
>init.S \
2>&1
## Dump the hello disassembly to hello.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
../apps/bin/hello \
>hello.S \
2>&1
echo ----- Wait for microSD
set +x # Don't echo commands
echo "***** Insert microSD into computer"
while : ; do
if [ -d "/Volumes/NO NAME" ]
then
break
fi
sleep 1
done
set -x # Echo commands
echo ----- Copy to microSD
cp Image "/Volumes/NO NAME/"
ls -l "/Volumes/NO NAME/Image"
## TODO: Verify that /dev/disk2 is microSD
echo ----- Unmount microSD
diskutil unmountDisk /dev/disk2
## Run the firmware
open -a CoolTerm
Apache NuttX RTOS for Pine64 Star64 JH7110 RISC-V SBC
Read the articles...
Build Script
#!/usr/bin/env bash
# Build NuttX for Star64
set -e # Exit when any command fails
set -x # Echo commands
git clone --branch 860571471da095948fa0c39ce8ac6593a1efbad7 https://github.com/apache/nuttx
git clone --branch ee71af840f543b067c72077ec7fe74c2c7153998 https://github.com/apache/nuttx-apps apps
cd nuttx
## Download the microSD Image sdcard.img
## - https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v3.1.5/sdcard.img
## Write the downloaded image to a microSD Card with Balena Etcher or GNOME Disks.
## Check that microSD has been inserted.
if [ ! -d "/Volumes/NO NAME" ]
then
echo "Insert microSD"
exit 0
fi
## Clean up the NuttX Project
make distclean || true
## Show the version of GCC
riscv64-unknown-elf-gcc -v
## Configure and Build NuttX
rm -f nuttx.bin
tools/configure.sh star64:nsh
make
riscv64-unknown-elf-objcopy -O binary nuttx nuttx.bin
ls -l nuttx.bin
## Build Apps Filesystem as Initial RAM Disk
rm -f initrd
make export
pushd ../apps
tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import
popd
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
ls -l initrd
## Generate FIT Image
rm -f nuttx.its jh7110-visionfive-v2.dtb starfiveu.fit
wget https://raw.githubusercontent.com/lupyuen/nuttx-star64/main/nuttx.its
wget https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v3.1.5/jh7110-visionfive-v2.dtb
mkimage -f nuttx.its -A riscv -O linux -T flat_dt starfiveu.fit
ls -l starfiveu.fit
## Copy to microSD
cp starfiveu.fit "/Volumes/NO NAME"
ls -l "/Volumes/NO NAME/starfiveu.fit"
## Unmount microSD
## TODO: Verify that /dev/disk2 is microSD
diskutil unmountDisk /dev/disk2
## Show the size
riscv64-unknown-elf-size nuttx
## Copy the config
cp .config nuttx.config
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
../apps/bin/init \
>init.S \
2>&1
## Boot Star64 with the microSD Card
Output Log
Script started on Mon Aug 7 16:27:21 2023
command: screen /dev/tty.usbserial-1420 115200
�[?1049h�[!p�[?3;4l�[4l�>�[4l�[?1h�=�[0m�(B�[1;61r�[H�[2J�[H�[2J
U-Boot SPL 2021.10 (Jan 19 2023 - 04:09:41 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : StarFive VisionFive V2
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 4000000Hz
Platform Console Device : uart8250
Platform HSM Device : jh7110-hsm
Platform PMU Device : ---
Platform Reboot Device : pm-reset
Platform Shutdown Device : pm-reset
Firmware Base : 0x40000000
Firmware Size : 288 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01 : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000040200000
Domain0 Next Arg1 : 0x0000000042200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 1
Boot HART Domain : root
Boot HART Priv Version : v1.11
Boot HART Base ISA : rv64imafdcbx
Boot HART ISA Extensions : none
Boot HART PMP Count : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
U-Boot 2021.10 (Jan 19 2023 - 04:09:41 +0800), Build: jenkins-github_visionfive2-6
CPU: rv64imacu
Model: StarFive VisionFive V2
DRAM: 8 GiB
MMC: sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
StarFive EEPROM format v2
--------EEPROM INFO--------
Vendor : PINE64
Product full SN: STAR64V1-2310-D008E000-00000003
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:75:5d
Ethernet MAC1 address: 6c:cf:39:00:75:5e
--------EEPROM INFO--------
In: serial@10000000
Out: serial@10000000
Err: serial@10000000
Model: StarFive VisionFive V2
Net: eth0: ethernet@16030000, eth1: ethernet@16040000
switch to partitions #0, OK
mmc1 is current device
found device 1
bootmode flash device 1
Failed to load 'uEnv.txt'
Can't set block device
Hit any key to stop autoboot: 2 ��� 1 ��� 0
1579 bytes read in 5 ms (307.6 KiB/s)
Importing environment from mmc1 ...
Can't set block device
## Warning: defaulting to text format
switch to partitions #0, OK
mmc1 is current device
10232366 bytes read in 438 ms (22.3 MiB/s)
## Loading kernel from FIT Image at a0000000 ...
Using 'nuttx' configuration
Trying 'vmlinux' kernel subimage
Description: vmlinux
Type: Kernel Image
Compression: uncompressed
Data Start: 0xa00000b4
Data Size: 2097800 Bytes = 2 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x40200000
Entry Point: 0x40200000
Verifying Hash Integrity ... OK
## Loading fdt from FIT Image at a0000000 ...
Using 'nuttx' configuration
Trying 'fdt' fdt subimage
Description: unavailable
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0xa09b58bc
Data Size: 50235 Bytes = 49.1 KiB
Architecture: RISC-V
Load Address: 0x46000000
Hash algo: sha256
Hash value: 42767c996f0544f513280805b41f996446df8b3956c656bdbb782125ae8ffeec
Verifying Hash Integrity ... sha256+ OK
Loading fdt from 0xa09b58bc to 0x46000000
Booting using the fdt blob at 0x46000000
## Loading loadables from FIT Image at a0000000 ...
Trying 'ramdisk' loadables subimage
Description: buildroot initramfs
Type: RAMDisk Image
Compression: uncompressed
Data Start: 0xa02003f0
Data Size: 8082432 Bytes = 7.7 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x46100000
Entry Point: unavailable
Hash algo: sha256
Hash value: 41cdaae1d74fbf5f03e1a9c52ca91a13b14efc3de12f6ad690cf7b45474703a7
Verifying Hash Integrity ... sha256+ OK
Loading loadables from 0xa02003f0 to 0x46100000
Loading Kernel Image
## Error: "cpu_vol_set" not defined
Booting kernel in
## Flattened Device Tree blob at 46000000
Booting using the fdt blob at 0x46000000
Using Device Tree in place at 0000000046000000, end 000000004600ffff
Starting kernel ...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
BC
NuttShell (NSH) NuttX-12.2.1-RC0
nsh>
nsh> uname -a
NuttX 12.2.1-RC0 8605714 Aug 7 2023 16:20:45 risc-v star64
nsh>
nsh> free
total used free largest nused nfree
Kmem: 2065400 14600 2050800 2049440 50 3
Page: 20971520 643072 20328448 20328448
nsh>
nsh> ls -l
/:
dr--r--r-- 0 dev/
dr--r--r-- 0 proc/
dr--r--r-- 0 system/
nsh>
nsh> help
help usage: help [-v] [<cmd>]
. break dd exit kill printf sleep uname
[ cat df false ls ps source umount
? cd dmesg fdinfo mkdir pwd test unset
alias cp echo free mkrd rm time uptime
unalias cmp env help mount rmdir true usleep
basename dirname exec hexdump mv set truncate xd
nsh>
nsh> ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 null
brw-rw-rw-16777216 ram0
crw-rw-rw- 0 ttyS0
crw-rw-rw- 0 zero
nsh>
nsh> ls -l /system
/system:
dr-xr-xr-x 0 bin/
nsh>
nsh> ls -l /system/bin
/system/bin:
-r-xr-xr-x 895184 getprime
-r-xr-xr-x 512432 hello
-r-xr-xr-x 3346072 init
-r-xr-xr-x 3327736 sh
nsh>
nsh> ls -l /system/bin/hello
-r-xr-xr-x 512432 /system/bin/hello
nsh>
nsh> hello
Hello, World!!
nsh>
nsh> getprime
Set thread priority to 10
Set thread policy to SCHED_RR
Start thread #0
thread #0 started, looking for primes < 10000, doing 10 run(s)
thread #0 finished, found 1230 primes, last one was 9973
Done
getprime took 0 msec
nsh>
nsh>
Script done on Mon Aug 7 16:28:20 2023
Apache NuttX RTOS for Pine64 Star64 JH7110 RISC-V SBC
Build Script:
#!/usr/bin/env bash
# Build NuttX for Star64
set -e # Exit when any command fails
set -x # Echo commands
## Download the microSD Image sdcard.img
## - https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v3.1.5/sdcard.img
## Write the downloaded image to a microSD Card with Balena Etcher or GNOME Disks.
## Check that microSD has been inserted.
if [ ! -d "/Volumes/NO NAME" ]
then
echo "Insert microSD"
exit 0
fi
## Clean up the NuttX Project
make distclean || true
## Show the version of GCC
riscv64-unknown-elf-gcc -v
## Configure and Build NuttX
rm -f nuttx.bin
tools/configure.sh star64:nsh
make
riscv64-unknown-elf-objcopy -O binary nuttx nuttx.bin
ls -l nuttx.bin
## Build Apps Filesystem as Initial RAM Disk
rm -f initrd
make export
pushd ../apps
tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import
popd
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
ls -l initrd
## Generate FIT Image
rm -f nuttx.its jh7110-visionfive-v2.dtb starfiveu.fit
wget https://raw.githubusercontent.com/lupyuen/nuttx-star64/main/nuttx.its
wget https://github.com/starfive-tech/VisionFive2/releases/download/VF2_v3.1.5/jh7110-visionfive-v2.dtb
mkimage -f nuttx.its -A riscv -O linux -T flat_dt starfiveu.fit
ls -l starfiveu.fit
## Copy to microSD
cp starfiveu.fit "/Volumes/NO NAME"
ls -l "/Volumes/NO NAME/starfiveu.fit"
## Unmount microSD
## TODO: Verify that /dev/disk2 is microSD
diskutil unmountDisk /dev/disk2
## Show the size
riscv64-unknown-elf-size nuttx
## Copy the config
cp .config nuttx.config
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
../apps/bin/init \
>init.S \
2>&1
## Boot Star64 with the microSD Card
Output Log:
U-Boot SPL 2021.10 (Jan 19 2023 - 04:09:41 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : StarFive VisionFive V2
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 4000000Hz
Platform Console Device : uart8250
Platform HSM Device : jh7110-hsm
Platform PMU Device : ---
Platform Reboot Device : pm-reset
Platform Shutdown Device : pm-reset
Firmware Base : 0x40000000
Firmware Size : 288 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01 : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000040200000
Domain0 Next Arg1 : 0x0000000042200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 1
Boot HART Domain : root
Boot HART Priv Version : v1.11
Boot HART Base ISA : rv64imafdcbx
Boot HART ISA Extensions : none
Boot HART PMP Count : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
U-Boot 2021.10 (Jan 19 2023 - 04:09:41 +0800), Build: jenkins-github_visionfive2-6
CPU: rv64imacu
Model: StarFive VisionFive V2
DRAM: 8 GiB
MMC: sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
StarFive EEPROM format v2
--------EEPROM INFO--------
Vendor : PINE64
Product full SN: STAR64V1-2310-D008E000-00000003
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:75:5d
Ethernet MAC1 address: 6c:cf:39:00:75:5e
--------EEPROM INFO--------
In: serial@10000000
Out: serial@10000000
Err: serial@10000000
Model: StarFive VisionFive V2
Net: eth0: ethernet@16030000, eth1: ethernet@16040000
switch to partitions #0, OK
mmc1 is current device
found device 1
bootmode flash device 1
Failed to load 'uEnv.txt'
Can't set block device
Hit any key to stop autoboot: 0
1579 bytes read in 4 ms (384.8 KiB/s)
Importing environment from mmc1 ...
Can't set block device
## Warning: defaulting to text format
switch to partitions #0, OK
mmc1 is current device
10232366 bytes read in 436 ms (22.4 MiB/s)
## Loading kernel from FIT Image at a0000000 ...
Using 'nuttx' configuration
Trying 'vmlinux' kernel subimage
Description: vmlinux
Type: Kernel Image
Compression: uncompressed
Data Start: 0xa00000b4
Data Size: 2097800 Bytes = 2 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x40200000
Entry Point: 0x40200000
Verifying Hash Integrity ... OK
## Loading fdt from FIT Image at a0000000 ...
Using 'nuttx' configuration
Trying 'fdt' fdt subimage
Description: unavailable
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0xa09b58bc
Data Size: 50235 Bytes = 49.1 KiB
Architecture: RISC-V
Load Address: 0x46000000
Hash algo: sha256
Hash value: 42767c996f0544f513280805b41f996446df8b3956c656bdbb782125ae8ffeec
Verifying Hash Integrity ... sha256+ OK
Loading fdt from 0xa09b58bc to 0x46000000
Booting using the fdt blob at 0x46000000
## Loading loadables from FIT Image at a0000000 ...
Trying 'ramdisk' loadables subimage
Description: buildroot initramfs
Type: RAMDisk Image
Compression: uncompressed
Data Start: 0xa02003f0
Data Size: 8082432 Bytes = 7.7 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x46100000
Entry Point: unavailable
Hash algo: sha256
Hash value: 05e61cf645e01893f6ac03ae0d098cb0f3dc0d75bed494945ebb6633092cdd68
Verifying Hash Integrity ... sha256+ OK
Loading loadables from 0xa02003f0 to 0x46100000
Loading Kernel Image
## Error: "cpu_vol_set" not defined
Booting kernel in
## Flattened Device Tree blob at 46000000
Booting using the fdt blob at 0x46000000
Using Device Tree in place at 0000000046000000, end 000000004600ffff
Starting kernel ...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
BC
NuttShell (NSH) NuttX-12.2.1-RC0
nsh>
nsh>
nsh> uname -a
NuttX 12.2.1-RC0 57d5bba-dirty Aug 5 2023 12:30:55 risc-v star64
nsh>
nsh> free
total used free largest nused nfree
Kmem: 2065400 14600 2050800 2049440 50 3
Page: 20971520 643072 20328448 20328448
nsh>
nsh> ls -l
/:
dr--r--r-- 0 dev/
dr--r--r-- 0 proc/
dr--r--r-- 0 system/
nsh>
nsh> ls -l /dev
/dev:
crw-rw-rw- 0 console
crw-rw-rw- 0 null
brw-rw-rw-16777216 ram0
crw-rw-rw- 0 ttyS0
crw-rw-rw- 0 zero
nsh>
nsh>
nsh>
nsh> ls -l /system
/system:
dr-xr-xr-x 0 bin/
nsh>
nsh> ls -l /system/bin
/system/bin:
-r-xr-xr-x 895184 getprime
-r-xr-xr-x 512432 hello
-r-xr-xr-x 3346040 init
-r-xr-xr-x 3327696 sh
nsh>
nsh> ls -l /system/bin/init
-r-xr-xr-x 3346040 /system/bin/init
nsh>
nsh> hello
Hello, World!!
nsh>
nsh>
WIP: Apache NuttX RTOS for Pine64 Star64 JH7110 RISC-V SBC (Fixed PLIC)
Read the article...
See below for the Build Outputs. We built NuttX with these steps...
## Install the Build Prerequisites and Toolchain:
## https://lupyuen.github.io/articles/nuttx#install-prerequisites
## https://lupyuen.github.io/articles/riscv#appendix-download-toolchain-for-64-bit-risc-v
## Download the `star64d` branch of our WIP NuttX Repos
mkdir nuttx
cd nuttx
git clone --branch star64d https://github.com/lupyuen2/wip-pinephone-nuttx nuttx
git clone --branch star64d https://github.com/lupyuen2/wip-pinephone-nuttx-apps apps
## Configure and build NuttX
cd nuttx
tools/configure.sh rv-virt:knsh64
make
## Build Apps Filesystem
make export V=1
pushd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import V=1
popd
## Generate Initial RAM Disk
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
## We assume that `nuttx` contains the NuttX ELF Image.
## Export the NuttX Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
../apps/bin/init \
>init.S \
2>&1
## Copy the config to nuttx.config
cp .config nuttx.config
## Copy NuttX Binary Image, Device Tree and
## Initial RAM Disk to TFTP Folder
cp nuttx.bin $HOME/tftproot/Image
cp jh7110-star64-pine64.dtb $HOME/tftproot
cp initrd $HOME/tftproot
## Boot NuttX over TFTP:
## https://lupyuen.github.io/articles/semihost#appendix-boot-nuttx-over-tftp-with-initial-ram-disk
Here's the Star64 Output Log...
123067BCnx_start: Entry
up_irq_enable:
up_enable_irq: irq=17
up_enable_irq: RISCV_IRQ_SOFT=17
uart_register: Registering /dev/console
uart_register: Registering /dev/ttyS0
work_start_lowpri: Starting low-priority kernel worker thread(s)
board_late_initialize:
nx_start_application: Starting init task: /system/bin/init
elf_symname: Symbol has no name
elf_symvalue: SHN_UNDEF: Failed to get symbol name: -3
elf_relocateadd: Section 2 reloc 2: Undefined symbol[0] has no name: -3
nx_start_application: ret=3
up_exit: TCB=0x404088d0 exiting
up_enable_irq: irq=57
up_enable_irq: extirq=32, RISCV_IRQ_EXT=25
..***main
NuttShell (NSH) NuttX-12.0.3
nsh> ......++.+.l......s......
................................................p.o.s.i.x._.s.p.a.w.n..:. .p.i.d.=...0.x.c.0.2.0.2.9.7.8. .p.a.t.h.=..l.s. .f.i.l.e._.a.c.t.i.o.n.s.=...0.x.c.0.2.0.2.9.8.0. .a.t.t.r.=...0.x.c.0.2.0.2.9.8.8. .a.r.g.v.=...0.x.c.0.2.0.2.a.2.8.
.........................................................e.x.e.c._.s.p.a.w.n.:. .E.R.R.O..R.:. .F.a.i.l.e.d. .t.o. .l.o.a.d. .p.r.o.g.r.a.m. .'..l.s.'.:. ..-.2.
.......n.x.p.o.s.i.x._.s.p.a.w.n._.e.x.e.c.:. .E.R.R.O.R.:. .e.x.e.c. .f.a.i.l.e.d.:. ..2.
............................................................................................................../:
............................................................... dev......../
.............. proc......../
............... system........./
.............................................................nsh> ...................n.x._.s.t.a.r.t.:. .C.P.U.0.:. .B.e.g.i.n.n.i.n.g. .I.d.l.e. .L.o.o.p.
..........................
WIP: Apache NuttX RTOS for RISC-V QEMU (Log Serial I/O)
Read the article...
See below for the Build Outputs. We built NuttX with these steps...
## Install the Build Prerequisites and Toolchain:
## https://lupyuen.github.io/articles/nuttx#install-prerequisites
## https://lupyuen.github.io/articles/riscv#appendix-download-toolchain-for-64-bit-risc-v
## Download the `ramdisk2` branch of our WIP NuttX Repos
mkdir nuttx
cd nuttx
git clone --branch ramdisk2 https://github.com/lupyuen2/wip-pinephone-nuttx nuttx
git clone --branch ramdisk2 https://github.com/lupyuen2/wip-pinephone-nuttx-apps apps
## Configure and build NuttX
cd nuttx
tools/configure.sh rv-virt:knsh64
make
## Build Apps Filesystem
make export V=1
pushd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import V=1
popd
## Generate Initial RAM Disk
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
## We assume that `nuttx` contains the NuttX ELF Image.
## Export the NuttX Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
../apps/bin/init \
>init.S \
2>&1
## Copy the config to nuttx.config
cp .config nuttx.config
## Start QEMU with Initial RAM Disk
qemu-system-riscv64 \
-semihosting \
-M virt,aclint=on \
-cpu rv64 \
-smp 8 \
-bios none \
-kernel nuttx \
-initrd initrd \
-nographic
Here's the QEMU Output Log...
→ qemu-system-riscv64 \
-semihosting \
-M virt,aclint=off \
-cpu rv64 \
-smp 8 \
-bios none \
-kernel nuttx \
-initrd initrd \
-nographic \
ABCnx_start: Entry
up_irq_enable:
up_enable_irq: irq=17
up_enable_irq: RISCV_IRQ_SOFT=17
uart_register: Registering /dev/console
uart_register: Registering /dev/ttyS0
up_enable_irq: irq=35
up_enable_irq: extirq=10, RISCV_IRQ_EXT=25
work_start_lowpri: Starting low-priority kernel worker thread(s)
board_late_initialize:
nx_start_application: Starting init task: /system/bin/init
elf_symname: Symbol has no name
elf_symvalue: SHN_UNDEF: Failed to get symbol name: -3
elf_relocateadd: Section 2 reloc 2: Undefined symbol[0] has no name: -3
up_exit: TCB=0x802088d0 exiting
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
...
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
uart_write (0xc0200428):
0000 2a 2a 2a 6d 61 69 6e 0a ***main.
FAAAAAAAADEF*F*F*FmFaFiFnF
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
...
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
$%&riscv_doirq: irq=8
uart_write (0xc000a610):
0000 0a 4e 75 74 74 53 68 65 6c 6c 20 28 4e 53 48 29 .NuttShell (NSH)
0010 20 4e 75 74 74 58 2d 31 32 2e 30 2e 33 0a NuttX-12.0.3.
FAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEF
FNFuFtFtFSFhFeFlFlF F(FNFSFHF)F FNFuFtFtFXF-F1F2F.F0F.F3F
$%&riscv_doirq: irq=8
uart_write (0xc0015340):
0000 6e 73 68 3e 20 nsh>
AAAAADEFnFsFhF>F $%&riscv_doirq: irq=8
uart_write (0xc0015318):
0000 1b 5b 4b .[K
AAADEF[FK$%&riscv_doirq: irq=8
nx_start: CPU0: Beginning Idle Loop
$%^&riscv_doirq: irq=35
#*ADEFa$%&riscv_doirq: irq=8
$%^&riscv_doirq: irq=35
#*ADEFa$%&riscv_doirq: irq=8
$%^&riscv_doirq: irq=35
#*ADEFa$%&riscv_doirq: irq=8
WIP: Apache NuttX RTOS for RISC-V QEMU (Initial RAM Disk)
Read the article...
See below for the Build Outputs. We built NuttX with these steps...
## Install the Build Prerequisites and Toolchain:
## https://lupyuen.github.io/articles/nuttx#install-prerequisites
## https://lupyuen.github.io/articles/riscv#appendix-download-toolchain-for-64-bit-risc-v
## Download the `ramdisk` branch of our WIP NuttX Repos
mkdir nuttx
cd nuttx
git clone --branch ramdisk https://github.com/lupyuen2/wip-pinephone-nuttx nuttx
git clone --branch ramdisk https://github.com/lupyuen2/wip-pinephone-nuttx-apps apps
## Configure and build NuttX
cd nuttx
tools/configure.sh rv-virt:knsh64
make
## Build Apps Filesystem
make export V=1
pushd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import V=1
popd
## Generate Initial RAM Disk
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
## We assume that `nuttx` contains the NuttX ELF Image.
## Export the NuttX Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
../apps/bin/init \
>init.S \
2>&1
## Copy the config to nuttx.config
cp .config nuttx.config
## Start QEMU with Initial RAM Disk
qemu-system-riscv64 \
-semihosting \
-M virt,aclint=on \
-cpu rv64 \
-smp 8 \
-bios none \
-kernel nuttx \
-initrd initrd \
-nographic
Here's the QEMU Output Log...
→ qemu-system-riscv64 \
-semihosting \
-M virt,aclint=on \
-cpu rv64 \
-smp 8 \
-bios none \
-kernel nuttx \
-initrd initrd \
-nographic \
ABCnx_start: Entry
uart_register: Registering /dev/console
uart_register: Registering /dev/ttyS0
work_start_lowpri: Starting low-priority kernel worker thread(s)
board_late_initialize:
nx_start_application: Starting init task: /system/bin/init
elf_symname: Symbol has no name
elf_symvalue: SHN_UNDEF: Failed to get symbol name: -3
elf_relocateadd: Section 2 reloc 2: Undefined symbol[0] has no name: -3
up_exit: TCB=0x802088d0 exiting
NuttShell (NSH) NuttX-12.0.3
nsh> nx_start: CPU0: Beginning Idle Loop
nsh> ls -l /system/bin/init
posix_spawn: pid=0xc0202978 path=ls file_actions=0xc0202980 attr=0xc0202988 argv=0xc0202a28
exec_spawn: ERROR: Failed to load program 'ls': -2
nxposix_spawn_exec: ERROR: exec failed: 2
-r-xr-xr-x 3278720 /system/bin/init
nsh>
WIP: Apache NuttX RTOS for Pine64 Star64 JH7110 RISC-V SBC (Initial RAM Disk)
Read the article...
See below for the Build Outputs. We built NuttX with these steps...
## Install the Build Prerequisites and Toolchain:
## https://lupyuen.github.io/articles/nuttx#install-prerequisites
## https://lupyuen.github.io/articles/riscv#appendix-download-toolchain-for-64-bit-risc-v
## Download the `star64c` branch of our WIP NuttX Repos
mkdir nuttx
cd nuttx
git clone --branch star64c https://github.com/lupyuen2/wip-pinephone-nuttx nuttx
git clone --branch star64c https://github.com/lupyuen2/wip-pinephone-nuttx-apps apps
## Configure and build NuttX
cd nuttx
tools/configure.sh rv-virt:knsh64
make
## Build Apps Filesystem
make export V=1
pushd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import V=1
popd
## Generate Initial RAM Disk
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
## We assume that `nuttx` contains the NuttX ELF Image.
## Export the NuttX Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
../apps/bin/init \
>init.S \
2>&1
## Copy the config to nuttx.config
cp .config nuttx.config
## Copy NuttX Binary Image, Device Tree and
## Initial RAM Disk to TFTP Folder
cp nuttx.bin $HOME/tftproot/Image
cp jh7110-star64-pine64.dtb $HOME/tftproot
cp initrd $HOME/tftproot
## Boot NuttX over TFTP:
## https://lupyuen.github.io/articles/semihost#appendix-boot-nuttx-over-tftp-with-initial-ram-disk
Here's the Star64 Output Log...
U-Boot SPL 2021.10 (Jan 19 2023 - 04:09:41 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : StarFive VisionFive V2
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 4000000Hz
Platform Console Device : uart8250
Platform HSM Device : jh7110-hsm
Platform PMU Device : ---
Platform Reboot Device : pm-reset
Platform Shutdown Device : pm-reset
Firmware Base : 0x40000000
Firmware Size : 288 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01 : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000040200000
Domain0 Next Arg1 : 0x0000000042200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 1
Boot HART Domain : root
Boot HART Priv Version : v1.11
Boot HART Base ISA : rv64imafdcbx
Boot HART ISA Extensions : none
Boot HART PMP Count : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
U-Boot 2021.10 (Jan 19 2023 - 04:09:41 +0800), Build: jenkins-github_visionfive2-6
CPU: rv64imacu
Model: StarFive VisionFive V2
DRAM: 8 GiB
MMC: sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
StarFive EEPROM format v2
--------EEPROM INFO--------
Vendor : PINE64
Product full SN: STAR64V1-2310-D008E000-00000003
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:75:5d
Ethernet MAC1 address: 6c:cf:39:00:75:5e
--------EEPROM INFO--------
In: serial@10000000
Out: serial@10000000
Err: serial@10000000
Model: StarFive VisionFive V2
Net: eth0: ethernet@16030000, eth1: ethernet@16040000
Card did not respond to voltage select! : -110
Card did not respond to voltage select! : -110
bootmode flash device 0
Card did not respond to voltage select! : -110
Hit any key to stop autoboot: 0
Card did not respond to voltage select! : -110
Couldn't find partition mmc 0:3
Can't set block device
Importing environment from mmc0 ...
Card did not respond to voltage select! : -110
Couldn't find partition mmc 1:2
Can't set block device
## Warning: defaulting to text format
## Error: "boot2" not defined
Card did not respond to voltage select! : -110
ethernet@16030000 Waiting for PHY auto negotiation to complete...... done
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
*** Unhandled DHCP Option in OFFER/ACK: 43
*** Unhandled DHCP Option in OFFER/ACK: 43
DHCP client bound to address 192.168.x.x (784 ms)
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'boot.scr.uimg'.
Load address: 0x43900000
Loading:
TFTP server died; starting again
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 43
*** Unhandled DHCP Option in OFFER/ACK: 43
DHCP client bound to address 192.168.x.x (540 ms)
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'boot.scr.uimg'.
Load address: 0x40200000
Loading:
TFTP server died; starting again
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'Image'.
Load address: 0x40200000
Loading: #################################################################
. #################################################################
. #############
. 7 MiB/s
done
Bytes transferred = 2097800 (200288 hex)
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'jh7110-star64-pine64.dtb'.
Load address: 0x46000000
Loading: ####
. 5.3 MiB/s
done
Bytes transferred = 50235 (c43b hex)
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'initrd'.
Load address: 0x46100000
Loading: #################################################################
. #################################################################
. #################################################################
. ############################T #########################T ############
. #################################################################
. #################################################################
. #################################################################
. #################################################################
. #####################
. 702.1 KiB/s
done
Bytes transferred = 7930880 (790400 hex)
## Flattened Device Tree blob at 46000000
Booting using the fdt blob at 0x46000000
Using Device Tree in place at 0000000046000000, end 000000004600f43a
Starting kernel ...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
123067DFHBCInx_start: Entry
uart_register: Registering /dev/console
uart_register: Registering /dev/ttyS0
work_start_lowpri: Starting low-priority kernel worker thread(s)
board_late_initialize:
nx_start_application: Starting init task: /system/bin/init
elf_symname: Symbol has no name
elf_symvalue: SHN_UNDEF: Failed to get symbol name: -3
elf_relocateadd: Section 2 reloc 2: Undefined symbol[0] has no name: -3
nx_start_application: ret=3
up_exit: TCB=0x404088d0 exiting
nx_start: CPU0: Beginning Idle Loop
WIP: Apache NuttX RTOS for Pine64 Star64 JH7110 RISC-V SBC (Kernel Mode)
Read the article...
See below for the Build Outputs. We built NuttX with these steps...
## Install the Build Prerequisites and Toolchain:
## https://lupyuen.github.io/articles/nuttx#install-prerequisites
## https://lupyuen.github.io/articles/riscv#appendix-download-toolchain-for-64-bit-risc-v
## Download the `star64a` branch of our WIP NuttX Repos
mkdir nuttx
cd nuttx
git clone --branch star64a https://github.com/lupyuen2/wip-pinephone-nuttx nuttx
git clone --branch star64a https://github.com/lupyuen2/wip-pinephone-nuttx-apps apps
## Configure and build NuttX
cd nuttx
tools/configure.sh rv-virt:knsh64
make
## We assume that `nuttx` contains the NuttX ELF Image.
## Export the NuttX Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Copy the config to nuttx.config
cp .config nuttx.config
## To boot NuttX on Star64, we prepare the Armbian MicroSD Card:
## Download the Armbian Image (Minimal) for Star64: https://www.armbian.com/star64/
## Or pick the latest Star64 Minimal Image: https://github.com/armbianro/os/releases/
## Uncompress the `.xz` file. Write the `.img` file to a microSD Card with
## Balena Etcher: https://www.balena.io/etcher/
## or GNOME Disks: https://wiki.gnome.org/Apps/Disks
## Fix the Missing Device Tree in the Armbian MicroSD Card:
sudo chmod go+w /run/media/$USER/armbi_root/boot
sudo chmod go+w /run/media/$USER/armbi_root/boot/dtb/starfive
cp \
/run/media/$USER/armbi_root/boot/dtb/starfive/jh7110-visionfive-v2.dtb \
/run/media/$USER/armbi_root/boot/dtb/starfive/jh7110-star64-pine64.dtb
## Delete Linux Kernel `/boot/Image`
rm /run/media/$USER/armbi_root/boot/Image
## Copy `nuttx.bin` to Linux Kernel `/boot/Image`
cp nuttx.bin /run/media/$USER/armbi_root/boot/Image
## Insert the MicroSD Card into Star64 and power up.
## Or try Network Booting with TFTP (instead of MicroSD):
## https://lupyuen.github.io/articles/tftp
Here's the Star64 Output Log...
U-Boot SPL 2021.10 (Jan 19 2023 - 04:09:41 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : StarFive VisionFive V2
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 4000000Hz
Platform Console Device : uart8250
Platform HSM Device : jh7110-hsm
Platform PMU Device : ---
Platform Reboot Device : pm-reset
Platform Shutdown Device : pm-reset
Firmware Base : 0x40000000
Firmware Size : 288 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01 : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000040200000
Domain0 Next Arg1 : 0x0000000042200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 1
Boot HART Domain : root
Boot HART Priv Version : v1.11
Boot HART Base ISA : rv64imafdcbx
Boot HART ISA Extensions : none
Boot HART PMP Count : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
U-Boot 2021.10 (Jan 19 2023 - 04:09:41 +0800), Build: jenkins-github_visionfive2-6
CPU: rv64imacu
Model: StarFive VisionFive V2
DRAM: 8 GiB
MMC: sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
StarFive EEPROM format v2
--------EEPROM INFO--------
Vendor : PINE64
Product full SN: STAR64V1-2310-D008E000-00000003
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:75:5d
Ethernet MAC1 address: 6c:cf:39:00:75:5e
--------EEPROM INFO--------
In: serial@10000000
Out: serial@10000000
Err: serial@10000000
Model: StarFive VisionFive V2
Net: eth0: ethernet@16030000, eth1: ethernet@16040000
Card did not respond to voltage select! : -110
Card did not respond to voltage select! : -110
bootmode flash device 0
Card did not respond to voltage select! : -110
Hit any key to stop autoboot: 0
Card did not respond to voltage select! : -110
Couldn't find partition mmc 0:3
Can't set block device
Importing environment from mmc0 ...
Card did not respond to voltage select! : -110
Couldn't find partition mmc 1:2
Can't set block device
## Warning: defaulting to text format
## Error: "boot2" not defined
Card did not respond to voltage select! : -110
ethernet@16030000 Waiting for PHY auto negotiation to complete....... done
BOOTP broadcast 1
BOOTP broadcast 2
*** Unhandled DHCP Option in OFFER/ACK: 43
*** Unhandled DHCP Option in OFFER/ACK: 43
DHCP client bound to address 192.168.x.x (773 ms)
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'boot.scr.uimg'.
Load address: 0x43900000
Loading:
TFTP server died; starting again
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 43
*** Unhandled DHCP Option in OFFER/ACK: 43
DHCP client bound to address 192.168.x.x (545 ms)
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'boot.scr.uimg'.
Load address: 0x40200000
Loading:
TFTP server died; starting again
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'Image'.
Load address: 0x40200000
Loading: #################################################################
. #################################################################
. #############
. 7.3 MiB/s
done
Bytes transferred = 2097832 (2002a8 hex)
Using ethernet@16030000 device
TFTP from server 192.168.x.x; our IP address is 192.168.x.x
Filename 'jh7110-star64-pine64.dtb'.
Load address: 0x46000000
Loading: ####
. 5.3 MiB/s
done
Bytes transferred = 50235 (c43b hex)
## Flattened Device Tree blob at 46000000
Booting using the fdt blob at 0x46000000
Using Device Tree in place at 0000000046000000, end 000000004600f43a
Starting kernel ...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
123067DFHBCqemu_rv_kernel_mappings: map I/O regions
qemu_rv_kernel_mappings: map kernel text
qemu_rv_kernel_mappings: map kernel data
qemu_rv_kernel_mappings: connect the L1 and L2 page tables
qemu_rv_kernel_mappings: map the page pool
qemu_rv_mm_init: mmu_enable: satp=1077956608
Inx_start: Entry
elf_initialize: Registering ELF
uart_register: Registering /dev/console
uart_register: Registering /dev/ttyS0
work_start_lowpri: Starting low-priority kernel worker thread(s)
nx_start_application: Starting init task: /system/bin/init
load_absmodule: Loading /system/bin/init
elf_loadbinary: Loading file: /system/bin/init
elf_init: filename: /system/bin/init loadinfo: 0x404069e8
host_call: nbr=0x1, parm=0x40406788, size=24
_assert: Current Version: NuttX 12.0.3 c994f46 Jul 17 2023 18:06:52 risc-v
_assert: Assertion failed panic: at file: common/riscv_hostfs.c:58 task: Idle Task 0x40200cd0
up_dump_register: EPC: 000000004020f590
up_dump_register: A0: 0000000040401630 A1: 000000000000003a A2: 0000000040219ee8 A3: 0000000000000000
up_dump_register: A4: 000000000000000a A5: 0000000000000000 A6: 0000000000000009 A7: 0000000000000068
up_dump_register: T0: 0000000000000030 T1: 0000000000000009 T2: 0000000000000020 T3: 000000000000002a
up_dump_register: T4: 000000000000002e T5: 00000000000001ff T6: 000000000000002d
up_dump_register: S0: 0000000000000000 S1: 0000000040400b28 S2: 0000000040401768 S3: 0000000040219ee8
up_dump_register: S4: 0000000040229b08 S5: 000000000000003a S6: 0000000000000000 S7: 0000000000000000
up_dump_register: S8: 00000000fff47194 S9: 0000000000000000 S10: 0000000000000000 S11: 0000000000000000
up_dump_register: SP: 0000000040406650 FP: 0000000000000000 TP: 0000000000000001 RA: 000000004020f590
dump_stack: User Stack:
dump_stack: base: 0x40406030
dump_stack: size: 00003024
dump_stack: sp: 0x40406650
stack_dump: 0x40406640: 40406650 00000000 4020f688 00000000 00000000 00000000 40212bc8 00000000
stack_dump: 0x40406660: deadbeef deadbeef 40406680 00000000 deadbeef deadbeef 7474754e 00000058
stack_dump: 0x40406680: 404066b8 00000000 00000001 00000000 40406788 00000000 40205cc0 00000000
stack_dump: 0x404066a0: 00000074 00000000 fffffff8 2e323100 00332e30 00000000 40229ae0 00000000
stack_dump: 0x404066c0: 39636708 34663439 754a2036 3731206c 32303220 38312033 3a36303a 00003235
stack_dump: 0x404066e0: 40205cc0 00000000 0000000a 00000000 00000000 73697200 00762d63 00000000
stack_dump: 0x40406700: ffff9fef ffffffff 40406740 00000000 fff47194 00000000 00000000 00000000
stack_dump: 0x40406720: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x40406740: 40408720 00000000 40406968 00000000 00000000 00000000 40204e80 00000000
stack_dump: 0x40406760: 00000074 00000000 40213e3c 00000000 fff47194 00000000 40213e64 00000000
stack_dump: 0x40406780: ...
WIP: Apache NuttX RTOS for Pine64 Star64 JH7110 RISC-V SBC
Read the article...
See below for the Build Outputs. We built NuttX with these steps...
## Install the Build Prerequisites and Toolchain:
## https://lupyuen.github.io/articles/nuttx#install-prerequisites
## https://lupyuen.github.io/articles/riscv#appendix-download-toolchain-for-64-bit-risc-v
## Download the `star64` branch of our WIP NuttX Repos
mkdir nuttx
cd nuttx
git clone --branch star64 https://github.com/lupyuen2/wip-pinephone-nuttx nuttx
git clone --branch star64 https://github.com/lupyuen2/wip-pinephone-nuttx-apps apps
## Configure and build NuttX
cd nuttx
tools/configure.sh rv-virt:knsh64
make menuconfig
## In Build Setup > Debug Options,
## Enable Warnings Output, Info Debug Output, Debug Assertions Show Expression
## Save and exit menuconfig
make
## We assume that `nuttx` contains the NuttX ELF Image.
## Export the NuttX Binary Image to `nuttx.bin`
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
-t -S --demangle --line-numbers --wide \
nuttx \
>nuttx.S \
2>&1
## Copy the config to nuttx.config
cp .config nuttx.config
## To boot NuttX on Star64, we prepare the Armbian MicroSD Card:
## Download the Armbian Image (Minimal) for Star64: https://www.armbian.com/star64/
## Or pick the latest Star64 Minimal Image: https://github.com/armbianro/os/releases/
## Uncompress the `.xz` file. Write the `.img` file to a microSD Card with
## Balena Etcher: https://www.balena.io/etcher/
## or GNOME Disks: https://wiki.gnome.org/Apps/Disks
## Fix the Missing Device Tree in the Armbian MicroSD Card:
sudo chmod go+w /run/media/$USER/armbi_root/boot
sudo chmod go+w /run/media/$USER/armbi_root/boot/dtb/starfive
cp \
/run/media/$USER/armbi_root/boot/dtb/starfive/jh7110-visionfive-v2.dtb \
/run/media/$USER/armbi_root/boot/dtb/starfive/jh7110-star64-pine64.dtb
## Delete Linux Kernel `/boot/Image`
rm /run/media/$USER/armbi_root/boot/Image
## Copy `nuttx.bin` to Linux Kernel `/boot/Image`
cp nuttx.bin /run/media/$USER/armbi_root/boot/Image
## Insert the MicroSD Card into Star64 and power up.
## Or try Network Booting with TFTP (instead of MicroSD):
## https://lupyuen.github.io/articles/tftp
We use rv-virt:knsh64
(NuttX Kernel Mode) instead of rv-virt:nsh64
(NuttX Flat Mode) so that NuttX will run in RISC-V Supervisor Mode. (Instead of RISC-V Machine Mode)
Here's the Star64 Output Log...
U-Boot SPL 2021.10 (Jan 19 2023 - 04:09:41 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : StarFive VisionFive V2
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 4000000Hz
Platform Console Device : uart8250
Platform HSM Device : jh7110-hsm
Platform PMU Device : ---
Platform Reboot Device : pm-reset
Platform Shutdown Device : pm-reset
Firmware Base : 0x40000000
Firmware Size : 288 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01 : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000040200000
Domain0 Next Arg1 : 0x0000000042200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 1
Boot HART Domain : root
Boot HART Priv Version : v1.11
Boot HART Base ISA : rv64imafdcbx
Boot HART ISA Extensions : none
Boot HART PMP Count : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
U-Boot 2021.10 (Jan 19 2023 - 04:09:41 +0800), Build: jenkins-github_visionfive2-6
CPU: rv64imacu
Model: StarFive VisionFive V2
DRAM: 8 GiB
MMC: sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
StarFive EEPROM format v2
--------EEPROM INFO--------
Vendor : PINE64
Product full SN: STAR64V1-2310-D008E000-00000003
data version: 0x2
PCB revision: 0xc1
BOM revision: A
Ethernet MAC0 address: 6c:cf:39:00:75:5d
Ethernet MAC1 address: 6c:cf:39:00:75:5e
--------EEPROM INFO--------
In: serial@10000000
Out: serial@10000000
Err: serial@10000000
Model: StarFive VisionFive V2
Net: eth0: ethernet@16030000, eth1: ethernet@16040000
switch to partitions #0, OK
mmc1 is current device
found device 1
bootmode flash device 1
** Invalid partition 3 **
Couldn't find partition mmc 1:3
Can't set block device
** Invalid partition 3 **
Couldn't find partition mmc 1:3
Can't set block device
Hit any key to stop autoboot: 2 ��� 1 ��� 0
** Invalid partition 3 **
Couldn't find partition mmc 1:3
Can't set block device
Importing environment from mmc1 ...
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
** Invalid partition 2 **
Couldn't find partition mmc 1:2
Can't set block device
## Warning: defaulting to text format
## Error: "boot2" not defined
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
383 bytes read in 7 ms (52.7 KiB/s)
1:�[6CArmbian
Retrieving file: /boot/uInitrd
10911538 bytes read in 466 ms (22.3 MiB/s)
Retrieving file: /boot/Image
2097832 bytes read in 95 ms (21.1 MiB/s)
append: root=UUID=99f62df4-be35-475c-99ef-2ba3f74fe6b5 console=ttyS0,115200n8 console=tty0 earlycon=sbi rootflags=data=writeback stmmaceth=chain_mode:1 rw rw no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 splash plymouth.ignore-serial-consoles
Retrieving file: /boot/dtb/starfive/jh7110-star64-pine64.dtb
50235 bytes read in 13 ms (3.7 MiB/s)
## Loading init Ramdisk from Legacy Image at 46100000 ...
Image Name: uInitrd
Image Type: RISC-V Linux RAMDisk Image (gzip compressed)
Data Size: 10911474 Bytes = 10.4 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 46000000
Booting using the fdt blob at 0x46000000
Using Device Tree in place at 0000000046000000, end 000000004600f43a
Starting kernel ...
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
123067DFAGHBCI[ 1
301