解决参数不足运行会报错的问题
This commit is contained in:
11
kunlun.py
11
kunlun.py
@@ -295,11 +295,15 @@ def global_def():
|
|||||||
global time_stamp_end
|
global time_stamp_end
|
||||||
global function_type
|
global function_type
|
||||||
global upload_key
|
global upload_key
|
||||||
|
|
||||||
|
arg_num=len(sys.argv)
|
||||||
|
if(arg_num<=1):
|
||||||
|
return
|
||||||
|
|
||||||
init_str="WQKL"
|
init_str="WQKL"
|
||||||
serial_com=sys.argv[1]
|
serial_com=sys.argv[1]
|
||||||
b_rate=115200
|
b_rate=115200
|
||||||
nb_rate=1500000
|
nb_rate=1500000
|
||||||
arg_num=len(sys.argv)
|
|
||||||
def set_upload():
|
def set_upload():
|
||||||
global function_type
|
global function_type
|
||||||
if(sys.argv[3].endswith('.bin')):
|
if(sys.argv[3].endswith('.bin')):
|
||||||
@@ -328,17 +332,16 @@ def global_def():
|
|||||||
if(function_type=='upload'):
|
if(function_type=='upload'):
|
||||||
ram_file=f'bootram_{sys.argv[2]}.bin'
|
ram_file=f'bootram_{sys.argv[2]}.bin'
|
||||||
iot_flash_file=sys.argv[3]
|
iot_flash_file=sys.argv[3]
|
||||||
|
ram_file=os.path.join(bin_path(),ram_file)
|
||||||
elif(function_type=='download'):
|
elif(function_type=='download'):
|
||||||
ram_file=f'{sys.argv[2]}_ram_build.bin'
|
ram_file=f'{sys.argv[2]}_ram_build.bin'
|
||||||
iot_flash_file=sys.argv[3]
|
iot_flash_file=sys.argv[3]
|
||||||
|
ram_file=os.path.join(bin_path(),ram_file)
|
||||||
elif(function_type=='ram'):
|
elif(function_type=='ram'):
|
||||||
ram_file=sys.argv[2]
|
ram_file=sys.argv[2]
|
||||||
iot_flash_file=sys.argv[2]
|
iot_flash_file=sys.argv[2]
|
||||||
return
|
|
||||||
elif(function_type=='convert'):
|
elif(function_type=='convert'):
|
||||||
iot_flash_file=sys.argv[1]
|
iot_flash_file=sys.argv[1]
|
||||||
return
|
|
||||||
ram_file=os.path.join(bin_path(),ram_file)
|
|
||||||
|
|
||||||
|
|
||||||
def print_help():
|
def print_help():
|
||||||
|
Reference in New Issue
Block a user