Why does this endup in DRAM instead of flash?

greengnu
Posts: 27
Joined: Wed May 08, 2019 8:45 pm

Why does this endup in DRAM instead of flash?

Postby greengnu » Wed Nov 06, 2019 5:12 pm

I'm currently trying to compile a library for the esp32. Some parts already work, but I'm overruning dram when linking. I changed the esp32_out.ld file to fake more available dram, so I can link and inspect the resulting firmware.elf

I see that the following definitions end up in dram:

Code: Select all

    const ResizeFunc lanczos4_tab[] =
    {
        resizeGeneric_<HResizeLanczos4<uchar, int, short>,
            VResizeLanczos4<uchar, int, short,
            FixedPtCast<int, uchar, INTER_RESIZE_COEF_BITS*2>,
            VResizeNoVec> >,
        0,
        resizeGeneric_<HResizeLanczos4<ushort, float, float>,
            VResizeLanczos4<ushort, float, float, Cast<float, ushort>,
            VResizeLanczos4Vec_32f16u> >,
        resizeGeneric_<HResizeLanczos4<short, float, float>,
            VResizeLanczos4<short, float, float, Cast<float, short>,
            VResizeLanczos4Vec_32f16s> >,
        0,
        resizeGeneric_<HResizeLanczos4<float, float, float>,
            VResizeLanczos4<float, float, float, Cast<float, float>,
            VResizeLanczos4Vec_32f> >,
        resizeGeneric_<HResizeLanczos4<double, double, float>,
            VResizeLanczos4<double, double, float, Cast<double, double>,
            VResizeNoVec> >,
        0
    };

Code: Select all

3ffed108	l	O	.dram0.bss	40000	_ZN2cvL13Lanczos4Tab_fE
3ffcd106	l	O	.dram0.bss	20000	_ZN2cvL13Lanczos4Tab_iE
40035108	l	O	.dram0.bss	10000	_ZN2cvL12BicubicTab_fE
4002d108	l	O	.dram0.bss	8000	_ZN2cvL12BicubicTab_iE
40047108	l	O	.dram0.bss	4000	_ZN2cvL13BilinearTab_fE
40045108	l	O	.dram0.bss	2000	_ZN2cvL13BilinearTab_iE
The definition of ResizeFunc is

Code: Select all

typedef void (*ResizeFunc)( const Mat& src, Mat& dst,
                            const int* xofs, const void* alpha,
                            const int* yofs, const void* beta,
                            int xmin, int xmax, int ksize );
I marked them with const - shouldn't they be put in flash then rather than dram?

I also don't really get how this array can end up being 260kb in size...

I should add: I'm first compiling the library into a static .a library before then linking it into my app


//edit:
uuuuh, i just noticed that the library defines these arrays in a namespace named "hal". I take it that's the source of the problem? It's not compiled into a library named libhal.a however

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Why does this endup in DRAM instead of flash?

Postby ESP_Angus » Thu Nov 07, 2019 2:50 am

Hi greengnu,

What is the library named?

Could you please post the .map file from your project? This should give some clues about which linker rules, if any, were applied when linking these symbols.

Also, if you dump the unlinked .a file contents then what sections do these symbols belong to before they are linked?

Angus

Who is online

Users browsing this forum: Bing [Bot] and 149 guests