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.
HiIs 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()
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).
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...