Forum Discussion
Altera_Forum
Honored Contributor
16 years agoMemory Commands
Hi,
im trying to use a SOPC-generated On-Chip-Memory (RAM) as a general purpose Data-Memory in my NIOS-System. What C-Functions can i use tio access the Memory? Is there a .h-File for the On-Chip-Memory? I did not find any documentation about using the Memory in C. Paddy4 Replies
- Altera_Forum
Honored Contributor
You can use C pointers. The address of your memory block will be in system.h (ON_CHIP_MEMORY_BASE if your on-chip RAM is called on_chip_memory)
- Altera_Forum
Honored Contributor
Ok, i found the address (BASE-Address) in my system.h. But how can i access the memory? Is there a function like IOWR and IOREAD? Which parameters do this functions use?
Paddy - Altera_Forum
Honored Contributor
How do you access RAM in a standard micro controller? With a function? No. You just define some variables and the linker "places" these into the RAM. Since NIOS *is* a standard micro controller it's the same method here. Tell the linker to use your RAM as for the rwdata or the stack or the heap...
In case you already have a RAM for your variables and want to use an additional RAM you have to use pointers for reading and writing to the additional RAM, as Daixiwen said. Harald - Altera_Forum
Honored Contributor
Ok, i think now i understand what you wrote about the pointers. I will try it out!
Thanks, Paddy