SAMD21 Writing To unused part of the Flash?

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

Hi 

 

I am using the ATSAMD21G18.

 

The Flash Memory is 256K.

 

I would like to implement some type of firmware update using a bootloader.

 

I would first need to download the updated firmware and have it stored.

 

Is it possible that i can use 128K for my Application and then use the other 128K to store firmware bin file.

 

Then jump into boot sector to copy the updated firmware from the stored location to the first page?

 

Can this be possible?

 

 

 

 

Thanks

Regards

DJ

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

You sure can. See this App Note for more information.

"When all else fails, read the directions"

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

Hi 

 

Thanks

 

Would that allow me to write to that flash while i am in application sector or do i need to be in boot sector?

 

 

Thanks

Regards

DJ

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

You have to really consider if it is ok that only your application can download/write an updated application since it implies that a flashed bad application can't be updated.

Commonly all of this is a task for the bootloader.

/Lars

 

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

I am using the WINC3400 with SAMD21, therefore i would need to preform the download in application layer as bootloader sector will not be large enough for my download code.

 

 

Thanks

Regards

DJ

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

You can perform the download of the firmware in the bootloader because the bootloader isn't a set size. The SAMD21 doesn't have a bootloader sector. You tell the boot loader where to start the application code. See app note I posted above. 

"When all else fails, read the directions"

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

Ok, that will be good, I can keep my boot code similar to my application code, where it would download the necessary file but remove all the unnecessary code to keep it small as possible.

Thanks

Regards

DJ

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

I have existing project, how can i change where the application start address is?

 

It seems the default is set to 0

Thanks

Regards

DJ

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

You can change the linker script, page 38 in the app note in post #2.

/Lars

 

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

So that i am understanding it correctly.

 

If my bootloader becomes 75K( Due to a downloading firmware over wifi), i can then set my application memory to be between 80K-256K?

Thanks

Regards

DJ

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

djoshi wrote:

I have existing project, how can i change where the application start address is?

 

It seems the default is set to 0

 

Hi - Did you read the app note? 

"When all else fails, read the directions"