This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to stored global variable in CPU flash (MCF5213 Freescale)

How to store variables in microcontroller inbuild flash? to reduce the overhead of SRAM.
Our controller SRAM is almost reach at 94%. What wil be the solution if I have to add more variables even more, shall I shore variable in CPU flash.?

Thanks

shyam tayade

shyam.tayade@kpitcummins.com

Parents
  • Flash is not a replacement for RAM.

    It wears out quickly (the code space flash isn't specified for the same number of rewrite cycles as data flash intended for flash file systems), so even slowly changing variables can't be stored in the flash.

    You either have selected the wrong processor, or you have written code that makes use of too many - or too large - variables.

    With potentially larger code, you can often change from 32-bit integers into 16-bit or 8-bit variables, after checking what real numeric range you need.

    Keeping down on recursion means you can save stack space.

    Keeping down on global variables and trying to have variables on the stack - just living for the amount of time they are really needed - means the same stack space can be used for multiple different variables instead of each being a unique global variable.

    Sometimes, you can convert multiple boolean conditions into individual bits stored in a single variable. Potentially larger code size, depending on processor used, but less RAM requirements.

    But I'm sure you really did spend sometime checking up on your RAM budget in relation to your software design, before you selected what processor to use.

    By the way, the MCF5213 is a ColdFire processor. Didn't realize something was wrong, when you didn't find any suitable processor architecture on this forum? You really, really sure this is the right forum for your questions?

Reply
  • Flash is not a replacement for RAM.

    It wears out quickly (the code space flash isn't specified for the same number of rewrite cycles as data flash intended for flash file systems), so even slowly changing variables can't be stored in the flash.

    You either have selected the wrong processor, or you have written code that makes use of too many - or too large - variables.

    With potentially larger code, you can often change from 32-bit integers into 16-bit or 8-bit variables, after checking what real numeric range you need.

    Keeping down on recursion means you can save stack space.

    Keeping down on global variables and trying to have variables on the stack - just living for the amount of time they are really needed - means the same stack space can be used for multiple different variables instead of each being a unique global variable.

    Sometimes, you can convert multiple boolean conditions into individual bits stored in a single variable. Potentially larger code size, depending on processor used, but less RAM requirements.

    But I'm sure you really did spend sometime checking up on your RAM budget in relation to your software design, before you selected what processor to use.

    By the way, the MCF5213 is a ColdFire processor. Didn't realize something was wrong, when you didn't find any suitable processor architecture on this forum? You really, really sure this is the right forum for your questions?

Children
No data