Merge pull request #1546 from flyingcys/dev_wifi

update gen_bin.py
This commit is contained in:
Bernard Xiong 2018-06-15 17:22:24 +08:00 committed by GitHub
commit 7bceef9ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 5 deletions

View File

@ -3,7 +3,27 @@ import subprocess
import os
import platform
tool_pwd=os.path.normpath(os.getcwd()+r'/packages/realtek_ameba/sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0/component/soc/realtek/8711b/misc/iar_utility/common/tools')
#tool_pwd=os.path.normpath(os.getcwd()+r'/packages/realtek_ameba/sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0/component/soc/realtek/8711b/misc/iar_utility/common/tools')
pwd=[]
def findfile(path,filename):
for x in os.listdir(path):
if x=='8195a':
continue
x=os.path.join(path,x)
if os.path.isdir(x):
findfile(x,filename)
else:
if filename in os.path.split(x)[1]:
pwd.append(os.path.split(x)[0])
break
return
findfile(os.path.abspath('.'),'pick.exe')
if pwd:
print(pwd[0])
tool_pwd=str(pwd[0])
def grep_func(file,str):
fd=open(file,'r')
@ -34,14 +54,14 @@ addr6=grep_func(r'application.nmap','__xip_image2_start__')
sysstr = platform.system()
print(sysstr)
if(sysstr == "Linux"):
exec_pick = tool_pwd + r'/pick'
exec_checksum = tool_pwd + r'/checksum'
exec_pick=os.path.join(tool_pwd,'pick')
exec_checksum=os.path.join(tool_pwd,'checksum')
os.system('chmod +x ' + exec_pick)
os.system('chmod +x ' + exec_checksum)
#print(exec_pick)
elif(sysstr == "Windows"):
exec_pick=tool_pwd+r'/pick.exe'
exec_checksum = tool_pwd + r'/checksum.exe'
exec_pick=os.path.join(tool_pwd,'pick.exe')
exec_checksum=os.path.join(tool_pwd,'checksum.exe')
#print(exec_pick)
else:
print("not support!!!")