Skip to content

Instantly share code, notes, and snippets.

@mguentner
Created April 27, 2012 14:02
Show Gist options
  • Save mguentner/2509533 to your computer and use it in GitHub Desktop.
Save mguentner/2509533 to your computer and use it in GitHub Desktop.
Display the EEPROM allocation of an ethersex firmware/config
/* Compile with gcc eeprom_check.c -I /usr/avr/include/ -I . within the ethersex directory
How to get the MCU define (__AVR_AT....):
avr-gcc -mmcu=$MCU -E -dM - < /dev/null | grep _AVR_AT
where $MCU is MCU in autoconf.h */
#define __AVR_ATmega644P__
#include "config.h"
#include "core/eeprom.h"
#include "avr/io.h"
int
main(void)
{
printf("EEPROM: %d/%d bytes: (%.2f%)\n", sizeof(struct eeprom_config_t),
(E2END + 1), 100 * (float) sizeof(struct eeprom_config_t) / (E2END + 1) );
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment