Reading Initial SRAM memory values of Arduino Uno

How we can read the initial power up values of all SRAM memory cells of an arduino uno board i.e the entire 2048 byte. Do we need to write something in the bootloader. Please give the program code for the same.

Why on earth do you want to do that? It is known in the trade as random switch on rubbish for a reason. Using C some of it will be initialises anyway before you can get to it. What do you want to do with it when you have read it?

If you want to do it just use the indirection operator *

Please give the program code for the same.

No.

What u said is wright, but i need sram memory values when the board is powered ON. i.e it should be before any program is executed

Boney: but i need sram memory values when the board is powered ON. i.e it should be before any program is executed

Again why?

So how can you want code that sees the value in SRAM before any code is executed. Anything I post is going to have to be executed in order for you to see the memory. Therefore what you are asking is nonsensical.

t should be before any program is executed

You mean like before a program like the boot loader?

Just a point, you do know that it can be different every time you power up the processor don't you?

How does the AVR set its memory to zero ( on power up ), in hardware or software.

Either way it would be safe to assume the initial values are all zero.

How does the AVR set its memory to zero ( on power up ),

It doesn't. The C compiler will sometimes initialise a variable though, when an array is being declared for example.

Everything that is not specified in the .noinit section should be zero initialized on startup.

You would need to place the variables in the noinit section to avoid this:

The .noinit Section

This sections is a part of the .bss section. What makes the .noinit section special is that variables which are defined as such:

int foo attribute ((section (".noinit"))); will not be initialized to zero during startup as would normal .bss data.

This is why people can assume their uninitialized globals are zero.

Initial value (power on) of all sram memory will be random. For constant room temperature and voltage there will not be any change.The random value would be same for all memory cell.it' proven. i want to know is it possible to get that SRAM POWER ON values.

This seems to be working, it produces different output every time the power is removed ( not reset button ). There seems to be a larger difference when the power is off for longer.

So it seems that you can read the raw ram state. However reading memory that hasn’t been reserved seems dodgy. You can place code in the ‘.init0’ section and then try initialize the serial comms, or toggle bits out to another arduino. The .init0 section runs immediately after reset.

char bytes[ 1024 ] __attribute__ ((section (".noinit")));

void setup() {
  Serial.begin( 9600 );
  for( int i = 0 ; i < 1024 ; ++i ) ItemOut( i, bytes[ i ] );
}

void ItemOut( int i, char el ){
  Serial.print( ( unsigned int ) el, HEX ); 
  if( i % 16 ) Serial.print( ',' );
  else Serial.println( ',' );
}

void loop() {}

Two different runs.

FF,F1,AF,AE,22,D3,FB,45,2E,ED,75,7B,D4,EF,91,5F,
7F,E4,FE,50,8A,27,EF,DE,3B,3D,53,FF,EF,8B,FF,85,
FF,BA,35,6B,E,DA,E5,67,B5,FC,75,FB,F4,7B,8F,7C,
A8,DF,BF,DC,31,DF,18,3F,7B,B0,2D,B4,CD,9E,FC,FF,
B4,DA,BC,8E,AD,6A,43,7E,2F,DC,7D,1B,EC,EF,2C,71,
C2,4E,7C,CE,BD,E9,B6,CF,FF,36,FB,39,F6,7F,93,5E,
B6,25,DE,4D,62,C8,CB,EF,53,18,CB,2F,58,AD,64,D,
97,77,2E,F3,FF,67,95,E5,B3,B6,A6,B9,83,6D,72,

FF,F1,AF,AE,22,D3,FB,45,E,AC,75,7B,D4,ED,99,7F,
7F,E2,FE,50,8A,27,EF,DE,33,3D,53,FF,EF,8B,FF,85,
FF,BA,35,73,E,DA,E5,67,B5,FC,7D,FB,F4,7F,CF,FC,
A8,DF,BF,DC,39,DD,18,1F,7B,B0,2D,B4,CD,9E,FC,EE,
34,DA,BC,8E,AD,6A,CB,7E,AF,DC,FC,9B,EC,EF,3C,71,
CA,4E,7C,CE,BD,E9,B6,4F,FF,96,FB,39,F6,7A,83,56,
B6,25,DA,6C,62,C8,EB,FF,D3,18,CB,2F,E8,AD,64,D,
97,77,2E,FA,FF,67,95,E5,B3,B6,A6,B1,83,6D,62,

For constant room temperature and voltage there will not be any change

Total rubbish.

Grumpy_Mike: Total rubbish.

It's not rubbish.

Initial SRAM values can be used for generating a random and device unique cryptographic key. Google 'SRAM PUF'.

haji_akhundov: Initial SRAM values can be used for generating a random and device unique cryptographic key. Google 'SRAM PUF'.

There is no possible proof of 'random' so that cannot be true.