The ATmega328p and ATmega32u4 microcontroller have 32Kb of flash memory (as datasheet). Bootloader for each microcontroleer has different size (about 512 byte for 328p and 4kb for 32u4).

Why in boards.txt the "upload.maximum_size" parameters is 32256 for 328p and 28672 for 32u4?

I we have to consider bootloader size, the "upload.maximum_size" parameter for 328p must be about 31.5k and not 32k. And, if we do not have to consider bootloader size, as the default boards.txt configuration (above) for 328p, the "upload.maximum_size" parameter for 32u4 must be 32k not 28k. Correct?

Thank you

1 Answer 1


1KB is 1024 bytes, not 1000 bytes.

Therefore 32kb = 32768 bytes.

32768-512=32256, which is exactly the value used for upload.maximum_size for the 328p.

4kb=4096 bytes. 32768-4096=28672 which is the value for the 32u4.

  • You are right @Gerben. Excuse me for my attention fault. I found this thread about 32u4 flash size. Is it possible the available flash (with bootloader) be less then ~28k because USB stack (as questioned in thread)?
    – Mario J.
    Oct 3, 2019 at 15:22
  • Yes, you are correct. The 32u4 bootloader has to implement the USB stack, which the 328p only has to do UART, which is a lot simpler.
    – Gerben
    Oct 3, 2019 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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