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++
12745 Discussions

Run from flash and use flash device driver?

Altera_Forum
Honored Contributor II
1,380 Views

I'm planning to store my program in flash and also store data using the flash device driver. Individually everything works: I can run out of RAM and write data to flash. If I run from flash (e.g. program is stored AND runs from flash) then I cannot open the flash device. I poked around in the sources and it looks like the flash device driver is disabled if it collides with the program. How do I get around this? My program determines its own end so I think I can protect myself from overwriting the program code. 

 

Thanks, 

Andrew Queisser
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
490 Views

Hi Andrew, 

 

> it looks like the flash device driver is disabled if it collides with the program. 

 

This makes sense ... If you do something as simple as (trying) to read the 

manufacturer and device IDs, you won't be fetching instructions any 

longer -- you'll be trying to execute the IDs ;-) 

 

> My program determines its own end so I think I can protect myself from 

> overwriting the program code. 

 

Fair enough ... but that's not the problem. If you're executing code that's 

being fetched from the device that you're programming, a (typical) device 

will not be driving array data onto the data bus. It will insted be driving 

the write status (e.g. toggle bits, etc.). So you won't be fetching valid 

instructions. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Scott, 

 

Your're right, of course, I should have thought of that. I learned it the hard way by forcing the flash driver to initialize and then crashing when the driver tried to read the flash configuration data back from the device. 

 

My next plan of attack is to do this: 

 

- Run the driver initialization from a RAM segment, which will then get reused as a scratch buffer 

- Run the flash write routine from a small RAM segment. I might even copy the routine from flash to RAM each time I need it but only if we get desparate for RAM 

 

Thanks, 

Andrew
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Dear friends , 

 

I have doubt in Flash programming , 

 

I want to store the datas in flash and retrive it when needed , I gone thro' nios flash programer tutorial ,  

 

with that i created the target board , My actuall board is already contains (sdram pll , sdram , flash , tristate mux ...) but i have doubt that whether this is my actual design(.bdf) which is downloaded from UP3 (refdesign for cyclone 1c6 ). 

 

so pls tell me how to create basic .bdf file to program flash memory (main problem is assigning pin ..) 

 

if it is available in any site pls send me the link . 

 

Its head breaking for me ,  

 

eagerly waiting for ur reply , 

 

regards , 

Murugan.b
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

i'm not familier with quartos ide to perform this task (of assigenning pins) but if you will open the file *.qsf you could text lines that will define the pins , look at the standart project for exampel

0 Kudos
Reply