/* linker_dsp.cmd */
-stack 0x00001000
-heap 0x00001000
MEMORY
{
dsp_l2_ram: ORIGIN = 0x11800000 LENGTH = 0x00040000
shared_ram: ORIGIN = 0x80000000 LENGTH = 0x00020000
external_ram: ORIGIN = 0xC0000000 LENGTH = 0x08000000
}
SECTIONS
{
.text > external_ram
.const > dsp_l2_ram
.bss > external_ram
.far > external_ram
.switch > dsp_l2_ram
.stack > dsp_l2_ram
.data > dsp_l2_ram
.cinit > external_ram
.sysmem > dsp_l2_ram
.cio > dsp_l2_ram
.vecs > dsp_l2_ram
.EXT_RAM > external_ram
}
#include "L138_LCDK_aic3106_init.h"
#include <stdint.h>
//short bufferindex = 12; //buffer size for delay
//create buffer
short j=0;
//short amplitude=5
short i=0,k=0,m=0;
float avg_t=0;
int16_t sum=0;
float add1=0;
float rxy[127];
float max_value[3];
float ar[2][128];
//float meanframe1[3];
interrupt void interrupt4(void)
{
//frame 1 to frame 6 to calculate avg mean
int16_t input ;
float avg[6];
float avg_mean;
short flag;
short N=128,n;
//float avg[6];
//float avg_mean;
if(j<6)
{
if(i==128)
{
i=0;
avg[j]=sum/128;
avg_t+=avg[j];
sum=0;
j++;
}
if(i<128)
{
input = input_left_sample();
sum= sum+input;
i++;
}
}
if(j==6)
{
avg_mean=avg_t/6;
j++;
i=0;
}
if(j>6)
{
if(j<10)
{
if(i<128)
{
input = input_left_sample();
ar[0][i]=input-avg_mean;
if (ar[0][i]<=0)
{
ar[0][i]=0; //threshold set to 0 to remove the negative values//
}
else
{
ar[0][i]=ar[0][i];
}
//add1= add1+ar[0][i];
}
else
{
if(i==256)
{
i=127;
flag=1;
j++;
}
else
{
k=i-128;
input = input_left_sample();
ar[1][k]=input-avg_mean;
if (ar[1][k]<=0)
{
ar[1][k]=0; //threshold set to 0 to remove the negative values//
}
else
{
ar[1][k]=ar[1][k];
}
}
}
i++;
if(flag==1)
{
short m=0,q;
for(n=0;n<N-64;n++)
{
float b=0,b1=0;
for(k=0;k<N-n;k++)
{
b=b+(ar[0][k]*ar[1][n+k]);
b1=b1+(ar[0][n+k]*ar[1][k]);
}
if(n==0)
{
rxy[n]=b;
}
else
{
rxy[n]=b;
rxy[n+63]=b1;
}
}
float max_val=0.0;
for(q=0;q<127;q++)
{
if(rxy[q]>max_val)
max_val=rxy[q];
else
max_val=max_val;
}
max_value[m]=max_val;
m++;
short l=0;
for(l=0;l<128;l++)
{
ar[0][l]=ar[1][l];
}
flag=0;
}
}
}
output_left_sample(input);
return;
}
int main(void)
{
L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);
while(1);
}
I am trying to execute one code in LCDK6748. But is not executing properly.The code is having two for loops.So, according to my observation memory insufficiency is there.I tried to modify the linker_dsp.cmd file but no result.I am attaching the code and .cmd file .Please someone resolve the memory issue
