ATSAMD21G18 (Arduino Zero) Bootloader Suddenly Stopped Working in Atmel Studio

Hello,
I have been using Atmel Studio to program an Arduino Zero variant. I've been using the same sketch and properties for over a year now. I'm using Atmel Studio 7 with the Arduino Core and bootloader and using the SAM ICE JTAG controller to program it.
All of a sudden, out of the blue, the bootloader no longer works (same sketch I've been using and was even working yesterday). When I load the firmware without the bootloader it works, but I need the bootloader for USB connectivity.
It seems like the controller is having trouble jumping to the 0x000. The debugger simply goes to the disassembly window, points to 0xFFFFFFFE / 0x00000000 where it says "Memory out of bounds or read error."
I've been looking for the bootloader but am not sure where Atmel Studio is looking for it. But is this even the problem? Could it be a problem with my JTAG?

Has anyone experienced this before? With seemingly no warning, and I have not touched any of the core files for at least a year.

Thank you!

I'm very perplexed as to how this suddenly happened. I still have not ostensibly changed any settings - although now there are instructions written at 0x0000. However, it seems as if the bootloader is no longer loaded. The device does not appear as a USB device on my computer as it did before and I cannot connect to it over USB. I am still using the linker flash -Tflash_with_bootloader.ld, I have changed nothing about the project, the .cppproj file, bootloader or location. And now, instead of writing 0x00 to all bytes until 0x2000 (earmarked for the bootloader) there is code in there that still does not appear to be a bootloader!

Hi masoandro,

It might be worth checking the fuse settings. On Atmel Studio 7 they can be found on the fuse tab in the "Device Programming" dialog box and selecting the "Read" button.

Here's what I have them set to on my (Arduino Zero bootloader based) boards, these also happen to be the default settings for the SAMD21:

NVMCTRL_BOOTPROT: 0x07
NVMCTRL_EEPROM_SIZE: 0x07
BOD3USER_LEVEL: 0x07
BOD33_EN: Yes (checked)
BOD33_ACTION: 0x01
WDT_EN: No (unchecked)
WDT_ALWAYS_ON: No
WDT_PER: 0x0B
WDT_WINDOW0: Yes
WDT_WINDOW1: 0x05
WDT_EWOFFSET: 0x0B
WDT_WEN: No
BOD33_HYST: No
NVMCTRL_REGION_LOCK: 0xFFFF

Interestingly, the Arduino Zero bootloader doesn't set the BOOTPROT fuse that protects the bootloader from being overwritten (0x07), whereas the UF2 bootloader used by Adafruit for their M0 boards does (0x02). I imagine that this means that the Arduino core code is relying on its linker scripts to respect the bootloader's memory, in order to prevent it from being overwritten. Might also be worth checking if your build is using the correct linker script file?

If your custom board uses the same LED pins (13, TX, RX) as the Arduino Zero, you could possibly try buring the bootloader using the Arduino IDE instead of using Atmel Studio 7?