Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Type cast to byte aligned variable in GCC

2006-02-19 by weartronics

Dear lpc2000,

I am trying to port some Keil example code (LPC2148 USBHID) to the GCC
compiler. Keil use the __packed keyword to specify byte alignment for
variables (see
http://www.keilsoftware.com/support/man/docs/ca/ca_le_packed.htm) but
this is not supported by GCC. I know GCC provides an "__attribute__
((__packed__))" which can be used in variable declarations, but how
can I type cast to a byte aligned variable type!? My problem line is
below...

*((__packed WORD *)EP0Buf) = (USB_EndPointHalt & m) ? 1 : 0;

Thanks!

Nic

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.