How to define persistent variables in IAR compiler for ARM

Hello!

I'm using lpc2129 microcontroller. I couldn't find how to define persistent variables (that will be not reset after power up) in IAR compiler for ARM.
I tried _no_init macro. When I soft reset the board variables keeps their value. But when the system shutdown it lost their values.

Any idea?

Kind regards...
viledaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

phoffric\Commented:
If you need a set of variables to be persistent after the system power is lost, then these variables need to be placed into NVM (non-volatile memory) or in flash memory. FYI - some NVM memory is a module that comes with its own battery to keep the memory persistent when the main power is turned off. RAM memory keeps its values as long as proper power is maintained.

When you soft reset the board, power to the RAM is not lost, so the RAM can maintain its values (until running the software changes it).
HappyCactusCommented:
lpc2129 has 256kb of in-system flash memory that can be written via the API, as specified by the datasheet (p.18, last paragraph).
In the same datasheet (you can download it here[1]) the chapter starting from p.279 describes the procedure and the available API to write to the flash memory from software.
Pay attention that flash memory have a limited number of writing cycles (10,000 for lpc2129) and it can be consumed fast if written programmatically.
For example, if you write the flash ram one time at second, it can be consumed in less than 3 hours. Writing one time per minute, consumes it in less than a week. writing it one time every 5 minutes, burns it in a month.

[1] http://www.keil.com/dd/docs/datashts/philips/user_manual_lpc2119_2129_2194_2292_2294.pdf

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
phoffric\Commented:
http:#34447697 60% - Accept
http:#34435981 40% - Assist
Both clear up misconception of hardware needed. 2nd post goes into more depth.
Dirk HaestProject managerCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.