Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

patch to allow for avrdude to erase by not appending -D #207

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions ino/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def setup_arg_parser(self, parser):
parser.add_argument('-p', '--serial-port', metavar='PORT',
help='Serial port to upload firmware to\nTry to guess if not specified')

parser.add_argument('-e', '--auto-erase', metavar='<0|1>', default='0',
help='Enable auto-erase of firmware\npass 1 for yes, 0 (default) for no')

self.e.add_board_model_arg(parser)
self.e.add_arduino_dist_arg(parser)

Expand Down Expand Up @@ -126,13 +129,17 @@ def run(self, args):
port = new_port

# call avrdude to upload .hex
subprocess.call([
avrargs = [
self.e['avrdude'],
'-C', self.e['avrdude.conf'],
'-p', board['build']['mcu'],
'-P', port,
'-c', protocol,
'-b', board['upload']['speed'],
'-D',
'-U', 'flash:w:%s:i' % self.e['hex_path'],
])
'-U', 'flash:w:%s:i' % self.e['hex_path']
]

if (args.auto_erase == '0'):
avrargs.append('-D')

subprocess.call(avrargs)