gcc linkerscript, sections
Correo Fernando-ruiz (E-mail)
correo at fernando-ruiz.com
Thu Feb 15 21:51:59 UTC 2001
The system to place variables (Or code) in a special section outside of the
.data
.bss
COMMON
is the next.
I'am a special vector table.
/*==========================================================================
==*/
In the 'c' source...
fp new_vects[0x100] __attribute__ ((section (".ramvect"))) = {(fp)0L};
You can assign initial values or not. Default is assign only one value of
256 candidates.
(Ugly but works).
You can define more variables in the same section (Or diferent section)
/*=====================================================================*/
After in linkcmds you need to place the correct address for every section.
You can see rtc section (rtc memory mapped).
fsector to place the cache flash memory section. etc...
SECTIONS
{
.vects 0x0000000 (NOLOAD) :
{
*(.romvect);
} > rom
.iram 0x0F000000 (NOLOAD) :
{
_iram = .;
*(.iram)
_eiram = .;
} > iram
.ramvects 0xA000000 (NOLOAD) :
{
*(.ramvect)
} > ram
.code 0xA008000 :
{
_code = .;
ldr.o(.text);
*(.text)
_ecode = .;
} > ram
.mdata ALIGN(4) :
{
_mdata = .;
_data = .;
*(.data)
_edata = .;
} > ram
.bss ALIGN(4) :
{
_bss = .;
*(.bss )
*(COMMON)
*(.fsector)
_ebss = .;
} > ram
.rtc 0x06000000 (NOLOAD):
{
*(.rtc );
} > rtc
}
And in the final command in makefile
$(tools)objcopy ram.cof -O binary -R.bss -R.ramvect -R.guia -R.rtc -R.iram
ram.bin
You exclude the section in the final binary image.
This is my method.
Is this your answer?
Fernando RUIZ CASAS
home: correo at fernando-ruiz.com
work: fernando.ruiz at ctv.es
> -----Mensaje original-----
> De: peter.o.mueller at gmx.de [mailto:peter.o.mueller at gmx.de]
> Enviado el: jueves, 15 de febrero de 2001 10:31
> Para: rtems-users at OARcorp.com
> Asunto: gcc linkerscript, sections
>
>
> Hi,
>
> I have to reuse some old code from a system where one can specify the
> location of variables in memory in the following way:
>
> hardware_base .BLKB 0
> var1 .BLKB 1
> var2 .BLKB 1
> var_array .BLKB 19
> var3 .BLKB 1
>
> The whole stuff is placed in an own section and the linker
> puts it to the
> right address.
> Example: hardware_base is located at the beginning of the
> section, but no
> space is reserved. var1 is located also at the beginning, and
> is 1 byte long.
> var2 is located at hardware_base + 1 ...
> One can also reserve blocks of bytes (like in var_array).
>
> Is there some doku how to place a whole file or a bunch of
> variables in an
> own section using a linker script? Can one do something shown
> above with
> gcc/ass?
>
> Thank you very much,
> Peter
>
> --
> Sent through GMX FreeMail - http://www.gmx.net
>
>
More information about the users
mailing list