This is bad when your setting fuses to turn the reset pin to an IO pin. The '-e' option (erase) is included from two places:
1) The FUSESCMD uses UPLOADERFLAGS and from the board definition the upload.extra_flags are appended and for attint85 for example this includes -e. This happens in BeforeUpload.
2) The setup for the fuses target also adds the -e option here.
There is a work around using an extra script:
Import('env')
# the uplaod flags for attiny85 adds -e that erases the flash and when we don't
# want that to happen when we are setting the fuses, espically when we change
# the reset pin to an IO pin. The '-e' is actually added twice, once via extra
# upload flags in the board definition and once in the setup for the fuses target
def fuses_command(source, target, env):
env['UPLOADERFLAGS'].remove('-e')
cmd = " ".join(
["avrdude", "$UPLOADERFLAGS"] +
["-U%s:w:%s:m" % (k, v)
for k, v in env.BoardConfig().get("fuses", {}).items()]
)
return env.Execute(cmd)
env.Replace(FUSESCMD=fuses_command)
This is my platformio.ini:
[platformio]
default_envs = default
[env]
board = attiny85
platform = atmelavr@1.15.0
framework = arduino
build_flags = -D__AVR_ATtiny85__
board_build.f_cpu = 1000000L ; we run at 1Mhz
extra_scripts=fuses.py ; fix fuses target not to erase flash!
[env:default]
; fuses for 1Mhz/bod=1.8/EESAVE/RSTDISABLE
board_fuses.hfuse = 0x56
board_fuses.lfuse = 0x62
[env:testing]
; fuses for 1Mhz/bod=1.8/EESAVE
board_fuses.hfuse = 0xd6
board_fuses.lfuse = 0x62
This is bad when your setting fuses to turn the reset pin to an IO pin. The '-e' option (erase) is included from two places: 1) The FUSESCMD uses UPLOADERFLAGS and from the board definition the upload.extra_flags are appended and for attint85 for example this includes -e. This happens in BeforeUpload. 2) The setup for the fuses target also adds the -e option here.
There is a work around using an extra script:
This is my platformio.ini: