[En-Nut-Discussion] Newbie - Debugging - makefile removes(rm) *.elf file

Anton Veldhuizen antonv at hotmail.com
Thu Jul 15 10:41:23 CEST 2004


Thanks Marc,

My elf file problem is now sorted.  Now trying to convert that to a coff...  
My makefile instruction is as follow:
coff: $(OBJS) $(PROJ).elf $(PROJ).cof end

The compiler output:
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=gsmgenie.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include gsmgenie.c -o gsmgenie.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=global.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include global.c -o global.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=initialization.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include initialization.c -o initialization.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes -Wa,-ahlms=rtc.lst 
-DETHERNUT2 -IC:/ethernut/nut/mod/include -IC:/ethernut/nut/include rtc.c -o 
rtc.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=smsengine.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include smsengine.c -o smsengine.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=messagehandler.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include messagehandler.c -o messagehandler.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes -Wa,-ahlms=io.lst 
-DETHERNUT2 -IC:/ethernut/nut/mod/include -IC:/ethernut/nut/include io.c -o 
io.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=utilities.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include utilities.c -o utilities.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=pc_uart0_rx.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include pc_uart0_rx.c -o pc_uart0_rx.o
avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes 
-Wa,-ahlms=g18_uart1_rx.lst -DETHERNUT2 -IC:/ethernut/nut/mod/include 
-IC:/ethernut/nut/include g18_uart1_rx.c -o g18_uart1_rx.o
avr-gcc gsmgenie.o global.o initialization.o rtc.o smsengine.o 
messagehandler.o io.o utilities.o pc_uart0_rx.o g18_uart1_rx.o 
-mmcu=atmega128 -Wl,--defsym=main=0,-Map=gsmgenie.map,--cref 
-LC:/ethernut/nut/lib/gcc/atmega128  
C:/ethernut/nut/lib/gcc/atmega128/nutinit.o -lnutos -lnutdev -lnutos 
-lnutcrtf -lm -o gsmgenie.elf
objtool loadelf gsmgenie.elf mapfile gsmgenie.map writecof gsmgenie.cof
NO .STAB SECTION FOUND ON CONVERSION!
Failed to create symbol information!
ERROR: Could not convert from .ELF to .COF.

OBJTOOL v0.05 beta

help                - Displays this screen.
loadelf  <filename> - Loads a .ELF file into memory.
loadcof  <filename> - Loads a .COF file into memory.
writecof <filename> - Writes memory contents into a .COF file.
mapfile  <filename> - Sets the name of the mapfile for global symbol 
addresses.
dumpelf             - Dumps memory contents to screen in .ELF format.
dumpcof             - Dumps memory contents to screen in .COF format.
copyright           - Displays copyright information.

invent <name> <type> <A1> <A2> <A3> <A4> - Invents a symbol information type 
of
                                           <name> with a type of <type> and
                                           with the array attributes of <Ax>

make: *** [gsmgenie.cof] Error 255

My c compiler flags:
CPFLAGS = -g $(MCFLAGS) -Os -Wall -Werror -Wstrict-prototypes 
-Wa,-ahlms=$(<:.c=.lst) $(DEFS)

My assembler flags:
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.S=.lst),-gstabs $(DEFS)

Question:
How does one generate the .STAB section?  I've added the -g and -gstabs to 
the above CPFLAGS and ASFLAGS respectively.

Kind Regards,
Anton

Thats done automagically, because make sees that noone uses the generated
elf-file IMHO.

If you add the elf.file to your build rule or e.g. just type
'make projektname.elf' it will be generated.

/Marc

>-----Original Message-----
>From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
>bounces at egnite.de] On Behalf Of Anton Veldhuizen
>Sent: Tuesday, July 13, 2004 3:59 PM
>To: en-nut-discussion at egnite.de
>Subject: [En-Nut-Discussion] Newbie - Debugging - makefile removes(rm)
>*.elffile
>
>Hi all,
>
>When compiling an app using the standard makefile supplied with ethernut
>example apps, some instruction(!?) deletes the elf file directly after the
>compilation finishes (see "make all" capture below).  I've searched all
>the
>included files in the project makefile, but this instruction illudes me.
>
>Can someone please indicate how I can remove this instruction (I want to
>use
>the .elf file for debugging).  Furthermore, does someone have an example
>makefile, makedefs and makerules that builds a coff file for debugging via
>AVR Studio?
>
>Regards,
>Anton
>
>Make all capture:
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes
>-Wa,-ahlms=basemon.lst -DETHERNUT2 -I../../mod/include -I../../include
>basemon.c -o basemon.o
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes
>-Wa,-ahlms=xmemtest.lst -DETHERNUT2 -I../../mod/include -I../../include
>xmemtest.c -o xmemtest.o
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes
>-Wa,-ahlms=realtek.lst -DETHERNUT2 -I../../mod/include -I../../include
>realtek.c -o realtek.o
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes -Wa,-
>ahlms=smsc.lst
>-DETHERNUT2 -I../../mod/include -I../../include smsc.c -o smsc.o
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes -Wa,-
>ahlms=uart.lst
>-DETHERNUT2 -I../../mod/include -I../../include uart.c -o uart.o
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes
>-Wa,-ahlms=webdemo.lst -DETHERNUT2 -I../../mod/include -I../../include
>webdemo.c -o webdemo.o
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes
>-Wa,-ahlms=utils.lst -DETHERNUT2 -I../../mod/include -I../../include
>utils.c
>-o utils.o
>../..\tools\win32\crurom -r -ourom.c html
>avr-gcc -c -mmcu=atmega128 -Os -Wall -Wstrict-prototypes -Wa,-
>ahlms=urom.lst
>-DETHERNUT2 -I../../mod/include -I../../include urom.c -o urom.o
>avr-gcc basemon.o xmemtest.o realtek.o smsc.o uart.o webdemo.o utils.o
>urom.o -mmcu=atmega128 -Wl,--defsym=main=0,-Map=basemon.map,--cref
>-L../../lib/gcc/atmega128  -lnutnet -lnutpro -lnutfs -lnutos -lnutdev
>-lnutnet -lnutcrt -o basemon.elf
>avr-objcopy -O ihex basemon.elf basemon.hex
>rm basemon.elf

_________________________________________________________________
Keep in touch with friends abroad - it's easy with MSN Groups! 
http://groups.msn.com/people.msnw?pgmarket=en-za




More information about the En-Nut-Discussion mailing list