This question is in regards to CodeWarrior IDE version 5.9.0 targeting processor family HCS08. I am having an issue writing to flash using the methods provided through CodeWarrior. I am reading from and writing to a buffer using the GetBytePage, GetWordPage, SetBytePage, and SetWordPage methods. This buffer is in turn being read from and written to flash using the SetPage and GetPage methods. The problem occurs when I attempt to use the SetPage method: whenever the program attempts to write the buffer to flash, the results are erratic. Sometimes my registers are corrupted, sometimes my microcontroller locks up until the watchdog timer expires. If I comment out the SetPage method, my code functions as expected. Does anyone have a suggestion as to what the problem(s) may be?
Below is the section of code I am using to read from and write to flash.
const word Buffer_Address = 0xDD00;
// Reading from flash
// Writing to flash