|
|
# Demo
|
|
|
# How to Build / Use the Demo
|
|
|
|
|
|
## Synthesize the HDL
|
|
|
|
|
|
- Demo source is found in pexaria2a-wishbone-demo.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 device
|
|
|
|
|
|
- Open quartus
|
|
|
- Tools, Programmer
|
|
|
- Hardware Setup to detect your programmer (we use the USB-Blaster)
|
|
|
- Attach the Pexaria2a adapter to the Pexaria2a and your JTAG
|
|
|
programmer
|
|
|
- Power the Pexaria2a
|
|
|
- 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 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 firmware
|
|
|
|
|
|
- Extract it from the archive
|
|
|
- Enter the folder in a linux console
|
|
|
- Run 'make'
|
|
|
- You should now have a 'blink.elf' file suitable for the LM32
|
|
|
|
|
|
## Load the blink demo
|
|
|
|
|
|
- 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 "rite dev/pcie\_wb0 0x100400/4 0xff"
|
|
|
|
|
|
|
|
|
|
... | ... | |