This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

error: program will not fit into available memory :(

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

  • I forgot to add:

    from linker.cmd:

    SECTIONS
    {
        .text: load >> DSP_PROG
        .ti.decompress: load > DSP_PROG
        .stack: load > DSP_PROG
        GROUP: load > DSP_PROG
        {
            .bss:
            .neardata:
            .rodata:
        }
        .cinit: load > DSP_PROG
        .pinit: load >> DSP_PROG
        .init_array: load > DSP_PROG
        .const: load >> DSP_PROG
        .data: load >> DSP_PROG
        .fardata: load >> DSP_PROG
        .switch: load >> DSP_PROG
        .sysmem: load > DSP_PROG
        .far: load >> DSP_PROG
        .args: load > DSP_PROG align = 0x4, fill = 0 {_argsize = 0x0; }
        .cio: load >> DSP_PROG
        .ti.handler_table: load > DSP_PROG
        .vecs: load >> DSP_PROG
        xdc.meta: load >> DSP_PROG, type = COPY

    }

    from config.bld:

    Build.platformTable["ti.platforms.evmTI814X:dsp"] = {
        externalMemoryMap: [
            [ SR_0.name, SR_0 ],
            [ SR_1.name, SR_1 ],
            [ "DSP_PROG", {
                name: "DSP_PROG", space: "code/data", access: "RWX",
                base: 0x99500000, len: 0xC00000,
                comment: "DSP Program Memory (12 MB)"
            }]
        ],
        codeMemory:  "DSP_PROG",
        dataMemory:  "DSP_PROG",
        stackMemory: "DSP_PROG",
        l1DMode: "32k",
        l1PMode: "32k",
        l2Mode: "256k"
    };