OpenRISC / de0 nano resources ============================= :Date: Sept 12th, 2013 :modified: 2018-09-03 :category: Programming :slug: intro-openrisc :tags: lab notes .. sectnum:: .. contents:: Lab notes --------- Day 1. 1. got a de0 nano. 2. installed Lubuntu 13.04 in VirtualBox, 32-bit, 6GB space. 3. tried to install the Altera Quartus II suite. Not enough space. 4. bigger HD image: 10GB. 5. installed the tools. Fits. 6. tried to download/install OpenRISC tools. Not enough space. 7. ordered external SSD drive. Day 2, new HD delivered. 1. configured/installed VirtualBox/Lubuntu again, 30GB HD space. 2. installed Quartus II suite from Altera, OK. 3. installed the **or1k-elf-** tool chain (binutils, gcc) as per OpenCores wiki, OK. Day 3. 1. looked at OpenCores wiki page on FPGA dev boards, saw a reference to a pre-build image from Stefan K from October 2012. 2. ``quartus_pgm`` complains that it cannot find a JTAG hardware. 3. (lots of search / trying things out afterwards) Quartus II 10.1 as shipped on the de0 nano DVD can't work directly with Ubuntu 13.04 because it required usbdevfs mounted /proc/bus/usb and Ubuntu does not provide that. 4. Used a workaround to make /proc/bus/usb available. 5. uploaded Stefan K's prebuilt image to the board. OK. 6. found the UART pin assignments from a file ``UART0_pin_assignments.tcl`` in Stefan's orpsoc repository. Says PIN_C16 and PIN_D15, which according to the de0 manual map to GPIO_23 and GPIO_25 at the back of the board. 7. Missing some cables to connect to the configured UART. 8. upgraded Quartus II install to 13sp1. 9. wrote this doc. 10. discovered the OpTiMSoC project which provides ready-to-use VirtualBox images. 11. discovered the "new OpenRISC SoC dev board" page on the OpenRISC wiki. Things to do: find some cables to connect to the image already flashed to the de0 nano. Build own linux image. Build own orpsoc image. Check the OpTiMSoC virtualbox image out. Learned on the way: - Quartus tools are required to upload an image to the board (``quartus_pgm``). - Both the SoC bitstream and the linux kernel image can be integrated into one image that flashes both the FPGA and attached SPI flash. The orpsoc image can boot from the SPI flash. - binutils, gcc, built for target "or1k-elf", are required to build the linux kernel and other binaries. - Quartus tools are required to build orpsoc and core Verilog code to FPGA bitstream. - pre-built bitstreams available from various people (ask on IRC). Web Resources ------------- - September 2013. `git.openrisc.net :: Source code repositories`__, mirrored (partially?) on GitHub__. Main Contributors: Stefan Kristiansson, Julius Baxter, Jonas Bonn. Sources for the binutils, gcc, llvm, linux kernel, orpsoc, other things. (Unclear which version is authoritative, but git.openrisc.net seems to have more activity.) .. __: http://git.openrisc.net/ .. __: https://github.com/openrisc/ - August 2013. `opencores.org :: or1k wiki :: OpenRISC tool chain`__. Editors: Olof Kindgren, Stefan Kristiansson, Julius Baxter. Explains how to build the binutils, gcc, newlib, uClibc from source. Note from August 2013: **Note: There is an ongoing transition away from the or32- prefix to or1k-. In practice this means that the stable toolchain uses the old CPU target or32 (e.g. or32-elf, or32-linux), while the new/developemnt toolchain uses or1k (eg. or1k-elf, or1k-linux). Please consider using the new or1k toolchain - especially if you're building straight from the development repos and don't have any issues with backwards compatibility.** .. __: http://opencores.org/or1k/OpenRISC_GNU_tool_chain - August 2013. `OpTiMSoC`__. Maintainers: Stefan Wallentowitz, Philipp Wagner, Michael Tempelmeier. An integrated framework for a multi-core OpenRISC in simulation and FPGA, from Technische Universität Munchen. .. __: http://optimsoc.org/ Sub-resources: - June 2013: `optimsoc.org :: Get OpTiMSoC`__ - downloadable Virtual Box image, running Xubuntu .. __: http://optimsoc.org/download.html - April 2013: `arXiv.org :: Open Tiled Manycore System-on-Chip`__ - OpTiMSoC tech report, edited regularly .. __: http://arxiv.org/abs/1304.5081 - February 2013. `opencores.org :: or1k wiki :: FPGA Development Boards`__. Editors: Rdeyi, Stefan Kristiansson, Julius Baxter, Olof Kindgren. .. __: http://opencores.org/or1k/FPGA_Development_Boards - 2012. `altera.com :: DE0-Nano User Manual`__. .. __: http://www.altera.com/education/univ/materials/boards/de0-nano/unv-de0-nano-board.html - October 2012. `kevinmehall :: Getting Started with OpenRISC`__. Author: Kevin Mehall. **Partially outdated, refers to 'older' tool versions.** .. __: http://kevinmehall.net/openrisc/guide/ - December 2011. `opencores.org :: or1k wiki :: Ubuntu VirtualBoximage updates and information`__. **Probably outdated.** .. __: http://opencores.org/or1k/Ubuntu_VirtualBox-image_updates_and_information - November 2011. `opencores.org :: or1k wiki :: The NEW OpenRISC System-on-Chip FPGA development board`__. Contains the same FPGA chip as the de0 nano, but has more I/O devices. 2-3x more expensive. .. __: http://opencores.org/or1k/Ordb2a-ep4ce22 - July 2011. `openrisc.net :: Building the OpenRISC Toolchain`__. Author(s) unknown. **OUTDATED** .. __: http://openrisc.net/toolchain-build.html Snippets -------- - The Quartus II delivered on DVD with the de0 nano board (v10.1) does not work directly with Ubuntu 13.04. In particular its JTAG flashing component requires usbfs in /proc/bus/usb which is disabled in the latest versions of Ubuntu. Solutions: - Install Quartus II 13+ from the Altera web site. This can use /sys/bus/usb directly; or - alternatively, work around the problem using the following:: sudo killall jtagd sudo chmod 755 /sys/kernel/debug/usb/devices sudo chmod 755 /sys/kernel/debug/usb sudo chmod 755 /sys/kernel/debug sudo mount --bind /dev/bus /proc/bus sudo ln -s /sys/kernel/debug/usb/devices /proc/bus/usb/devices - The guide from Kevin Mehall suggests uploading the Linux kernel to the board via the USBBlaster link and an OCD utility. Instead, it is possible to flash the vmlinux image on the board so it can boot autonomously. Use the following snippet (courtesy of Stefan K.):: rm linux/vmlinux.bin.gz orpsoc.jic make -C linux -j3 make -C u-boot -j3 gzip linux/vmlinux.bin u-boot/tools/mkimage -A or1k -T kernel -C gzip -a 0 -e 0x100 -d linux/vmlinux.bin.gz uImage.bin orpsoc/sw/utils/bin2binsizeword u-boot/u-boot.bin bu-boot.bin bin2hex.py uImage.bin uImage.hex bin2hex.py bu-boot.bin bu-boot.hex cp orpsoc/boards/altera/de0_nano/syn/quartus/run/orpsoc.sof ./ quartus_cpf -c orpsoc.cof quartus_pgm --mode=jtag -o pi\;orpsoc.jic People ------ - Olof Kindgren / irc: olofk / OpenCores: `olof`__ / SE .. __: http://opencores.org/acc,view,olof - Stefan Kristiansson / irc: stekern / OpenCores: `stekern`__ / SE .. __: http://opencores.org/acc,view,stekern - Julius Baxter / irc: juliusb / OpenCores: `julius`__ / UK .. __: http://opencores.org/acc,view,julius - Jonas Bonn / / OpenCores: `jonibo`__ / `South Pole`_ / SE .. __: :http://opencores.org/acc,view,olof .. _`South Pole`: http://southpole.se - Jeremy Benett / / OpenCores: `jeremybenett`__ / `Embecosm`_ / UK .. __: http://opencores.org/acc,view,jeremybennett .. _Embecosm: http://embecosm.com/ - Stefan Wallentowitz / / TUM_ .. _`TUM`: http://optimsoc.org/about.html - Philipp Wagner / / TUM_ - Michael Tempelmeier / / TUM_