FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5930 Discussions

DE0-Nano EPCS Nios II problem

Altera_Forum
Honored Contributor II
995 Views

Hi all, 

 

I know this question has been asked many times, but I did a lot of searching and followed few tutorials and still couldn't make it to work on DE0-Nano. 

 

I want to save both hardware and Nios II software in EPCS so that the system will run after power up. I know my project works, because it runs without problem if I load the hardware through USB blaster and run the Nios II software from on-chip memory. I understand in order to run Nios II SW from EPCS I first need to include an epcs_flash_controller in the Qsys project and change the CPU reset vector memory to EPCS. 

 

I've tried the following two methods to download HW/SW to EPCS, but only the HW part works, SW doesn't. 

 

Method 1: using Nios II command shell 

I ran the following commands in the command shell 

 

sof2flash --epcs --input=nios2_quartus2_project.sof --output=hw.flash --verbose 

elf2flash --input=count.elf --output=sw.flash --epcs --after=hw.flash --verbose 

nios2-elf-objcopy -I srec -O ihex hw.flash hw.hex 

nios2-elf-objcopy -I srec -O ihex sw.flash sw.hex 

 

Then I used the Quartus II Convert Programming File tool to create a JIC file with the hex files created above. And used the Quartus II programmer to program this JIC file to DE0-Nano. After power reset, the HW works but SW doesn't. 

 

Method 2: Nios II Flash Programmer 

In Nios II Flash Programmer I simply added SOF and ELF files to the program and press the start button. The result is the same. HW works, but SW doesn't. 

 

Can anyone tell me what I did wrong? 

 

And here is another question. From both of the methods above, the programmer first writes the HW to EPCS at address 0x00, then immediately followed by SW hex. Although the CPU's reset vector memory is set to EPCS, but how does it know where the software instructions start at? It is not at 0x00. 

 

Thank you!
0 Kudos
0 Replies
Reply