Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
15476 Discussions

sof2flash output different than quartus_cpf

Altera_Forum
Honored Contributor II
967 Views

Hi everybody,  

 

I try to convert my project sof file into an srec file to store it into a CFI memory. On my board, I have a PFL onto a Max device to boot the bitstream from CFI memory address 0x01F0_0000. 

 

1: memory file generation with quartus_cpf 

I use the "Convert Programming File" tool to create a "cof" file, which will help me to create a "pof" file to download into the memory.  

 

The "cof" file is describded below : 

<?xml version="1.0" encoding="US-ASCII" standalone="yes"?><cof> <eprom_name>CFI_1GB</eprom_name> <output_filename>bitstream.pof</output_filename> <n_pages>1</n_pages> <width>1</width> <mode>0</mode> <sof_data> <start_address>01F10000</start_address> <user_name>Page_0</user_name> <page_flags>1</page_flags> <bit0> <sof_filename>bitstream.sof</sof_filename> </bit0> </sof_data> <version>5</version> <create_cvp_file>0</create_cvp_file> <options> <map_file>1</map_file> <option_start_address>1f00000</option_start_address> <dynamic_compression>0</dynamic_compression> </options> </cof> 

 

I create the pof file with the command : 

quartus_cpf -c bitstream.cof 

 

I download this "bitstream.pof" file into the memory using Quartus Programmer. 

Then, the FPGA boots fine at board power up ! 

 

2: memory file generation with sof2flash 

Let's say the FPGA is already running and a Nios2 is running on it. I can then use the nios2-flash-programmer to overwrite the flash contents. 

I create the srec file with the following commands : 

sof2flash --input=bitstream.sof --offset=0x1F10000 --output=bitstream.flash --pfl --programmingmode=PS --optionbit=0x1F00000 

 

It creates two files : bitstream.flash and bitstream.map.flash. 

 

I download these two files into the memory with the following command : 

nios2-flash-programmer --base=0x0 -g bitstream.map.flash bitstream.flash  

Then, the FPGA doesn't start and CONF_DONE is stuck at '0' at power up ! 

 

3: differences : 

 

I have dumped the memory for both configuration. There is only one difference located after the option area:  

(option area is the four first lines, the difference is in the fifth one) 

 

quartus_cpf configuration :S32501F00000101FE41FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD3 S32501F00020FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9 S32501F00040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9 S32501F00060FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9 S32501F0008003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF85  

 

sof2flash configuration :S32501F00000101FE41FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD3 S32501F00020FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9 S32501F00040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC9 S32501F00060FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9 S32501F00080FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF89  

 

I cannot explain this. Does anyone have a clue ? 

 

I'm using Quartus 12.1sp1. 

 

Thanks
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
140 Views

I've manage to create my srec file by using quartus_cpf with a cof file to create a pof (as in solution n°1 in my post). Then convert back the pof file into ihex also with quartus_cpf and then into an srec with nios2-elf-objcopy. 

quartus_cpf -c bitstream.pof bitstream.hexout mv bitstream.hexout bitstream.hex nios2-elf-objcopy -I ihex -O srec bitstream.hex bitstream.flash 

 

I have checked and the byte 0x03 is still there and every thing works fine.  

 

It's still a strange behavior and I'd like to know if this is a 12.1sp1 bug.
Reply