Hi,
There is an application for which I have to store 7K samples and store them for later processing. Due to RAM constraints we have in K53 MCU, I thought about going ahead with pointers for data storage. As the first step, I wrote a simple code for K53 in IAR. The code works for sometime and then throws the error "******default_isr entered on vector 3 *****". But even then it works at times and then again throws this statement. Is there anything wrong in my usage as I can't find out where I am exactly going wrong. I allotted memory using malloc and then freed memory using free(pointer). After using free(), the control goes somewhere and when I pause the debug session, it gives me a pop up saying target cannot be halted, do you want to stop debug session? is there a specific way to use malloc and free?If there is some example project using pointers as a replacement for array, it would be great.? I am attaching the code i wrote .
void main (void)
{
int *raw;
raw = malloc(1000* sizeof(int));
int i=0;
while(1)
{
int count=0;
for(int k=0;k<1000;k++) {
*(raw++) = 2*count++;
}
printf("\TEST");
for(int i=1000;i>0;i--) {
printf("%d\n",*(raw -i));
}
free(raw);
}
}