Content originally posted in LPCWare by williamjsell on Fri Jan 25 12:11:05 MST 2013
firstly, I searched to see if there was a port of the AN10866 USB bootloader over to Rowley Crossworks in the public domain, but no luck here, so if anyone has done this... :) ...so figured this should not be too hard, but I ran into a couple of snags. The keyword __packed is not supported by Crossworks, so I used the #pragma pack(1), which should work the same way. I then ran into a code issue.
the declaration:
USB_COMMON_DESCRIPTOR *pD;
the initialization:
pD = (USB_COMMON_DESCRIPTOR *)USB_ConfigDescriptor;
The Keil compiler builds fine, but Crossworks bitches on this statement:
(uint8_t *)pD += ((USB_CONFIGURATION_DESCRIPTOR *)pD)->wTotalLength;
with the message
"lvalue required as left operand of assignment"
Makes sort of sense, it wants pD to reference a member of the structure it points to, even though it is being cast to uint8_t. Looks like the author is attempting to increment the pointer by wTotalLength. I am a little lost here. Firstly, looks like it should work, but I tried several different iterations and I get the same message...any ideas?
thanks