Go Down

Topic: Leonardo Bootloader Compiles but Cannot Start (Read 696 times) previous topic - next topic


Oct 06, 2013, 09:50 am Last Edit: Oct 06, 2013, 10:24 am by bshambles Reason: 1
Hi. I've been trying to compile the Leonardo (Caterina) bootloader from scratch for a couple days, but I still have one issue.

I'm on Windows 7 64-bit. After burning my freshly compiled bootloader, I plug in my Leonardo board, it is recognized as "Arduino Leonardo bootloader (COMx). But, the device status is "The device cannot start (Code 10)". This means that I can't upload a sketch using the Arduino IDE.

What I did:
I grabbed the Arduino code from Github, and I'm using the master branch.
I downloaded LUFA (111009), and pointed the Caterina makefile to its folder.
I uncommented the standard Arduino VID and Leonardo PID in the makefile, just for testing.
I use the same lock and fuse bits as described in the boards.txt for the Leonardo.

I tried to compile the Blink sketch, and upload the generated .hex file to the flash without erasing my bootloader. I can see that the LED pulses indicating that the bootloader starts, and then blinks, showing that the sketch also runs. But I still have the same problem, the bootloader shows "The device cannot start (Code 10)", so I can't upload a new sketch from the IDE.

I also tested the pre-compiled Leonardo bootloader, which contains the default Blink sketch, and that works like a charm.

If anyone went through this or has any suggestions, I would love to hear them.


I'll add a bit more hoping that someone will jump in.

I noticed files that contain the exact versions of the tools and libraries used to generate the pre-compiled Leonardo bootloader found in the GitHub.

Builds against LUFA version 111009
make version 3.81
avrdude version 5.11

All AVR tools except avrdude were installed by CrossPack 20100115:
avr-gcc version 4.3.3 (GCC)
Thread model: single
Configured with: ../configure --prefix=/usr/local/CrossPack-AVR-20100115 --disable-dependency-tracking --disable-nls --disable-werror --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
avr-libc version 1.6.7
binutils version 2.19

Some of the versions I was using did not match so I made some changes to use every exact version. On Windows, this led to a problem with avr-gcc 4.3.3, which compiles the bootloader to 4104 bytes, which doesn't fit.

I update avr-gcc to the latest AVR Toolchain, which produces a bootloader that fits, but still show the same error: "The device cannot start (Code 10)", in my Device Manager.



After hours of trying different things. The problem was with LUFA.
Make sure you get the LUFA-111009 release from Google Code NOT from GitHub. I'm not sure what the different is between the two, but they are not the same.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131