"Destructive write (with erase)" write method erases actual sector if it is necessary (without any data backup) and after that data is written into the FLASH. This information can be found in the
help (pop-up menu) of IntFlash bean on page properties in section "Write method".
The problem may be related to declaration of const variable bytMyFlashPage. If it is not located explicitly to an absolute address, linker will chose the location itself (can be found in the map file). However the location of the variable may be close to the program code and not aligned with the flash sector boundary. Since flash erase sector size is 512 byte, destructive write may erase part of the code or other variables as well. I would recommend to put the bytMyFlashPage variable to an absolute address to control the location, where the flash memory is erased and written.
const byte bytMyFlashPage[256]@0x8000;
best regards
Vojtech Filip
Processor Expert Support Team
UNIS