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

What to do if on-chip memory is too small for Nios II program

Altera_Forum
Honored Contributor II
3,093 Views

All Nios II tutorials explain how to use on-chip memory to store the Nios II program. However, what does one do if the program is too big to fit in there? Then one would have to use off-chip memory. However, I do not know how this is incorporated into the design flow. 

 

 

In other words, in tutorials Qsys system we connect the instruction master of the processor to on-chip memory. Thereafter, when we execute the program from Nios II Ecplise IDE, the program is downloaded into the on-chip memory automatically (I think) and executed. How do I make the program be put into off-chip memory like SDRAM or SRAM or Flash? Is off-chip program download as simple as with on-chip memory i.e one click and the Nios II program is downloaded and executed? 

 

 

Finally, which file generated by the Nios II Eclipse IDE contains the size of the program? Is the size of the ELF file all that I need to know?
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
1,618 Views

You specify the address of the external memory controller and connect it to the instruction master in Qsys, just like with on-chip memory. 

 

I believe the size of the .elf file is the size you need to know.
0 Kudos
Altera_Forum
Honored Contributor II
1,618 Views

Hi Xaui, 

 

When .elf file is generated, there are 2 additional text files that are generated as well - .map and .objdump 

Good estimation on the size of memory can be found in .map file. 

 

There is some kind of table "memory configuration", where entry .text correspond to your code segment. 

In the column "length" - the size of your compiled code. 

 

Regards.
0 Kudos
Altera_Forum
Honored Contributor II
1,618 Views

Thanks for the answers, however there is still a missing element, provided that I add an external memory controller into the Qsys system and link the Nios II instruction master to it, the question still remains as to how will I instruct Eclipse IDE to put the code into that memory device?

0 Kudos
Altera_Forum
Honored Contributor II
1,618 Views

You set up the linker script in the BSP Editor to specify the address where code lives.

0 Kudos
Altera_Forum
Honored Contributor II
1,618 Views

 

--- Quote Start ---  

Thanks for the answers, however there is still a missing element, provided that I add an external memory controller into the Qsys system and link the Nios II instruction master to it, the question still remains as to how will I instruct Eclipse IDE to put the code into that memory device? 

--- Quote End ---  

 

You can also specify your external memory module in the settings of your NIOS processor in qsys ("reset vector memory" and "exception vector memory") ... see screenshot below. 

Then, (as I suppose) the memory selected in these options, is "picked up" when BSP is generated. 

https://www.alteraforum.com/forum/attachment.php?attachmentid=14015
0 Kudos
Reply