summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorarmink <[email protected]>2018-06-22 10:03:03 +0800
committerarmink <[email protected]>2018-06-22 13:46:12 +0800
commit9539892a1c4922f18ed3d7538d187d1d8e8b6081 (patch)
tree87cb5b42dd9ada19279bbcd5b0a9ff404b2e65e6 /tools
parentff9162a9945267c9d2fa1166d889c694f51efa2c (diff)
[tools] Fix IAR get version failed on RT-Thread Env tools.
Diffstat (limited to 'tools')
-rw-r--r--tools/iar.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/iar.py b/tools/iar.py
index 09271ba4eb..66864d1adf 100644
--- a/tools/iar.py
+++ b/tools/iar.py
@@ -164,7 +164,7 @@ def IARVersion():
def IARPath():
import rtconfig
- # set environ
+ # backup environ
old_environ = os.environ
os.environ['RTT_CC'] = 'iar'
reload(rtconfig)
@@ -178,16 +178,25 @@ def IARVersion():
return path
+ # get the IAR path in 'RTT_EXEC_PATH'
path = IARPath();
+ # retry to get IAR path on 'rtconfig.py'
+ if not os.path.exists(path):
+ rtt_exec_path = os.environ['RTT_EXEC_PATH']
+ if rtt_exec_path:
+ del os.environ['RTT_EXEC_PATH']
+ path = IARPath();
+ os.environ['RTT_EXEC_PATH'] = rtt_exec_path
+
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!')
+ print('Get IAR version error. Please update IAR installation path in rtconfig.py!')
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
+ return re.search('[\d\.]+', stdout).group(0)