Bootloader corrupted when flashing application

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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?

More details;
platform: SAME70 Xplained dev board
debugger: on-board debugger (SWD), reflashed with Segger Jlink firmware
IDE: Atmel Studio 7.0.1931

Last Edited: Wed. Dec 26, 2018 - 03:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have no experience with the SAM parts, but on an AVR, there are fuse settings to protect the bootload part of memory from being erased when the chip erase is done just prior to programming the flash for the application. 

It sounds like that bootloader memory has not been defined/protected properly for your bootloader and gets erased upon flash programming.

 

Hopefully someone with SAM experience will answer your question better.

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the suggestion ki0bk.

I tried setting the fuse bits to protect the flash area where the bootloader lives. However, when I program the application through atmel studio it seems to clear the fuse bits. I've fiddled with different programming settings ("Erase only program area" and "incremental programming") but no success as yet. It is still clearing the fuse bits and corrupting the bootloader.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I usually just don't have the bootloader flashed if I need to debug/develop the application but I just tested flashing the application using the bootloader and then debug with option "skip programming" and that seems ok.

/Lars

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you using the default debugger firmware that comes installed on the dev board (I think it's called EDBG)?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No this is not with a dev board, I was using a Atmel ICE.  It's with a SAMC21 also so might not be relevant for your case.

/Lars