''int'' requires more than 4 bytes - but why ?
Dear community,
I use a STM32F051 plattform
and I want to pre-define the flash address of a few integer values during compile-time to e.g. later on change those values using flash- write operations. Since I use a keil compiler I tried:int a __atribute__((at(0x080008000 ))) = 1234;
int b __atribute__((at(0x080008000 + 2* sizeof(int)))) = 1234;
int c __atribute__((at(0x080008000 + 3* sizeof(int)))) = 1234;
int d __atribute__((at(0x080008000 + 4* sizeof(int)))) = 1234;
int e __atribute__((at(0x080008000 + 5* sizeof(int)))) = 1234;
However this produces an internal fault [0x5352b9:5050106].
Then I tried:int a __atribute__((at(0x080008000 ))) = 123456;
int b __atribute__((at(0x080008000 + 2* 4* sizeof(int)))) = 123456;
int c __atribute__((at(0x080008000 + 3* 4* sizeof(int)))) = 123456;
int d __atribute__((at(0x080008000 + 4* 4* sizeof(int)))) = 123456;
int e __atribute__((at(0x080008000 + 5* 4* sizeof(int)))) = 123456;
and it works for some reason. I would be very happy, if someone could explain, why “int�? requires more FLASH size than it actually uses.
