avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Strings getting clobbered trying to load avr-gcc output


From: James Washer
Subject: [avr-gcc-list] Strings getting clobbered trying to load avr-gcc output .hex file into avr studio 4
Date: Fri, 17 Dec 2004 10:00:55 -0800

 I have a line of source code:

That shows up in the .lst file as

  96                    gps_data_buffer:
  97 0000 2447 5052             .ascii  "$GPRMC,190844,A,3"
  97      4D43 2C31
  97      3930 3834
  97      342C 412C
  97      33
  98 0011 3933 302E             .string 
"930.2391,N,11947.1967,W,000.0,268.1,041204,015.6,E*6B           "
  98      3233 3931
  98      2C4E 2C31
  98      3139 3437
  98      2E31 3936
  99 0052 0000                  .skip 2,0

But after loading the .hex file into avr studio 4, I see the string has been 
corrupted. After a few bytes, it is overwritten with "P l e a s e  w a i t , L 
o a d i n g   p r o g r a m   m e m o r y" with nulls between each byte.

avr-objdump'ing the .hex files shows the string intact.

 13d0 0048656c 6c6f2077 6f726c64 00244750  .Hello world.$GP
 13e0 524d432c 31393038 34342c41 2c333933  RMC,190844,A,393
 13f0 302e3233 39312c4e 2c313139 34372e31  0.2391,N,11947.1
 1400 3936372c 572c3030 302e302c 3236382e  967,W,000.0,268.
 1410 312c3034 31323034 2c303135 2e362c45  1,041204,015.6,E
 1420 2a364220 20202020 20202020 20200000  *6B           ..
 1430 00122000 1d020000                    .. .....       

So, is there something wrong with loading the hex file into avr-studio?


Below is the output from make, so that you can see just how program was compiled

set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -mcall-prologues -funsigned-char 
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes 
-Wa,-adhlns=jtimers.lst  -std=gnu99 jtimers.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > jtimers.d; \
[ -s jtimers.d ] || rm -f jtimers.d
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -mcall-prologues -funsigned-char 
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes 
-Wa,-adhlns=gps.lst  -std=gnu99 gps.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > gps.d; \
[ -s gps.d ] || rm -f gps.d
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -mcall-prologues -funsigned-char 
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes 
-Wa,-adhlns=modem.lst  -std=gnu99 modem.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > modem.d; \
[ -s modem.d ] || rm -f modem.d

-------- begin --------
avr-gcc (GCC) 3.3.2
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling: modem.c
avr-gcc -c -mmcu=atmega8 -I. -g -Os -mcall-prologues -funsigned-char 
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes 
-Wa,-adhlns=modem.lst  -std=gnu99 modem.c -o modem.o

Compiling: gps.c
avr-gcc -c -mmcu=atmega8 -I. -g -Os -mcall-prologues -funsigned-char 
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes 
-Wa,-adhlns=gps.lst  -std=gnu99 gps.c -o gps.o
gps.c: In function `setup_gps_uart':
gps.c:405: warning: implicit declaration of function `strlen'

Compiling: jtimers.c
avr-gcc -c -mmcu=atmega8 -I. -g -Os -mcall-prologues -funsigned-char 
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes 
-Wa,-adhlns=jtimers.lst  -std=gnu99 jtimers.c -o jtimers.o

Linking: modem.elf
avr-gcc -mmcu=atmega8 -I. -g -Os -mcall-prologues -funsigned-char 
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes 
-Wa,-adhlns=modem.o  -std=gnu99 modem.o  gps.o jtimers.o   --output modem.elf 
-Wl,-Map=modem.map,--cref -lm

Creating load file for Flash: modem.hex
avr-objcopy -O ihex -R .eeprom modem.elf modem.hex

Creating load file for EEPROM: modem.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex modem.elf modem.eep

Creating Extended Listing: modem.lss
avr-objdump -h -S modem.elf > modem.lss

Creating Symbol Table: modem.sym
avr-nm -n modem.elf > modem.sym

Size after:
modem.elf  :
section     size      addr
.text       5044         0
.data        132   8388704
.bss         313   8388836
.noinit        0   8389149
.eeprom        0   8454144
.stab      15660         0
.stabstr    7509         0
Total      28658





reply via email to

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