Altera_Forum
Honored Contributor
11 years agoHow do I determine FPGA image size within a POF
Hello all. I have searched around and can't find quite the answer I'm looking for so I'm hoping that I can get some help here.
First a little background. I am attempting to create an application which will run on an SBC controller, read in a POF file and write the FPGA contained in the file across a cPCI interface to flash on a selected PIO board. These peripheral boards are using Cyclone IV. The POF files are generated by a vendor who also builds the enclosure housing the boards. The enclosure is sealed, so I have no access to the JTAG ports on the cards. The POF files at the moment are generated using either QuartusII 12.1 or QuartusII 13.1.0 (some with each). All this is to say that I don't have access to the JTAG interface, I don't have access to the "source" project which generates the FPGAs, and I don't have the ability to receive the files from the vendor in another format. Due to configuration management requirements I need to be using these files unmodified. So far I have managed to create a program which does this, however identifying the location of the FPGA image within the POF file has been problematic. By dumping the contents of the POF file I have basically discovered that there is a brief header containing version information on the QuartusII software used to generate the POF, then a block containing what should be the entire contents of flash, then a footer with some other information including the Page_0 offset and a mysterious hex value which does not appear to be the size of the FPGA. I have noticed that the FPGA images always seem to start with 0xF76A, so I have been able to make my program scan for that pattern, the problem is that I don't know how to determine where the end of the actual FPGA is located (right now it is a hard-coded size, which concerns me because I don't want the loader to have to be checked every time a new FPGA is received from the vendor). I don't want to write to the entire flash space, just the minimum needed to get the FPGA image into flash. I could scan from the 0xF76A until I reach a large block of 0xFFFF's, then back up, but I am hoping that there is a more elegant way to do this. While using the USB Blaster on a test board in a development box which isn't sealed, it looks like the Quartus software stops writing right at the end of the FPGA image, so there must be some way to tell how large it is. Does anyone know how to determine this from within the POF file data? Thanks in advance!