Skip to content

Commit

Permalink
add an option (-n) to specify the path of the DA file to be used.
Browse files Browse the repository at this point in the history
  • Loading branch information
shihhsuan committed Feb 7, 2017
1 parent 95f167a commit 385c5f7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Official GitHub repository: https://github.com/MediaTek-Labs/mt76x7-uploader
```
-c COM_PORT COM port, can be COM1, COM2, ..., COMx
-f BIN_FILE path of the bin file to be uploaded
-n DA_FILE path of the DA file to be used. The default file is da97.bin for mt7697 and da87.bin for mt7687
-p PLATFORM_NAME platform to be flashed (mt7687 | mt7697). The default platform is mt7697
-t FLASH_TARGET target to be flashed (cm4 | ldr | n9)
```
Expand Down
Binary file added upload.exe
Binary file not shown.
21 changes: 14 additions & 7 deletions upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
parser.add_option("-c", dest="com_port", help="COM port, can be COM1, COM2, ..., COMx")
parser.add_option("-d", action="store_true", dest="debug")
parser.add_option("-f", dest="bin_path", help="path of the bin file to be uploaded")
parser.add_option("-n", dest="da_file", help="path of the DA file to be used")
parser.add_option("-p", dest="platform", help="patform to be flashed (mt7687 | mt7697)", default='mt7697')
parser.add_option("-t", dest="target", help="target to be flashed (cm4 | ldr | n9).", default='cm4')
(opt, args) = parser.parse_args()
Expand All @@ -31,14 +32,26 @@

debug = opt.debug

da_path = opt.da_file

if not opt.da_file:
if opt.platform == 'mt7697':
da_path = './da97.bin'
elif opt.platform == 'mt7687':
da_path = './da87.bin'
pass

if not opt.bin_path or not opt.com_port:
print >> sys.stderr, "\nError: Invalid parameter!! Please specify the COM port and the bin file.\n"
parser.print_help()
sys.exit(-1)

if not os.path.exists(opt.bin_path):
print >> sys.stderr, "\nError: Bin file [ %s ] not found !!!\n" % (opt.bin_path)
parser.print_help()
sys.exit(-1)

if not os.path.exists(da_path):
print >> sys.stderr, "\nError: DA file [ %s ] not found !!!\n" % (da_path)
sys.exit(-1)

s = serial.Serial()
Expand Down Expand Up @@ -112,12 +125,6 @@ def resetIntoBootloader():
exit()
pass

da_path = da97_path

if opt.platform == 'mt7687':
da_path = da87_path
pass

statinfo = os.stat(da_path)
bar = pyprind.ProgBar(statinfo.st_size/1024+2)

Expand Down

0 comments on commit 385c5f7

Please sign in to comment.