MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / detect

Method detect

tools/ng/toolchain.py:173–206  ·  view source on GitHub ↗

Detect ARM Compiler toolchain.

(self)

Source from the content-addressed store, hash-verified

171 return "armcc"
172
173 def detect(self) -> bool:
174 """Detect ARM Compiler toolchain."""
175 armcc_path = shutil.which("armcc")
176 if not armcc_path:
177 # Try common Keil installation paths
178 keil_paths = [
179 r"C:\Keil_v5\ARM\ARMCC\bin",
180 r"C:\Keil\ARM\ARMCC\bin",
181 "/opt/arm/bin"
182 ]
183 for path in keil_paths:
184 test_path = os.path.join(path, "armcc")
185 if os.path.exists(test_path):
186 armcc_path = test_path
187 break
188
189 if not armcc_path:
190 return False
191
192 # Get version
193 ret, stdout, _ = self._run_command([armcc_path, "--version"])
194 if ret == 0:
195 lines = stdout.split('\n')
196 for line in lines:
197 if "ARM Compiler" in line:
198 version = line.split()[-1]
199 self.info = ToolchainInfo(
200 name="armcc",
201 version=version,
202 path=os.path.dirname(armcc_path)
203 )
204 return True
205
206 return False
207
208 def configure_environment(self, env) -> None:
209 """Configure environment for ARM Compiler."""

Callers

nothing calls this directly

Calls 3

ToolchainInfoClass · 0.85
_run_commandMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected