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

Class ArmccToolchain

tools/ng/toolchain.py:167–255  ·  view source on GitHub ↗

ARM Compiler (Keil) toolchain implementation.

Source from the content-addressed store, hash-verified

165
166
167class ArmccToolchain(Toolchain):
168 """ARM Compiler (Keil) toolchain implementation."""
169
170 def get_name(self) -> str:
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."""
210 env['CC'] = 'armcc'
211 env['CXX'] = 'armcc'
212 env['AS'] = 'armasm'
213 env['AR'] = 'armar'
214 env['LINK'] = 'armlink'
215
216 # ARM Compiler specific settings
217 env['ARCOM'] = '$AR --create $TARGET $SOURCES'
218 env['LIBPREFIX'] = ''
219 env['LIBSUFFIX'] = '.lib'
220 env['LIBLINKPREFIX'] = ''
221 env['LIBLINKSUFFIX'] = '.lib'
222 env['LIBDIRPREFIX'] = '--userlibpath '
223
224 # Path

Callers 1

select_toolchainMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected