I am experimenting with the USB bootloader example provided by Atmel for the SAMV7/SAME7 (search "AT16743: SAM V7/E7/S7 Safe and Secure Bootloader").
I can successfully flash the bootloader using a debugger, and then use the bootloader to flash a simple blinky application. However, I don't want to use the bootloader every time to load/debug my application. I would also like to be able to load the application via the debugger, so I can quickly and easily debug my code.
I have modified the application linker script and added the application header information as described in the bootloader application note. I've inspected the generated .hex file and it looks like the start memory address for the application and application header are correct. However, when I program the application into flash using the debugger, part of the bootloader is being corrupted. I downloaded the memory contents are flashing the application and it looks like a portion of the flash memory starting at 0x00404000 has been erased (filled with 0xFFFF). This is in the bootloader space, which shouldn't have been touched when the application was flashed.
If I choose "Skip programming" in the debugger settings and use it only for debugging, then I can successfully debug an application that was programmed via the bootloader.
Any ideas why the bootloader would be getting partially erased when the application is programmed via the debugger? Suggestions for things to check?
platform: SAME70 Xplained dev board
debugger: on-board debugger (SWD), reflashed with Segger Jlink firmware
IDE: Atmel Studio 7.0.1931