I am using Atmel Studio 6 SP1 with an XMEGA128D3 and 128A3U. I am programming with an AVRISP mkII over PDI. If I select "Erase only program area" programming appears to complete but the flash memory is corrupt.
In my HEX file I have:
In the actual flash read back with the AVRISP mkII I have:
If I change to "Erase entire chip" everything works and the flash memory matches the HEX file.
This is a bit of a problem because it erases the bootloader. Long story short the bootloader is quite slow so I want to use the AVRISP mkII for development, but need the bootloader to be in place for the application to perform certain functions. I tried combining the bootloader and application but could not find an automated way to do it in AS6, even with scripts in the build process.