- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use NIOSII IDE ( Version: 1.1.0 Build: 137 ) to write c software for a design consisting of SRAM, peripherals and a PCI-Interface. Booting is done via EPCS and a short programme initializes all peripherals and PCI. Now the SRAM is mapped into PCI space to load the actual software for NIOS by a linux host. In the meantime NIOS runs in internal ROM (in a wait loop) until download has finished.
How can I force the compiler / linker to place one function into this internal ROM? Adding __attribute__ ((section (".waitrom"))) doesn't work with functions. It's no problem with variables and constants so I've created an const array filled with assemby code. But how can I do this with a standard c-function? MikeLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can do it with functions, but you must put the attribute on the declaration, not the definition. So your code would look something like this:
void function(void) __attribute__ ((section (".memory_name")));
void function(void)
{
/* stuff */
}
Of course the declaration will often be in a header file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
wombat,
next time I'll ask you earlier. Thanks for your help. Mike- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
This works fine for me as well, but when I try to place a variable in the same memory, I get an error about causing a section type conflict. Just to make clear: I have a program running from sdram. Then I want to have a variable in onchip memory as well as another function in onchip memory. Here is the codeint var __attribute__ ((section (".onchip_ram")))=0;
int func(void) __attribute__ ((section (".onchip_ram")));
Is there any known problem placing both of these in the same memory ? Nir
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
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