Go Down

Topic: Dual Boot (Read 3697 times) previous topic - next topic

mauromoretto

Hello everybody.

I found a very interesting information about SAM3X8E and would like to share it:

The data sheet says (Page 41):

Quote
9.1.4 Boot Strategies
The system always boots at address 0x0. To ensure maximum boot possibilities, the memory
layout can be changed via GPNVM.
A general-purpose NVM (GPNVM1) bit is used to boot either on the ROM (default) or from the
Flash.
The GPNVM bit can be cleared or set respectively through the "Clear General-purpose NVM Bit"
and "Set General-purpose NVM Bit" commands of the EEFC User Interface.
Setting GPNVM Bit 1 selects the boot from the Flash, clearing it selects the boot from the ROM.
Asserting ERASE clears GPNVM Bit 1 and thus selects the boot from the ROM by default.
GPNVM2 enables to select if Flash 0 or Flash 1 is used for the boot.
Setting GPNVM bit 2 selects the boot from Flash 1, clearing it selects the boot from Flash 0.


If this is true maybe could be possible to have a firmware in Flash 0 that programs Flash 1 or vice versa.
That means that this firmware could interface potentially to any peripheral (Uart, CAN, USB Mass storage, Ethernet, etc)  to program new firmware, then write proper value in the GPNVM and restart booting from the flash area where the new firmware resides.
In this way it could be possible to program Arduino Due from any peripheral.


Thank everyone.

spiceice

so now can i put Android on an outer storage(memory card) and then change the boot, to make my kit boot from memory card and install Android?? is it possible?

mauromoretto

Be careful spiceice, I said that maybe could be possible that Arduino due can perform In Application Programming (IAP) like your DSL router, not boot from a device.

I found something about flash programming on the Atmel Software Frameworkhttp://asf.atmel.com/docs/latest/search.html?board=Arduino%20Due/X, but I still don't know how to integrate in Arduino IDE.

Have a nice day.

robbsadler

I know this is an old post, but wanted to share a link that may be helpful to others who come across this thread that I am using to implement dual-boot: If you want to do it via a wire, you can use this as a jumping off point: https://github.com/collin80/FirmwareReceiver

HTH

AdderD

Heh, it's kind of funny that I just saw this pop up. Yes, I ended up doing exactly what this Mamo person thought might be possible. It is indeed possible to store a bootloader in one of the flash sections and use it to flash the other section with a sketch. It halves the space your sketch can take up but not too many sketches are over 256k anyway.

paulcdsi

Hi Guys,
Are you aware of Errata info about 64KByte limitation?
On Page 1443 of the full manual it says:

49.1.1.3 Flash: Boot Flash Programming Mapping Is Wrong
GPNVM2 enables to select if Flash0 or Flash1 is used for the boot. But when GPNVM2 is 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.

AdderD

Yes, I was aware of that. However, even if by accident, Arduino Due sketches are immune to this. All actual data and function calls are done with the absolute address. So, all you need the boot mapping for is the initial function call. After that an Arduino Due sketch doesn't ever use the boot mapped section. I suppose the only way it could mess anybody up is if your starting function was found more than 64kb into the code. Then you wouldn't get it and things would crash. So long as that first function call is less than 64kb into the code you're golden.

Go Up