Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

How to convert from .pof to binary?

Altera_Forum
Honored Contributor II
3,539 Views

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
0 Kudos
10 Replies
Altera_Forum
Honored Contributor II
1,429 Views

Not shure that I got you right, but 

 

You can create a .rbf file with the "convert programming file" option in the file menu.
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

Or use quartus_cpf to do it from the command line. 

 

See `quartus_cpf --help` for more details.
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

Thanks for the suggestion. Getting data around sometimes seems like a big riddle - I will try and see what new combinations of file translators/etc gets the end result...... 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/blink.gif
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

> 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
0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

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

0 Kudos
Altera_Forum
Honored Contributor II
1,429 Views

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
0 Kudos
Reply