The code is based on Xilinx Application Note XAPP058 and the code provided with it.
An example EDK project can be downloaded here.
The idea is to:
- run the system provided on a NEXYS-2 board.
- connect the JTAG port of a another FPGA/ FPGA board to GPIO of the first one.
- download the configuration file for the devices on the second board in XSVF format to the RAM of the NEXYS-2 board.
- run the XSVF player on the NEXYS-2 board in order to configure the devices on the second board.
A. Prepare the configuration file for the device(s) you want to configure:
- Create BIT file(s) for the devices you want to configure.
- Use Xilinx IMPACT tool to create an XSVF file for the device(s) you want to configure. This works simply by running impact in GUI mode, setting up a project with all devices of the target board in the configuration chain and assigning BIT files.
The final step is then to go to Output -> XSVF File -> Create XSVF File in order to generate the XSVF configuration file that can be used by the XSVF player.
B. Create the hardware and software for the NEXYS-2 board:
- download the example EDK project, unzip it and open it in EDK.
- use Device Configuration -> Update Bitstream to create the BIT file for the NEXYS-2 board, which contains the MicroBlaze based hardware system.
- go to a console and change into the "code" subfolder within the EDK project folder.
- open the "Makefile" in a text editor and adjust the two variables EDK_PROJECT_PATH and EDK_LIB_PATH to point to the EDK project paths where you have unzipped it to on your harddisk.
- go back to the console and type Make to build the XSVF Player software application. Note that you now should have an ELF file "xsvf_player.elf" in the "code" folder.
C. Download and run the hardware and software system / configuration files:
- connect a Xilinx programming cable to the NEXYS-2 board.
- connect a serial cable to the NEXYS-2 and your PC for MicroBlaze OS printfs.
- connect the GPIO used for the XSVF Player to the JTAG port of the second board you want to configure.
- go to the top-level folder of your EDK project and configure the Spartan FPGA on the NEXYS-2 board:
impact -batch ./etc/download.cmd - go to the "code" folder containing the compiled ELF file of the XSVF Player.
- run the Xilinx Embedded Debugger XMD: xmd and download/ run the ELF file:
- connect mb mdm -cable type xilinx_platformusb port usb21
- stop
- dow -data
0xcbf00000 - dow JTAG_SVF_Player_MBlaze/xsvf_player.elf
- run
- exit
- after exiting XMD:
- change the serial port specified in the Python script "comm_mblaze.py" to the one where your NEXYS-2 board is attached, save and
- run the Python skript, which communicates with the FPGA:
- ./comm_mblaze.py
- when you are asked for input, type "R" and "Enter". This will then run the XSVF Player that reads the configuration file for the target device(s) from RAM and configure them.
Notes:
- The JTAG signals are written to a log-file on your computer if you specify the flag -DDEBUG_MODE in the Makefile (see Makefile).
- In case you do not have a target device attached, which can deliver appropriate TDO signals, you can do a DUMMY run by specifying -DDEBUG_TDO_DONTCARE in the Makefile (see Makefile).
- In the example above, you can store the XSVF configuration file wherever you want in the RAM, by specifying other addresses within the RAM (see item 9). Make sure to change the address in "defines.h" as well.