Difference between revisions of "PCIe FPGA loading"
(→Automatic FPGA configuration) |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
== Introduction == | == Introduction == | ||
− | On APF6_SP | + | On APF6_SP PCI express bus is used to configure the FPGA (cycloneV). This article describe how to do that. |
== Generate files == | == Generate files == | ||
Line 9: | Line 9: | ||
=== Quartus configuration === | === Quartus configuration === | ||
− | Your design must include the PCIe and CvP components. Once the project synthesized, open the menu | + | Your design must include the [[IMX6-CycloneV_interface_description#Qsys_.28Quartus.29_:_Avalon-MM_Cyclone_V_Hard_IP_for_PCI_Express_configuration_.28CvP.29 | PCIe and CvP components]]. Once the project synthesized, open the menu: |
<pre class="config"> | <pre class="config"> | ||
File -> Convert Programming Files ... | File -> Convert Programming Files ... | ||
Line 19: | Line 19: | ||
* Click on '''Generate''' | * Click on '''Generate''' | ||
− | You will get two files : | + | You will get two files: |
− | * '''binary.periph.rbf''': peripheral config file to be loaded via serial config bus with | + | * '''binary.periph.rbf''': peripheral config file to be loaded via serial config bus with U-Boot |
* '''binary.core.rbf''': core config file to be loaded via PCIe bus with Linux. | * '''binary.core.rbf''': core config file to be loaded via PCIe bus with Linux. | ||
=== Linux configuration === | === Linux configuration === | ||
− | All drivers are already selected by default in | + | All drivers are already selected by default in APF6's Buildroot configuration. |
== Configure the FPGA == | == Configure the FPGA == | ||
Line 53: | Line 53: | ||
</pre> | </pre> | ||
− | You can then download the core : | + | You can then download the core (192.168.0.2 should be replaced with your Host PC IP address): |
− | + | ||
<pre class="apf"> | <pre class="apf"> | ||
− | $ tftp -g -r binary.core.rbf 192.168.0. | + | $ tftp -g -r binary.core.rbf 192.168.0.2 |
− | $ | + | $ load_fpga output_file.core.rbf |
− | + | ||
Altera CvP 0000:01:00.0: Now starting CvP... | Altera CvP 0000:01:00.0: Now starting CvP... | ||
Altera CvP 0000:01:00.0: CvP successful, application layer now ready | Altera CvP 0000:01:00.0: CvP successful, application layer now ready | ||
− | $ | + | </pre> |
+ | |||
+ | === Automatic FPGA configuration === | ||
+ | |||
+ | To let apf configure the FPGA automatically at boot we have to configure U-boot and Linux as seen in the following. | ||
+ | |||
+ | ==== U-boot ==== | ||
+ | See the [[Target_Software_Installation#APF6_SP | target software installation]] to know how to install a ''firmware autoload'' on U-Boot. | ||
+ | |||
+ | ==== Linux ==== | ||
+ | Once Linux booted, the core must be loaded via PCIe. This can be done with an init.d script: | ||
+ | |||
+ | * Copy the bitstream '''firmware.core.rbf''' in target directory : '''/lib/firmware/fpga/''' | ||
+ | * Create a file in '''/etc/init.d/''' named '''S80firmware''' for example. | ||
+ | * Edit it with these lines: | ||
+ | <source lang="bash"> | ||
+ | load_fpga /lib/firmware/fpga/firmware.core.rbf | ||
+ | </source> | ||
+ | * Then add execution right for the script : | ||
+ | <pre class="apf"> | ||
+ | $ chmod +x /etc/init.d/S80firmware | ||
+ | </pre> | ||
+ | |||
+ | * Reboot the board: | ||
+ | <pre class="apf"> | ||
+ | $ reboot | ||
</pre> | </pre> | ||
== Links == | == Links == |
Latest revision as of 10:59, 5 February 2016
Contents
Introduction
On APF6_SP PCI express bus is used to configure the FPGA (cycloneV). This article describe how to do that.
Generate files
Quartus configuration
Your design must include the PCIe and CvP components. Once the project synthesized, open the menu:
File -> Convert Programming Files ...
- In Output programming file select the programming file type: Raw Binary File (.rbf).
- In Input files to convert clic on Add Files... and add your binary.sof file.
- In Output programming file check the option Create CvP files (Generate binary.periph.rbf and binary.core.rbf)
- Click on Generate
You will get two files:
- binary.periph.rbf: peripheral config file to be loaded via serial config bus with U-Boot
- binary.core.rbf: core config file to be loaded via PCIe bus with Linux.
Linux configuration
All drivers are already selected by default in APF6's Buildroot configuration.
Configure the FPGA
Peripheral configuration in uboot
PCIe must be activated before Linux boot. To do that, just load the peripheral bitstream with uboot :
BIOS> tftpboot ${loadaddr} 192.168.0.117:binary.periph.rbf BIOS> fpga load 0 ${loadaddr} ${filesize}
Then boot Linux:
BIOS> boot
Core configuration in Linux
The PCIe device must be seen in lspci command in Linux :
# lspci 00:00.0 PCI bridge: Device 16c3:abcd (rev 01) 01:00.0 Unclassified device [0013]: Altera Corporation Device e001 (rev 01)
You can then download the core (192.168.0.2 should be replaced with your Host PC IP address):
$ tftp -g -r binary.core.rbf 192.168.0.2 $ load_fpga output_file.core.rbf Altera CvP 0000:01:00.0: Now starting CvP... Altera CvP 0000:01:00.0: CvP successful, application layer now ready
Automatic FPGA configuration
To let apf configure the FPGA automatically at boot we have to configure U-boot and Linux as seen in the following.
U-boot
See the target software installation to know how to install a firmware autoload on U-Boot.
Linux
Once Linux booted, the core must be loaded via PCIe. This can be done with an init.d script:
- Copy the bitstream firmware.core.rbf in target directory : /lib/firmware/fpga/
- Create a file in /etc/init.d/ named S80firmware for example.
- Edit it with these lines:
load_fpga /lib/firmware/fpga/firmware.core.rbf
- Then add execution right for the script :
$ chmod +x /etc/init.d/S80firmware
- Reboot the board:
$ reboot