Missing Section

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can anyone tell me what I'm doing wrong? I'm creating a .hex file with avr-objcopy.exe (like I've always done in the past), but one of my sections is disappearing.

From cygwin, I can type:

$ avr-objdump.exe -V
GNU objdump 2.17 + coff-avr-patch (20050630)
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of the GNU General Public License.
This program has absolutely no warranty.

$ avr-objcopy.exe -V
GNU objcopy 2.17 + coff-avr-patch (20050630)
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of the GNU General Public License.
This program has absolutely no warranty.

$ avr-objdump.exe -dj .update RIO-15C/temp1.elf |less

RIO-15C/temp1.elf: file format elf32-avr

Disassembly of section .update:

00001e40 :
1e40: f8 94 cli
1e42: 08 e1 ldi r16, 0x18 ; 24
1e44: 01 bd out 0x21, r16 ; 33
1e46: 00 e0 ldi r16, 0x00 ; 0

So there is obviously code at 0x1E40, as there should be, but when I create my .hex file:

$ avr-objcopy.exe -O ihex -R .eeprom RIO-15C/temp1.elf temp.hex

$ tail temp.hex
:101D900080917100909172006D3E91F47A3D81F4D2
:101DA0008B3E71F49E3F61F44FEF44AF45AF46AFB9
:101DB00047AF81CE803B20F48A5A880F805C8FCE5B
:101DC00082E090E0089515D001921A94E1F7089509
:101DD000E199FECFBFBBAEBB0DBA11960FB6F8941A
:101DE000E29AE19A0FBE08950190F2DF1A94E1F7AA
:101DF0000895E199FECFBFBBAEBBE09A11960DB23C
:021E0000089543
:041E0200FF0F983AFC
:00000001FF

There's the end of my .text section, but my .update section which starts at 0x1E40 is nowhere to be found.

I've looked through the file with a text editor (in case it was placed out of order), but it's simply not there.

I've even tried removing the "-R .eeprom" in case my .update section had merged under the .eeprom section somehow, but that didn't do it. If I do that, I can see the .eeprom section added, but no .update.

Pretty weird, huh? Check this out:

$ avr-objcopy.exe -O ihex -j .update RIO-15C/temp1.elf temp.hex

$ cat temp.hex
:00000001FF

avr-objdump.exe can see my .update section, but avr-objcopy.exe can't.

Please help!

Gre7g

Last Edited: Wed. Oct 3, 2007 - 11:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay, I've found a little more information. Perhaps this will give someone a clue as to what it is I'm doing wrong.

My .update section currently is created by compiling a single .S file which includes:

.section .update

before all of the code. However, if I compile that *AND* a dummy C file:

void __attribute__ ((section (".update"))) junk(void) { }

Then my .update section is created normally.

I can do this as a workaround, but my new question is, "WHY?" What does the presence of a .c file do to the .elf that a .S does not? What do I need to put in my .S file or linker script so that my .elf is created normally for sections with only a .S file?