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

Add bootloader hashes from the Sanguino Arduino core repo #1533

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

MCUdude
Copy link
Collaborator

@MCUdude MCUdude commented Oct 22, 2023

Adds the bootloader hashes from the Sanguino Arduino core to urclock.c
https://github.com/Lauszus/Sanguino

Closes #1532

@MCUdude
Copy link
Collaborator Author

MCUdude commented Oct 22, 2023

I forgot to mention; that I tested this on a board that runs that ancient Sanguino bootloader, and with this PR there's no need to specify the bootsize.

@mcuee
Copy link
Collaborator

mcuee commented Oct 22, 2023

This should be safe to merge.

@stefanrueger
Copy link
Collaborator

Just occurred to me it would be good to provide the provenance of the bootloaders like so

diff --git a/src/urclock.c b/src/urclock.c
index 9fa92367..a4f20c03 100644
--- a/src/urclock.c
+++ b/src/urclock.c
@@ -1101,6 +1101,7 @@ static void guessblstart(const PROGRAMMER *pgm, const AVRPART *p) {
     return;
 
   Blhash_t blist[] = {
+    // From https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders
     { 1024, 0, 0x35445c45, 0x9ef77953 }, // ATmegaBOOT-prod-firmware-2009-11-07.hex
     { 1024, 0, 0x32b1376c, 0xceba80bb }, // ATmegaBOOT.hex
     { 2048, 0, 0x08426ba2, 0x29e81e21 }, // ATmegaBOOT_168.hex
@@ -1120,6 +1121,8 @@ static void guessblstart(const PROGRAMMER *pgm, const AVRPART *p) {
     {  512, 0, 0xd2001ddb, 0x16c9663b }, // optiboot_atmega328.hex v4.4
     {  512, 0, 0x49c1e9a4, 0xa450759b }, // optiboot_atmega328.hex v8.3
     {  512, 0, 0xc54dcd6c, 0x5bfc5d06 }, // optiboot_atmega8.hex
+
+    // From https://github.com/nerdralph/picoboot
     {  256, 0, 0x5a01c55b, 0x5a01c55b }, // picobootArduino168.hex
     {  256, 0, 0x1451061b, 0x1451061b }, // picobootArduino168v3b2.hex
     {  512, 0, 0x3242ddd3, 0x53348738 }, // picobootArduino328.hex
@@ -1128,7 +1131,11 @@ static void guessblstart(const PROGRAMMER *pgm, const AVRPART *p) {
     {  256, 0, 0xaa62bafc, 0xaa62bafc }, // picobootArduino8v3rc1.hex
     {  256, 0, 0x56263965, 0x56263965 }, // picobootSTK500-168p.hex
     {  512, 0, 0x3242ddd3, 0x5ba5f5f6 }, // picobootSTK500-328p.hex
+
+    // From https://github.com/LGTMCU/Larduino_HSP/tree/master/hardware/LGT/avr/bootloaders/lgt8fx8p
     { 3072, 0, 0x3242ddd3, 0xd3347c5d }, // optiboot_lgt8f328p.hex
+
+    // From https://github.com/Lauszus/Sanguino
     { 1024, 0, 0xe244a3c6, 0xc7ceaadf }, // optiboot_atmega644.hex
     { 1024, 0, 0xe244a3c6, 0x063b24dd }, // optiboot_atmega1284p.hex
     { 1024, 0, 0xe244a3c6, 0x6e5d8d92 }, // optiboot_balanduino644.hex
@@ -1137,6 +1144,7 @@ static void guessblstart(const PROGRAMMER *pgm, const AVRPART *p) {
     { 1024, 0, 0xe244a3c6, 0x365954f4 }, // optiboot_atmega644p_8m.hex
     { 1024, 0, 0xe244a3c6, 0x6f120e6a }, // optiboot_atmega644_8m.hex
     { 1024, 0, 0xe244a3c6, 0x79b266ae }, // optiboot_balanduino.hex
+
 #include "urclock_hash.h"                // Selected from https://github.com/MCUdude/optiboot_flash
   };

I can push that onto your PR @MCUdude if you wish

@MCUdude
Copy link
Collaborator Author

MCUdude commented Oct 23, 2023

I can push that onto your PR @MCUdude if you wish

Yes, please! We should perhaps also consider adding the optiboot bootloaders used by ATTinyCore, if that's what this is all about. However, let's wait to hear what Spence has to say first.

@stefanrueger
Copy link
Collaborator

if that's what SpenceKonde/ATTinyCore#750 (comment) is all about

I don't think it is as the comment refers to avrdude incompatibility with the Dx core.

These have bootloaders at the bottom of flash and AVRDUDE (currently) has no mechanism to guess their bootloader sizes

avrdude/src/urclock.c

Lines 1476 to 1477 in 481a91d

} else if(!ur.boothigh) { // Fixme: guess bootloader size from low flash
}

Best would be to read the bootend/bootsize fuse from the mapped memory using a unified flash read bootloader request.

@MCUdude
Copy link
Collaborator Author

MCUdude commented Oct 23, 2023

I don't think it is as the comment refers to avrdude incompatibility with the Dx core.

Well, it sounded like there was a major issue with the -c arduino implementation, but as you pointed out, -c arduino has seen few changes recently, and MegaCoreX has been using Avrdude v7.1 for the last six months, without any bootloader related issues being reported.

@stefanrueger
Copy link
Collaborator

stefanrueger commented Oct 23, 2023

No point in second-guessing but what we could do is checking git main's -c arduino and -c urclock -xbootsize=... with urclock, optiboot and optibootx bootloaders before releasing v7.3.

@stefanrueger stefanrueger merged commit 9b97480 into avrdudes:main Oct 23, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Sanguino" Optiboot hashes to urclock.c
3 participants