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

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

RE: [avr-gcc-list] Remove .bss size from RAM segment of AVR ELF?


From: Weddington, Eric
Subject: RE: [avr-gcc-list] Remove .bss size from RAM segment of AVR ELF?
Date: Thu, 5 Jun 2008 11:35:48 -0600

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Tero Sinervo
> Sent: Thursday, June 05, 2008 7:52 AM
> To: address@hidden
> Subject: [avr-gcc-list] Remove .bss size from RAM segment of AVR ELF?
> 
> This may seem like nitpicking but I think it should be considered as 
> current operation seems to conflict with ELF specification.
> 
> There's a very slight problem with ELF files that have a .bss section 
> regarding chip programming. If you read the RAM 
> initialization segment 
> header of an ELF file you see that its filesz equals the size 
> of .data 
> (which is to be written to Flash) and memsz equals the sizes of .data 
> and .bss combined (initialized data and data to be 
> initialized to zero). 
> The ELF specification states that if memsz is greater than 
> filesz, bytes 
> after filesz should be initialized to zero and follow the segment's 
> initialized area. This is all nice and smooth. The problem comes with 
> AVRs that don't actually have their RAM initialized at this point but 
> the data is actually written to Flash for startup code to read and 
> initialize the RAM with. The startup code handles .bss by 
> zeroing that 
> RAM area in a loop and not by reading it from Flash memory. 
> Currently it 
> is ambiguous whether the .bss part of the RAM initialization segment 
> should be written to Flash after the .data part or not.

I can make it unambiguous: The .bss segment should NOT be written to
Flash after .data as it would take up too much space in the precious
Flash. The .data section has to be initialized from somewhere so it has
to be stored in Flash.

 
> This can be easily fixed in programming software but I wonder if it 
> should be done in AVR ELF files too. Would it be possible to exclude 
> .bss from AVR ELF file segments by setting memsz==filesz and 
> only keep 
> .bss as a section header? That would make the program part of the ELF 
> file more consistent with actual programming.
> 

What advantage does making this change bring?




reply via email to

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