Skip to main content
added 17 characters in body
Source Link
Diego
  • 129
  • 1
  • 6

iI have this code showingthat shows the available sram memory

    int freeRam() 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

void setup()
{
  Serial.begin(9600);
  Serial.println(freeRam());
}

void loop()
{
}

enter image description here

The arduino compiler shows a different value.

  • the arduino compiler shows 1856 bytes and
  • Serial port shows 1850 bytes

What is the correct value?

i have this code showing sram memory

    int freeRam() 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

void setup()
{
  Serial.begin(9600);
  Serial.println(freeRam());
}

void loop()
{
}

enter image description here

The arduino compiler shows a different value.

  • the arduino compiler shows 1856 bytes and
  • Serial port shows 1850 bytes

What is the correct value?

I have this code that shows the available sram memory

    int freeRam() 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

void setup()
{
  Serial.begin(9600);
  Serial.println(freeRam());
}

void loop()
{
}

enter image description here

The arduino compiler shows a different value.

  • the arduino compiler shows 1856 bytes and
  • Serial port shows 1850 bytes

What is the correct value?

Source Link
Diego
  • 129
  • 1
  • 6

Arduino compiler shows different value of sram memory

i have this code showing sram memory

    int freeRam() 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

void setup()
{
  Serial.begin(9600);
  Serial.println(freeRam());
}

void loop()
{
}

enter image description here

The arduino compiler shows a different value.

  • the arduino compiler shows 1856 bytes and
  • Serial port shows 1850 bytes

What is the correct value?