Move .data section (initialised values)

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the best way to prevent gcc putting data at the last 4 bytes of flash?

 

I've got some old code built with gcc 4.3.2.  That puts the initialization data in flash at the end of the code section. This is good, since it leaves the end of flash free, which the program uses as a known location for a serial number, added at programming time. Unfortunately, our standard build environment for legacy code is gcc 4.3.3, which by default puts the initialization data at the end of flash, levaing a space between it and the end of the code section.

 

I'd like to move the .data section, or block out the last 4 bytes of flash, or do something generic so that the program can be compiled with something other than gcc 4.3.2.

 

Suggestions?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

our standard build environment for legacy code is gcc 4.3.3, which by default puts the initialization data at the end of flash

 That doesn't seem like it would be true (and it's certainly not true of later versions.)  Are you sure you don't have some sort of rogue linker map file or something?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you write:

our standard build environment for legacy code is gcc 4.3.3

Do you really mean avr-gcc (WinAVR 20100110) 4.3.3 ?

If so then I too am sceptical about your assertion.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
That doesn't seem like it would be true (and it's certainly not true of later versions.)

And never has been. The load image for an AVR from GCC is always .text at 0x0000 immediately followed by the .data initialisers so if that is reaching the last 4 bytes in flash then it simply means your load image fills/overflows the entire flash space.