So I came across this issue without understing why.
I'm reading an EEPROM portion of 16 bit. On the first ever read of the EEPROM, all the cells are 0xffff. This portion of memory will store a flag so, basically 1 bit.
This flag is stored into the code inside a structure as unsigned char maxM1 :1;. See below
struct s_system {
unsigned char maxM1 :1;
}
I'm reading the EEPROM with a special function rd_word(MEMORY_ADDRESS) that returns 16bit
Now I'm assigning the return value to the maxM1 variable quoted above as
struct s_system sys;
...
...
sys.maxM1=rd_word(MEMORY_ADDRESS);
Where rd_word returns return SPI_I2S_ReceiveData(SPI2);
Now, I'm using IAR 6.50 as IDE and in debug mode it seems that the line sys.maxM1=rd_word(MEMORY_ADDRESS); makes the STM32F to reset
Now, I'm thinking it's because I'm assigning a value not compatible to the variable type of the variable but, in this case, shouldn't the compiler be reporting an error?