[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 :
{
*(.vectors)
__ctors_start = . ;
*(.ctors)
__ctors_end = . ;
__dtors_start = . ;
*(.dtors)
__dtors_end = . ;
*(.progmem.gcc*)
*(.progmem*)
. = ALIGN(2);
*(.init0) /* Start here after reset. */
*(.init1)
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
*(.init3)
*(.init4) /* Initialize data and BSS. */
*(.init5)
*(.init6) /* C++ constructors. */
*(.init7)
*(.init8)
*(.init9) /* Call main(). */
*(.text)
. = ALIGN(2);
*(.text.*)
. = ALIGN(2);
*(.fini9) /* _exit() starts here. */
*(.fini8)
*(.fini7)
*(.fini6) /* C++ destructors. */
*(.fini5)
*(.fini4)
*(.fini3)
*(.fini2)
*(.fini1)
*(.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:
.progmem.signature
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
http://www.DaveHylands.com/