I have a doubt in strucure padding relavant to code warrior IDE. I'm working on a 16 bit microcontroller mc9s12xhy.
unsigned int x;
unsigned char y;
While compiler compiles the code, it shall allocate 4 bytes for Error_mode_Data ( with padding refernce: .map file ). It doesnt seem to happen. It s allocating 3 bytes only. Hw to switch on/off padding in a code warrior compiler? this is critical coz of im using for EEPROM write/read!
unsigned char is 1 byte in CodeWarrior for HCS12. so, this struct will take 3 bytes after compiled.
maybe the better way to do that is to define the element y as unsigned int.
If you just want the generated struct is aligned with 2bytes, then, you can also add "ALIGN 2" in the prm file follows the memory address like below:
|EEPROM_00||= READ_ONLY DATA_FAR IBCC_FAR 0x000800 TO 0x000BFF ALIGN 2;|
then, all data in EEPROM_00 will be aligned with 2 bytes.
I hope it helps!