Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Data in .noinit isn't seen by linker [RSS Feed]

#1 Oct. 27, 2005 01:13:42

Andrew M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Data in .noinit isn't seen by linker


Hi,I'm trying to put a structure into the ".noinit" space and I'm getting acomplaint from the linker. Here is my ".h" definition.struct my_dsl_s {
unsigned char state;
...

};

struct my_dsl_s my_dsl __attribute__ ((section(".noinit")));Compilation and linking is normal when I don't have the "attribute"addition to the data-type definition, but with this addition I get numerouscomplaints from the linker for each .c module that includes this .h file. Itsays there are multiple definitions for the variable even though there arepreprocessor guards up for the .h file. For exampleLinking: dsl_modem.elf
c:/cygwin/usr/local/bin/avr-gcc -mmcu=atmega32 -I. -gdwarf-2 -g3 -Os -funit-at-a
.....
dal.o: In function `dsl_init':
/home/reckless/Hades/dal.c:19: multiple definition of `my_dsl'
./main.o:/home/reckless/Hades/main.c:62: first defined here
dal.o: In function `dsl_init':Do I need to inform the linker about this section? (noinit). From theavr-libc docs it seems that this section is predefined but based on thecompiler output it seems it doesn't know what to do with this section.Any help???

Thanks

Andrew





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

Offline

#2 Oct. 27, 2005 02:35:28

Erik C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Data in .noinit isn't seen by linker


On Wed, Oct 26, 2005 at 08:13:33PM -0400, Andrew M. Cullen wrote:
> I'm trying to put a structure into the ".noinit" space and I'm getting a
> complaint from the linker. Here is my ".h" definition.

> struct my_dsl_s my_dsl __attribute__ ((section(".noinit")));

Have you tried:

In one file:
struct my_dsl_s my_dsl __attribute__ ((section(".noinit")));

In all others:
extern struct my_dsl_s my_dsl __attribute__ ((section(".noinit")));

This works for me with the gnu toolchain in this situation, though
currently on another target, I'll admit. (And I'm not doing
-funit-at-a-time)

>
> Do I need to inform the linker about this section? (noinit). From the
> avr-libc docs it seems that this section is predefined but based on the
> compiler output it seems it doesn't know what to do with this section.

Nope. If ld didn't know about .noinit, you'd see an error like:

error: no memory region specified for loadable section `.noinit'

(Try using __attribute__ ((section (".chook"))) , for example. ;)

hth,
Erik

--
_,-_|\ Erik Christiansen Phone: +61 3 9264 3416
/ \ Technology Group Fax: +61 3 9264 3438
\_,-.__/ Key Systems Development
v NEC Business Solutions Ltd. www.necbs.com.au


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

Offline

#3 Oct. 27, 2005 02:47:26

Andrew M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Data in .noinit isn't seen by linker


I will try the extern declarations and report back but I can tell you nowthat the following creates no errorsstruct my_dsl_s my_dsl __attribute__ ((section(".foobar")));This is why I was wondering if I needed to add section information to thelinker command file for "noinit".Andrew----- Original Message -----From: "Erik Christiansen" <>To: "Andrew M. Cullen" <>
Cc: <avr-gcc-l***@*ongnu.org>
Sent: Wednesday, October 26, 2005 9:26 PM
Subject: Re: Data in .noinit isn't seen by linkerOn Wed, Oct 26, 2005 at 08:13:33PM -0400, Andrew M. Cullen wrote:I'm trying to put a structure into the ".noinit" space and I'm gettingacomplaint from the linker. Here is my ".h" definition.struct my_dsl_s my_dsl __attribute__ ((section(".noinit")));Have you tried:

In one file:
struct my_dsl_s my_dsl __attribute__ ((section(".noinit")));

In all others:
extern struct my_dsl_s my_dsl __attribute__ ((section(".noinit")));

This works for me with the gnu toolchain in this situation, though
currently on another target, I'll admit. (And I'm not doing
-funit-at-a-time)Do I need to inform the linker about this section? (noinit). From the
avr-libc docs it seems that this section is predefined but based on the
compiler output it seems it doesn't know what to do with this section.Nope. If ld didn't know about .noinit, you'd see an error like:

error: no memory region specified for loadable section `.noinit'

(Try using __attribute__ ((section (".chook"))) , for example. ;)

hth,
Erik

--
_,-_|\ Erik Christiansen Phone: +61 3 9264 3416
/ \ Technology Group Fax: +61 3 9264 3438
\_,-.__/ Key Systems Development
v NEC Business Solutions Ltd. www.necbs.com.au_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#4 Oct. 27, 2005 11:13:30

Erik C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Data in .noinit isn't seen by linker


On Wed, Oct 26, 2005 at 09:40:38PM -0400, Andrew M. Cullen wrote:
> I will try the extern declarations and report back but I can tell you now
> that the following creates no errors
>
> struct my_dsl_s my_dsl __attribute__ ((section(".foobar")));

Hmmm, my avr toolchain is a little old now, so it only gives an overlap
warning when challenged with a non-existent program section (i.e. on a
function prototype), and like yours, fails to warn about a non-existent
data section. I then tried an avr-ld from binutils 2.15.94, but it also
fails to warn. (I don't have time to build from binutils-2.16.1 just
now, on my slow laptop. ;) The warning may well be missing for avr,
then.

You could try:

avr-ld --verbose | grep noinit

to see how much mention there is of .noinit in the linker script that is
being used in your compile. If none, then there's more to choose from in
.../avr/lib/ldscripts/. (Normally 3 for each avr size, IIRC.)

Erik


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

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Data in .noinit isn't seen by linker [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support