diff options
| author | Bernard Xiong <[email protected]> | 2018-04-07 09:21:58 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-04-07 09:21:58 +0800 |
| commit | a8a2e55444b8a45b754f482e5c12a9e4aeafcbeb (patch) | |
| tree | 43e89517c43221921f3714ae5fe75c6eb7931f15 /tools | |
| parent | 1d878887c03ade06284c9a193d815af089513978 (diff) | |
| parent | 570627b72f75cb39fbb602143f8edc9146e0507c (diff) | |
Merge pull request #1342 from TanekLiang/iar8201
Auto remove macro _DLIB_THREAD_SUPPORT when IAR version higher than 8.20.1
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/iar.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/iar.py b/tools/iar.py index b5a012e4c5..09271ba4eb 100644 --- a/tools/iar.py +++ b/tools/iar.py @@ -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 |
