[En-Nut-Discussion] generating .elf files for debugging

José Vallet jose.vallet at hut.fi
Fri Jan 27 16:39:51 CET 2006


Ups! sorry, stupid mistake. I misspelled HWDEF...

Just as reference, added to UserConf.mk at nutapp.

Now the problem is that the avr-gcc doesn't accept the dwarf-2 option.

I use WinAVR, and this uses the following avr-gcc version
$ avr-gcc -v
Reading specs from c:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\specs
Configured with: ../configure --prefix=/e/avrdev/install --target=avr 
--enable-languages=c,c++ --disable-nls --enable-win32-registry=WinAVR
Thread model: single
gcc version 3.3.1

I cannot see the --with-dwarf2 option that I have seen in many places. 
Could this be the reason?

If so, could be a solution  to try to recompile avr-gcc under cygwin 
with --with-dwarf2 option? Any other better suggestion?

Thanks.
José


---------------------------------------------------------------------
jose at aut-090 /cygdrive/c/ethernut-4.0.1/nutapp/PEM
$ make all
avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
-Wstrict-prototypes -Wa,-ahlms=pemctrl.lst -DETHERNUT2 
-D__HARVARD_ARCH__ -g3 -gd
warf-2 -O0 -Ic:/ethernut-4.0.1/nutbld/include 
-Ic:/ethernut-4.0.1/nut/include  pemctrl.c -o pemctrl.o
cc1.exe: warning: `dwarf-2': unknown or unsupported -g option
In file included from pemctrl.c:45:
pem_httpd.c: In function `DataServer':
pem_httpd.c:711: warning: unused variable `adc_value'
avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
-Wstrict-prototypes -Wa,-ahlms=xflash.lst -DETHERNUT2 -D__HARVARD_ARCH__ 
-g3 -gdw
arf-2 -O0 -Ic:/ethernut-4.0.1/nutbld/include 
-Ic:/ethernut-4.0.1/nut/include  xflash.c -o xflash.o
cc1.exe: warning: `dwarf-2': unknown or unsupported -g option
avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
-Wstrict-prototypes -Wa,-ahlms=tftp.lst -DETHERNUT2 -D__HARVARD_ARCH__ 
-g3 -gdwar
f-2 -O0 -Ic:/ethernut-4.0.1/nutbld/include 
-Ic:/ethernut-4.0.1/nut/include  tftp.c -o tftp.o
cc1.exe: warning: `dwarf-2': unknown or unsupported -g option
avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
-Wstrict-prototypes -Wa,-ahlms=pbtwique.lst -DETHERNUT2 
-D__HARVARD_ARCH__ -g3 -g
dwarf-2 -O0 -Ic:/ethernut-4.0.1/nutbld/include 
-Ic:/ethernut-4.0.1/nut/include  pbtwique.c -o pbtwique.o
cc1.exe: warning: `dwarf-2': unknown or unsupported -g option
avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
-Wstrict-prototypes -Wa,-ahlms=PemBoard.lst -DETHERNUT2 
-D__HARVARD_ARCH__ -g3 -g
dwarf-2 -O0 -Ic:/ethernut-4.0.1/nutbld/include 
-Ic:/ethernut-4.0.1/nut/include  PemBoard.c -o PemBoard.o
cc1.exe: warning: `dwarf-2': unknown or unsupported -g option
avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
-Wstrict-prototypes -Wa,-ahlms=PbDebug.lst -DETHERNUT2 
-D__HARVARD_ARCH__ -g3 -gd
warf-2 -O0 -Ic:/ethernut-4.0.1/nutbld/include 
-Ic:/ethernut-4.0.1/nut/include  PbDebug.c -o PbDebug.o
cc1.exe: warning: `dwarf-2': unknown or unsupported -g option
avr-gcc pemctrl.o  xflash.o tftp.o pbtwique.o PemBoard.o PbDebug.o 
-mmcu=atmega128 -Wl,--defsym=main=0,-Map=pemctrl.map,--cref 
-Lc:/ethernut-4.0.1/nut
bld/lib c:/ethernut-4.0.1/nutbld/lib/nutinit.o -lnutarch -lnutnet 
-lnutpro -lnutfs -lnutos -lnutdev -lnutnet -lnutcrt -o pemctrl.elf
avr-objcopy -R .eeprom -O ihex pemctrl.elf pemctrl.hex



José Vallet wrote:
> Hello.
> 
> I am trying to debug my code, so I am trying to tell the avr-gcc to 
> include debugging information.
> 
> My application lives under nutapp/PEM directory
> 
> What I do is to include the line
> HDEF += -g3 -gdwarf-2 -O0
> 
> in the file nutapp/UserConf.mk
> after make all (or make myaplication.elf), I cannot see anywhere any of 
> the above options as input to avr-gcc during the compilation/linking 
> process, and when I feed the .elf to AVR Studio it complains that: "The 
> object file does not contain source code information". Insight complains 
> about the same issue.
> 
> Also I tryed to put that line at UserConf.mk living at nutbld, but 
> didn't work either. And finally I tried also to include that line in the 
> makefile straight, but didn't work either.
> 
> Can somebody tell me what to put and where so the source code 
> information is included in the elf and I can debug my application?
> 
> Thanks!
> 
> 
> 
> Here I put the make process output just in case...
> ----------------------------------------------------------------------
> $ make pemctrl.elf
> avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
> -Wstrict-prototypes -Wa,-ahlms=pemctrl.lst -DETHERNUT2 
> -D__HARVARD_ARCH__ -Ic:/ethernut-4.0.1/nutbld/include 
> -Ic:/ethernut-4.0.1/nut/include  pemctrl.c -o pemctrl.o
> In file included from pemctrl.c:45:
> pem_httpd.c: In function `DataServer':
> pem_httpd.c:711: warning: unused variable `adc_value'
> avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
> -Wstrict-prototypes -Wa,-ahlms=xflash.lst -DETHERNUT2 -D__HARVARD_ARCH__ 
> -Ic:/ethernut-4.0.1/nutbld/include  -Ic:/ethernut-4.0.1/nut/include 
> xflash.c -o xflash.o
> avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
> -Wstrict-prototypes -Wa,-ahlms=tftp.lst -DETHERNUT2 -D__HARVARD_ARCH__ 
> -Ic:/ethernut-4.0.1/nutbld/include  -Ic:/ethernut-4.0.1/nut/include 
> tftp.c -o tftp.o
> avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
> -Wstrict-prototypes -Wa,-ahlms=pbtwique.lst -DETHERNUT2 
> -D__HARVARD_ARCH__ -Ic:/ethernut-4.0.1/nutbld/include 
> -Ic:/ethernut-4.0.1/nut/include  pbtwique.c -o pbtwique.o
> avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
> -Wstrict-prototypes -Wa,-ahlms=PemBoard.lst -DETHERNUT2 
> -D__HARVARD_ARCH__ -Ic:/ethernut-4.0.1/nutbld/include 
> -Ic:/ethernut-4.0.1/nut/include  PemBoard.c -o PemBoard.o
> avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall 
> -Wstrict-prototypes -Wa,-ahlms=PbDebug.lst -DETHERNUT2 
> -D__HARVARD_ARCH__ -Ic:/ethernut-4.0.1/nutbld/include 
> -Ic:/ethernut-4.0.1/nut/include  PbDebug.c -o PbDebug.o
> avr-gcc pemctrl.o  xflash.o tftp.o pbtwique.o PemBoard.o PbDebug.o 
> -mmcu=atmega128 -Wl,--defsym=main=0,-Map=pemctrl.map,--cref 
> -Lc:/ethernut-4.0.1/nutbld/lib c:/ethernut-4.0.1/nutbld/lib/nutinit.o 
> -lnutarch -lnutnet -lnutpro -lnutfs -lnutos -lnutdev -lnutnet -lnutcrt 
> -o pemctrl.elf
> 
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
> 
> 





More information about the En-Nut-Discussion mailing list