- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using a 12K on chip memory for my Nios II system. In my software code, I am using an Integer array of length 500000. But I am wondering how it can be implemented on a 12k on chip memory?!!!. the project is built succesfully with no shortage of memory. Here is my code:
# include "system.h" int main(void) { volatile unsigned int * read_ptr = (unsigned int *) (READ_PORT_BASE + 1); volatile unsigned int * write_ptr = (unsigned int *) (WRITE_PORT_BASE + 1); unsigned int temp; int length = 500000; unsigned int buff[length]; while(1) { buff[0] = (* read_ptr); for (int i = 1; i < length - 1; i++) { temp = buff;buff = buff[i - 1]; buff[i + 1] = temp; } temp = buff[0] + buff[length]; (* write_ptr) = temp; } }
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is a on-stack array - so space is only allocated at run time.
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