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

nios using specific memory device

Altera_Forum
Honored Contributor II
1,389 Views

hi all, 

 

i'd like to ask that whether nios can create array on a specific memory device or not. 

 

i have two sram memory device , let's name it sram1 & sram2 

i run my system , stack, and heap on sram1 

[ in this case, if i declare a global array, the memory allocation should be on sram1 ] 

anyway, i'd like to put an array on sram2 for special use. 

 

please tell me if there's any command that can indicate the memory device to put the array 

 

thanks in advance. 

 

btw, i roughly remembered that there's a command provided by gcc or something that matches my need.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
414 Views

Hi 

Is SRAM2 a part of normal available RAM ? 

You can explicitly point your array to an address in SRAM2 

 

If SRAM2 is a special RAM, you can employ functions like IOWR()
0 Kudos
Altera_Forum
Honored Contributor II
414 Views

I believe you are looking for the "section" attribute via GCC. 

 

char foo __attribute__ ((section("FOO_SECTION"))); 

 

You then need to modify your linker script (via nios2-bsp-editor) to create a named section (e.g. "FOO_SECTION") which is located in the memory hardware of your choice. 

 

The GCC manual is here: 

http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc.pdf 

 

Functions are discussed on page 238. 

Variables are discussed on page 249. 

 

You can also do it via the linker script if needed (e.g. if you want to manipulate binary objects instead of source code).
0 Kudos
Altera_Forum
Honored Contributor II
414 Views

But be aware, that you have connected the DataMasterPort of the NIOS to this RAM, then you can address this Ram also, like you would address an other IP via NIOS...

0 Kudos
Altera_Forum
Honored Contributor II
414 Views

thanks for all the reply 

 

what ted replied is the command i'm looking for 

 

thanks again
0 Kudos
Altera_Forum
Honored Contributor II
414 Views

Because I am curious, what the meaning of "putting an array on sram2 for special use". sram2 is special ?

0 Kudos
Reply