Hello i made a system using C and the memory program is around 2~4MB, it isn't going to fit inside an onchip memory, i am also using a second NIOS2 with Linux inside a 128MB sdram.How can i use the same SDRAM for both NIOS2 instruction/data masters? I am using a DE2-70 board which has two 64MB SDRAM memories, and, in my first step i could instantiate two 64mb SDRAM memories@QSys and use one for each. But in my final system i will have just one SDRAM memory so i need to learn how to do this.. Thanks!
I designed a similar 2 CPU / 1 SDRAM system (not Nios) a few years ago.So, you can surely design a system with two Nios processors and a single shared sdram device, but you must be aware of these points: - sdram accesses will be shared between the two processors, so the running applications could suffer great performance decrement; the actual performance will depend on several factors, i.e. number of sdram accesses, arbitration priorities and cache usage. - you must carefully instruct the linker to place memory sections into proper sdram areas in order to avoid overlapping and consequent data/code corruption. I think the first point is the major issure. I'd suggest you keep the more program code you can in onchip memory, along with stack and often-accessed data. Move into sdram only non time-critical parts and bulk data or seldom accessed data.
Cris72 how can i move only part of my program to a sdram?Just to remember, one of my NIOS2's program is a mmu-linux and the other is a simple elf application
Sorry, I don't know anything about mmu-linux, since I never used it.For normal Nios application, a simple method is using the __attribute__ directive after the function/variable definition you want to place in a specific memory. For example, if your code defaults to onchip_ram and you want function ext_function to be mapped to ext_sdram, you define it: int ext_function(int param) __attribute__ ((section (".ext_sdram"))); This is convenient if you only need to move a few functions to the alternate memory device. If you need something more advanced (i.e. remapping a whole library module or all symbols of a set of .c files), you'd better use a custom linker script file. In your case you need to move symbols to sdram but you also need to specify where, in order to avoid overlap, as I said before. So I believe the linker script method is mandatory.