-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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
[BUG] env:melzi and env:sanguino1284p flash size to large, leads to overwriting of bootloader. #18501
Comments
Where to get it? I keep destroying my bootloader. |
Its parts of arduino sanguino package. https://github.com/Lauszus/Sanguino/tree/master/bootloaders/optiboot optiboot_atmega1284p.hex is 16mhz version you need. |
@ellensp
After that my board and bootloader is dead. Empty screen and errors when attempting to upload another Marlin.
Need to attach USBasp and flash bootloader again.
And it works. |
usbasp is junk, doesn't decode address > 64k correctly. Will write crap all over the flash. (ok junk is a bit harsh, but is designed for devices with < 64k flash ) |
Finally. It works. So somehow USBasp uploads "currupted"(?) bootloader that can't process 127746 byte sketch, but processes 125292 without any problem multiple times. This is some black magic I will not be able to understand. |
Thx for posting. I guess this exactly describes how i crashed my bootloader XD. I have a Creality 1.1.5 Silent Board for the Ender 3 which comes with a preinstalled bootloader. So it seems to use the large one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Description
This was discussed way back in March in discord, but never got fixed.
There are two common bootloader options on a sanguino_atmega1284p
The older bootloader is 4096 bytes in size leaving 126976 byes for firmware.
The newer optiboot bootloader is only 1024 bytes in size leaving 130048 bytes for firmware.
But platformio presumes the newer optiboot bootloader and always sets 130048 bytes for firmware size
So if you select env:melzi or env:sanguino1284p and upload the firmware, If it exceeds 126976 bytes it starts to try overwriting the beginning of the larger bootloader.
The env: can set a new max firmware size with the following line.
board_upload.maximum_size = 126976 <= search for this on discord to find the discussion.
My Configurations
Configs crafted for size only.
Configuration.zip (generates bugfix marlin of 128370 bytes)
Steps to Reproduce
"avrdude: stk500_cmd(): programmer is out of sync" and "avrdude: stk500_cmd(): protocol error"
Expected behavior:
No issues upload a second time.
Actual behavior:
You get "avrdude: stk500_cmd(): programmer is out of sync" and "avrdude: stk500_cmd(): protocol error" on attempt to upload second time.
Additional Information
search discord for "board_upload.maximum_size = 126976"
The text was updated successfully, but these errors were encountered: