This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Struct problems

First off, I am fairly new to chip level programming!

I am using a SILabs C8051F330 and I am having trouble in the compilation
of some libraries that I need to use that were given by Texas Instruments to
implement a SPI interface to one of their wireless chips. Anyway, the library
uses many structures to handle the comm back and forth with their product.

An example of one is the following:

typedef struct {
    uint32_t rfChMask                : 20; ///< New dynamic RF channel mask to be used by WASPM
    uint32_t reserved0               : 12; ///< Reserved
} EHIF_CMD_NWM_SET_RF_CH_MASK_PARAM_T;

I get many errors all of this type:

ERROR C155 IN LINE 480 OF FILE_DEFS.H: 'rfChMask': char/int required for fields

Any suggestions are greatly appreciated!
Thanks

Parents
  • Note that IAR make compilers for a huge range of chips - maybe they were referring to an IAR compiler where int is 32 bits?

    The 'C' language standard specifies only 'int', 'unsigned int' or 'signed int' as the base for fields - so Keil C51 is giving an extension by allowing 'char'

    Maybe this "IAR" compiler allow 32-bit fields as an extension...?

    In the words of K&R:

    "Almost everything about fields is implementation-dependent"

Reply
  • Note that IAR make compilers for a huge range of chips - maybe they were referring to an IAR compiler where int is 32 bits?

    The 'C' language standard specifies only 'int', 'unsigned int' or 'signed int' as the base for fields - so Keil C51 is giving an extension by allowing 'char'

    Maybe this "IAR" compiler allow 32-bit fields as an extension...?

    In the words of K&R:

    "Almost everything about fields is implementation-dependent"

Children
No data