Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12452 Discussions

Using Flash Programmer to download NIOS II Project into FlashMemory

Honored Contributor II



My first (quite big actually) NIOS II project is about to be delivered, and I have some doubts regarding the process of download of the SW project into flash. 


I don't have NIOS II licence at the moment, and for the sake of presentation I want the following scenario (it is tPad board): 


- Use the Quartus II programmer to download the *time_limited.sof to the board 

- have NIOS II software residing in the on-board flash so it starts executing after the download of FPGA configuration data. 


Please go through the description of my system and tell me what may be wrong 

1. There is a Flash memory interface and an Avalon-MM Tristate Bridge in SOPC system 

2. There is no JTAG UART, but plain UART at 115200bps only (will use it as a terminal) 

3. The cpu's reset vector is in the flash, at offset 0x00, the exception vector also in the flash, at offset 0x20 


System library in NIOS II IDE (not NIOS II SBT) 

1. .text flash 

2. .rodata flash 

3. .rwdata sdram 

4. heap sdram 

5. stack sdram 

6. stdout rs232 


Do these settings make sense?  

I have a simple utility software what reads out my custom component, printing out the data at the terminal. The program hangs after initial start, but when I unintentionally added another printf (printf("interrupt\n")) in my component's interrupt routine component it started to work perfectly... I suspect some setting may be wrong here. 


Any help is greatly appreciated!
0 Kudos
3 Replies
Honored Contributor II

I'm not sure but I think the exception vector needs to be set to the RAM. The startup code in crt0.s takes care of initializing the exception RAM with the correct vectors. 

Except for that your settings look ok. 

You also have another alternative, it is to set all the sections in Sdram (including .text and .rodata) but still put the CPU's reset vector to the flash (and still exceptions in Sdram). In that case the Nios Programmer should detect that you need to copy your application to the SDRAM and will put a bootloader for you in the flash.
Honored Contributor II

Thank you Daixiwen! 


Sorry I have not come back earlier, I had to tidy a lot of stuff before the presentation, which went well. 

My application now works with reset vector in flash, exception vector in SDRAM, and all the secions in SDRAM. 

Very happy here. :-)
Honored Contributor II

Good to know :)