Forum Discussion
Altera_Forum
Honored Contributor
19 years agoVariables in different physical memory
Im looking to define some variables (large arrays)such that one resides in sdram and the other in separate sram so that my custom peripheral can do work on one while i do work on the other array with...
Altera_Forum
Honored Contributor
19 years agoInstead of declaring arrays, declare pointers, and initialize them with an address (which might be defined in system.h, or you might add offsets to the values from system.h).
If one memory is already where your .rodata and .rwdata are being placed, then you only need a pointer for the other one. Example - if you are running code from sdram, your compiler setting are probably also placing .rwdata in the sdram as well, so just set a pointer to the SRAM like so: alt_u32 * my_sram = ONCHIP_MEMORY_0_BASE ; Now you can use my_sram[i] as an array of 32 bit values. (Assuming ONCHIP_MEMORY_0_BASE is defined in your system.h). Or if your code and .rwdata are in the onchip SRAM, then instead setup a pointer to the base address of the SDRAM. \chuck