SAM3x8E bootloader implementation

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

Posts: 2
Joined: Sun Nov 20, 2016 2:14 pm

SAM3x8E bootloader implementation

Sun Nov 20, 2016 3:10 pm

Hi All,

I know this question has been asked in many different forms here but I'm still confused as to the outcome so i will ask it again hopefully i can get to an answer my small brain can use :D

I have been asked to write a bootloader for a application that is using Arduino (1.6) to compile (the hardware is custom but based on the DUO board)

The bootloader is based on the Atmel AT02333 dual banked method and despite the lack of supporting paperwork it is all looking good for the most part however i see some odd behaviours still when loading an image into the second bank, my assumption is that the image is using direct addressing and therefore running back to the code on Bank0.

Questions regarding this:
1. Customisation of the Arduino, does the compiler support dual banks (essentially removing direct addressing, using relative addressing only)?
2. is there an easy way to ensure a fixed entry point in the main code, besides just moving the .text / ROM sections in the linker?
3. does anyone have any tips for the implementation of dual banks (failure modes, pinch points, general tips), i think i have my bases covered but i'm really trying to make sure that i get all the failure modes under control

Thanks in advance

Posts: 5
Joined: Tue Nov 24, 2015 4:55 pm

Re: SAM3x8E bootloader implementation

Tue Nov 22, 2016 9:03 pm

If your code is under 64K, you should be OK with the Dual Bank method. You would not have to worry about relative vs direct addressing because when you remap the Flash address using the GPNVM bits, it will appear at the same address that it was compiled for.

If your code is > 64K, there is a bug in the SAM3X8E that prevents the Dual Bank method from working.

This is documented in chapter 49, SAM3XA Series Errata, section 49.1.3 Flash: Boot Flash Programming Mapping is Wrong, it states:
"GPNVM2 enables to select if Flash0 or Flash1 is used for the boot. But when GPNVM2is set, only the first 64 Kbytes of the Flash 1 are seen in the Boot Memory. The rest of the Boot memory corresponds to Flash 0 content.

Problem Fix/Workaround
No fix required if the code size is less than 64Kbytes. Otherwise the software needs to take into account this limitation if GPNVM2 is used."

This means that this dual banking scheme will not work if the code is > 64K
Posts: 2
Joined: Sun Nov 20, 2016 2:14 pm

Re: SAM3x8E bootloader implementation

Wed Nov 23, 2016 1:34 am

thanks for that, my code is heading toward that >64kb size so I think a little bit of optimisation might be necessary but otherwise i am good to go!

Thanks for the response!

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 4 guests