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

Contents of not initialized memory

Hello!

Here is a general question that probably doesn't have a definite answer:

What data does memory (static RAM) hold if it never was initialized? What I mean is if the controller boards (with external S-RAM) are manufactured, then a software is loaded that doesn't access parts of the RAM, is it possible to "know" what data one would find there before writing to it?
A couple of tests with different boards gave me always $FF for every memory location never initalized, but I am not sure if one could count on this.
Might also depend on the manufacturer of the RAM... maybe?

Thanks for any help
Holger

  • Hi Holger:

    I cannot really answer your question but the rule of thumb I usually follow is to never count on things that are not absolutely guaranteed in the data sheet of the device I'm using.

    -Walt

  • SRAM will hold whatever random value that the device will hold after power is applied. One doesn't have to "initialize" SRAM anyhow. SDRAM, requires an init. sequence before it can be used.

    If this is C related, all file scoped variables are either zeroed by the C run-time (.bss) or set to a particular value by the C run-time (.data). Automatic variables are indeterminate and should always be set before use.

  • The content of SRAM after powerup is udefined - that is, it could be anything, and it doesn't have to be repeatable or predictable.

    This is why embedded code must never use a variable before it has been initialised (whether explicitly in your code, or by your startup routines).