Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Decoding Cyclone III SOF header

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

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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