embeddedartistry / athena-bootloader

An AVR Arduino bootloader that supports uploads over Ethernet (via TFTP) and Serial.
GNU Lesser General Public License v2.1
12 stars 5 forks source link

Proposal- remove image validation altogether #88

Closed hagaigold closed 2 years ago

hagaigold commented 2 years ago

from README.md:

This sketch fails because it is written in plain C and not in Arduino. That way it lacks some "signatures" the bootloader uses to validate Arduino sketches.

There is no real technical reason why the board can not run a non-Arduino program if it was built with the right AVR toolchain. While it is very convenient to program the board with the Arduino IDE, it can also be programmed without (using AVRDUDE).

more ever, the image validation was removed (a long time ago) for non-UNO boards, so it is already partially not validating :)

    if(writeAddr == 0)
    {
        // First sector - validate
        if(!validImage(pageBase))
        {
#if defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
            /* FIXME: Validity checks. Small programms (under 512 bytes?) don't
                * have the the JMP sections and that is why app.bin was failing.
                * When flashing big binaries is fixed, uncomment the break below.*/
            returnCode = INVALID_IMAGE;
            break;
#endif
        }
    }

Do I miss something here? Why do we "need" this validation after all?

hagaigold commented 2 years ago

Previous discussion: per1234/Ariadne-Bootloader#14 codebndr/Ariadne-Bootloader#22

phillipjohnston commented 2 years ago

No, you don't miss anything at all, not sure I ever even noticed that. I don't think validation is needed, and that can be safely removed.