[ARM compiler 6] Compile struct with bit field and prevent 8bit access


I have a problem with struct compile, and I need your help. Thanks so much.

I have a register (32 bits) that is defined as a struct:

typedef struct {

  int field_1 : 1;

  int field_2 : 1;

  int field_3 : 6;

  int field_4 : 8;

  int field_5 : 16;

} reg_t;

When I read/write the fileds in this struct, the compiler uses LDRB/STRB instruction. However, the register interface only supports 32b access.

How can I force the compiler to only use LDR/STR for this struct type?