Reply
Posts: 16
Registered: ‎10-20-2016

Saving dynamic variable in flash memory

[ Edited ]

I am working with EM3588 to perform a ZigBee power cycle reset. I want to have a variable which is incremented every time the chip has been reset, meaning it will have to be saved in memory. Currently, I only see the key word PGM which allows for a static variable to be stored in memory, which does not work for me as I would like it to increment. So is there a way to save a dynamic variable in memory?

Posts: 16
Registered: ‎10-20-2016

Re: Saving dynamic variable in flash memory

Sorry, I meant to say constant. Not static.

Highlighted
Posts: 2,326
Registered: ‎10-14-2014

Re: Saving dynamic variable in flash memory

@dan95c

I don't know this part well and what toolchain you are using to develop program for it.

 

Not sure below KB helps or not.

http://community.silabs.com/t5/32-bit-MCU-Knowledge-Base/Placing-an-array-at-a-specific-location-in-...

It looks like you also need to modify/write the variable, I think you need explicitly use the MSC to write the content of the variable.

 

Maybe another option is to reserve a flash space for this variable. See below KB if helps or not:

http://community.silabs.com/t5/32-bit-MCU-Knowledge-Base/Writing-to-Internal-Flash/ta-p/122576

WeiguoLu