APF9328 APF27 APF51 OPOS6UL SP FPGA configuration: Difference between revisions
No edit summary |
|||
Line 16: | Line 16: | ||
== Configuring from Linux == | == Configuring from Linux == | ||
=== Directly === | |||
Please use the [[FPGA_loader | FPGA loader linux driver]]. | Please use the [[FPGA_loader | FPGA loader linux driver]]. | ||
{{Warning | For APF51, please use binary format '''.bin''', bitstream format '''.bit''' doesn't work.}} | {{Warning | For APF51, please use binary format '''.bin''', bitstream format '''.bit''' doesn't work.}} | ||
=== Flashing the FPGA firmware partition === | |||
The FPGA firmware partition (mainly used from U-Boot) can be updated by means of U-Boot (see [[APF9328_APF27_APF51_OPOS6UL_SP_FPGA_configuration#Configuring_from_uBoot|here]]) or directly from Linux as described herewith. | |||
Under Linux: | |||
* At first, download your FPGA firmware: | |||
<pre class="apf"> | |||
# tftp -g -r my_firmware.bit 192.168.0.2 | |||
</pre> | |||
* Then, determine which partition in the flash is the firmware partition: | |||
<pre class="apf"> | |||
# cat /proc/mtd | |||
dev: size erasesize name | |||
mtd0: 00100000 00020000 "u-boot" | |||
mtd1: 00080000 00020000 "env" | |||
mtd2: 00080000 00020000 "env2" | |||
mtd3: 00100000 00020000 "firmware" | |||
mtd4: 00080000 00020000 "dtb" | |||
mtd5: 00080000 00020000 "splash" | |||
mtd6: 00800000 00020000 "kernel" | |||
mtd7: 1f400000 00020000 "rootfs" | |||
</pre> | |||
The example above is taken from an APF51 running Armadeus version 5.2 and we can see that mtd3 is the firmware partition. If yours is different, then replace mtd3 by what you found out to be the right one in the following commands. | |||
* Once done, the firmware partition has to be erased: | |||
<pre class="apf"> | |||
# flash_erase /dev/mtd3 0 0 | |||
</pre> | |||
* Then your FPGA .bit file can be written: | |||
<pre class="apf"> | |||
# nandwrite -p /dev/mtd3 my_firmware.bit | |||
</pre> | |||
== Configuring from uBoot == | == Configuring from uBoot == |
Latest revision as of 16:03, 3 October 2025
Test bitstream
- The FPGA bitstreams are all located in the firmware/ directory of your Armadeus BSP sources:
$ ls firmware/ apf_pkg BRAMTest bus_led led PS2 PS2_Opencore servo sram_test wishbone_example Xtools
- You can make some trials with the firmware/leds/blinking_led/bin/ files.
Configuring from Linux
Directly
Please use the FPGA loader linux driver.
Flashing the FPGA firmware partition
The FPGA firmware partition (mainly used from U-Boot) can be updated by means of U-Boot (see here) or directly from Linux as described herewith.
Under Linux:
- At first, download your FPGA firmware:
# tftp -g -r my_firmware.bit 192.168.0.2
- Then, determine which partition in the flash is the firmware partition:
# cat /proc/mtd dev: size erasesize name mtd0: 00100000 00020000 "u-boot" mtd1: 00080000 00020000 "env" mtd2: 00080000 00020000 "env2" mtd3: 00100000 00020000 "firmware" mtd4: 00080000 00020000 "dtb" mtd5: 00080000 00020000 "splash" mtd6: 00800000 00020000 "kernel" mtd7: 1f400000 00020000 "rootfs"
The example above is taken from an APF51 running Armadeus version 5.2 and we can see that mtd3 is the firmware partition. If yours is different, then replace mtd3 by what you found out to be the right one in the following commands.
- Once done, the firmware partition has to be erased:
# flash_erase /dev/mtd3 0 0
- Then your FPGA .bit file can be written:
# nandwrite -p /dev/mtd3 my_firmware.bit
Configuring from uBoot
- Step 1: instal/copy your firmware to /tftpboot
- manually:
$ cp myfirmware.bin /tftpboot/apfXX-firmware.bin (where apfXX is the name of your board: apf27, apf51 or apf9328)
- using the armadeus BSP:
$ make menuconfig
Package Selection for the target ---> Armadeus specific tools/utilities --->
- specify the path to the FPGA firmware:
- manually:
[*] FPGA Firmware Firmware to install (Install a custom FPGA firmware) ---> ($(TOPDIR)/../firmware/leds/blinking_led/bin/blinking_led_apf27_200k.bit) FPGA binary file path [*] Export this file to Buildroot images folder
$ cp buildroot/output/images/* /tftpboot
- Step 2: Load FPGA firmware image file with U-Boot through Ethernet:
BIOS> tftpboot ${loadaddr} fpgafirmware.bin
fpgafirmware.bin is of course the name of your bitfile stored in your TFTP shared directory (/tftpboot/)
then you can type the c command to reconnect to the terminal
- Step 3: Test your new FPGA firmware's downloading:
- for .bin binary files
BIOS> fpga load 0 ${loadaddr} ${filesize}
- for .bit binary files
BIOS> fpga loadb 0 ${loadaddr} ${filesize}
- for .bin binary files
Using U-Boot scripts
For your convenience a set of U-Boot script to facilitate firmware management with the APF boards:
- download_firmware: assuming your firmware is in /tftpboot and name apfXX-firmware.bin (where apfXX is the name of your board apf27, apf51, apf9328..) will download the firmware in RAM with the command: run download_firmware
- flash_firmware: save the previously downloaded firmware from RAM into the flash.
- update_firmware: will execute the previous 2 scripts in sequence.
- load_firmware: read a firmware from the flash (there is dedication partition named firmware for this purpose) and load it into the FPGA.
Download and test your firmware image with:
BIOS> run download_firmware BIOS> run load_firmware
Autoloading
When you are satisfied with your firmware, you can write it in flash make it "autoloaded" at power up:
BIOS> run update_firmware BIOS> setenv firmware_autoload 1 BIOS> saveenv