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
Based on the error message, I'm making the conclusion that Keil C51 only supports (unsigned) char and int as data types for bit fields.
At the same time, I know that an int in C51 is 16-bit, in which case I have to assume that a uint32_t is a unsigned long int - a data type the error message claims isn't supported.
I can very well understand why C51 don't want to support it - the processor is 8-bit, so it requires library helper functions or lots of inlined assembler instructions to work with 32-bit integers. And it doesn't get easier with 32-bit bit fields, since the individual bit fields need not be aligned on bytes. Live is so trivial when the compiler can implement the bit manipulation natively, by operating on a single full-size register. Just think about taking a value larger than what fits in any register, and then shift it more steps than what fits in any register, before storing the value in a variable that is 4 times the size of a basic processor register. Obviously possible, but costing a lot in a tiny processor with normally limited code space.