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

Memory for Nios II Software

Honored Contributor II

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]; 



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
Honored Contributor II

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

0 Kudos