From 7cb0bf6923fe613016cd83c511187539e0709af1 Mon Sep 17 00:00:00 2001 From: RJ Ryan Date: Sun, 18 Sep 2011 15:39:28 -0400 Subject: Fix memory alignment of USB descriptor structures. A variety of USB descriptor structures have been manually "unpacked". Instead of using the struct, their members were unpacked into the struct they were nested in. Additionally sizeof()'s were commented in favor of manual calculation of structure sizes. After uncommenting these changes, the USB CDC peripheral stopped correctly configuring with the host. The root problem with the structures is that GCC is padding them. By applying __attribute__((__packed__)), these problems are fixed. I removed all the instances of the workaround I saw within the USB code. Signed-off-by: RJ Ryan --- libmaple/libmaple_types.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libmaple/libmaple_types.h') diff --git a/libmaple/libmaple_types.h b/libmaple/libmaple_types.h index 17bcfb1..08adaff 100644 --- a/libmaple/libmaple_types.h +++ b/libmaple/libmaple_types.h @@ -47,6 +47,7 @@ typedef void (*voidFuncPtr)(void); #define __io volatile #define __attr_flash __attribute__((section (".USER_FLASH"))) +#define __packed __attribute__((__packed__)) #ifndef NULL #define NULL 0 -- cgit v1.2.3