Compilation fault using Keil uVision

Hello all!

I'm writing to a chip with a cortex m-4  in it and the compiler creates a weird assembly:

I'm trying to develop an I2C driver so i have a made some unions to allow easy access to registers, it all worked fine until today - today things got quite phishy!

take a look:

compiler option:

here is the code for the union of "reg":

typedef union
{
    uint32_t value; 
    struct 
    { 
        unsigned dummy1 :1
        unsigned dummy2 :1
                .
                .
                .  
        unsigned dummy32 :1
    }fields;
} IC_INTR_MASK;

/******************************/

//module typedef
typedef struct _MODULE_S
{
    IC_INTR_STAT IC_INTR_STAT;
} I2CInitDef;

As you can see the compiler creates the assembly with a "!"(write back to the register) - so after I write 0x00 to "reg->IC_INTR_MASK.value" the pointer of "reg" is no longer point to the right address!

I can tell I'm using this method to write hardware registers all over my code and it always works fine! what do you thing might be the problem here?

Parents Reply Children
No data
More questions in this forum