This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: what sections get objcopied into the SREC file?


Hi,

i found out that the section .data gets copied into the
output SREC file when i do:

avr-objcopy -Osrec file.elf file.srec

But at a different address than mentioned in the section
header.

When i look at the program headers:
---- program header 1
p_type 0x0001
p_offset 0x0000222E
p_vaddr 0x00800100
p_paddr 0x0000219A
p_filesz 0x000C
p_memsz 0x000C
p_flags 0x0006
p_align 0x0001

This seems to tell that virtual addresses at 0x800100 get
loaded at 0x219A.  Is this correct?

Can anybody give me some information how to treat all the
other data, do i also need to look them up in the program
headers?  It seems i was just lucky until now that virtual
addresses and program addresses matched.

What do p_type and p_flags tell me, do i need to consider
them?


Best regards,
Torsten.


> Hi,
>
> i once got the hint that a section needs to be of type
> PROGBITS and the allocate bit needs to be set, then a
> section gets copied from the ELF file into an SREC file.
>
> avr-gcc/-ld produces ELF output where the .data section
> meets these conditions.  But when i avr-objcopy it to SREC,
> the .data section is not contained in it.
>
> This looks fine to me, i just wonder now what the condition
> is that a section gets copied.  I wrote a bootloader that
> reads the ELF file and that now also tries to download the
> section .data which makes no sense.  I'd like to fix the
> condition for my bootloader.
>
>
> Best regards,
> Torsten.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]