avr-gcc-list
[Top][All Lists]
Advanced

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

RE: [avr-gcc-list] Howto put constants on fixed address


From: Stu Bell
Subject: RE: [avr-gcc-list] Howto put constants on fixed address
Date: Wed, 19 Dec 2007 10:53:25 -0700

I forgot to add that you can specify the linker script by using the -T
loader flag.  In the make file (generated by Mfile), I added:

LDFLAGS += -T linker_script.x

Where linker_script.x is my modified linker script, which resides in the
source home directory. 


Best regards, 

Stu Bell 
DataPlay (DPHI, Inc.) 


-----Original Message-----
From: Stu Bell 
Sent: Wednesday, December 19, 2007 10:26 AM
To: 'address@hidden'; address@hidden
Subject: RE: [avr-gcc-list] Howto put constants on fixed address

I have code in my bootloader that runs a CRC on the loaded code for a
sanity check.  For that I need a length.  Of course, that needs to be
supplied after the code is compiled, but I allocate space for it by
doing the following:

In the .c file:

/* flash code length -- this is loaded in flash by the linker and other
scripts */ const uint32_t ProgramLength __attribute__ ((section
(".length"))) = 0;

Modified linker script (This is avr<architecture>.x in
<WinAVR>\avr\lib\ldscripts - for me avr6.x):

. . . 
  /* Internal text space or external memory.  */
  .text :
  {
    *(.vectors)
    KEEP(*(.vectors))
    *(.length)
    KEEP(*(.length))
    /* For data that needs to reside in the lower 64k of progmem.  */
    *(.progmem.gcc*)
. . .

(where the .length stuff is what I added)

Give it a shot.


Best regards, 

Stu Bell
DataPlay (DPHI, Inc.) 




reply via email to

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