[arm-gnu] Placing variable at absolute address in RAM

Krzysztof Wesołowski krzysztof.wesolowski at rainlabs.pl
Fri Apr 6 11:06:59 UTC 2012


Maybe i missed some hardware specific part there, but why do not place
whole standard SRAM first and use last 16bytes for DMA? Any reason to
place this DMA specific part in first 512bytes?

Regards,
Krzysztof Wesołowski,
http://www.rainlabs.pl
http://en.rainlabs.pl



On Fri, Apr 6, 2012 at 12:57 PM, 42Bastian
<list-bastian.schick at sciopta.com> wrote:
> Hi
>
>> I manually chose several static and global variables to go into SRAM1
>> using "__attribute__ ((section(".sram1")))", and this works pretty well
>> linker-wise.  The problem is, some of these variables no longer
>> function.  I can't say how exactly because they are from a third party
>> library (lwIP) and I haven't debugged yet, but I know if I let the
>> linker allocate automatically, they're ok.
>
> For variables that do not go to the standard places .data and .bss you
> need to initialize them with your own code.
>
> If you are lucky, those variables are initialized to zero, so you can do
> a memset() of SRAM by hand.
>
> If initialized you need to enhance your linker script like this:
>
>  .sram1 : {
>        *(.sram1_data)
>        sram1_bss = .;
>        *(.sram1_bss)
>  } > SRAM1 AT > FLASH
>
> sram1_loadaddr = LOADADDR(.sram1);
>
>> .data : AT (ADDR(.text) + SIZEOF(.text)) { _data = .; *(vtable)
>> *(.data*) _edata = .; } > SRAM2
>
> BTW: Better way is
> .data : {
>
> } > SRAM2 AT > FLASH
> (Leave it to ld to do the calculation.)
>
>
> --
> 42Bastian
> +
> | http://www.sciopta.com
> | Fastest direct message passing kernel.
> | IEC61508 certified.
> +
> _______________________________________________
> arm-gnu mailing list
> arm-gnu at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu



More information about the arm-gnu mailing list