Companion CD-ROM: board/software/fpga_config directory

The /board/software/fpga_config directory contains the source code and binary tools for configuring and testing the SPARTAN-XL FPGA without using KMD.

Bypassing KMD allows the test code to run at full speed on the target board.

This code runs via GDB using Angel or RedBoot.

  1. To compile this code, you will need to replace your version of crt0.o with our version. Place this in the directory /<arm-elf-root>/arm-elf/lib. Make sure to rename your existing version first. The GDB system uses software interrupts to perform system calls. Unfortunately, RedBoot does not support this method. This replacement object file removes the SWI system calls.
  2. Place the files ( bit2c, design_test.c, spartan.c, spartan.h, makefile ) in a directory where you will be able to access them easily.
  3. Using the Xilinx ISE tools, generate a bitstream of your design, making sure you specify 'Express Mode'. Rename the .bit file to spartan_test.bit and place it in the same directory as the previous step.
  4. The file design_test.c contains a stub function. Inside the function design_test(), place your own code to stimulate the Spartan-XL chip. The pointer *spartan points to the base address of the Spartan-XL chip. If you create any new pointers derived from this, be sure to declare them as volatile. For example:

    volatile unsigned char *my_ptr = (unsigned char *)(SPARTAN_BASE + 2);

    The volatile keyword is essential when accessing memory mapped peripherals. It ensures that any access to the memory pointed to will actually generate a physical transaction. Without it, you may find that nothing happens when you write to or read from the chip, because the compiler has optimised the physical access out...

  5. Before building, set the clock frequency of your board inside spartan.h (line 27). By default, we assume a 20MHz clock.

    Once you have modified the design_test() code, simply type:

    make

    Fix any errors and warnings (warnings are very useful for finding small typos and if fixed may save you a lot of bug chasing).

  6. Set the board to boot into RedBoot.

    Turn on the board.

    Start the debugger:

    arm-elf-insight spartan.elf &

    Connect to the remote target and download your code.

    Set a breakpoint inside design_test() if you like. Don't put any breakpoints inside the program_spartan() or delay() code, as timing is quite tight.

    Run the testbench!

Directory Contents

[Root] CD-ROM Root Directory
[Dir] board: Information about the DSLMU Microcontroller Board hardware
[Dir] software: Software for the DSLMU Microcontroller Board
[Dir] fpga_config: Software for programming and testing Spartan-XL FPGA designs This is the current directory
[File] bit2c: Convert xilinx Spartan-XL Express Bitstream into a C array
[File] crt0.o: Library object file required to use GDB on RedBoot
[File] design_test.c: C stub function to test Spartan-XL design
[File] dslmu_rb.ld: Linker Script to link for RedBoot
[File] makefile: Makefile to build source into .elf
[File] spartan.c: Source code to program Spartan-XL chip
[File] spartan.h: Header file containing useful defines for programming Spartan-XL Chip
[File] bit2c.make: Makefile to build bit2c program
[File] bit2c.c: Source code for bit2c program
[File] bit2c.h: Header file for bit2c program
[File] README.html: The file you are currently reading