Hello,
I have an image buffer in the memory and I want to read each frame at one time by using memcpy to copy from memory to an 3 dimensions array with size 82x62x3 but the program stuck at the call of memcpy function.
Here is my code:
Int8U buf[82][62][3];
memcpy(buf, (Int8U *)IMAGE_BUFFER_BASE_ADDRESS, IMAGE_FRAME_SIZE);
(where IMAGE_FRAME_SIZE=82x62x3=15252 bytes)
Could you give me any suggestion?
Thank you.
Hello,
Probably you already got it solved but let me shoot some ideas:
First, is IMAGE_BUFFER_BASE_ADDRESS a valid address? was this allocated somewhere? have access through MMU, have you tried accessing (read/write) with the CPU?
Secondly: memcpy with CPU is very simple, you can do it your own to debug more easily:
int8U ptr1;ptr2;
ptr1 = buf;
ptr2= IMAGE_BUFFER_BASE_ADDRESS;
for(i=0; i<IMAGE_FRAME_SIZE; i++)
{
ptr1[i] = ptr2[i];
}
Run the code above and check where it fails... if it fails at the begining, is very likely your memory is not being correctly allocated or addressed (ie. IMAGE_BUFFER_BASE_ADDRESS is invalid address)