[En-Nut-Discussion] Program starts executing immediately after loading with AVRStudeo 4.12

Chuck Hackett egroupscdh at up844.us
Sat Feb 4 20:01:01 CET 2006


I've had some success, but I'm still trying to get the Ethernut httpd demo
program (Ethernut-4.0.1) to run on my Ethernut 2.1b board with debugging info
turned on.

If I compile (with WinAVR-20060125 on WinXP) the demo with debug information
turned off and load httpserv.elf it to the target board using AVRStudio (4.12
with Service Pack 1 and the latest patches shown at
http://www.atmel.no/beta_ware/) via my JATG AVR ICE-Cube the disassembler window
opens with the program counter at location 0x0000.  When I click run all works
well.  The board acquires its IP address via DHCP and announces this fact on the
serial port.

To generate debug information for the httpd only (i.e.: not the Ethernut
libraries) I now add " -O0 -g3 -gdwarf-2" to the Apps\UserConf.mk file to alter
the gcc compiler options resulting in the following make sequence:

avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall
-Wstrict-prototypes -Wa,-ahlms=httpserv.lst -DETHERNUT2 -D__HARVARD_ARCH__ -O0
-g3 -gdwarf-2 -IC:/ethernut-4.0.1/NutBuild/include
-IC:/ethernut-4.0.1/nut/include  httpserv.c -o httpserv.o

httpserv.c: In function `ShowSockets':
httpserv.c:341: warning: assignment discards qualifiers from pointer target type
httpserv.c:344: warning: assignment discards qualifiers from pointer target type
httpserv.c:347: warning: assignment discards qualifiers from pointer target type
httpserv.c:350: warning: assignment discards qualifiers from pointer target type
httpserv.c:353: warning: assignment discards qualifiers from pointer target type
httpserv.c:356: warning: assignment discards qualifiers from pointer target type
httpserv.c:359: warning: assignment discards qualifiers from pointer target type
httpserv.c:362: warning: assignment discards qualifiers from pointer target type
httpserv.c:365: warning: assignment discards qualifiers from pointer target type
httpserv.c:368: warning: assignment discards qualifiers from pointer target type
httpserv.c:371: warning: assignment discards qualifiers from pointer target type
httpserv.c:374: warning: assignment discards qualifiers from pointer target type

C:\ethernut-4.0.1\nut\tools\win32\crurom -r -ourom.c sample

avr-gcc -c -mmcu=atmega128 -Os -fno-delete-null-pointer-checks -Wall
-Wstrict-prototypes -Wa,-ahlms=urom.lst -DETHERNUT2 -D__HARVARD_ARCH__ -O0 -g3
-gdwarf-2 -IC:/ethernut-4.0.1/NutBuild/include  -IC:/ethernut-4.0.1/nut/include
urom.c -o urom.o

avr-gcc httpserv.o urom.o -mmcu=atmega128
-Wl,--defsym=main=0,-Map=httpserv.map,--cref -LC:/ethernut-4.0.1/NutBuild/Lib
C:/ethernut-4.0.1/NutBuild/Lib/nutinit.o  -lnutpro -lnutos -lnutarch -lnutdev
-lnutnet -lnutfs -lnutcrt -o httpserv.elf

avr-objcopy -R .eeprom -O ihex httpserv.elf httpserv.hex

(blank lines added by me for readability and the assignment warnings are in the
non-symbols compile also which works)

If I now load the httpserv.elf file the program gets loaded but appears to
immediately start executing (i.e.: says run in the lower right in AVRStudio).
If I click pause in AVRStudio the program counter is usually in a small 4
instruction loop.

My question isn't why is the PC in the loop, but rather, why did it immediately
start executing rather than just setting up at PC=0x0000 and waiting for the run
command?

Also, why would adding debug info to the file cause this?

Can someone post the version numbers of an Ethernut/WinAVR/AVRStudio combination
that is known to be able to compile the Nut examples with symbols?  I have
another computer that I'd be willing to load fresh just to be able to make some
progress here ...

I've spent days on this resulting in nothing but frustration ... (does it show?)

Cheers,

Chuck Hackett
"Good judgment comes from experience, experience comes from bad judgment"
7.5" gauge Union Pacific Northern (4-8-4) 844 http://www.whitetrout.net/Chuck





More information about the En-Nut-Discussion mailing list