March Madness - Arduino CPU info

There is lots of information in the multitude of .h files in both the Arduino core files and in the avr .h files. Much of this information can be useful both at compile time and at run time. For exmple, if you need to worry about how much memory is avaialbe.

__AVR_ARCH__     = 5
AVR LibC Version = 1.6.4
CPU signature= 1E 95 0F
RAM size     =2 K
FLASH size   =31 K
EEPROM size  =3FF bytes
size of char =1
size of int  =2
size of long =4
size of float=4
size of double=4


	

//************************************************************************
//*	Arduino CPU info
//*		(C) 2010 by Mark Sproul
//*		Open source as per standard Arduino code
//*
//************************************************************************



//************************************************************************
void setup()
{
char	textString[32];


	Serial.begin(9600);
	
	Serial.println();




	Serial.print("__AVR_ARCH__     = ");
	Serial.println(__AVR_ARCH__);
	
//*	these can be found in avr/version.h
	Serial.print("AVR LibC Version = ");
	Serial.println(__AVR_LIBC_VERSION_STRING__);

//*	these can be found in avr/iomxxx.h
#ifdef SIGNATURE_0
	sprintf(textString, "CPU signature= %02X %02X %02X", SIGNATURE_0, SIGNATURE_1, SIGNATURE_2);
	Serial.println(textString);
#endif


//*	these can be found in avr/iomxxx.h
#ifdef RAMEND
	Serial.print("RAM size     =");
	Serial.print(RAMEND / 1024);
	Serial.println(" K");
#endif


#ifdef FLASHEND
	Serial.print("FLASH size   =");
	Serial.print(FLASHEND / 1024);
	Serial.println(" K");
#endif

#ifdef E2END
	Serial.print("EEPROM size  =");
	Serial.print(E2END, HEX);
	Serial.println(" bytes");
#endif

	Serial.print("size of char =");
	Serial.println(sizeof(char));
	
	Serial.print("size of int  =");
	Serial.println(sizeof(int));
	
	Serial.print("size of long =");
	Serial.println(sizeof(long));

	Serial.print("size of float=");
	Serial.println(sizeof(float));
	
	Serial.print("size of double=");
	Serial.println(sizeof(double));
	
	Serial.println();
	
	
}


//************************************************************************
void loop()
{


}