Array Error

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am

Array Error

Post by rp181 »

I am getting an error i have never gotten before, "error: source array smaller than destination for argument 1 of `readFrame'"

code:

Code: Select all

char data[256][128];
readFrame(data,opf); //the line giving the error
header:

Code: Select all

void readFrame(int buffer[256][128], OpticalFlow &opf);
function:

Code: Select all

void readFrame(int buffer[256][128], OpticalFlow &opf) {
	if (init_type == 1) {
		readLogFrame(buffer, opf);
	} else {
		readLinFrame(buffer, opf);
	}
}
readLogFrame:

Code: Select all

void readLogFrame(int buffer[256][128], OpticalFlow &opf) {

	int x;
	int y;
	int tmp;
	for (y = 0; y < 128; y++) {
		sendToOpticFlow(ROWSEL, y, opf); // Select row
		delay(3);
		for (x = 0; x < 256; x++) {
			sendToOpticFlow(ADCOP, 0, opf); // Reset ADC
			sendToOpticFlow(COLSEL, x, opf); // Select column
			delay_us(3);
			sendToOpticFlow(ADCOP, 1, opf); // Start ADC conversion
			tmp = readOpticFlow(opf);
			buffer[x][y] = tmp;

		}

	}
}


User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

readFrame() wants an int[][], you're passing it a char[][].

int[256][128] will not fit in memory, btw.