Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Memory Commands

Altera_Forum
Honored Contributor II
938 Views

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. 

 

Paddy
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
270 Views

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)

0 Kudos
Altera_Forum
Honored Contributor II
270 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
270 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
270 Views

Ok, i think now i understand what you wrote about the pointers. I will try it out! 

 

Thanks, 

 

Paddy
0 Kudos
Reply