Section 20.13.7 of the Xmega manual speaks about the requirement of 16 bit 
alignment.

http://www.atmel.com/images/doc8331.pdf

As the MAXIMUM_ALIGNMENT in avr.h is set to 1,  it throws an error when trying 
to compile.

I have attached a patch which sets it to 2 by default in the compiler.
I have also attached a case which fails.

Would this be an acceptable change ?

-George-
struct testStruct {

char a;
int  b;
float c;
};


/*volatile struct testStruct testObj; */
char a __attribute__ ((aligned (2)));

int main () {
a = 2;
/*
testObj.a = 'c';
testObj.b = 6;
return testObj.a;
*/

}
diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
--- gcc/config/avr/avr.h	2012-11-16 13:43:25.000000000 +0530
+++ gcc/config/avr/avr.h	2012-11-16 14:12:32.000000000 +0530
@@ -245,8 +245,8 @@ enum
 
 #define EMPTY_FIELD_BOUNDARY 8
 
-/* No data type wants to be aligned rounder than this.  */
-#define BIGGEST_ALIGNMENT 8
+/* For Xmega USB buffers */
+#define BIGGEST_ALIGNMENT 16
 
 #define TARGET_VTABLE_ENTRY_ALIGN 8
 
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to