Running ORPSoC on DE0 Nano

Rui Zhang
3 min readFeb 24, 2016

--

Step 0: OpenRISC GNU Toolchain Installation

See my previous article about how to compile and install OpenRISC GNU toolchain here.

Step 1: Altera Quartus Installation

Download Quartus-web-13.0.1.232-linux.tar from here.

Add /path-to/quartus/bin directory to the end of your $PATH variable in your .bashrc file. For example:

export ALTERA_PATH=/path-to/altera/13.0sp1
export PATH=$PATH:$ALTERA_PATH/quartus/bin

Step 2: OpenOCD Installation

Download and install OpenOCD:

git clone git://repo.or.cz/openocd.git
./bootstrap
./configure --enable-ftdi --enable-usb_blaster_libftdi --enable-maintainer-mode
make
make install
cd ..

Troubleshooting:

  1. Missing packages. You should install these packages: autoconf, pkg-config, automake, libtool, libusb-1.0–0-dev, libtclcl1-dev, libftdi-dev.
  2. TCL error message during configuration. If you have already installed the Altera Quartus suite and its quartus/bin directory is in your $PATH then remove it while you configure and build OpenOCD.

Step 3: Programming the FPGA

Plug the DE0 Nano FPGA board into your PC via the USB cable.

quartus_pgm --mode=jtag -o p\;/path-to/de0_nano_orconf2013.sof

It works if you see the following messages:

Info (209017): Device 1 contains JTAG ID code 0x020F30DD
Info (209007): Configuration succeeded -- 1 device(s) configured
Info (209011): Successfully performed operation(s)

Troubleshooting:

  1. If you get an error message about the sof file being corrupted, it is very likely that you are using the wrong version of Quartus. You should use version 13.0sp1.
  2. If you get an error message: Can’t scan JTAG chain. Error code 89. You should do the following:

sudo killall jtagd
which jtagd
sudo `which jtagd`

And try to program again.

Step 4: Attach the Debug Proxy

Go to the OpenOCD directory in which everything was compiled and run:

sudo ./src/openocd -s ./tcl -f ./tcl/interface/altera-usb-blaster.cfg -f ./tcl/board/or1k_generic.cfg

It works if you see the following messages:

Info : only one transport option; autoselect 'jtag'
Info : vjtag tap selected
Info : adv debug unit selected
Info : Option 1 is passed to adv debug unit adapter speed: 3000 kHz
Info : No lowlevel driver configured, will try them all
Info : usb blaster interface using libftdi
Info : This adapter doesn't support configurable speed
Info : JTAG tap: or1200.cpu tap/device found: 0x020f30dd (mfg: 0x06e, part: 0x20f3, ver: 0x0)
Info : adv debug unit is configured with option ADBG_USE_HISPEED
Halting processor
Chip is or1200.cpu, Endian: big, type: or1k
Target ready...

Troubleshooting:

  1. If you get the error message: JTAG tap: or1200.cpu expected 1 of 1: 0x020b30dd. You can open the following file from the OpenOCD tree: tcl/board/or1k_generic.cfg. And change this line: set FPGATAPID 0x020b30dd to set FPGATAPID 0x020f30dd.

Step 5: Physically Attach the UART

Attach the UART as shown below:

Open a second terminal:

sudo chmod a+rwx /dev/ttyUSB0
screen /dev/ttyUSB0 115200

Step 6: Download Demo Bare-Metal Software

Download the pre-compiled demo bare-metal software timerled from here.

Step 7: Download and Run OpenRISC Software on SoC

Open a third terminal and use telnet to connect to OpenOCD:

telnet localhost 4444

Download and run the demo program:

halt; load_image /<path to your>/orconf2013/sw/timer/timer; reg npc 0x100; resume

It may be required to reset the board once the software has been downloaded:

reset
resume

Step 8: Run Linux

Download the pre-compiled Linux kernel from here. And Load it with the following method via telnet:

halt; load_image /work/orpsoc-build/vmlinux-de0_nano; reset

Hopefully, you will see Linux booting up.

Instead of OpenOCD, GDB can also be used in step 7 and 8. Open a third terminal:

or1k-elf-gdb
(gdb) target remote localhost:3333
(gdb) file /path-to/vmlinux-de0_nano
(gdb) load
(gdb) jump *0x100

Hopefully again, you will see linux booting up.

--

--