mirror of https://github.com/RT-Thread/rt-thread
Merge pull request #1342 from TanekLiang/iar8201
Auto remove macro _DLIB_THREAD_SUPPORT when IAR version higher than 8.20.1
This commit is contained in:
commit
a8a2e55444
|
@ -1,4 +1,7 @@
|
||||||
from building import *
|
from building import *
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
from iar import IARVersion
|
||||||
|
|
||||||
Import('rtconfig')
|
Import('rtconfig')
|
||||||
|
|
||||||
src = Glob('*.c')
|
src = Glob('*.c')
|
||||||
|
@ -11,7 +14,10 @@ CPPDEFINES = ['RT_USING_DLIBC']
|
||||||
if rtconfig.PLATFORM == 'iar':
|
if rtconfig.PLATFORM == 'iar':
|
||||||
|
|
||||||
if GetDepend('RT_USING_DFS'):
|
if GetDepend('RT_USING_DFS'):
|
||||||
CPPDEFINES = CPPDEFINES + ['_DLIB_FILE_DESCRIPTOR', '_DLIB_THREAD_SUPPORT']
|
CPPDEFINES = CPPDEFINES + ['_DLIB_FILE_DESCRIPTOR']
|
||||||
|
|
||||||
|
if LooseVersion(IARVersion()) < LooseVersion("8.20.1"):
|
||||||
|
CPPDEFINES = CPPDEFINES + ['_DLIB_THREAD_SUPPORT']
|
||||||
|
|
||||||
group = DefineGroup('dlib', src, depend = ['RT_USING_LIBC'],
|
group = DefineGroup('dlib', src, depend = ['RT_USING_LIBC'],
|
||||||
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
|
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
|
||||||
|
|
35
tools/iar.py
35
tools/iar.py
|
@ -156,3 +156,38 @@ def IARProject(target, script):
|
||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
IARWorkspace(target)
|
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)
|
Loading…
Reference in New Issue