Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20693 Discussions

Flash memory share for POF and NIOS HEX

Altera_Forum
Honored Contributor II
1,138 Views

Hi 

i have a question related to a NIOS application on S3 devkit. 

As you probably know this kit has a flash memory which can be used to set up the S3 with an on board Max device which does a parallel configuration from that flash. 

A NIOS can also access this flash with appropriate memory interface. 

At the same time I wish to store my NIOS software there as it does not fit in the on chip ram. 

When I do the "Convert programming files" and fit that in the CFI_512 the whole flash is filed with a 64MB POF. 

So my questions are: 

+ how should I concatenate POF and HEX and what would be the page management? 

+ once the S3 configured, how can I transfer the executable from the flash to the DDR with a bootloader? 

+ anything particular to do or set in the software tool? 

 

Thanks in advance for your hints! 

kind regard 

thouthi38
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
215 Views

Regarding your first question, the concatenation is between the SOF and the HEX. You can concatenate both in one single POF with the convert programming file tool in Quartus II.

0 Kudos
Altera_Forum
Honored Contributor II
215 Views

Hi 

Thank you for your reply. 

I already used that feature in a previous design where the software actually fitted in the on chip memory. 

No I've another design which weights 600K and my intention is to store that in the on board flash. 

But as I said, it is also used by the device's initialization POF. 

I have added the "External Flash Interface" in the design, that works but I have no idea how to put both POF and the 600K EXE of the NIOS in that memory and recover it after the device is set. 

 

K.r. 

Thouthi38
0 Kudos
Altera_Forum
Honored Contributor II
215 Views

As I already told you, choosing add hex file when you create a pof you will be able to choose the start address of the HEX PAGE in the POF that you'll write. I am not saying that this will reopen the SOF, fill the M9k with the hex and the build a pof: I am saying it will put at a user defined offset the hex in the pof (and so in the flash when you program the flash with it). 

Already used this technique a lot of times with Quartus 9.1. I do not know if you are using a version that fails it. 

 

How to make Nios II boot from this hex in flash is another question. You may need to write a little bootloader that lives in internal memory (reset address to ram) or a little preamble that copies the hex to other resources (reset address to flash) or, if your program support XIP, just execute from flash (reset address to flash). 

 

Regards
0 Kudos
Altera_Forum
Honored Contributor II
215 Views

Thanks again. 

If I understood well, I can play with the possible pages while doing the Convert Programming File. 

In fact I simply need a Copy loader, to be more precise: 

-- The NIOS boots on on chip memory throughout what comes inside the reguler configuration POF 

-- the first think NIOS does is fetching the HEX or EXE and copy it from the flash to a DDR (or elsewhere) and jump to it. 

That's exactly what you've stated in your reply. 

 

I just wonder if this would interfere with the MAX II which is reading pages of the flash to get the POF to set up the S3 in PP scheme. 

I'll give a try and let you know. 

 

Regards
0 Kudos
Altera_Forum
Honored Contributor II
215 Views

If the lanes are placed correctly ad use some kind of handshake between the Parallel Flash Loader in Max II, it will work as worked for me.

0 Kudos
Altera_Forum
Honored Contributor II
215 Views

Hi! 

I owe you a report on how this works on the S3150 dev kit. 

Very easy actually but some time spent to find out. 

 

In fact, for bigger designs that won't fit in the on chip memories: 

-- put the reset entry of NIOS in the flash area. 

-- for the S3 kit, choose a flash address which doesn't interfere with the CPLD's POF pages for S3 initialization. 

-- this is above 0x0350_0000 

-- take into account that NIOS might see this address with additional offset 

-- with the Eclipse perform "Make Targets / Build" 

-- you'll get a .flash file which actually is a Motorola s-record 

-- inside, you'll get the boot copier automatically 

-- use the NIOS II Command Shell and type nios-elf-objcopy -I srec -O ihex <my_soft_stuff>.flash <loutput_file_name>.hex 

-- this will generate an Intel HEX 

-- use Convert Programming Files in Quartus II and set up: 

** your design SOF to be converted to POF at the page you want 

** add HEX data, specify your .HEX file with "Absolute Addressing mode" 

** you'll see that an address will show up and it is right where you want to put it 

** click generate to get your POF 

-- Use the Standard programmer and use the PFL design to access the on boar flash 

-- when done, click the Auto detect, you'll see the CFI flash; 

-- choose the POF just generated for that CFI and programm. 

 

That's it. 

 

May be this applies somehow to other dev kits too! 

 

Kind regards 

 

Thouthi38
0 Kudos
Reply