I am developing a custom bootloader (downloading firmware over CAN bus) for a custom SAM3X8E board. I have code written that downloads the program into Flash1. I am using the Single Bank method as described in the application note, Safe and Secure Bootloader Implementation for SAM3/4. The tricky part is that you have to copy code from Flash1 (new firmware) over Flash0 (where you are currently executing). You cannot directly write to a Flash bank when you are executing from it.
Section 184.108.40.206 Single Banked Flash Programming shows a solution using the __ramfunc attribute to load a generic flash_cmd() function into RAM and execute it from there. You cannot use any of the ASF driver functions in this routine since they cannot run from RAM. It has to be done with low level EFC programming. I am looking for some actual application code that shows how to do this.
The only code example I can find for a SAM3X8E bootloader was designed in 2011 for IAR 5.5. I am using IAR 7.4 and this code is not compatible and won’t compile. Instead of using __ramfunc, it uses the FlashD driver code. This is not a trivial piece of code to port to the new compiler. I does not appear to part of the latest ASF driver code base. I am hoping that someone can point me an updated driver or example code that will work under IAR 7.4.
Originally I wanted to use the simpler Dual Bank method described in the App note, but there is a bug in the chip (confirmed by Atmel) that prevents this from working for programs over 64Kb.
Can someone show me a working example of how to do the Flash copy with code that can actually compiles under the latest compiler? Is there an easier way to do this? Is there an ASF function to do this?
Discussion around product based on ARM Cortex M3 core.
2 posts • Page 1 of 1
Who is online
Users browsing this forum: Majestic-12 [Bot] and 9 guests