cancel
Showing results for 
Search instead for 
Did you mean: 

Creating section in FLASH for datastorrage

dschneeweis
Associate II
Posted on June 08, 2009 at 03:35

Creating section in FLASH for datastorrage

5 REPLIES 5
dschneeweis
Associate II
Posted on May 17, 2011 at 12:46

Hi

I am using the Keil compiler. I want to store data in FLASH (EEPROM-Emulation). Writing and reading works fine. I use #define to define the beginning of the flashregion where my data is stored.

Now I wanted to create a section in the scatterfile so that the compiler doesnt map any code or something into the region where my data is stored.

If I only define a region with no data in it, it is removed by the linker.

If I place a Variable in it like

__attribute__(''VarSection'') const volatile char dummy[1024];

This section is initialized to 0 when I program the device and the stored data is cleared. Even if I decline the section as UNINIT in the scatterfile the data is initialized.

How can I define a section in the scatterfile which is not initialized by the programmer?

dschneeweis
Associate II
Posted on May 17, 2011 at 12:46

Ok I find a solution by myself

The variable has to be defined as zero_init

like

__attribute__((''VarSection''), zero_init) const volatile char dummy[1024];

I thought ''zero_init'' means the opposite....

4522252
Associate
Posted on May 17, 2011 at 12:46

Hi,

I can use your solution - if you wish to share with the community,

Thx

4522252
Associate
Posted on May 17, 2011 at 12:46

Hi,

I can use your solution - if you wish to share with the community,

Thx

st3
Associate II
Posted on May 17, 2011 at 12:46

Quote:

if you wish to share with the community

He just did share it with ''the community'' by posting here!

Thanks, dschneeweis, for doing that - I was wondering how this might be achieved with Keil...! :D