[En-Nut-Discussion] avr-objcopy - elf to coff conversion

Michael Hallak-Stamler michael at mhseng.com
Mon Jul 28 09:40:33 CEST 2003


I am trying to convert elf to coff using 'avr-objcopy' with the usual
standard makefiles that comes with the en-nut OS. But the sections it
produces are not sequential. In particular, the .data section does not come
immediately after the .text section and this causes havoc in debugging with
JTAG-ICE as the data section is not correctly copied to memory. The
following is a log of events:

F:\scanv\nut-3.2.1-sn\app\timers>make clean
rm -f timers.o
rm -f *.aps *.elf *.cof
rm -f timers.hex
rm -f timers.eep
rm -f timers.obj
rm -f timers.map
rm -f timers.lst
rm -f timers.bak

F:\scanv\nut-3.2.1-sn\app\timers>make
avr-gcc -c -g -mmcu=atmega128 -O0 -Wall -Wstrict-prototypes -Wa,-ahlms=timer
s.ls
t  -I../../mod/include -I../../include timers.c -o timers.o
timers.c:316:2: warning: no newline at end of file
avr-gcc
timers.o -g -mmcu=atmega128 -Wl,--defsym=main=0,-Map=timers.map,--cref -
L../../lib/gcc/atmega128
../../lib/gcc/atmega128/nutinit.o -lnutos -lnutdev -lnu
tcrt -o timers.elf
avr-objcopy -O ihex timers.elf timers.hex

F:\scanv\nut-3.2.1-sn\app\timers>make coff
avr-objcopy --debugging --change-section-address
.data-0x800000 --change-section
-address .bss-0x800000 --change-section-address
.noinit-0x800000 --change-sectio
n-address .eeprom-0x810000 -O coff-avr timers.elf timers.cof
Discarding local symbol outside any compilation unit: .__do_copy_data_start
Discarding local symbol outside any compilation unit: .__do_copy_data_loop

F:\scanv\nut-3.2.1-sn\app\timers>avr-objdump -h timers.elf

timers.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         000001ec  00800100  00004c0c  00004ca0  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  1 .text         00004c0c  00000000  00000000  00000094  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .bss          0000026a  008002ec  008002ec  00004e8c  2**0
                  ALLOC
  3 .noinit       00000000  00800556  00800556  00004e8c  2**0
                  CONTENTS
  4 .eeprom       00000000  00810000  00810000  00004e8c  2**0
                  CONTENTS
  5 .stab         0000963c  00000000  00000000  00004e8c  2**2
                  CONTENTS, READONLY, DEBUGGING
  6 .stabstr      000037c1  00000000  00000000  0000e4c8  2**0
                  CONTENTS, READONLY, DEBUGGING

F:\scanv\nut-3.2.1-sn\app\timers>avr-objdump -h timers.cof

timers.cof:     file format coff-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         000001ec  00000100  00000100  000000dc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  1 .text         00004c0c  00000000  00000000  000002c8  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  2 .bss          0000026a  000002ec  000002ec  00000000  2**2
                  ALLOC
  3 .noinit       00000000  00000556  00000556  00000000  2**2
                  ALLOC, LOAD
  4 .eeprom       00000000  00000000  00000000  00000000  2**2
                  ALLOC, LOAD

F:\scanv\nut-3.2.1-sn\app\timers>

Here the data section starts at LMA 00000100 instead of 00004c0c

Can anyone help me out here?

Thanks,


=========================================
Michael Hallak-Stamler, MSEE
General Manager, MHS Engineering
email:       <mailto:michael at mhseng.com>
web site:    <http://www.mhseng.com>
tel:         +972-67-662-394


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20030728/95feb6c5/attachment-0001.html>


More information about the En-Nut-Discussion mailing list