[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Put text string after interrupt vectors

From: Dave Hylands
Subject: Re: [avr-gcc-list] Put text string after interrupt vectors
Date: Mon, 15 Aug 2005 19:02:19 -0700

Hi Lars,

> Is there a way to tell gcc (or ld) to put the signature at 0x20? If not,
> is there at least a way to guarantee, that the signature is "anywhere
> near the beginning" of the flash memory?

The secret lies in the linker script files. An example of such a file
can be found in WinAVR/avr/lib/ldscript/avr5.x

You'll see something like the following:

  .text :
     __ctors_start = . ;
     __ctors_end = . ;
     __dtors_start = . ;
     __dtors_end = . ;
    . = ALIGN(2);
    *(.init0)  /* Start here after reset.  */
    *(.init2)  /* Clear __zero_reg__, set up stack pointer.  */
    *(.init4)  /* Initialize data and BSS.  */
    *(.init6)  /* C++ constructors.  */
    *(.init9)  /* Call main().  */
    . = ALIGN(2);
    . = ALIGN(2);
    *(.fini9)  /* _exit() starts here.  */
    *(.fini6)  /* C++ destructors.  */
    *(.fini0)  /* Infinite loop after program termination.  */
     _etext = . ;
  }  > text

So if you're not use C++, then the .ctors and .dtors will be empty.
Anything in a section that starts with .progmem will go next. So you
could name your section:


and it would go pretty early in the file. If you make your section
named .vectors then it will go after the real vectors.

Dave Hylands
Vancouver, BC, Canada

reply via email to

[Prev in Thread] Current Thread [Next in Thread]