- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, everybody.
I want to place some code, that is critical in fast onchip memory. I've read in "Nios II Software Developer's Book" from Altera's site this: "Within your program source code, you can specify a target memory section for a specific piece of code. To do this action in C or C++, you can use the section attribute. The following code shows placing a variable foo within the memory named on_chip_memory, and the function bar()in the memory named sdram. Use the extension .txt for code, and the extension .rodata for read-only data or .rwdata for read-write data. Example: Manually Assigning C Code to a Specific Memory Section /* data should be initialized when using the section attribute */ int foo __attribute__ ((section (".on_chip_memory.rwdata"))) = 0; void bar __attribute__ ((section (".sdram.txt"))) (void) { foo++; }" I'm using Nios II IDE, have onchip memory generated in SOPC Builder named onchip_memory_0, and I want to place my interrupt service routine in this memory. For program, read only, heap, stack, and read/write memory in system description in Nios II IDE I choose sram. I can define variable in this memory like this: int foo __attribute__ ((section (".onchip_memory_0.rwdata"))) = 0; ,but if I try to place there function like this: void function __attribute__ ((section (".onchip_memory_0.text"))) (void) { foo++; } compiler returns errors: 1) parse error before "(" ,and 2) size of function isn't known What's happening? What must I do? Have I write my own linker script instead of automatically written by Nios II IDE, or something?Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Shouldn't you be using ".txt" instead of ".text"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, I've tried both. I think that in pdf it is a bug, and it should be text. I've tried .txt, .text, without .something, and have same errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't looked at this, but I think that "Nios2 Forum" should have something more suitable to address your issue.
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