Skip to main content
Visitor II
January 29, 2007
Question

Putting variables in flash?

  • January 29, 2007
  • 3 replies
  • 869 views
Posted on January 29, 2007 at 17:04

Putting variables in flash?

    This topic has been closed for replies.

    3 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:35

    I need to have some variables that retain their values when the CPU is reset or powered off. I'm using the IAR dev. system, and the only way I can see to do it is by using their ''@'' and ''__no_init'' C extensions that allow you to specify an actual memory location for a variable and leave it uninitialized by the compiler. So I tried the following code:

    __no_init char NonVolatile[40] @ 0x20000;

    ....

    NonVolatile[0] = 'A';

    putchar(NonVolatile[0]);

    I have tried a lot of different memory addresses beside 0x20000, with the same results -- the contents of NonVolatile[0] is always a blank (32).

    Can anyone tell me how to do this properly?

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:35

    Read chapter 4 (FMI) in

    ''UM0233

    User manual

    STR91x software library''

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:35

    Lakata -- Thanks.