Results 1 to 6 of 6

Thread: DE0-Nano EPCS Nios II problem

  1. #1
    Join Date
    Aug 2009
    Posts
    5
    Rep Power
    1

    Default DE0-Nano EPCS Nios II problem

    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!

  2. #2
    Join Date
    Feb 2016
    Posts
    21
    Rep Power
    1

    Default Re: DE0-Nano EPCS Nios II problem

    Hi,

    I think you have not set the Nios II reset vector to an address where the software instruction starts. You will need to set the reset vector offset to where your software starts.

  3. #3
    Join Date
    Aug 2009
    Posts
    5
    Rep Power
    1

    Default Re: DE0-Nano EPCS Nios II problem

    Quote Originally Posted by aaronchng View Post
    Hi,

    I think you have not set the Nios II reset vector to an address where the software instruction starts. You will need to set the reset vector offset to where your software starts.
    The tutorials that I looked at didn't talk about setting the reset vector offset. I only know the SW instruction data starts right after the HW configuration data. But how do I find out exactly where it is at?

  4. #4
    Join Date
    Feb 2016
    Posts
    21
    Rep Power
    1

    Default Re: DE0-Nano EPCS Nios II problem

    Hi,

    Please refer to AN736 page 3 for flash layout and page 6 for setting reset vector.
    You can determine the minimum reset vector offset by using the following equation:
    minimum reset vector offset = (.sof image start address + .sof image size) in HEX

  5. #5
    Join Date
    Aug 2009
    Posts
    5
    Rep Power
    1

    Default Re: DE0-Nano EPCS Nios II problem

    AN736 talks about EPCQ, not EPCS.
    Couple days ago, I found UG-20001 Generic Nios II Booting Methods User Guide. And on page 11 it has a section about "Nios II Processor Application Copied from EPCS Flash to RAM Using Boot Copier".

    "The EPCS address space is not mapped into the Altera Avalon EPCS Flash Controllerís Avalon MM slave interface. Instead, read or write accesses are done through CSRs. Upon system reset, the EPCS device
    needs to be initialized before usage. For these reasons, the EPCS controller-based boot copier is required for initializing the EPCS device and copying the Nios II application to RAM for execution. The EPCS controller instantiates a block of boot ROM internally at its base address (offset 0x0, just before EPCS controllerís CSRs) for storing the boot copier. Nios II reset vector offset must set to EPCS controller base address, such that upon system reset the boot copier is executed first to initialize the EPCS controller and device."

    So the reset vector memory should set to EPCS controller and the reset vector offset should set to 0x00. I still don't know what I have done wrong.

  6. #6
    Join Date
    Feb 2016
    Posts
    21
    Rep Power
    1

    Default Re: DE0-Nano EPCS Nios II problem

    The EPCQ flow is same as EPCS. I would suggest you follow the instructions in AN736 and replace the Legacy EPCS Controller with Altera Serial Flash Controller.
    Setting reset vector offset to 0x0 is definitely not right for your case as the SOF file has been stored at location 0x0.
    These documentations will be updated/integrated eventually

Similar Threads

  1. DE0-Nano EPCS Nios II problem
    By nice2meet_you in forum Development Kit Related
    Replies: 0
    Last Post: January 5th, 2017, 10:45 PM
  2. DE0-Nano Nios II won't boot from EPCS if Compression is Enabled
    By yflyf in forum Development Kit Related
    Replies: 7
    Last Post: July 2nd, 2016, 08:58 AM
  3. EPCS flash problem @ DE0-Nano board
    By PDP11GY in forum Development Kit Related
    Replies: 17
    Last Post: December 5th, 2012, 06:04 PM
  4. EPCS-16 / CYCLON-IVE flash problem @ DE0-Nano board
    By PDP11GY in forum General Altera Discussion
    Replies: 1
    Last Post: December 4th, 2012, 07:00 AM
  5. Problem with nano-X in a nios-mmu system
    By Smarter.UJS in forum Linux Forum
    Replies: 1
    Last Post: August 12th, 2010, 02:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •