Hi,
I’m trying to and an Keil Arm toolchain. At the beginning I tried just change executable and a toolchain path:
arm(Gcc) {
path "somePath"
eachPlatform {
cCompiler.executable = 'armcc’
cppCompiler.executable = 'armcc’
staticLibArchiver.executable = 'armar’
linker.executable = 'armlink’
assembler.executable = ‘armasm’
}
}
Unfortunately it doesn’t work, since armcc.exe doesn’t support version read in the same way as gcc, so I have following error:
Tool chain 'arm' (GNU GCC): Could not determine GCC version: failed to execute armcc.exe -m32 -dM -E -.
So I decided to go with a solution proposed by daz in the following topic: How to pass arguments to gcc instead of ld during the linking step?
apply plugin: 'c'
model {
toolChains {
crossCompiler(Gcc) {
addPlatformConfiguration(new ArmArchitecture())
}
}
targetPlatforms {
arm {
architecture “arm”
}
}
components {
main(NativeExecutableSpec) {
targetPlatform “arm”
}
}
}
import org.gradle.nativeplatform.toolchain.internal.gcc.TargetPlatformConfiguration;
class ArmArchitecture implements TargetPlatformConfiguration {
boolean supportsPlatform(Platform element) {
return targetPlatform.getArchitecture().name == “arm”
}
}
Unfortunately it also fails due to following issue:
Can’t have an abstract method in a non-abstract class. The class ‘ArmArchitecture’ must be declared abstrct or the method ‘boolean supportsPlatform(org.gradle.nativeplatform.platform.internal.NativePlatformInternal)’ must be implemented.
@ line 44, column 1.
class ArmArchitecture implements TargetPlatformConfiguration {
^
So I changed code slightly to have ‘supportsPlatform’ and ‘apply’ implementation:
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.internal.gcc.TargetPlatformConfiguration;
import org.gradle.nativeplatform.toolchain.internal.gcc.DefaultGccPlatformToolChain;
class ArmArchitecture implements TargetPlatformConfiguration {
public boolean supportsPlatform(NativePlatformInternal targetPlatform) {
return targetPlatform.getArchitecture().name == "arm"
}
public void apply(DefaultGccPlatformToolChain gccToolChain) {
}
}
... but then gradle fails:
> Exception thrown while executing model rule: NativeComponentRules#createBinaries
> Invalid NativePlatform: arm
Can somebody help me? What am I do wrongly?