Will taking away the bootloader reduce boot-up time?

Hi Arduino experts,

I am using Atmega328. I have an application that requires the Atmega328 to boot up as fast as possible. Currently, I measure that there is a delay of about 1.8secs before the MCU starts running code inside loop(). Will taking away the bootloader reduce boot-up time? If yes, has anyone tried what is the time-savings?

Thank you.

lightaiyee: Will taking away the bootloader reduce boot-up time?

Yes.

lightaiyee: If yes, has anyone tried what is the time-savings?

A lot.

I measure that there is a delay of about 1.8secs before the MCU starts running code inside loop(). Will taking away the bootloader reduce boot-up time? If yes, has anyone tried what is the time-savings?

1.8 seconds?

The chip gets under way depending on the fuses but it is something like 65 mS. You just have to change the fuses to turn off the BOOTRST fuse and it will go straight to the main code.

1.8 s from when?

The current bootloader should run for about 1s after a RESET, and start the sketch nearly immediately after a power-on. (not counting the 65ms oscillator startup.) That's leaving about 0.7s unaccounted for...

I measured almost 1.6 seconds on a Uno using Optiboot.

I put one probe on Vcc, and the other on D8, running this sketch:

void setup ()
  {
  pinMode (8, OUTPUT);
  digitalWrite (8, HIGH);
  }  // end of setup

void loop () { }

I had a pull-down resistor on D8 to make sure it stayed low during boot-up. My fuses are:

LFuse = 0xFF 
HFuse = 0xD6 
EFuse = 0xFD

According to my calculations the chip startup time would be:

16K clocks + 65 mS = 0.066 mS

That's because 16000 clock cycles at 16 MHz would take 1 mS.

Another test, also measuring D13, seems to show it takes just over a second after flashing the LED 3 times:

I presume D13 goes high at the end when output mode is released.

start the sketch nearly immediately after a power-on

Hmm. It doesn't seem to be doing that! In theory, a power-on should never get to the code that flashes the LEDs in the bootloader, for example.

I think the LED blinking covers most of the extra .7 seconds. Most Arduinos should have 3 flashes with a period (off+on) of about 0.125s.

[quote author=Nick Gammon link=topic=158078.msg1184928#msg1184928 date=1365020743] I measured almost 1.6 seconds on a Uno using Optiboot.

[/quote]

Thank you for your tests. Most helpful. Unlike your more precise measurement, I relied on eye observation using an LED. 1.8secs was the time between letting go of the reset button and the LED turning on.