summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorguozhanxin <[email protected]>2023-10-19 14:19:13 +0800
committerMeco Man <[email protected]>2023-10-19 12:14:01 -0400
commit21facce4726eed5f264bf459307cce9e5d497376 (patch)
tree9e47c01576a8c475df5db56c709317d4a9d51afe /tools
parentd01dd05a0cd2107d85e26a445a43957880fd1978 (diff)
[tools] support LLVMEmbeddedToolchainForArm-17.0.1
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm_arm.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/llvm_arm.py b/tools/llvm_arm.py
index e7910ce141..3d015e9197 100644
--- a/tools/llvm_arm.py
+++ b/tools/llvm_arm.py
@@ -34,11 +34,11 @@ def GetLLVM_ARMRoot(rtconfig):
def CheckHeader(rtconfig, filename):
root = GetLLVM_ARMRoot(rtconfig)
- config = re.findall(r"--config (.*)\.cfg", rtconfig.CFLAGS)
- if config:
- fn = os.path.join(root, config[0], 'include', filename)
- if os.path.isfile(fn):
- return True
+ if os.path.isdir(root):
+ for config in os.listdir(root):
+ fn = os.path.join(root, config, 'include', filename)
+ if os.path.isfile(fn):
+ return True
return False
@@ -46,12 +46,13 @@ def GetPicoLibcVersion(rtconfig):
version = None
root = GetLLVM_ARMRoot(rtconfig)
if CheckHeader(rtconfig, 'picolibc.h'): # get version from picolibc.h file
- config = re.findall(r"--config (.*)\.cfg", rtconfig.CFLAGS)
- fn = os.path.join(root, config[0], 'include', 'picolibc.h')
- f = open(fn, 'r')
- if f:
- for line in f:
- if line.find('__PICOLIBC_VERSION__') != -1 and line.find('"') != -1:
- version = re.search(r'\"([^"]+)\"', line).groups()[0]
- f.close()
+ for config in os.listdir(root):
+ fn = os.path.join(root, config, 'include', 'picolibc.h')
+ f = open(fn, 'r')
+ if f:
+ for line in f:
+ if line.find('__PICOLIBC_VERSION__') != -1 and line.find('"') != -1:
+ version = re.search(r'\"([^"]+)\"', line).groups()[0]
+ f.close()
+ return version
return version