Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Program starts executing immediately after loading with AVRStudeo 4.12

2006-02-04 by Chuck Hackett

I'm trying to get the Ethernut httpd demo program (Ethernut-4.0.1) running on my
Ethernut 2.1b board.  

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 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 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).  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?

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

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.