This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to use OVERLAY?


I'm having problem using OVERLAY keyword in ld script. The following code
was successfully used with binutils 2.9.1:
===
MEMORY
{
     baseram   : org =   0x0400 , l = 0x3000
     osram       : org =   0x3400 , l = 0x4c00
     bflashram : org =   0x8000 , l = 0x0400
     flashram  : org =   0x8400 , l = 119k
     rombase   : org = 0xe00000 , l = 44k
}

SECTIONS
{
/* skipped */
     OVERLAY ALIGN ( 2 ): AT (QueryImg)
     {
          FlashQueryPart
          {
               OverlayStart = . ;
               ./object/debug/flash.o(FlashQueryPart)
          }
          FlashATMELDrv
          {
               ./object/debug/flash.o(FlashATMELDrv)
          }
          FlashAMDDrv
          {
               ./object/debug/flash.o(FlashAMDDrv)
          }
     } >baseram
/* skipped */
     misc ALIGN(0x2) :
     {
          *.o(.text)
          *.o(.data)
          *.o(.bss)
     } >rombase =0x4e71
     QueryImg = ABSOLUTE (.);
/* skipped */
}
===

With binutils 2.9.5.0.46 I get the following error with it:
===
/usr/local/m68k-coff/bin/ld: use an absolute load address or a load memory
region, not both
===

So I have to replace OVERLAY section with the following code in order to
make it working:
===
/* OVERLAY */
     FlashQueryPart ALIGN (0x2): AT (QueryImg)
     {
          OverlayStart = . ;
          ./object/debug/flash.o(FlashQueryPart)
     } >baseram
     FlashATMELDrv ADDR(FlashQueryPart): AT (QueryImg + SIZEOF
(FlashQueryPart))
     {
          ./object/debug/flash.o(FlashATMELDrv)
     }
     FlashAMDDrv ADDR(FlashQueryPart): AT (QueryImg + SIZEOF
(FlashQueryPart) + SIZEOF (FlashATMELDrv))
     {
          ./object/debug/flash.o(FlashAMDDrv)
     }
     __load_start_FlashQueryPart = LOADADDR (FlashQueryPart);
     __load_stop_FlashQueryPart = LOADADDR (FlashQueryPart) + SIZEOF
(FlashQueryPart);
     __load_start_FlashATMELDrv = LOADADDR (FlashATMELDrv);
     __load_stop_FlashATMELDrv = LOADADDR (FlashATMELDrv) + SIZEOF
(FlashATMELDrv);
     __load_start_FlashAMDDrv = LOADADDR (FlashAMDDrv);
     __load_stop_FlashAMDDrv = LOADADDR (FlashAMDDrv) + SIZEOF
(FlashAMDDrv);
     . = ADDR(FlashQueryPart) + MAX (MAX (SIZEOF (FlashQueryPart), SIZEOF
(FlashATMELDrv)), SIZEOF(FlashAMDDrv));
/* END OF OVERLAY */
===

Anyone have an idea what's wrong in my definition of OVERLAY?

--
Alexander Aganichev
Hypercom Europe Limited, Inc.
Software Engineer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]