- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm developing an application with CyclloneII and I have the issue below: is there a way to place a variable at particular address in memory, something like the "_AT_" flag of some micros? Example: alt_u8 DummyByte ...something here.... 0x0080000: Note that i want to put the variable in some fixed location, not in some section like .text,.rodata et., or provided the allocation in a section, I want the freedom to choose the address within that memory. Thanks in Advance EmmeLink Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can use register variable of NIOS cpu. Here is the syntex of it. register unsigned int temp_data2 asm("r12"); by this you have a freedom to choose the memory location of your specific variables. I hope this would be sufficient help for you. Regards, slsnios- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm not sure if I am on the right track, if I "put" variable in the register how can I bond its address? More, I've many variables to place at fixed address ... Emme- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Emme,
> Note that i want to put the variable in some fixed location, not in some section > like .text,.rodata et., or provided the allocation in a section, I want the freedom to > choose the address within that memory. The compiler puts variables, code, etc. into sections ... there's no choice in this matter other than specifying a compiler output section ... so, if you want to do things at run time, you'll have to use a pointer: alt_u8 *pDummyByte = (alt_u8 *) 0x0080000; or something similar. Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Scott,
I see... Thanks a lot, now I`m using pointers and things are going well. Best regards, Emme. --- Quote Start --- originally posted by smcnutt@Nov 21 2006, 05:12 PM hi emme,
> note that i want to put the variable in some fixed location, not in some section
> like .text,.rodata et., or provided the allocation in a section, i want the freedom to
> choose the address within that memory.
the compiler puts variables, code, etc. into sections ... there's no choice in this matter other than
specifying a compiler output section ... so, if you want to do things at run time, you'll have to use a
pointer:
alt_u8 *pdummybyte = (alt_u8 *) 0x0080000;
or something similar.
regards,
--scott
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19563)
--- quote end ---
--- Quote End ---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by smcnutt@Nov 21 2006, 10:12 AM the compiler puts variables, code, etc. into sections ... there's no choice in this matter other than
specifying a compiler output section ... so, if you want to do things at run time, you'll have to use a
pointer:
alt_u8 *pdummybyte = (alt_u8 *) 0x0080000;
or something similar.
regards,
--scott
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19563)
--- quote end ---
--- Quote End --- Many embedded C compilers have the extensions like Emme has mentioned (_AT_) to not only allow usage of the memory block but make the access fast. Using "at" lets you avoid indirect addressing in case your main memory is slow. Let's say you want to put some data buffer for an isr in a on-chip memory to avoid using slow external ram bus - how would you do it with your method? To resolve pointer you would still have to access it located in the external ram, so you would not save any time doint this... It would be great if the gcc compiler implementation for Nios could be extended with some typical embedded features like "at" directive...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> Let's say you want to put some data buffer for an isr in a on-chip memory to avoid using slow
> external ram bus - how would you do it with your method? The same way ;-) > To resolve pointer you would still have to access it located in the external ram, so you would > not save any time doint this... This is an optimization issue -- even -O1 will avoid this, and keep the pointer in a register. > It would be great if the gcc compiler implementation for Nios could be extended with some > typical embedded features like "at" directive... The section attribute handles many of these situations. A linker script can handle the rest -- using script defined variables, for example, Regards, --Scott
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