Hello,
I'm making heavy use of dsplibs DSPF_sp_fftSPxSP for many different FFT sizes (Parameter N). Until now, I was calculating twiddle factors on the fly, whenever I need them for a new fft size. Now I've found out that this is a bottleneck in my program and wanted to trade speed vs memory and create a table of twiddle factors:
#pragma DATA_ALIGN( 8 )
const float afTwiddle_65536[] =
{
1.000000000e+00, 0.000000000e+00, 1.000000000e+00, 0.000000000e+00, 1.000000000e+00,
0.000000000e+00, 1.000000000e+00, 9.587380191e-05, 1.000000000e+00, 1.917476038e-04,
9.999999404e-01, 2.876213985e-04, 1.000000000e+00, 1.917476038e-04, 9.999999404e-01,
// and so on
};
This worked fine, but only for the biggest available FFT size. As I said, I need many different FFT sizes. Now I could for example pick each 2nd pair of values from this table and put it in afTwiddle_32768 and so on. This again costs CPU cycles (ok, could do it with DMA) and heap.
My idea was to "waste" more memory and pre-calculate all the other tables that I could need and include them the same way. I'd access them comfortably with the array:
const float* afTwiddle[] = { afTwiddle_00016, afTwiddle_00032, afTwiddle_00064, afTwiddle_00128,
afTwiddle_00256, afTwiddle_00512, afTwiddle_01024, afTwiddle_02048,
afTwiddle_04096, afTwiddle_08192, afTwiddle_16384, afTwiddle_32768,
afTwiddle_65536 };
All in all, this wouldn't even double the memory consumption which is 65536*sizeof(float)*2 = 0.5 mebi byte for the biggest array. Together with the other tables I wouldn't even reach 1MB. But now comes the linker:
"configuro/linker.cmd", line 190: error: program will not fit into available
memory. placement with alignment fails for section ".const" size 0x1079cf .
Available memory ranges:
DSP_PROG size: 0xc00000 unused: 0x4 max hole: 0x4
"configuro/linker.cmd", line 192: error: program will not fit into available
memory. placement with alignment fails for section ".fardata" size 0x4948 .
Available memory ranges:
DSP_PROG size: 0xc00000 unused: 0x4 max hole: 0x4
And so on and on :(
I'm compiling this with EZSDK 5.05.02.00 default memory map, which gives DSP_PROG 12 MB.
Now my questions:
0) Why can't I add 1 MB of data to my code?
1) Am I insane to even try this?
2) What's a better way?
3) Can I increase the memory region for DSP_PROG so that much more fits into it?
Many thanks for your help,
Markus