| Current Directory: | |
|---|---|
| Quick Links: |
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.
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...
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).
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!