Arduino upload instruction ignores changes to platform.txt

Hi all, I'm using a USBasp and Technoblogy's ATtiny10core to program my ATtiny10 ICs. Everything works fine if the IC is new, but it's a hassle to reprogram chips. The actual upload command looks like this:

C:\Users\Sam\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Sam\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -pattiny10 -cusbasp -PCOM13 -b115200 -D -Uflash:w:C:\Users\Sam\AppData\Local\Temp\arduino_build_692255/attiny10_test.ino.hex:i

The problem is that -D flag near the end; it stops avrdude from erasing the chip before uploading. I want to remove the -D flag from the avrdude command, but I am unable.

I had assumed I could simply go into the ATtiny10core platform.txt file and edit the lines with tools.avrdude.upload.pattern and tools.avrdude.program.pattern. However, no matter what I do to these lines, the actual upload command looks identical to the one I pasted above. Why do my edits to platform.txt do nothing? What should I change instead to remove the -D flag? Any help is much appreciated.

There are a few confusing things about the Arduino boards platform system to understand here.


The first thing to understand:
https://arduino.github.io/arduino-cli/dev/platform-specification/#upload-using-programmer-by-default

If the upload.protocol property is not defined for a board, the Arduino IDE’s “Upload” process will use the same behavior as “Upload Using Programmer”. This is convenient for boards which only support uploading via programmer.

If you look in boards.txt, you can see there is no “attiny10.upload.protocol” property definition, so actually the “tools.avrdude.upload.pattern” in that platform.txt is pointless. They probably just did a copy/paste from another boards platform and didn’t bother to delete it.


The next thing:
https://arduino.github.io/arduino-cli/dev/platform-specification/#upload-using-an-external-programmer

When using the Arduino IDE, if the selected programmer is from a different platform than the board, the program recipe defined in the programmer’s platform is used

The attiny10core boards platform doesn’t define any programmers, so the “tools.avrdude.program.pattern” being used is from the arduino:avr (Arduino AVR Boards platform). So the “tools.avrdude.program.pattern” defined in the attiny10core platform.txt is also a pointless artifact of copy/paste platform development.


The last thing is that you may need to restart the Arduino IDE before changes to the configuration files like platform.txt will take effect.


After all that, I’m still quite confused about how you managed to get this strange upload command. I guess you’ve been messing about with boards.txt?

Thank you for the help!

I guess you've been messing about with boards.txt?

Ach, you're right! At some point I had added the line attiny10.upload.protocol=usbasp and forgotten.

I've gone back to a "clean" install of attiny10core, and added a programmers.txt file with the following contents:

usbasp.name=USBasp
usbasp.communication=usb
usbasp.protocol=usbasp
usbasp.program.protocol=usbasp
usbasp.program.tool=avrdude
usbasp.program.extra_params=-Pusb

This appears to have fixed all my issues. Thank you!

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per