Forum Discussion

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

How to convert from .pof to binary?

Hi all,

I've manged to combine the .sof and my boot-loader into .pof file (via the convert file option in quartus) - and everything is good.

However, for remote updates I'd like to be able to write directly to the EPCS4, which I can do - but I'd need to be able to get the .pof file that I usally program from quartus into a format I understand (binary?) to be able to write some code for the NIOS to write it into the EPCS4.

A means to convert the .pof file to a binary (.rbf?) file would probably do - but I don't know if this is possible?

Is this possible?

Thanks,

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif

10 Replies

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

    Not shure that I got you right, but

    You can create a .rbf file with the "convert programming file" option in the file menu.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Or use quartus_cpf to do it from the command line.

    See `quartus_cpf --help` for more details.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    the convert programming file can only generate a .rbf from a .sof.

    i must convert my design to a .pof, because I add in my loader.hex code using that convert-programming file....

    so, I can generate a .pof with my .sof and the .hex file located at the end of the device - good.

    and I can generate a .rbf of the .sof (only).

    however, there is no combination of the tools/file-types I have come up with to get the .pof into a .rbf (or even intel hex which I could then convert with a wee program).

    http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ohmy.gif
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    What about `quartus_cpf -c <project>.sof <project>.hexout`?

    You can then use nios2-elf-objcopy to convert the hexout to srec if that&#39;s what you&#39;d rather have.

    It works for .pof files too, although I haven&#39;t verified that it creates the correct output.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I got a reply from a separate mySupport posting... However the chap says that unfortunatly this cannot be done. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif

    What I can maybe do is write a nios program to read its serial memory and fire it back at me through the serial port to capture it?

    I wonder though - if there is documentation to explain the header formats for a .pof? I don&#39;t care at all for the file format other than to get the bytes to write to the serial memory? In my simple mind all I need to the rules for skipping through the .pof file and extract the binary lumps accordingly?

    Any ideas folks?

    The riddle of file-formats continues.....

    http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi all,

    I have converted the .sof to a .rbf and written it to the EPCS device. But the FPGA will not boot?

    Now, I have verified that the data is written down correctly - and also that the bits are reversed for each byte for example - but no boot.

    Is a .rbf file of a .sof okay to write straight to address 0 onwards in the EPCS4?

    Thanks

    http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/unsure.gif
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > I have converted the .sof to a .rbf and written it to the EPCS device.

    > But the FPGA will not boot?

    This won&#39;t work ... the contents of an rbf and what goes into the

    epcs device are not the same ... almost the same ... but they&#39;re not

    identical :-(

    As I recall, the data packet contents in the pof has what you want ...

    the magic "register" bits et. al. I have some old code laying around

    somewhere that parses pof/sof and can extract the necessary

    bits ... if I can find it, I&#39;ll post it.

    Regards,

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

    Hi Joe,

    I have some good news and some better news ... the good

    news is I found the code and can send it to you if you like. The

    better news is you don&#39;t need it ;-)

    1. Use sof2flash

    2. Use objcopy as wombat suggested

    E.g.:

    $ sof2flash --epcs --input=proj.sof --offset=0x0 --output=proj.flash

    $ nios2-elf-objcopy -I srec -O binary proj.flash proj.bin

    As an aside, the logical address/data packet in the pof is _NOT_

    compressed. Using the steps above however will produce a

    compressed bitstream (as appropriate).

    Regards,

    --Scott