- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI, eveyone:
i just a beginner of NIOS, i have a quetion about software development of absolute address's accessing. for example, the system have one 1kbytes ram, its start avalon address is 0x0, and length is 0x3ff. i want to access the space which address is 0x100 in my program. can i use pointer of C language like this? unsigned char *p=(unsigned char *)0x100; when i want to know what's byte's data, then x=*p; when i want to give this byte's data, then *p=0xff; how about another way to access absolute address in NIOS2 IDE? is there any document about this?Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi oceanx,
if I understand what it is that you want maybe I can help you. If you want to give your data an offset en you have a base address, you should do it like this: data = BASE_ADDRESS_OF_RAM_USED | 0x(hex-value); this way your offset should be added with the base adress, which can be found in system.h. And data should be declared as a pointer.... Cheers, Danny- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry didn't read it that well I think. It's still early http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/tongue.gif
data = BASE_ADDRESS_OF_RAM_USED | 0x100; Good luck, Danny- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Danny
i just want to write the value-0xFF to the ram space which absolute address is 0x100. in other mcu software programming, i can do it in this way: volatile unsigned char *p = (unsigned char *)0x100; *p = 0xFF; i wonder if it is the same in NIOS programming. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/blink.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ohmy.gif- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi oceanx,
did you try to do it?! Because I think that also should work... You are using the volatile statement.... In my eyes that also should work... Please let me know if it did. Cheers, Danny- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Danny
Because i have no hardware board of NIOS, so i can only to simulate this program. it seems ok. my board will arrive next week, then i can try the program in the hardware. Thanks again http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif Best Regards Yang- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi oceanx,
I think that looks basically fine. However, what you might have problems with is the data cache (if you have one installed in your system) - the write might be stored there instead of written to main memory. I suggest you check the IOWR and IORD macros which are provided in HAL to bypass the cache: Nios2 Documentation states that the 'volatile' keyword does not do the job because of a the cache machanism used in Nios2 (I believe it is called write-back cache). <Nios II kit path>/components/altera_nios2/HAL/inc/io.h Cheers, -pkumpula
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