With your mail, I got the idea to put the dataimage, data section,
bss section, directly on the place where the RAM is. At 2000h.
I set the __data_image equal to the __data_image_end, and I set the
__data_section_size on zero. So, after the _premain nothing is
copied over from ROM to RAM (loop checks on __data_section_size ).
In my makefile I don't do an OBJCOPY of the .data and the .bss
This method is working and gives me lots of free space in the common
bank (page 3F) now, where else the data_image was placed.
I limited the size of the .data section from 2000h to 1A00h in the
MEMORY declaration, to have some margin for stackcollision with the
Thanks for the replies.
--- In email@example.com
, "Jefferson Smith"
> One thing that makes it the data image is the gcc startup code,
> looks for it and copies it to RAM.
> The other is that section .data is being appended to text (ROM)
> by the linker script.
> In m68hc12elfb.x:
> /* Start of the data section image in ROM. */
> __data_image = .;
> PROVIDE (__data_image = .);
> /* All read-only sections that normally go in PROM must be above.
> We construct the DATA image section in PROM at end of all
> read-only sections. The data image must be copied at init
> Refer to GNU ld, Section 22.214.171.124 Output Section LMA. */
> .data : AT (__data_image)
> __data_section_start = .;
> PROVIDE (__data_section_start = .);
> _edata = .;
> PROVIDE (edata = .);
> } > data
> __data_section_size = SIZEOF(.data);
> PROVIDE (__data_section_size = SIZEOF(.data));
> __data_image_end = __data_image + __data_section_size;
> --- In firstname.lastname@example.org, "peter_lingier"
> > Hello,
> > Does anyone know how to get rid of the Dataimage?
> > This data_image is an image of the .data (global variables) I
> > declared and is put (due to the linkerscript I use) in page 3F.
> > After the _premain function is executed, the data_image in Flash
> > is copied to RAM.
> > All global variables are initialised in the code, and not at
> > decleration. So, I don't really need the data_image.
> > In the DG128 I have 8k of RAM, but due to this data_image I
> > use all of it, because I don't have that much space left in page
> > I had already the case that I declared too much .data to fit in
> > 3F and that I overwrote the secure bits. It seems to me that
> > linker doesn't check on bankoverflow, if it is because of the
> > data_image.
> > Does anyone has experience with this?
> > Peter