Sam-ba bootloader question

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm working on a SAMC21 design which has a sam-ba monitor bootloader and a main application.  The linker script shows memory layout for the SAMC21G18A device.  I'm looking to use a small 4 byte section of flash at the very end of the flash memory region to share status between the bootloader and the main application.


-------SAMC21 target the linker script ;



 rom   (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000

 ram   (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000




My sam-ba monitor sections resides at 0x00000000 - 0x00001FFF and my application resides at 0x00002000 - 0x00006000. The 4 byte section I'm looking to share between the application and the bootloader is at address 0x0003FFF0, well above the main application and just below the end of flash.


I hope this clarifies the memory ranges and the description of what I'm trying to do. It looks like the sam-ba monitor bootloader was created using ASF 3 and I'm looking to add flash writing ability for writing to the high 4 byte memory location.  Based on this scenario, what is the recommended way to write to flash from the bootloader?  I found that ASF has an NVM example application for the SAMC part and I started looking into it. It's not clear what parameters to pass the NVM erase, write, read functions for the memory size and range.  I'm hoping someone is familiar with the NVM functions and can provide help with this. 

Last Edited: Tue. Dec 10, 2019 - 12:50 PM