gcc linkerscript, sections (MORE)

Correo Fernando-ruiz (E-mail) correo at fernando-ruiz.com
Thu Feb 15 22:37:53 UTC 2001


Another method.

you declare the variable like external.

typedef struct {
 unsigned char second;
 unsigned char second_alr;
 unsigned char minute;
 ...
}TRtc;

extern TRtc rtc; /* This is only inside source.s asm a extern label */

after, in linkcmds, you put the address like a label (with underscore of
course)

************************************************
  _HeapStart = . ;
  _HeapEnd  = _HeapStart  + 1024 * 130;

  _WorkSpaceStart = _HeapEnd   ;
  _WorkSpaceEnd  = 0x0a080000 ;

/* The rtc multiplexed area 6 address BYTE bus width */
  _rtc = 0x06000000 ;

************************************************
Easy? No sections, the 'C' code clean.

More Methods?

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