From d3a782f08d414c1fd6e45558a1752ac8acdb9b02 Mon Sep 17 00:00:00 2001 From: flyingcys <294102238@qq.com> Date: Fri, 15 Jun 2018 15:07:52 +0800 Subject: [PATCH 1/2] update gen_bin.py --- bsp/amebaz/gen_bin.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/bsp/amebaz/gen_bin.py b/bsp/amebaz/gen_bin.py index 4537534f5..1a5785393 100644 --- a/bsp/amebaz/gen_bin.py +++ b/bsp/amebaz/gen_bin.py @@ -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') @@ -40,9 +60,9 @@ if(sysstr == "Linux"): 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' - #print(exec_pick) + exec_pick=tool_pwd+r'\pick.exe' + exec_checksum = tool_pwd + r'\checksum.exe' + print(exec_pick) else: print("not support!!!") From a462238d85548de206999f21291849506962423c Mon Sep 17 00:00:00 2001 From: flyingcys <294102238@qq.com> Date: Fri, 15 Jun 2018 15:31:58 +0800 Subject: [PATCH 2/2] update gen_bin.py --- bsp/amebaz/gen_bin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bsp/amebaz/gen_bin.py b/bsp/amebaz/gen_bin.py index 1a5785393..36f83184e 100644 --- a/bsp/amebaz/gen_bin.py +++ b/bsp/amebaz/gen_bin.py @@ -54,15 +54,15 @@ 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' - print(exec_pick) + 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!!!")