Go Down

Topic: What about the bootloader? (Read 9262 times) previous topic - next topic

giantsfan3

Will it be easy for tinkerers to eventually make their own Arduino Due, in barebones/breadboard/stripboard/PCB form? I see no provided bootloader.

It was great the way it was for the Atmega328 and Atmega2560, where I could burn the provided bootloaders via another Arduino using ArduinoISP or else using some other ICSP...

pYro_65

Bootloader's are provided by atmel, and seems Arduino hasn't replaced them.
Weather or not you can get only a binary file or the full source is a guess.

The bootloaders have a usb option too, custom boards / field updates may be easier.

giantsfan3

#2
Oct 25, 2012, 01:27 am Last Edit: Oct 25, 2012, 01:29 am by giantsfan3 Reason: 1
@pyro_65:
What do you mean, "bootloaders have a USB option" ?
I was under the impression that bootloader could only be burned via ICSP; and that only by reading the bootloader in the first section of the flash, the computer is then able to load firmware into the memory via serial.

pYro_65

The bootloader can upload new binary files from a mass storage device.

The bootloader is overwritten presumably through a ISP, http://arduino.cc/forum/index.php/topic,128707.msg968706.html#msg968706

Graynomad

#4
Oct 25, 2012, 03:56 am Last Edit: Oct 25, 2012, 04:03 am by Graynomad Reason: 1
On the SAM the bootloader resides in silicon, you cannot erase it and it doesn't take any flash space. I would think it could be disabled somehow but can't see any reference to doing so.

It will boot from either USB or the UART so there's no need for Arduino to supply another bootloader.

That said with ARMs (or at least LPCs) you can write a "secondary" bootloader if you want to do your own thing, I assume that would reside in flash but I can't see any reference to doing that in the SAM data sheet.

EDIT: It does look like the GPNVM bits can be used to select the boot options.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

giantsfan3

#5
Oct 25, 2012, 11:27 am Last Edit: Oct 25, 2012, 12:00 pm by giantsfan3 Reason: 1
@Graynomad, So do you mean that, if you buy a SAM3X8E from Atmel, it already comes with the necessary bootloader, and you can USB-upload Arduino sketches to it as purchased (assuming the UART interfacing in between is taken care of) ?

(Now if only it were in a hobbyist-friendly package!)

Markus_L811


@Graynomad, So do you mean that, if you buy a SAM3X8E from Atmel, it already comes with the necessary bootloader, and you can USB-upload Arduino sketches to it as purchased (assuming the UART interfacing in between is taken care of) ?

(Now if only it were in a hobbyist-friendly package!)


(I think)
Or you can use the Atmel SAM3X-EK as well with the Arduino IDE.

Graynomad

Quote
if you buy a SAM3X8E from Atmel, it already comes with the necessary bootloader

Yep, AFAIK you can hook a terminal program to the UART pins and away you go. Same with USB.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

cmaglie

The bootloader is preburned in ROM from Atmel and is called SAM-BA. There is no way to change it.

The desktop application that Atmel uses for uploading is called also SAM-BA, you can download it from the Atmel website, there is a version for Windows and Linux (no Mac). It works well, has a nice GUI, but its too big to include in Arduino distribution.

We used an open source alternative called 'bossac', written by Scott Shumate. This is a super-light tool, that supports a lot of SAM* cpu (from SAM3 to SAM9), that can be called by command line (like avrdude) and best of all, it runs on Linux, Windows and Mac.

http://www.shumatech.com/web/products/bossa
(actually the site is down, i think its a temporary problem)

I did a lot of patches to Bossac in order to allow autoreset, and to do some workaround for os-specific problems during upload.
Scott Shumate helped a lot in this phase of development, he was very kind and responsive.
The Arduino patches can be found in the "arduino" branch of bossac github:

https://github.com/shumatech/BOSSA/tree/arduino

hopefully these patch would be included in the upstream bossac in the coming weeks.

C.

giantsfan3

#9
Oct 25, 2012, 05:54 pm Last Edit: Oct 25, 2012, 05:57 pm by giantsfan3 Reason: 1
Great, thank you @cmaglie and @Graynomad.
So the conclusions are:

(1) Atmel has pre-burned bootloader into ROM for all SAM3X8E ic's as sold, so no such thing as "Arduino bootloader" any more as was the case for previous Arduino boards.

(2) USB/Serial uploading of "sketches"/firmware (or the corresponding hex files to be specific) can be done via SAM-BA software, or via Arduino 1.5 IDE (which uses bossac tool by Scott Shumate)

(3) And as @pyro_65 states, firmware uploads may also potentially be done from a mass-storage device via the USB host (?).

cmaglie

Yes for (1) and (2)

The answer for (3) is: no, you can't with SAM-BA bootloader.

Using SAM-BA bootloader you can upload a file in two way:
- from UART (pins RX0/TX0 on the Due Board at 115200bps N81).
- using USB, if you connect the board to a PC the board is seen as a virtual serial port. SAMBA has a little USB Device driver for serial port emulation.

So, forget mass storage devices, unless you write your own bootloader that handles USB Host OTG, but this is another story...
C.

Graynomad

#11
Oct 25, 2012, 06:26 pm Last Edit: Oct 25, 2012, 06:51 pm by Graynomad Reason: 1
1 and 2 yes.

3 I don't think so, the BL would be expecting a particular protocol, how does it get that from an SD card and there's no mention of it in the BL flow chart which goes like this

start:
   is USB enumeration successful?
   yes - run SAM-BA
   is char # received from UART?
   yes - run SAM-BA
goto start

no mention of SD cards.

Looking at the above, how does code execute when you are plugged into the USB, surely it goes into the BL and you would have to manually run the code from there.

cmaglie, do you know?

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Graynomad

#12
Oct 26, 2012, 02:06 am Last Edit: Oct 26, 2012, 02:09 am by Graynomad Reason: 1
Quote
how does code execute when you are plugged into the USB,

I think I've answered my own question, if there is no user code the BL is entered, if the is user code that's entered instead. This is good because you no longer have an delay while the BL decides if it should run or not as is currently the case with Arduinos.

For this reason you have to clear the flash before you can get access to the BL.

The Due board does have an ERASE button that can be used for this purpose, but that would be a pain to do every time so I looked at the schematic.

There's a FET across the switch that is controlled by ATMEGA16U2, so the USB chip can erase the SAM before programming. This is part of the standard download procedure as I understand it.

Mystery solved.


______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

avenue33

Can someone please post the verbose output when uploading a sketch to the Arduino Due with bossac?

Thanks!

hiduino

Code: [Select]
Binary sketch size: 9,660 bytes (of a 524,288 byte maximum)
Forcing reset using 1200bps open/close on port COM12
C:\Documents and Settings\randalm\My Documents\My Stuff\Arduino\arduino-1.5/hardware/tools/bossac.exe --port=COM12 -U false -e -w -v -b C:\DOCUME~1\randalm\LOCALS~1\Temp\build4692706267932093131.tmp/Blink.cpp.bin -R
Erase flash
Write 9740 bytes to flash

[                              ] 0% (0/39 pages)
[=======                       ] 25% (10/39 pages)
[===============               ] 51% (20/39 pages)
[=======================       ] 76% (30/39 pages)
[==============================] 100% (39/39 pages)
Verify 9740 bytes of flash

[                              ] 0% (0/39 pages)
[=======                       ] 25% (10/39 pages)
[===============               ] 51% (20/39 pages)
[=======================       ] 76% (30/39 pages)
[==============================] 100% (39/39 pages)
Verify successful
Set boot flash true
CPU reset.



Go Up