Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17252 Discussions

Decoding Cyclone III SOF header

Altera_Forum
Honored Contributor II
1,272 Views

I'm using remote update to go from factory image to application image. After remote update loads the application configuration, I now need to copy the application NIOS II firmware to RAM for execution. I am trying to mimic the bootloader by loading the application from EPCS to upper RAM, skipping the configuration, and copy the application to lower RAM. 

 

When I read the EPCS, I see the 56 that the bootload is syncing to, but after skipping 4 bytes, I see nothing reasonable for the length of the configuration (yes, after bit reversiving the bytes). Here is the beginning of the SOPC .flash file. The 56 is on line 3 - but which bytes are the length? It should be the CFCFCFDF following the bootloader code, but this cannot be the configuration size. What did I miss - where is the configuration size: 

 

S01100004E6577426F6172642E666C617368A0 

S32500000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA 

S3250000002056EFEFEFEFCFCFCFDF5F0FDF5F0F9F9F3FBFBF1F5FDF9F9FDF7F5FFFBF9FBF3FF3 

S325000000409F3F1F3F1F3F1F5F5F959BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF08 

 

I do know from the end of the .flash file that it's 0x55B41. Bit reversed that's 0xA0dA82. I don't see this in the header above. 

 

Thanks for anyone's help! 

Bill
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
577 Views

the bootloader sources are included in the nios install. 

 

nios2eds/components/altera_nios2/boot_loader_sources 

 

also, look at this app note 

 

http://www.altera.com/literature/an/an458.pdf 

 

and example files 

 

http://www.altera.com/literature/an/an458_design_example_files.zip 

 

--dalon
0 Kudos
Altera_Forum
Honored Contributor II
577 Views

Thank you. I've reviewed those files and source code - it's why I asked about syncing on the 0x56 byte - I see the bootloader do this. But in my header in the first post, I don't see the length 4 bytes past the 0x56 - what did I miss? 

 

Thanks, 

Bill
0 Kudos
Altera_Forum
Honored Contributor II
577 Views

It seems you are using the algorithm to find the length for Cyclone II. You should be looking at boot_loader_epcs_bits_sii_siii_ciii.S to know how to find the length for Cyclone III. 

 

For Cyclone III, one bit from each of bytes 33-39 and bytes 48-72 form a 32 bit length value for the total number of bits. Using your data, I determined the length to be 0xABB41 bytes. Maybe I picked out the wrong bits when I did this, as this still does not quite match the value you posted.
0 Kudos
Altera_Forum
Honored Contributor II
577 Views

Thanks so much Kevin! This was the problem - I saw boot_loader_epcs_bits_cyclone.s and then missed the file name with the ciii in the name. Yes, I see how they extract the bits - much more difficult! 

 

Bill
0 Kudos
Reply