upload using programmer & optiboot #305
Replies: 1 comment 2 replies
-
Well, if you did upload using programmer, you could no longer use the bootloader because a UPDI programmer, which is the only other kind of programmer I know of and which the core ships with support for, is likely to execute a chip erase, wiping out the bootloader, then upload the sketch starting from the start of the application section. And that's if the fuses were set correctly from previous bootloading; If they weren't, it'll work even worse and even more confusingly. If the BOOTEND fuse set on the chip and what the compiler thinks it's set for don't match, the hardware will think the vector table starts at a different location than the compiler does. Code that's intentionally do that can set the IVSEL bit before enabling interrupts, but if you compiled thinking you had a bootloader section, but didn't, every interrrupt would cause you to jump to the empty first page, skid along to 0xFF's until you hit reset and triggered the dirty reset protection (see Ref_Reset). And if you didn;t set IVSEL because you didn't think you were set to use a bootloaded but you are, you'll jump to the same byte as the interrupt vector but on page 1, effectively resulting in deterministically random behavior. It drove me insane when I ran into it, because I could recognize parts of the sketch behavior there, but they were all out of order. So on modern AVRs, because the bootloader is now at the beginning of the flash, "Upload using programmer" with an optiboot definition very likely means "Upload sketch that behaves completely wrong". Am I missing something? If it uses Optiboot, then why do you need to export and use external tool? |
Beta Was this translation helpful? Give feedback.
-
Why is upload using programmer disabled when optiboot is configured?
I have an application that uses optiboot for OTA firmware updates. But its a PITA in the development cycle to export the firmware and run it through the external loader. I don't have or want a serial-driven auto reset circuit and those pins are connected to another mcu anyway. It would be far more convenient if upload using programmer concatenated the bootloader with the hex and wrote both (or just erased/wrote the app section).
Beta Was this translation helpful? Give feedback.
All reactions