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

Method select_toolchain

tools/ng/toolchain.py:369–388  ·  view source on GitHub ↗

Select a toolchain by name.

(self, name: str)

Source from the content-addressed store, hash-verified

367 self.toolchains[name] = toolchain
368
369 def select_toolchain(self, name: str) -> Toolchain:
370 """Select a toolchain by name."""
371 if name not in self.toolchains:
372 # Try to create it
373 if name == 'gcc':
374 tc = GccToolchain()
375 elif name == 'armcc' or name == 'keil':
376 tc = ArmccToolchain()
377 elif name == 'iar':
378 tc = IarToolchain()
379 else:
380 raise ValueError(f"Unknown toolchain: {name}")
381
382 if tc.detect():
383 self.register_toolchain(name, tc)
384 else:
385 raise RuntimeError(f"Toolchain '{name}' not found")
386
387 self.current_toolchain = self.toolchains[name]
388 return self.current_toolchain
389
390 def get_current(self) -> Optional[Toolchain]:
391 """Get current toolchain."""

Callers

nothing calls this directly

Calls 5

detectMethod · 0.95
register_toolchainMethod · 0.95
GccToolchainClass · 0.85
ArmccToolchainClass · 0.85
IarToolchainClass · 0.85

Tested by

no test coverage detected