2

Recently hit the dreaded 0x7000 / 28k~ AVRDUDE+LUFA limit. It states everywhere this is because the bootloader uses 4KB, thus reducing the 32KB to 28KB. Makes sense, except...

Blank sketches on the 32U4 take nearly 4KB from the get go, which I thought was attributed to the bootloader? So now I'm confused. If I'm losing 4KB off the top, and 4KB off the bottom - is the bootloader 8KB?

EDIT: In case the above is unclear, it appears my sketches only have ~24k of the 32k available to them. Is this expected behavior?

  • 2
    32u4 sketches include the USB stack that 328p sketches don't. That consequently uses more space. – Majenko Feb 9 '16 at 12:55
  • I read the USB stack lives in the bootloader; are there two USB stacks? – Malachi Feb 9 '16 at 18:00
2

The bootloader needs a USB stack to work. It is possible to run the main sketch without a bootloader. So yes, I suppose you must have two of them. Looking at the assembler output for a blank sketch, it appears that you get the USB code in it by default. As I said, they have to assume you may not have the bootloader around, so they can't just execute the stack from the bootloader.

  • Not the answer I was hoping for, but an accurate and informative answer nonetheless. Thank you! – Malachi Feb 18 '16 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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