Skip to content

Instantly share code, notes, and snippets.

@mepunit
Created October 19, 2012 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mepunit/3918648 to your computer and use it in GitHub Desktop.
Save mepunit/3918648 to your computer and use it in GitHub Desktop.
Get Free SRAM available in AVR
extern void __bss_end;
extern void *__brkval;
int get_free_memory()
{
int free_memory;
if((int)__brkval == 0)
free_memory = ((int)&free_memory) - ((int)&__bss_end);
else
free_memory = ((int)&free_memory) - ((int)__brkval);
return free_memory;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment