[Top][All Lists]

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

RE: [avr-gcc-list] introducing a new section in data memory

From: Weddington, Eric
Subject: RE: [avr-gcc-list] introducing a new section in data memory
Date: Fri, 20 Feb 2009 11:20:59 -0700


> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Parthasaradhi Nayani
> Sent: Thursday, February 19, 2009 11:37 AM
> To: avr-gcc-list
> Subject: [avr-gcc-list] introducing a new section in data memory
> Hello all,
> I needed to create a buffer of 256 bytes starting at a page 
> boundary (xx00) in the RAM memory (Mega8). 
> I added this line in the makefile
> LDFLAGs = -wl,--section-start=.test=0x800200
> and defined a variable in the .C file (shown below)
> unsigned char mem3 __attribute__ ((section(".test")));
> However variable mem3 is being assigned address 0x60 in the 
> controller???
> also if I define another global in next line to mem3 I get 
> error that .data and .bss overlap lma 0xa0?? 
> I am of the opinion that all variable defined with attribute 
> .test will be located in that memory area and all other 
> global variables will be located in their native memory. 
> Perhaps if I ma able locate the .test section properly the 
> overlap error may vanish. Can you correct the problem please? 
> Thank you.

It works for me.

See attached demo. After the build look at the .map file and the disassembly 
file (.dis).

Just realize that because your variable is now in the .test section, don't 
expect the toolchain to automatically initialize the variable to zeros in the 
future. It may do that now, but the toolchain will change to not include the 
__do_clear_bss if it detects that there is nothing in the .bss section. The 
variable is now outside the .bss, so there are no guarantees that it will be 
initialized to a known value (zeros) in the startup code.

Eric Weddington

Attachment: build.sh
Description: build.sh

Attachment: test.c
Description: test.c

Attachment: test.map
Description: test.map

Attachment: test.dis
Description: test.dis

reply via email to

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