- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Im looking to define some variables (large arrays)such that one resides in sdram and the other in separate sram so that my custom peripheral can do work on one while i do work on the other array with Nios.
How can i direct the compiler to do this, i cant find anything in the manualLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead of declaring arrays, declare pointers, and initialize them with an address (which might be defined in system.h, or you might add offsets to the values from system.h).
If one memory is already where your .rodata and .rwdata are being placed, then you only need a pointer for the other one. Example - if you are running code from sdram, your compiler setting are probably also placing .rwdata in the sdram as well, so just set a pointer to the SRAM like so: alt_u32 * my_sram = ONCHIP_MEMORY_0_BASE ; Now you can use my_sram[i] as an array of 32 bit values. (Assuming ONCHIP_MEMORY_0_BASE is defined in your system.h). Or if your code and .rwdata are in the onchip SRAM, then instead setup a pointer to the base address of the SDRAM. \chuck- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thanks I will do that. I guess what i was after was a way of getting the compiler to do it so I didnt have to take care of allocating the memory and all the problems that will happen if I end up overwriting something i shouldnt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I imagine that getting the compiler to do it would involve something like:
1. declare/setup an extra data segment, in addition to rwdata or bss 2. specify that certain variables should use that segment instead. I can't even begin to guess at how to do either, if it's even possible. \c
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page