Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Memory for Nios II Software

Altera_Forum
Honored Contributor II
832 Views

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; 

 

}
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
93 Views

That is a on-stack array - so space is only allocated at run time.

Reply