Menu

=?utf-8?Q?How_to_use_packed_attribute_in_SDCC_for_8051=3F?=

Help
dfbaechtel
2015-06-28
2015-06-29
  • dfbaechtel

    dfbaechtel - 2015-06-28

    Must get struct size and layout correct.

    Source looks like:

    /// USB Info Basic Descriptor

    typedef struct {

    uint8 Type;

    uint16 Size;

    uint8 Checksum;

    uint8 BitSetting;

    uint16 VendorID;

    uint16 HubProductID;

    uint16 FunctionProductID;

    uint8 HubPOTG;

    uint8 HubCURT;

    } __attribute__ ((packed)) TUSBUSBInfoBasicDescriptor;

    Sent from Windows Mail

     

    Last edit: Maarten Brock 2015-06-30
  • Philipp Klaus Krause

    There is no such attribute in sdcc.
    for structs where the individual members are not bitfields there never is any padding in sdcc. Padding wouldn't make sense for 8-bit targets. So with sdcc you'll always get the layout, for which you might need something like a packed attribute in other compilers

    Philipp

     

Log in to post a comment.