It's almost impossible to erase device with enabled write protection in bootloader, because you need to change option bytes, then do power cycle and then mass erase. Issues it, after power cycle, bootloader again re-locks write access and erasing is not possible.
The only solution was manual write of magic value into upper 8 bytes of RAM to prevent auto flash write lock and then doing mass erase.
It's almost impossible to erase device with enabled write protection in bootloader, because you need to change option bytes, then do power cycle and then mass erase. Issues it, after power cycle, bootloader again re-locks write access and erasing is not possible.
The only solution was manual write of magic value into upper 8 bytes of RAM to prevent auto flash write lock and then doing mass erase.