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

NIOSII flash downloader probelm

Altera_Forum
Honored Contributor II
2,273 Views

I use the software 8.0,quartus 8.0 and sopc 8.0,niosII 8.0. 

my spoc file:3c_40.sof download in quartusII 

then I use the NIOSII hardware run,the result ok 

but when I want to flash the whole porject to the epcs,I meet probelm 

I add an epcs cotroller in my design in the sopc builder. 

the address 0x00003800-0x00003fff 

and set the Rest Vector 0x00003800 offset0x0 

then I use the flash programmer in command-line,make the .flash file 

successfully. 

I first download the sopc.sof into the fpga,then I wnat to download the flash file into the epcs,but failed. 

My command:nios2-flash-programmer --epcs --base=0x00003800 hello_world_small.flash 

the cmd console show: 

Using cable "USB-Blaster [USB-0]",device 1,instance 0 

Resetting and pausing target processor:OK 

Checksummed/read 61kB in 1.7s 

Erase failed at offset 50000 

Leaving target processor paused 

I tried in the IDE Flash Programmer ,but also failed. 

why?  

I use EP3C40F324I7N and EPCS4,use JTAG 

and I can use the Quartus II Programmer to download other hardware porjects i
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
1,123 Views

Are you sure you have enough space for both the configuration and a software in the EPCS4? It seems rather small, as an uncompressed configuration for an EP3C40 is already 9.6Mbits, more than the double of your flash size.

0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

I think Daixiwen has right. For example:  

The hello_world_small project for a NIOS2 processor needs approximatly 8 kByte space in flash ram. The epsc4 device has a memory space of 4'194'304 Bits. 4'194'304 / 1024 = 4096 Byte = 4 kByte. You see, you can't store your config file and the program file.
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

The EPCS4 is a 4Mbits device, which is 512kBytes, not 4kBytes. It is more than enough for small software projects, but together with a Cyclone 3 configuration it can be challenging.

0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

:eek: Ok, it was my fault, 4'194'304 Bits / 8 = 524288 / 1024 = 512 kByte. Sorry

0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

I see my project 

myProject.sof size = 1.144KB 

hello_world_smal.flash size = 8kB 

and myProject.flash size = 906KB 

can EPCS4 support these size 

I am a new NIOSII designer. 

how can I do to solve these problem?can you give me serval ways?thanks
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

I am also trying to build a own FPGA + NIOS2 project. In my case, I have a 2MB flash memory on board, where I can either store the NIOS2 programm or 

the NIOS2 programm and the FPGA config. I think, it's the easiest way.
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

#!/bin/sh# # This file was automatically generated by the Nios II IDE Flash Programmer.# # It will be overwritten when the flash programmer options change.#  

cd I:/ruanjianceshi/forNIOSII/software/hello_world_small_0/Release# Creating .flash file for the FPGA configuration 

"$SOPC_KIT_NIOS2/bin/sof2flash" --epcs --input="I:/ruanjianceshi/forNIOSII/myNIO 

SII.sof" --output="myNIOSII.flash"  

Info: ******************************************************************* 

Info: Running Quartus II Convert_programming_file 

Info: Command: quartus_cpf --no_banner --convert --device=EPCS128 --option=myNIO 

SII.opt I:/ruanjianceshi/forNIOSII/myNIOSII.sof myNIOSII.pof 

Info: Quartus II Convert_programming_file was successful. 0 errors, 0 warnings 

Info: Peak virtual memory: 70 megabytes 

Info: Processing ended: Fri Jul 17 14:41:05 2009 

Info: Elapsed time: 00:00:04 

Info: Total CPU time (on all processors): 00:00:02 

Info: ******************************************************************* 

Info: Running Quartus II Convert_programming_file 

Info: Command: quartus_cpf --no_banner --convert myNIOSII.pof myNIOSII.rpd 

Info: Quartus II Convert_programming_file was successful. 0 errors, 0 warnings 

Info: Peak virtual memory: 66 megabytes 

Info: Processing ended: Fri Jul 17 14:41:08 2009 

Info: Elapsed time: 00:00:03 

Info: Total CPU time (on all processors): 00:00:02# Programming flash with the FPGA configuration 

"$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x00003800 --accept-b 

ad-sysid --instance=0 "myNIOSII.flash" 

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 

Resetting and pausing target processor: OK 

: Checksumming existing contents  

00000000 : Verifying existing contents  

00010000 : Verifying existing contents  

00020000 : Verifying existing contents  

00030000 : Verifying existing contents  

00040000 : Verifying existing contents  

00050000 : Verifying existing contents  

00000000 : Reading existing contents  

00010000 : Reading existing contents  

00020000 : Reading existing contents  

00030000 : Reading existing contents  

00040000 : Reading existing contents  

00050000 : Reading existing contents  

Checksummed/read 22kB in 0.6s  

00000000 ( 0%): Erasing  

Erase failed at offset 0  

Leaving target processor paused# Creating .flash file for the project 

"$SOPC_KIT_NIOS2/bin/elf2flash" --epcs --after="myNIOSII.flash" --input="hello_w 

orld_small_0.elf" --output="epcs_controller.flash"# Programming flash with the project 

"$SOPC_KIT_NIOS2/bin/nios2-flash-programmer" --epcs --base=0x00003800 --accept-b 

ad-sysid --instance=0 "epcs_controller.flash" 

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 

Resetting and pausing target processor: OK 

: Checksumming existing contents  

00050000 : Verifying existing contents  

00050000 : Reading existing contents  

Checksummed/read 61kB in 1.8s  

00050000 ( 0%): Erasing  

Erase failed at offset 50000  

Leaving target processor paused 

-------------------------------------------------------------------- 

above is my NIOSII console whole message during the flash programmer 

I want to know why  

00000000  

00010000  

00020000  

00030000  

00040000  

00050000  

what is the meaning, Flash address?or Sectors? 

why I erase  

00000000 ( 0%): Erasing  

Erase failed at offset 0
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

I seems that your project is defined with an EPCS128. Change that setting in Quartus first and recompile your design. 

But I still can't see how you are going to fit all this in an EPCS4... You can replace it with a EPCS16, they are pin-to-pin compatible.
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

I have use assignment setting -->deivce-->device and pin options -->configuations-->configutions devices[EPCS4],and recomile,in quartusII 

open niosII ,build all,then use flash programmer,it's strange than EPCS128 also in the console. 

Info: Running Quartus II Convert_programming_file 

Info: Command: quartus_cpf --no_banner --convert --device=EPCS128 --option=myNIO 

SII.opt I:/ruanjianceshi/forNIOSII/myNIOSII.sof myNIOSII.pof 

 

where I loss to config? 

 

another, I shall make the footprint to fit the epcs16,I see they are different package, 

thank you for helping me:)
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

That's strange... I don't know where sof2flash gets the information about the size of the EPCS device. 

If you open the srec file in an editor you should also be able to find how big is the image to see if it fits in your flash. But from what I see you don't use compression, so it is most probably bigger than what the EPCS can get. Add the --compress flag to the sof2flash command to activate compression. 

 

You shouldn't need to do a different footprint, the EPCS16 can be found in an 8-pin package, just like the EPCS4.
0 Kudos
Altera_Forum
Honored Contributor II
1,123 Views

www.farnell.com 

Order number 1453463 for a EPCS16 device SO8 package.
0 Kudos
Reply