May I know can S12DP512 support self flash programming? E.g. Write data into the 512KBytes program memory.
Yes, that is possible.
In order to be able to program/erase all Flash without restriction, the program/erase function must be copied to and executed from a non-flash memory location, RAM or EEPROM for example.
A Flash block cannot be read whilst it is being programmed or erased. Therefore the program and erase function cannot be executed from the flash block which is being operated on.
Here is the application note with the SW example for this specific subject:
Fast NVM Programming for the MC9S12DP256
Retrieving data ...