Go Down

Topic: Removing the Arduino Bootloader (Read 3 times) previous topic - next topic

Coding Badly

@Coding Badly: What are the actual speeds you get? (roughly)


Arduino 1.0.1-rc2
avrdude 5.11

Times are reported by avrdude.  Rate is bytes per second for a write then verify.

Breadboard Uno running 250K baud Optiboot 4.4 with the Pololu programmer as the USB-to-serial converter: 5313.9

Pololu to an ATmega328P running at 16MHz (2M SPI): 4573.5

Teensy 1 running TinyISP to an ATtiny85: 1628.6

Uno running TinyISP to an ATtiny85: 1481.4

Uno running the stock ArduinoISP to an ATtiny85: 352.4

Quote
I'm working on a project where I have to upload via ISP (not bootloader) and I am uploading a sketch of 9308 bytes (program memory) or 26208 bytes (hex file size) in 11 seconds, using the Arduino via SD card system I devised.


846.2 bytes per second. 

Quote
http://www.gammon.com.au/forum/?id=11638


pollUntilReady ... that and fixing heartbeat makes the biggest difference to ArduinoISP.

Quote
I don't feel particularly annoyed at waiting that long. That time includes reading the file from SD and checking its integrity, uploading and then verifying the upload. There is an additional overhead of a few seconds to move the SD card from the Mac to the card reader.


Dude.  You need a programmer.   ;)

Nick Gammon


Dude.  You need a programmer.   ;)


OK, well I plugged in my USBtinyISP into the board under test. It has an Atmega32U4 on it, although it isn't a Leonardo. Since that is the same chip as the Leonardo I selected Leonardo in the Boards menu. (It's actually uploading using ICSP not the bootloader / USB interface).

My time to upload and verify was 45 seconds, compared to 11 seconds using my programmer. Maybe the configuration (in boards.txt) can be improved, but so far that is a lot slower. Using USBtinyISP that was only 215 bytes per second uploaded, whereas with my Uno as a programmer it was 879 bytes per second.

Quote
pollUntilReady ... that and fixing heartbeat makes the biggest difference to ArduinoISP.


Are you suggesting a fixed delay?

Coding Badly

Quote
pollUntilReady ... that and fixing heartbeat makes the biggest difference to ArduinoISP.


Are you suggesting a fixed delay?


No no.  The fixed delay is horrible.  The Atmel specification calls for a very conservative (read that as "way too long") delay.  Polling (when the target supports it) is most definitely the way to go.

ArduinoISP uses a fixed delay which is one of the reasons it's so slow.

Coding Badly



Dude.  You need a programmer.   ;)


My time to upload and verify was 45 seconds... Using USBtinyISP that was only 215 bytes per second uploaded...


Ouch!  Dude.  You need a better programmer.   :D

sTrider_7




You don't need to remove the bootloader in order to upload Arduino-less code.


Wait what?

The bootloader is just a piece of software that is loaded in the AVR that allows
a tool (avrdude in this case) to upload code to the AVR. The bootloader itself
is totally independent of anything Arduino.

As shipped the AVR fuses are set to create two sections in the FLASH. Bootloader and application.
The "Arduino" bootloader is small piece of code in the AVR that uses the serial port to update the flash
with the user application (code/program/sketch).
The bootloader runs at reset/powerup if there is no attempt to upload anything, the bootloader
will start the application code.
The application code can be written using any toolset you prefer. The Arduino tools are just one option.

avrdude is a tool that is used upload code into the flash.
avrdude can be used with an ISP programmer to upload code to the flash
avrdude can also use other mechanisms like a serial port that talks to a serial based programmer or to a bootloader.
The Arduino IDE uses avrdude to talk over a serial port to a pre-installed bootloader in the AVR chip.
The newer IDE can also use an ISP progammer to upload code. When an ISP programmer is used,
a bootloader is not used so the flash space used by the bootloader code frees up and can be used
by the application code.

If you don't want to use a bootloader, you will need some sort of ISP programmer.
Like Pico, I recommend getting a USBasp programmer off ebay.
I like the USBasp kk multicopter programmers (about $5-$10 USD) because they come with a 6 pin ISP
cable instead of 10 pin so no adapter is needed.

--- bill


This cleared up a lot of things, thank you Bill.

Go Up