提交 2545c385 编写于 作者: L liang yongxiang

[Tools] add IAR get version support

上级 1d878887
......@@ -156,3 +156,38 @@ def IARProject(target, script):
out.close()
IARWorkspace(target)
def IARVersion():
import subprocess
import re
def IARPath():
import rtconfig
# set environ
old_environ = os.environ
os.environ['RTT_CC'] = 'iar'
reload(rtconfig)
# get iar path
path = rtconfig.EXEC_PATH
# restore environ
os.environ = old_environ
reload(rtconfig)
return path
path = IARPath();
if os.path.exists(path):
cmd = os.path.join(path, 'iccarm.exe')
else:
print('Get IAR version error. Please update IAR installation path in rtconfig.h!')
return "0.0"
child = subprocess.Popen([cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
stdout, stderr = child.communicate()
# example stdout: IAR ANSI C/C++ Compiler V8.20.1.14183/W32 for ARM
return re.search('[\d\.]+', stdout).group(0)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册