- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
Sorry I'm a newbie in NIOSII... I would like to write and read a char in the SRAM, I try to use itoa function but NIOSII doesn't recognize this function? I use this command: IOWR_16DIRECT((SRAM_BASE), 4, "a"); value = IORD_16DIRECT((SRAM_BASE), 4); printf("%d,%s\n", 4,value); How can I write a char in SRAM whithout itoa function please? Thx.Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Non standard itoa() function is for convert an integer to a string, it is not related to SRAM,
If you want convert numbers to string just use standard function sprintf(). If you want write a single char, use simple quotes 'a', not double quotes "a".- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if i wanna write a char for exemple "abcd" what can i do ?
thx- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For declaring an initialized string at sram use:
char my_str __attribute__ ((section (".sram"))) = "abcde";
my_str must be global. This, assuming you have a sram object. For copying between memory locations just use memcpy().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok thx i'll try it.
I've one more question about that... what's the ".sram" ? cuz the sram that i use is a new component that i've created in SOPC builder...would like to know if this name should be linked with the name of the component.... Thx- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've tested your code....
I would like to know how you can read this char using IORD_16DIRECT ? How do you write a char as "abcd" at a specific adress ? Thanks for your help.
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