How to use the Pexaria2a Demo
Synthesize the HDL
- Demo source is found in pexaria2a-wishbone-demo-0.1.tar.xz on this page.
- Read-only source is located at git:https://www.ohwr.org/hdl-core-lib/general-cores.git branch master
- Developer source is located at git@ohwr.org:hdl-core-lib/general-cores.git branch master
- The project to synthesize is in syn/gsi_pexaria2a/wishbone_demo/wishbone_demo.qpf
- There should be no critical warnings
- The 558 warnings are normal... sadly.
Install the Pexaria2a card
- You can power it from any PCIe v1.1+ 4-lane slot
- You can power it from the external power input
- If you power it by PCIe, be aware that after programming the FPGA, the host system must be SOFT rebooted in order to see the device. A hard reset will depower the device and lose the programming.
Program the Pexaria2
- Attach the Pexaria2a adapter to the Pexaria2a and your JTAG programmer
- Power the Pexaria2a
- Open quartus
- Tools, Programmer
- Hardware Setup to detect your programmer (we use the USB-Blaster)
- Delete any existing device from the list and run 'auto detect' to find the device
- Fill in the "File" field with the 'sof' file generated by quartus (double-click it)
- Select the Program/Configure checkbox
- Start
Confirm access to the Wishbone bus using the LM32 over JTAG
- Close the programmer (and Signal Tap)
- Edit the lm32-ctl script, line 4, to set the path to quartus_stp on your system
- Run the 'lm32-ctl' from the linux console
- If it opens to the "lm32>" prompt, try writing and reading values to the LEDs:
- write 0x100400 0x55
Install the lm32 compiler toolchain
- The toolchain is compiled for 32-bit linux, so if you run 64-bit linux install the 32-bit compatibility libraries (called ia32-libs in debian)
- Extract cross compiler somewhere on your system
- When running the compiler, ensure the bin/ folder is in your PATH and the lib/ folder is in your LD_LIBRARY_PATH
- I achieve this by using a small shell script wrapper:
#! /bin/bash
export LD_LIBRARY_PATH=/my-path-to/lm32/lib
export PATH=/my-path-to/lm32/bin:$PATH
exec "/my-path-to/lm32/bin/`basename $0`" "$@"
Compile the blink-demo LM32 firmware
- Extract it from the archive 'blink-demo-0.1.tar.xz' on this page.
- There is no git repository for this little example I whipped up, just the attached sourceball.
- Enter the blink-demo folder in a linux console
- Run 'make'
- You should now have a 'blink.elf' file suitable for the LM32 over JTAG and a 'blink.bin' suitable for programming over PCIe
Load the blink demo over JTAG
- Enter the blink-demo folder
- Execute lm32-ctl
- load blink.elf
- You should now see the LEDs cycling
Configure the PCIe linux driver
- Install linux, including kernel sources/headers for your system
- Decompress the driver, pcie_wb-0.1.tar.xz, on this page.
- The driver is also available from git at git:https://www.ohwr.org/hdl-core-lib/etherbone-core.git branch pcie folder driver
- Enter the folder and run: make
- As root run: make install
- Program the Pexaria2a
- Reboot the system
- You should see a device /dev/pcie_wb0, a loaded module called "pcie_wb", and a kernel message (dmesg) like "pcie_wb 0000:01:00.0: irq 43 for MSI/MSI-X"
Compile the Etherbone library
- Decompress the library, etherbone-api.tar.xz, on this page.
- The driver is also available from git at git:https://www.ohwr.org/hdl-core-lib/etherbone-core.git branch master folder api
- Enter the folder
- Run "make"
- As root run "make install"
- Confirm the Wishbone bus is available "eb-ls dev/pcie_wb0"; you should see three devices
- Play with the LEDs "eb-write dev/pcie_wb0 0x100400/4 0xff"
Program the LM32 over the PCIe bus
- Raise the LM32 reset line (to stop it running / clear I-cache): "eb-write dev/pcie_wb0 0x100404/4 0x1"
- Program the LM32 using the blink 'bin' file: "eb-load dev/pcie_wb0 0 blink.bin"
- Release the CPU from reset: "eb-write dev/pcie_wb0 0x100404/4 0x0"
- The LEDs should now be rotating