Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I bought an Arduino Due, and I noticed unlike the other boards, the onboard LED does not flash after reset. I prefer this behavior, so I want to modify the bootloader to do this behavior when it starts. I have burnt bootloaders before, but I never modified one before.

How can I do this?

share|improve this question
up vote 2 down vote accepted

The Arduino Due bootloader is built-in. If you check the Arduino SAM core there are no bootloader files. There is a firmware file for the ATmega16u2 on the Programming Port. You might be able to modify this to do that (given that there is a LED to flash).

The alternative solution to a modified bootloader is modifing the init() of the Arduino SAM core. Please see or Blink code as proposed by Majenko could be added there.


share|improve this answer
In my Arduino Folder, in /hardware/arduino I do not have a sam folder. Do I need to reinstall Arduino? – Shiven Feb 22 at 2:14
Nevermind, I found it in the AppData folder. Thanks! – Shiven Feb 22 at 2:28
The newer Arduino Boards Manager uses packages. They are typically installed in a "hidden" folder such as AppData, .arduino15, etc. Editing the files there is only a very temporary solution as they may "disappear" in the next update. A long term solution would be to get the code into the Due/SAM core by filing a github issue and a pull-request. – Mikael Patel Feb 22 at 13:07

You cannot.

The SAM3X's bootloader is hard-coded into ROM and can never be changed.


Yes, I know, it sucks, doesn't it?

However, the bootloader only executes if the flash is empty (bit of an odd choice if you ask me, but there you go) so you could "emulate" the operation by flashing an LED as the first thing in your sketch.

pinMode(13, OUTPUT);
for (int i = 0; i < 5; i++) {
    digitalWrite(13, HIGH);
    digitalWrite(13, LOW);
pinMode(13, INPUT); // This will "reset" the pin to default.
share|improve this answer
The blink code could be added to the main.cpp for SAM core. There is actually an initVariant() that is available. That would be the place to put this or the init(). Please see… or… – Mikael Patel Feb 21 at 20:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.