Forum Discussion
Altera_Forum
Honored Contributor
10 years ago1.
You can use sdram for everything: code, data, stack, heap and data storage. If you need to reserve an address range for your data storage and use it with direct memory access, you must make sure it has been excluded from linkage, otherwise you risk to corrupt application data. So you need to instruct the linker to reserve that area, nemely specifying an empty memory section in the linker memory map. A better and safer option, which avoids you bothering with linker commands and settings, would be to define a generic array (i.e. int data_storage[STORAGE_SIZE] ) and then you read/write the variable rather than directly access sdram addresses. 2. The flash memory is normally used only to load the program code upon boot. Then its size is at least the same as code + initialized data. The sdram space where stack, heap and other memory sections are mapped, needs not to be saved into flash because these areas can start with random data or they can simply be initialized with zeros or other constant values. In the case of your test application, the required flash size is about 61kB. Account for a bit more since the flash image needs to store the bootloader.