FPGA loader

From ArmadeusWiki
Revision as of 16:49, 31 March 2008 by FabienM (Talk | contribs) (Module compilation & installation)

Jump to: navigation, search

On this page, you will find all the informations needed to use the Linux FPGA loader driver. This driver allows you to load the FPGA of your APF board from Linux userspace/shell -> FPGA reprogrammation after Linux boot.

Module compilation & installation

The first thing you have to do is to select the driver in the Linux configuration tool.

# cd buildroot/build_arm_nofpu/linux.2.6.xx/

Start the configuration tool:

# make linux-menuconfig

In Device Drivers, Armadeus specific drivers select "Armadeus FPGA configuration driver". Then, you have to start again the top make.

Once done, you will find the new driver in the /lib/modules/drivers/ of the rootfs In the host directory armadeus/target/linux/modules/fpga_devtools you will find a script named fpgaloader.sh.

Copy this script on the target and launch it

# sh fpgaloader.sh

This will install the driver.

  • Remark

The default FPGA version is the spartan3 200k. The version can be changed when installing the module (insmod /lib/modules/drivers/fpgaloader.ko fpga_descriptor=0 for a 200K and 1 for a 400k). These informations are given by the /proc interface.

Driver usage

The FPGA loader driver is usable through the standard Linux filesystem interface: To read the available configurations, do:

# cat /proc/driver/fpga/loader 

The displayed sizes correspond to the different FPGA versions supported by the board:

  • 130k: spartan 200k
  • 212k: spartan 400k

To upload a new firmware (here bramtest_top_apf.bin), write:

# dd if=bramtest_top_apf.bin of=/dev/fpga/fpgaloader

FPGARegs usage

  • Write to a FPGA address: fpgareg addr value
# fpgaregs 1000 abcd

this will write 0xabcd (16bits only interface) at the FPGA internal address 0x1000

  • Read a FPGA address: fpgareg addr
# fpgaregs 1000

this will read the address 0x1000

For details take a look at this page: Tips to debug under Linux