Hi Gerhard,
When you load your code by CW, the debugger will erase whole memory and write all data.
That is OK.
When you load just bootloader into your MCU (or bootloader with application), the project already contains some data at 0x00FFFE08..0x00FFFE0F. When bootloader wants to load new application, it obviously does not erase last P-Flash sector with flash configuration field prior new writing. I guess, that this last sector is occupied by the bootloader.
The cumulative write (rewrite already written data) will cause described behavior.
So, it is obviously an issue in your bootloader (cannot read/modify/write target sector) or in your system design.
In general, it is a bad idea when application and bootloader share any nonvolatile memory range.
The P-Flash areas for bootloader and application should be separated. The application should not contain any data in an area which is occupied by bootloader otherwise the bootloader must have feature for rewrite itself.
Since the smallest area which may be erased is sector (512 bytes in your case), the border between application and bootloader area must be aligned with sectors or your bootloader must contain feature for rewrite itself (inconvenient, in the case of the last sector also potentially dangerous).
Note: potentially dangerous = when we erase the last sector with flash configuration field, interrupt vectors and reset vector and unexpected reset occurs prior we write data back, the MCU will be stuck (bricked) due to missing reset vector.
About double bit fault at 0x00FFFE08..0x00FFFE0F range)
The MCU reads this area during reset sequence. If there is double bit ECC error, the Flash and EEPROM become fully protected and MCU secured.
This is for safety reason, when there is double bit error, we cannot trust to this flash content. This feature prevents against hack attack by using cumulative write for MCU unsecure.
From this point of view, the flash configuration field is quite critical and special area.
In such case, the CPU will continue in running as usual. But for example, the EEPROM update will not work due to the fact, that protection may be just increased during normal mode.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------