[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] [Patch] Include a device info note section in gcrt1.S
From: |
Joerg Wunsch |
Subject: |
Re: [avr-libc-dev] [Patch] Include a device info note section in gcrt1.S |
Date: |
Sat, 11 Oct 2014 10:35:22 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
I finally had a chance to test all this.
For reference, here's the result for an ATmega1281:
% avr-objdump -h -j .note.gnu.avr.deviceinfo -s
avr/lib/avr5/atmega1281/crtm1281.o
avr/lib/avr5/atmega1281/crtm1281.o: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
11 .note.gnu.avr.deviceinfo 00000034 00000000 00000000 0000181c 2**2
CONTENTS, READONLY
Contents of section .note.gnu.avr.deviceinfo:
0000 04000000 23000000 01000000 41565200 ....#.......AVR.
0010 00000000 00000200 00020000 00200000 ............. ..
0020 00000000 00100000 08000000 01000000 ................
0030 00000000 ....
As Senthil Kumar Selvaraj wrote:
> How does the below patch look? Once you guys find it ok, I'll follow it
> up with a documentation patch. Note that the part above the
> L__desc_start label (and the .balign directive at the end) are there as
> per the ELF spec for a note section.
OK, if that's required, we have to stick with that.
Wouldn't the note name string also possibly need padding
for alignment behind it? (In the case of the "AVR\0",
it only incidentally aligns the following .long values
to a long boundary.)
For the documentation, please include a C struct definition
as explanation:
#define __NOTE_NAME_LEN 4
struct __note_gnu_avr_deviceinfo
{
struct
{
uint32_t note_name_len; /* = __NOTE_NAME_LEN */
uint32_t desc_len;
char note_name[__NOTE_NAME_LEN]; /* = "AVR\0" */
}
elfinfo_hdr;
struct
{
uint32_t flash_start;
uint32_t flash_size;
uint32_t sram_start;
uint32_t sram_size;
uint32_t eeprom_start;
uint32_t eeprom_size;
uint32_t offset_table[2]; /* index 0: ... */
// ???
}
avr_desc;
};
> +.L__stroffsettab_end:
> + /* String table for storing arbitrary strings.
> + Offsets are stored in the string offset table above */
> +.L__strtab_start:
> + .byte 0
> +.L__device_name_start:
> + .asciz DEVICE_NAME
> +.L__device_name_end:
> + .byte 0
> +.L__strtab_end:
I don't quite understand the purpose of the two ".byte 0" definitions.
--
cheers, Joerg .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)
- Re: [avr-libc-dev] [Patch] Include a device info note section in gcrt1.S,
Joerg Wunsch <=