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

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

Re: [avr-gcc-list] how do I pass --defsym to avr-ld?


From: Dave N6NZ
Subject: Re: [avr-gcc-list] how do I pass --defsym to avr-ld?
Date: Tue, 30 Sep 2008 23:30:44 -0700
User-agent: Thunderbird 1.5 (X11/20051201)

Hi Knut,

Thanks for the reply. I did try to invoke the linker directly, without much luck.

In any case, after a lunch break I concluded that there was a cleaner and simpler way to accomplish what I wanted anyway, so I abandoned debugging this issue to pursue the alternate implementation, which I eventually got working quite nicely. The new scheme is much cleaner and doesn't require as much command line trickery.

Hopefully I'll have the whole thing written up soon.

Still, I'm not sure what I was doing wrong with DEFINED(), but I've concluded there is something I don't understand about how the linker recognizes symbols.

-dave


Schwichtenberg, Knut wrote:
Dave,

you are using the avr-gcc to pass the parameter to the linker. Did you
try to use the linker directly with
avr-ld --script=avr5.x --defsym=__libdatareserve=0x4 -o user user.o
bootlibentries.o

I'm not sure if the command line is okay :-(.

Knut
-----Original Message-----
From: address@hidden g [mailto:address@hidden
ongnu.org] On Behalf Of Dave N6NZ
Sent: Tuesday, September 30, 2008 10:15 PM
To: address@hidden
Cc: AVR-GCC
Subject: Re: [avr-gcc-list] how do I pass --defsym to avr-ld?

Now I'm even more confused.

I pass the symbol __libdatareserve in through a .o file.
and it shows up in avr-nm output for both the .o and the resulting output file. But it still seems to be ignored by the DEFINED() function.

avr-nm shows the symbol -- why doesn't DEFINED() see it????

badly need a clue here...

-dave

Dave N6NZ wrote:
After making many threats, I'm finally attacking the
problem of doing
separately compiled libraries in a robust fashion. (I can't bring myself to call them dll's since being flashed they are hardly very dynamic :)

I have patched the avr5.x ld script as follows, which is a
total of 3
additional lines, all upward compatible:

diff -u /usr/local/atmel/avr/lib/ldscripts/avr5.x avr5.x
--- /usr/local/atmel/avr/lib/ldscripts/avr5.x 2007-07-27 23:12:51.000000000 -0700
+++ avr5.x      2008-09-30 11:53:10.000000000 -0700
@@ -71,6 +71,7 @@
   {
     *(.vectors)
     KEEP(*(.vectors))
+    *(.entryjumps)
/* For data that needs to reside in the lower 64k of
progmem.  */
     *(.progmem.gcc*)
     *(.progmem*)
@@ -145,6 +146,7 @@
   }  > text
   .data          : AT (ADDR (.text) + SIZEOF (.text))
   {
+     . += DEFINED (__libdatareserve) ? __libdatareserve : 0 ;
      PROVIDE (__data_start = .) ;
     *(.data)
     *(.data*)
@@ -176,6 +178,7 @@
   }  > data
   .eeprom  :
   {
+    . += DEFINED(__libeepromreserve) ? __libeepromreserve : 0 ;
     *(.eeprom*)
      __eeprom_end = . ;
   }  > eeprom

My current problem revolves around the DEFINED() operator
in avr-ld. It
does not seem to recognize my definitions, invoked as follows:

avr-gcc -Wl,--script=avr5.x,--defsym=__libdatareserve=0x4 -o user \
user.o bootlibentries.o

No matter what I do, it appears as if the DEFINED() is
being ignored.
Perhaps I misunderstand how DEFINED() is supposed to work,
or perhaps I
misunderstand --defsym.

If I could solve this, then I believe I have the
gold-plated solution
for calling separately flashed libraries (ie: reusing bootloader functions.) I'll write that up fully after resolving this
annoyance.
-dave



_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list



_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list







reply via email to

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