AnsweredAssumed Answered

Placing variables at specific address generates large binary file

Question asked by Zlasu.Jan on Jan 8, 2016
Latest reply on Jan 8, 2016 by dembek.radoslaw.001

I have to place some variables  at specific address in memory. I'm using GCC.
I declare and use variable like this:

uint8_t __attribute__((section (".mySection"))) buffer = 5;

int main()
{
  buffer = 10;
}

And in linker script I've got:

MEMORY 
{ 
FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K 
RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 145K 
MYSEC (xrw)     : ORIGIN = 0x20025000, LENGTH = 155K 
}

and later:

.mySection : 
{ 
  *(.mySection); 
} > MYSEC 

Normally my program takes 22 KB, with this modification it takes 384 MB (!).

I don't understand why. If I remove __attribute__ it takes 22 KB again. What am I missing?


Outcomes