Arduino CLI on Windows runs AVRDUDE in safemode #844
Labels
conclusion: resolved
Issue was resolved
os: windows
Specific to Windows operating system
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Bug Report
Current behavior
I use Bash-style syntax below to provide a procedure that can be run on both Windows (git-bash) and Linux, but I have also tested this using cmd and PowerShell with the same results.
AVRDUDE has an odd behavior where it is in "safemode" by default, but when it is "run from a script" (whatever that means), "safemode" is automatically disabled:
The manual provides different information on the subject, which makes things more clear:
https://www.nongnu.org/avrdude/user-manual/avrdude_4.html
When you do an upload in the Arduino IDE, regardless of OS, apparently AVRDUDE considers this as being "run from a script", so safemode is never used.
With other AVR microcontrollers, it really isn't a big deal whether safemode is on or off, but the safemode fuse check fails when uploading to the ATmega32A because of a workaround done to allow it to work with the same the same
tools.avrdude.erase.pattern
as the other boards, despite it having no extended fuse.It was necessary to add a "fake"
efuse
to avrdude.conf:https://github.com/MCUdude/MightyCore/blob/v2.0.5/avr/avrdude.conf#L1651-L1653
This was also done by Arduino for the ATmega8 (arduino/Arduino#3446), so I'm guessing the same error will occur when uploading to
arduino:avr:atmegang:cpu=atmega8
using Arduino CLI on Windows.In the IDE, that's no problem because safemode is disabled. If you're running the AVRDUDE command directly it's no problem because you can just add the
-u
option. The problem is that, only on Windows, when Arduino CLI runs AVRDUDE, it doesn't happen to meet whatever AVRDUDE considers to be "run from a script", so you get an ugly error message:If you do the same process with the Arduino IDE on any OS or Arduino CLI on Linux, it is successful.
If you run the identical upload command from the command line on Linux or Windows, you get the same failure shown above.
Expected behavior
AVRDUDE should not run in safemode when using Arduino CLI from any OS.
Environment
arduino-cli version
): 0.11.0-rc1-62-g72c9655f Commit: a2f63fbThe text was updated successfully, but these errors were encountered: