-
1Step 1
Try ANGEL, an in-browser RISC-V ISA Simulator that boots Linux
You can try out RISC-V without even leaving your browser! Click here to launch ANGEL.
-
2Step 2
Install QEMU, a fast ISA Simulator
Prereqs:
- Linux or Mac OSX
- C compiler (gcc)
Download the QEMU Source, either as a zip from Github, or using git:
$ git clone https://github.com/ucb-bar/riscv-qemu.git
Now,
cd
into the riscv-qemu directory and run the following. You may exclude the prefix argument, in which case you'll find theqemu-system-riscv
binary in theriscv-softmmu
directory after building. Otherwise, replace[Location to place binaries]
with the location in which you'd likeriscv-qemu
to be installed.$ ./configure --target-list=riscv-softmmu --prefix=[Location to place binaries] $ make $ make install # only run this if you specified a prefix above
Next, you'll need to download two more files, the precompiled riscv-linux kernel and a disk image with the filesystem:
At this point, ensure that the prefix location you specified above is on your path. If you opted not to include the prefix argument, enter into the
riscv-softmmu
directory, where theqemu-system-riscv
binary is located. Once you've downloaded both of the above files, we can go ahead and boot linux:$ qemu-system-riscv -hda [Location of root.bin] -kernel [Location of vmlinux] -nographic
You should see the linux boot messages fly by and will eventually come to an
ash
shell prompt:... init started: BusyBox v1.22.1 (2014-07-19 16:30:20 PDT) starting pid 18, tty '': '/bin/busybox mount -t proc proc /proc' starting pid 19, tty '': '/bin/busybox mount -t tmpfs tmpfs /tmp' starting pid 20, tty '': '/bin/busybox mount -o remount,rw /dev/htifbd0 /' starting pid 21, tty '': '/bin/busybox --install -s' starting pid 22, tty '/dev/console': '-/bin/ash ' BusyBox v1.22.1 (2014-07-19 16:30:20 PDT) built-in shell (ash) Enter 'help' for a list of built-in commands. / #
Congratulations! At this point you've booted Linux on a simulated RISC-V system. To exit the system cleanly, you should issue the halt command inside the simulated system, and then hit
Ctrl-a x
:$ halt -f Hit Ctrl-a x to exit qemu
If you'd like to learn more about
riscv-qemu
, see the Download page. -
3Step 3
Build your own RISC-V Computer with a Zybo or ZedBoard
How it works
Both the ZedBoard and the Zybo board contain Xilinx Zynq chips with an ARM processor tied to some programmable logic. We'll use the ARM core to bootstrap the RISC-V Rocket Core that we'll run on the programmable logic. Once we've started the RISC-V core, the ARM chip will simply act to emulate devices on the Host-Target Interface Bus (HTIF), like consoles and disks, while the Rocket Core takes care of all the heavy lifting.
You can obtain a Zybo or ZedBoard from various distributors online. From our experience, academic users can buy a Zybo for $125 or a ZedBoard for around $320.
Instructions
1) Connect the necessary cables to your board
If you're using the Zybo, you can either use Ethernet + USB or just USB
If you're using the ZedBoard, you should connect the power and either the USB or the Ethernet
2) Download the appropriate package
Download the appropriate package below, unzip it, and place the contents on the root of your SD Card
Zybo RISC-V Getting Started Pack
ZedBoard RISC-V Getting Started Pack
Once you've done this, the file structure on your SD Card should match the following:
SD_ROOT/ |-> riscv/ |-> root.bin |-> vmlinux |-> boot.bin |-> devicetree.dtb |-> uImage |-> uramdisk.image.gz
3) Login to the ARM System:
Insert the (micro)SD card into your Zybo/ZedBoard. At this point you have two options for logging in:
1) USB-UART
To connect over usb, do the following (the device name following tty. may vary):
$ screen /dev/tty.usbserial-210279575138B 115200,cs8,-parenb,-cstopb
2) Telnet
You may also connect over telnet using ethernet. The default IP address is
192.168.192.5
:$ telnet 192.168.192.5
In either case, you'll eventually be prompted to login to the ARM system. Both the username and password are
root
.4) Start Linux on the RISC-V Rocket Core
Once you're in, you'll need to mount the sd card so that we can access the files necessary to boot linux on the Rocket core. Do the following:
$ mkdir /sdcard $ mount /dev/mmcblk0p1 /sdcard
Finally, we can go ahead and boot linux on the Rocket core:
$ ./fesvr-zedboard +disk=/sdcard/riscv/root.bin /sdcard/riscv/vmlinux
You should see the linux boot messages fly by and will eventually come to an
ash
shell prompt:... init started: BusyBox v1.22.1 (2014-07-19 16:30:20 PDT) starting pid 18, tty '': '/bin/busybox mount -t proc proc /proc' starting pid 19, tty '': '/bin/busybox mount -t tmpfs tmpfs /tmp' starting pid 20, tty '': '/bin/busybox mount -o remount,rw /dev/htifbd0 /' starting pid 21, tty '': '/bin/busybox --install -s' starting pid 22, tty '/dev/console': '-/bin/ash ' BusyBox v1.22.1 (2014-07-19 16:30:20 PDT) built-in shell (ash) Enter 'help' for a list of built-in commands. / #
Congratulations! At this point you've booted Linux on a simulated RISC-V system. If you'd like to learn more about the RISC-V FPGA Infrastructure, see the Download page.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.