Skip to content
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

Block files with bootloader #26

Closed
Alissonverd opened this issue Jan 25, 2018 · 10 comments
Closed

Block files with bootloader #26

Alissonverd opened this issue Jan 25, 2018 · 10 comments

Comments

@Alissonverd
Copy link

Alissonverd commented Jan 25, 2018

Block files with bootloader in name.
I tried sending a firmware with bootloader and it corrupted my card. After that the only solution was to write the bootloader again with another arduino.
Files without the bootloader work perfectly!

** Marlin.ino.with_bootloader.mega.hex

@Alissonverd Alissonverd changed the title Bootloader files Block files with bootloader Jan 25, 2018
@Alissonverd
Copy link
Author

@Alissonverd
Copy link
Author

And thank you for this amazing plugin!

@Alissonverd
Copy link
Author

Alissonverd commented Jan 25, 2018

@benlye
Take a look at this, I do not know if it helps.

Marlin.ino.mega.hex
End of file

:101A6C0065206C696768743A206F6E00436173651A
:101A7C00206C696768743A206F666600646973004D
:101A8C004D313038004D313132004D3431300000A1
:00000001FF

Marlin.ino.with_bootloader.mega.hex
End of file

:10FD0000F999FECF1FBA92BD81BD20BD0FB6F89400
:0EFD1000FA9AF99A0FBE01960895F894FFCF63
:040000033000E000E9
:00000001FF

http://www.microchip.com/forums/m1006173.aspx

Now.. See in file with bootloader then start the bootloader part.. after the last line of file without BL.

in Marlin.ino.with_bootloader.mega.hex

:101A6C0065206C696768743A206F6E00436173651A
:101A7C00206C696768743A206F666600646973004D
:101A8C004D313038004D313132004D3431300000A1 < Last line of file without bootloader
:020000023000CC < ?? Start bootloader code?
:10E000000D9489F10D94B2F10D94B2F10D94B2F129
:10E010000D94B2F10D94B2F10D94B2F10D94B2F1F0
..
..
:10FD0000F999FECF1FBA92BD81BD20BD0FB6F89400
:0EFD1000FA9AF99A0FBE01960895F894FFCF63
:040000033000E000E9
:00000001FF

And test this part of file with bootloader in one hex to text converter:
http://www.unit-conversion.info/texttools/hexadecimal/

:020000023000CC
:10E000000D9489F10D94B2F10D94B2F10D94B2F129
:10E010000D94B2F10D94B2F10D94B2F10D94B2F1F0
:10E020000D94B2F10D94B2F10D94B2F10D94B2F1E0
:10E030000D94B2F10D94B2F10D94B2F10D94B2F1D0
:10E040000D94B2F10D94B2F10D94B2F10D94B2F1C0
:10E050000D94B2F10D94B2F10D94B2F10D94B2F1B0
:10E060000D94B2F10D94B2F10D94B2F10D94B2F1A0
:10E070000D94B2F10D94B2F10D94B2F10D94B2F190
:10E080000D94B2F10D94B2F10D94B2F10D94B2F180
:10E090000D94B2F10D94B2F10D94B2F10D94B2F170
:10E0A0000D94B2F10D94B2F10D94B2F10D94B2F160
:10E0B0000D94B2F10D94B2F10D94B2F10D94B2F150
:10E0C0000D94B2F10D94B2F10D94B2F10D94B2F140
:10E0D0000D94B2F10D94B2F10D94B2F10D94B2F130
:10E0E0000D94B2F141546D656761323536300041AF
:10E0F000726475696E6F206578706C6F72657220DE
:10E1000073746B3530305632206279204D4C530099
:10E11000426F6F746C6F616465723E004875683F52
:10E1200000436F6D70696C6564206F6E203D200048
:10E130004350552054797065202020203D20005FF9
:10E140005F4156525F415243485F5F3D2000415658
:10E1500052204C696243205665723D20004743437C
:10E160002056657273696F6E203D20004350552024
:10E1700049442020202020203D20004C6F7720663D
:10E18000757365202020203D20004869676820665F
:10E190007573652020203D200045787420667573D6
:10E1A00065202020203D20004C6F636B2066757336
:10E1B000652020203D20004D617220203720323024
:10E1C000313300312E362E3800342E332E350056A2
:10E1D00023202020414444522020206F7020636F70
:10E1E00064652020202020696E73747275637469E1
:10E1F0006F6E2061646472202020496E74657272B3

Result Hex to text

���0���
���ATmega2560A����rduino explorer ���stk500V2 by MLS����Bootloader>Huh?R�� Compiled on = H��0CPU Type = ���@AVR_ARCH= AVX��PR LibC Ver= GCC|��` Version = CPU $��pID = Low f=��use = High f_��use = Ext fus���e = Lock fus6��e = Mar 7

@Alissonverd
Copy link
Author

Alissonverd commented Jan 25, 2018

@benlye
Maybe be it's safe to check file for this two keys:
426F6F746C6F61646572 < Bootloader
41546D65676132353630 < ATmega2560

@benlye
Copy link
Collaborator

benlye commented Jan 26, 2018

I can see another way to do this, which wouldn't require decoding the hex data...

We know which MCU the user has, and the datasheets tell us the start addresses of the flash bootloader section for each MCU we support, so we can just look for any matching lines.

For example, an Atmega2560 supports 512, 1024, 2048, or 4096 word bootloaders, with 4096 being the default. The start address for each of those is 0x3FC00, 0x3F800, 0x3F000, and 0x3E000, with 0x3E000 being the default.

In the Atmega2560 file with the bootloader we see this line:
:020000023000CC

Which instructs that each subsequent data record should be offset by 0x3000 * 16. So, the following line:
:10E000000D9489F10D94B2F10D94B2F10D94B2F129
is really being written at (0x3000 * 16) + 0xE000, which is 0x3E000, one of the known bootloader start addresses for the Atmega2560.

I'll work on a way to implement this check and throw a warning. It's should be fairly straight-forward.

@Alissonverd
Copy link
Author

=D
I have basic programming skills. So I can only get ideas and I can not implement them.
Many thanks for your support!

@codecvlt
Copy link

+1 Totally bricked my cr-10s because of this. Ordered an Arduino uno so i can reflash the bootloader. The fun never ends :)

@benlye
Copy link
Collaborator

benlye commented Jan 29, 2018

I haven't had time to implement the check yet, so I've added a warning (plus a few instructions) to the firmware update page. Hopefully this helps...

updater

@benlye
Copy link
Collaborator

benlye commented Mar 13, 2018

I've released v1.0.0 which will warn if 'bootloader' is in the hex file name.

@benlye benlye closed this as completed Mar 13, 2018
@github-actions
Copy link

This issue has been automatically locked because there was no further activity after it was closed. Please open a new issue for any related problems.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants