-
-
Notifications
You must be signed in to change notification settings - Fork 398
Incorrect "Sketch too big" error on insufficient Flash space when uploading using programmer #1035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the bug report. https://github.com/arduino/Arduino/blob/master/hardware/arduino/boards.txt#L511 C |
It seems like it would be a bad idea to allow random application code to be flashed into the boot section. Even when you are doing an "Upload Using Programmer", the |
I think you are correct here. If we'd want to allow using the full flash space by using a programmer, the fuses must also be changed, which would be a significant change (though writing the fuses using "Upload using programmer" would not neccesarily be bad, since currently people regularly get surprised by the fact they their CPU speed is wrong when they did "Upload using programmer" on a new chip directly, without doing "Burn bootloader" once). |
In my usecase, there actually is no boot section. If I remember the project correctly, I had simply run out of space and needed the extra bytes for the bootloader. As I was operating on a custom board with an Arduino inside (i.e., not destined for constant reprogramming) using an external programmer was totally fine. Also, similarly remembering the project, "Upload using bootloader" actually does remove the bootloader, so I really did get the extra space. |
If you have a custom board that is never intended to be used with a bootloader, the But if the Most of this is AVR-specific and might or might not apply to other architectures. In general, the original request seems to be (or could be) to allow different configurations (fuses and max flash) for when uploading by bootloader or by programmer. But for AVR, for this to really work, the fuses must also be programmed when doing "upload using programmer". |
avrdude at least supports programming fuses and flash in a single command:
so the only thing that would be needed is an property equivalent to The current workaround for this in the 3rd party platform world is to add a "no bootloader" custom board option (example) |
Thinking back to the question that raised this bugreport: I had a custom circuit soldered onto a perfboard, including the typical Arduino Uno parts (Xtal, Reset button, ISP Header, USB-Serial Adapter Header). I socketed store-bought Atmega328s into those boards. For the project I actually preferred not having the bootloader, since the 1 second delay at power on would have been annoying. Needing the flash space for the project was a problem on top, which eventually prompted this bugreport. The entire project was originally inspired by the "Arduino on Breadboard" and "DIY Arduino on Perfboard" post surrounding the Arduino community at the time. As I had store-bought AVRs, I must have programmed the fuses somehow, as the factory defaults don't work for an Arduino Uno board. I remember running into the issue of "Upload using programmer" not setting the fuses and incorrectly writing up a whole bunch of the AVRs as defective. Although whether I set the fuses using avrdude directly, using a custom boards.txt or messing with an existing boards.txt, I cannot say anymore. In any case, I was still working on on the code when I had set up circuit on the perfboard (removing bugs, adapting pinlayouts to circuit board revisions, adding the occasional functionality and the like). So this was not a matter of "mess with avrdude once" but of repeatedly recompiling my code and uploading through the programmer. |
Given a sketch of compiled size X, where X by itself will fit into the flash of a given chip, but X plus the Arduino Bootloader will not. When using the regular "Upload" Button, the Arduino IDE correctly prints a warning about insufficient flash memory and aborts the upload process.
However, when using "Upload using Programmer" (precisely to use the extra space by getting rid of the bootloader), the Arduino IDE again prints this warning (this time incorrectly!) and aborts the upload process.
To resolve this issue, the IDE should take the upload method (Bootloader/Programmer) into account when computing the amount of flash available on the chip.
I verified this using Arduino 1.0.4 and Arduino 1.0.5, both times compiling for an ATmega8 ("Ardunio NG or older w/ATmega8").
Until this bug is resolved, I would also appreciate a hint on how to work around this issue (i.e., how to burn an "oversize" sketch with a programmer) in the meantime.
The text was updated successfully, but these errors were encountered: