[Top][All Lists]

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

Re: [avr-gcc-list] Potential linker problems with interrupt routine

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Potential linker problems with interrupt routine
Date: Mon, 29 Oct 2001 12:22:59 +0100 (MET)

address@hidden (Nicolas Nickisch) wrote:

> As far as I know the problem comes from a linker problem: the
> startup code seems not to be linked to the compiled program.

You could verify this with "avr-nm -n PCF8574.elf".  Look at all the
symbols that have a »T« or »t« in it.  For a simple test program using
both external interrupts it looks like this:

% avr-nm -n i2cana.out | grep ' [tT] '
00000000 t .__start_of_init__
0000001c T greeting
00000027 T s1
00000033 T s2
00000040 T s3
0000004d T s4
0000005e t .__c_startup__
0000005e T _real_init_
00000076 t .copy_data_loop
0000007c t .copy_data_start
00000086 t .zero_bss_loop
00000088 t .zero_bss_start
0000008e t _unexpected_1_
00000092 T _interrupt0_
000000b4 T _interrupt1_
000000d6 T ioinit
000000ee T putchar
000000fa T printstr_p
00000118 t L_69
00000134 t L_87
00000146 T main
00000276 t __stop_progIi__
00000278 T _etext

Note the symbols located at addresses 0 and 0x5e.  These are the
run-time initialization functions.  The interrupt routines are located
way behind that.

> Somewhere I found I hint that the compiler switch "-c" is
> responsible for the missing link (?)

You misread that.  -c causes the compiler to compile a single source
file (either assembler or C code) into one (intermediate) object file.
All those object files then need to be linked (again, using avr-gcc)
together, plus the system library (which will cause the initialization
code and the relevant modules from the C library to be linked in).

As far as i can tell, your compile steps look OK (albeit you're
generating many many listing files -- do you really look at them at
all?), so the problem must be somewhere else.

J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/

reply via email to

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