I can write to EEPROM when using the BDM to program/debug. I cannot write in normal mode.
The datasheet lists the register EEPROT and DPOPEN, DPS. This register is rejected by the complier and is not in the mc9s12g128.h file.
As there is no EEPROT I have tried using this without success,
DFPROT_DPOPEN = 0x01;
DFPROT_DPS = 0x05;