Pages: [1] 2   Go Down
Author Topic: What about the bootloader?  (Read 6916 times)
0 Members and 1 Guest are viewing this topic.
Portland, OR
Offline Offline
Sr. Member
****
Karma: 5
Posts: 260
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 53
Posts: 1785
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Portland, OR
Offline Offline
Sr. Member
****
Karma: 5
Posts: 260
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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.
« Last Edit: October 24, 2012, 06:29:12 pm by giantsfan3 » Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 53
Posts: 1785
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 121
Posts: 8448
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: October 24, 2012, 09:03:30 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Portland, OR
Offline Offline
Sr. Member
****
Karma: 5
Posts: 260
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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!)
« Last Edit: October 25, 2012, 05:00:32 am by giantsfan3 » Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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.
Logged

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 121
Posts: 8448
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Forum Administrator
Milano, Italy
Offline Offline
Sr. Member
*****
Karma: 22
Posts: 292
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

C.

Portland, OR
Offline Offline
Sr. Member
****
Karma: 5
Posts: 260
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (?).
« Last Edit: October 25, 2012, 10:57:48 am by giantsfan3 » Logged

Forum Administrator
Milano, Italy
Offline Offline
Sr. Member
*****
Karma: 22
Posts: 292
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

C.

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 121
Posts: 8448
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: October 25, 2012, 11:51:42 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

nr Bundaberg, Australia
Online Online
Tesla Member
***
Karma: 121
Posts: 8448
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: October 25, 2012, 07:09:33 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

France
Offline Offline
God Member
*****
Karma: 9
Posts: 613
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks!
Logged


Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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.

Logged

Pages: [1] 2   Go Up
Jump to: