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++
12748 Discussions

Locate variables at fixed ram addresses

Altera_Forum
Honored Contributor II
1,292 Views

In NIOS II/ gnu cpp, are there a way to reserve a region of the ram or equivalently assign a variable to a fixed location? 

 

The reason I need this feature is that I have a nios user interface to a true dual ported ram. One side of this ram is accessed by hardware, the other side by the nios software. You may think, Why not reserve all this ram for exclusive use to communication with hardware? In this way I dont have to worry about competing with nios system variables for storage. 

The answer is that I have only one MRAM block left. This has to serve for nios ram storage and the dual port feature. The MRAM can not be split up in two blocks (as far as I can see). So by simply reserving the entire MRAM for true dual port ram, I can exploit all the ram in the remaining MRAM block. Part of the ram is used by hardware interface, rest is for nios traditional ram use. Hardware wise it works and compiles nicely, but how do I get the software to reserve the location accessed from the hardware port? I dont want nios to put any random storage in this region as this will be overwritten by the external hardware. 

Hope you have a hint as how this can be done.  

Maybe its some linker switch but I failed find the exact method. 

 

Regards 

henning
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
633 Views

Hi Henning, 

 

> In NIOS II/ gnu cpp, are there a way to reserve a region of the ram or 

> equivalently assign a variable to a fixed location? 

 

Yes. For details, please see the topic: 

 

"Linker (NIOS2-ELF-LD) help requested, Need to fix a const struct in memory" 

 

Regards, 

--Scott
0 Kudos
Reply