aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-01-29 16:17:45 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-02-13 10:25:21 +0000
commit9e9fb5997a36c9e0ea4847b56c6d107996b131a8 (patch)
tree812f97c0e4448804df2c556ec6b791283d6269c0 /share/qbs
parent7e407cfa0072ea7adfcd4a5ea74ce353dd5b5d4e (diff)
bare-metal: Add KEIL 8051 toolchain support for Windows
This commit adds a basic support of the KEIL toolchain for the 8051 processors family. The KEIL toolchain support only the Windows environment: * http://www.keil.com/support/docs/1456.htm To use it with Qt Creator, it is enough to add there a desired Kit with a custom KEIL C/C++ compiler, and then set the following in the Kit's Qbs profile settings: * Key: qbs.toolchainType * Value: keil Tested with the KEIL uVision v5.23 on Windows using the Cypress FX2 development kit examples. Change-Id: I2cf59b307762ab95c69bc22eb8989af9b68cd555 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs')
-rw-r--r--share/qbs/imports/qbs/Probes/KeilProbe.qbs65
-rw-r--r--share/qbs/modules/cpp/keil.js396
-rw-r--r--share/qbs/modules/cpp/keil.qbs227
3 files changed, 688 insertions, 0 deletions
diff --git a/share/qbs/imports/qbs/Probes/KeilProbe.qbs b/share/qbs/imports/qbs/Probes/KeilProbe.qbs
new file mode 100644
index 000000000..bc31a4149
--- /dev/null
+++ b/share/qbs/imports/qbs/Probes/KeilProbe.qbs
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: http://www.qt.io/licensing
+**
+** This file is part of Qbs.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms and
+** conditions see http://www.qt.io/terms-conditions. For further information
+** use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+import qbs.File
+import "../../../modules/cpp/keil.js" as KEIL
+
+PathProbe {
+ // Inputs
+ property string compilerFilePath;
+
+ // Outputs
+ property string architecture;
+ property string endianness;
+ property int versionMajor;
+ property int versionMinor;
+ property int versionPatch;
+
+ configure: {
+ if (!File.exists(compilerFilePath)) {
+ found = false;
+ return;
+ }
+
+ var macros = KEIL.dumpMacros(compilerFilePath, qbs);
+
+ architecture = KEIL.guessArchitecture(macros);
+ endianness = KEIL.guessEndianness(macros);
+
+ var version = KEIL.guessVersion(macros);
+ if (version) {
+ versionMajor = version.major;
+ versionMinor = version.minor;
+ versionPatch = version.patch;
+ }
+
+ found = version.found && architecture && endianness;
+ }
+}
diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js
new file mode 100644
index 000000000..3394cfc16
--- /dev/null
+++ b/share/qbs/modules/cpp/keil.js
@@ -0,0 +1,396 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: http://www.qt.io/licensing
+**
+** This file is part of Qbs.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms and
+** conditions see http://www.qt.io/terms-conditions. For further information
+** use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+var Cpp = require("cpp.js");
+var Environment = require("qbs.Environment");
+var File = require("qbs.File");
+var FileInfo = require("qbs.FileInfo");
+var ModUtils = require("qbs.ModUtils");
+var Process = require("qbs.Process");
+var TemporaryDir = require("qbs.TemporaryDir");
+var TextFile = require("qbs.TextFile");
+var Utilities = require("qbs.Utilities");
+var WindowsUtils = require("qbs.WindowsUtils");
+
+function guessArchitecture(macros)
+{
+ if (macros["__C51__"])
+ return "mcs51";
+}
+
+function guessEndianness(macros)
+{
+ // The 8051 processors are 8-bit. So, the data with an integer type
+ // represented by more than one byte is stored as big endian in the
+ // Keil toolchain. See for more info:
+ // * http://www.keil.com/support/man/docs/c51/c51_ap_2bytescalar.htm
+ // * http://www.keil.com/support/man/docs/c51/c51_ap_4bytescalar.htm
+ return "big";
+}
+
+function guessVersion(macros)
+{
+ var version = macros["__C51__"];
+ if (version) {
+ versionMajor = parseInt(version / 100);
+ versionMinor = parseInt(version % 100);
+ versionPatch = 0;
+ return { major: versionMajor,
+ minor: versionMinor,
+ patch: versionPatch,
+ found: true }
+ }
+}
+
+function dumpMacros(compilerFilePath, qbs) {
+
+ // Note: The KEIL compiler (at least for 8051) does not support the predefined
+ // macros dumping. So, we do it with following trick where we try to compile
+ // a temporary file and to parse the console output.
+
+ function createDumpMacrosFile() {
+ var td = new TemporaryDir();
+ var fn = FileInfo.fromNativeSeparators(td.path() + "/dump-macros.c");
+ var tf = new TextFile(fn, TextFile.WriteOnly);
+ tf.writeLine("#define VALUE_TO_STRING(x) #x");
+ tf.writeLine("#define VALUE(x) VALUE_TO_STRING(x)");
+ tf.writeLine("#define VAR_NAME_VALUE(var) \"\"\"|\"#var\"|\"VALUE(var)");
+ tf.writeLine("#ifdef __C51__");
+ tf.writeLine("#pragma message(VAR_NAME_VALUE(__C51__))");
+ tf.writeLine("#endif");
+ tf.close();
+ return fn;
+ }
+
+ var fn = createDumpMacrosFile();
+ var p = new Process();
+ p.exec(compilerFilePath, [ fn ], true);
+ var map = {};
+ p.readStdOut().trim().split(/\r?\n/g).map(function(line) {
+ var parts = line.split("\"|\"", 3);
+ map[parts[1]] = parts[2];
+ });
+ return map;
+}
+
+function adjustPathsToWindowsSeparators(sourcePaths) {
+ var resulingPaths = [];
+ sourcePaths.forEach(function(path) {
+ resulingPaths.push(FileInfo.toWindowsSeparators(path));
+ });
+ return resulingPaths;
+}
+
+function generateDefineDirective(allDefines) {
+ var adjusted = adjustPathsToWindowsSeparators(allDefines);
+ return "DEFINE (" + adjusted.join(",") + ")";
+}
+
+function generateIncludePathsDirective(allIncludePaths) {
+ var adjusted = adjustPathsToWindowsSeparators(allIncludePaths);
+ return "INCDIR (" + adjusted.join(";") + ")";
+}
+
+function generateObjectsLinkerDirective(allObjectPaths) {
+ var adjusted = adjustPathsToWindowsSeparators(allObjectPaths);
+ return adjusted.join(",");
+}
+
+function generateObjectOutputDirective(outputFilePath) {
+ return "OBJECT (" + FileInfo.toWindowsSeparators(outputFilePath) + ")";
+}
+
+function collectLibraryDependencies(product) {
+ var seen = {};
+ var result = [];
+
+ function addFilePath(filePath) {
+ result.push({ filePath: filePath });
+ }
+
+ function addArtifactFilePaths(dep, artifacts) {
+ if (!artifacts)
+ return;
+ var artifactFilePaths = artifacts.map(function(a) { return a.filePath; });
+ artifactFilePaths.forEach(addFilePath);
+ }
+
+ function addExternalStaticLibs(obj) {
+ if (!obj.cpp)
+ return;
+ function ensureArray(a) {
+ return Array.isArray(a) ? a : [];
+ }
+ function sanitizedModuleListProperty(obj, moduleName, propertyName) {
+ return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName));
+ }
+ var externalLibs = [].concat(
+ sanitizedModuleListProperty(obj, "cpp", "staticLibraries"));
+ var staticLibrarySuffix = obj.moduleProperty("cpp", "staticLibrarySuffix");
+ externalLibs.forEach(function(staticLibraryName) {
+ if (!staticLibraryName.endsWith(staticLibrarySuffix))
+ staticLibraryName += staticLibrarySuffix;
+ addFilePath(staticLibraryName);
+ });
+ }
+
+ function traverse(dep) {
+ if (seen.hasOwnProperty(dep.name))
+ return;
+ seen[dep.name] = true;
+
+ if (dep.parameters.cpp && dep.parameters.cpp.link === false)
+ return;
+
+ var staticLibraryArtifacts = dep.artifacts["staticlibrary"];
+ if (staticLibraryArtifacts) {
+ dep.dependencies.forEach(traverse);
+ addArtifactFilePaths(dep, staticLibraryArtifacts);
+ addExternalStaticLibs(dep);
+ }
+ }
+
+ product.dependencies.forEach(traverse);
+ addExternalStaticLibs(product);
+ return result;
+}
+
+function filterStdOutput(cmd) {
+ cmd.stdoutFilterFunction = function(output) {
+ // Allow only the error and warning messages
+ // with its sub-content.
+ var sourceLines = output.split('\n');
+ var filteredLines = [];
+ for (var i in sourceLines) {
+ if (sourceLines[i].startsWith("***")
+ || sourceLines[i].startsWith(">>")
+ || sourceLines[i].startsWith(" ")) {
+ filteredLines.push(sourceLines[i]);
+ }
+ }
+ return filteredLines.join('\n');
+ };
+}
+
+function compilerFlags(project, product, input, output, explicitlyDependsOn) {
+ // Determine which C-language we"re compiling.
+ var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
+
+ var args = [];
+ args.push(FileInfo.toWindowsSeparators(input.filePath));
+ args.push(generateObjectOutputDirective(output.filePath));
+
+ switch (input.cpp.optimization) {
+ case "small":
+ args.push("OPTIMIZE (SIZE)");
+ break;
+ case "fast":
+ args.push("OPTIMIZE (SPEED)");
+ break;
+ case "none":
+ args.push("OPTIMIZE (0)");
+ break;
+ }
+
+ if (input.cpp.debugInformation)
+ args.push("DEBUG");
+
+ var warnings = input.cpp.warningLevel;
+ if (warnings === "none") {
+ args.push("WARNINGLEVEL (0)");
+ } else if (warnings === "all") {
+ args.push("WARNINGLEVEL (2)");
+ args.push("FARWARNING");
+ }
+
+ var allDefines = [];
+ var platformDefines = input.cpp.platformDefines;
+ if (platformDefines)
+ allDefines = allDefines.uniqueConcat(platformDefines);
+ var defines = input.cpp.defines;
+ if (defines)
+ allDefines = allDefines.uniqueConcat(defines);
+ if (allDefines.length > 0)
+ args = args.concat(generateDefineDirective(allDefines));
+
+ var allIncludePaths = [];
+ var includePaths = input.cpp.includePaths;
+ if (includePaths)
+ allIncludePaths = allIncludePaths.uniqueConcat(includePaths);
+ var systemIncludePaths = input.cpp.systemIncludePaths;
+ if (systemIncludePaths)
+ allIncludePaths = allIncludePaths.uniqueConcat(systemIncludePaths);
+ var compilerIncludePaths = input.cpp.compilerIncludePaths;
+ if (compilerIncludePaths)
+ allIncludePaths = allIncludePaths.uniqueConcat(compilerIncludePaths);
+ if (allIncludePaths.length > 0)
+ args = args.concat(generateIncludePathsDirective(allIncludePaths));
+
+ args = args.concat(ModUtils.moduleProperty(input, "platformFlags"),
+ ModUtils.moduleProperty(input, "flags"),
+ ModUtils.moduleProperty(input, "platformFlags", tag),
+ ModUtils.moduleProperty(input, "flags", tag),
+ ModUtils.moduleProperty(input, "driverFlags", tag));
+ return args;
+}
+
+function assemblerFlags(project, product, input, output, explicitlyDependsOn) {
+ // Determine which C-language we"re compiling
+ var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
+
+ var args = [];
+ args.push(FileInfo.toWindowsSeparators(input.filePath));
+ args.push(generateObjectOutputDirective(output.filePath));
+
+ if (input.cpp.debugInformation)
+ args.push("DEBUG");
+
+ var allDefines = [];
+ var platformDefines = input.cpp.platformDefines;
+ if (platformDefines)
+ allDefines = allDefines.uniqueConcat(platformDefines);
+ var defines = input.cpp.defines;
+ if (defines)
+ allDefines = allDefines.uniqueConcat(defines);
+ if (allDefines.length > 0)
+ args = args.concat(generateDefineDirective(allDefines));
+
+ var allIncludePaths = [];
+ var includePaths = input.cpp.includePaths;
+ if (includePaths)
+ allIncludePaths = allIncludePaths.uniqueConcat(includePaths);
+ var systemIncludePaths = input.cpp.systemIncludePaths;
+ if (systemIncludePaths)
+ allIncludePaths = allIncludePaths.uniqueConcat(systemIncludePaths);
+ var compilerIncludePaths = input.cpp.compilerIncludePaths;
+ if (compilerIncludePaths)
+ allIncludePaths = allIncludePaths.uniqueConcat(compilerIncludePaths);
+ if (allIncludePaths.length > 0)
+ args = args.concat(generateIncludePathsDirective(allIncludePaths));
+
+ args = args.concat(ModUtils.moduleProperty(input, "platformFlags", tag),
+ ModUtils.moduleProperty(input, "flags", tag),
+ ModUtils.moduleProperty(input, "driverFlags", tag));
+ return args;
+}
+
+function linkerFlags(project, product, input, outputs) {
+ var args = [];
+ var allObjectPaths = [];
+
+ function addObjectPath(obj) {
+ allObjectPaths.push(obj.filePath);
+ }
+
+ // Add all object files.
+ if (inputs.obj)
+ inputs.obj.map(function(obj) { addObjectPath(obj) });
+
+ // Add all library dependencies.
+ var libraryDependencies = collectLibraryDependencies(product);
+ if (libraryDependencies) {
+ libraryDependencies.forEach(function(staticLibrary) {
+ addObjectPath(staticLibrary);
+ })
+ }
+
+ args = args.concat(generateObjectsLinkerDirective(allObjectPaths));
+
+ // We need to wrap a output file name with quotes. Otherwise
+ // the linker will ignore a specified file name.
+ args.push("TO", '"' + FileInfo.toWindowsSeparators(outputs.application[0].filePath) + '"');
+
+ if (!product.cpp.generateMapFile)
+ args.push("NOMAP");
+
+ args = args.concat(ModUtils.moduleProperty(product, "driverLinkerFlags"));
+ return args;
+}
+
+function archiverFlags(project, product, input, outputs) {
+ var args = [ "TRANSFER" ];
+ var allObjectPaths = [];
+
+ function addObjectPath(obj) {
+ allObjectPaths.push(obj.filePath);
+ }
+
+ if (inputs.obj)
+ inputs.obj.map(function(obj) { addObjectPath(obj) });
+
+ // We need to wrap a output file name with quotes. Otherwise
+ // the linker will ignore a specified file name.
+ args = args.concat(generateObjectsLinkerDirective(allObjectPaths));
+
+ args.push("TO", '"' + FileInfo.toWindowsSeparators(outputs.staticlibrary[0].filePath) + '"');
+ return args;
+}
+
+function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
+ var args = compilerFlags(project, product, input, output, explicitlyDependsOn);
+ var compilerPath = input.cpp.compilerPath;
+ var cmd = new Command(compilerPath, args)
+ cmd.description = "compiling " + input.fileName;
+ cmd.highlight = "compiler";
+ cmd.maxExitCode = 1;
+ filterStdOutput(cmd);
+ return [cmd];
+}
+
+
+function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
+ var args = assemblerFlags(project, product, input, output, explicitlyDependsOn);
+ var assemblerPath = input.cpp.assemblerPath;
+ var cmd = new Command(assemblerPath, args)
+ cmd.description = "assembling " + input.fileName;
+ cmd.highlight = "compiler";
+ filterStdOutput(cmd);
+ return [cmd];
+}
+
+function prepareLinker(project, product, inputs, outputs, input, output) {
+ var primaryOutput = outputs.application[0];
+ var args = linkerFlags(project, product, input, outputs);
+ var linkerPath = product.cpp.linkerPath;
+ var cmd = new Command(linkerPath, args)
+ cmd.description = "linking " + primaryOutput.fileName;
+ cmd.highlight = "linker";
+ filterStdOutput(cmd);
+ return [cmd];
+}
+
+function prepareArchiver(project, product, inputs, outputs, input, output) {
+ var args = archiverFlags(project, product, input, outputs);
+ var archiverPath = product.cpp.archiverPath;
+ var cmd = new Command(archiverPath, args)
+ cmd.description = "linking " + output.fileName;
+ cmd.highlight = "linker";
+ return [cmd];
+}
diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs
new file mode 100644
index 000000000..371d0535d
--- /dev/null
+++ b/share/qbs/modules/cpp/keil.qbs
@@ -0,0 +1,227 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: http://www.qt.io/licensing
+**
+** This file is part of Qbs.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms and
+** conditions see http://www.qt.io/terms-conditions. For further information
+** use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+import qbs 1.0
+import qbs.File
+import qbs.FileInfo
+import qbs.ModUtils
+import qbs.PathTools
+import qbs.Probes
+import qbs.Utilities
+import "keil.js" as KEIL
+
+CppModule {
+ condition: qbs.hostOS.contains("windows") && qbs.toolchain && qbs.toolchain.contains("keil")
+
+ Probes.BinaryProbe {
+ id: compilerPathProbe
+ condition: !toolchainInstallPath && !_skipAllChecks
+ names: ["c51"]
+ }
+
+ Probes.KeilProbe {
+ id: keilProbe
+ condition: !_skipAllChecks
+ compilerFilePath: compilerPath
+ }
+
+ qbs.architecture: keilProbe.found ? keilProbe.architecture : original
+
+ compilerVersionMajor: keilProbe.versionMajor
+ compilerVersionMinor: keilProbe.versionMinor
+ compilerVersionPatch: keilProbe.versionPatch
+ endianness: keilProbe.endianness
+
+ compilerDefinesByLanguage: []
+
+ property string toolchainInstallPath: compilerPathProbe.found
+ ? compilerPathProbe.path : undefined
+
+ property string compilerExtension: qbs.hostOS.contains("windows") ? ".exe" : ""
+
+ property bool generateMapFile: true
+ PropertyOptions {
+ name: "generateMapFile"
+ description: "produce a linker list file (enabled by default)"
+ }
+
+ /* Work-around for QtCreator which expects these properties to exist. */
+ property string cCompilerName: compilerName
+ property string cxxCompilerName: compilerName
+
+ compilerName: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ return "c51" + compilerExtension;
+ }
+ }
+ compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
+
+ assemblerName: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ return "a51" + compilerExtension;
+ }
+ }
+ assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName)
+
+ linkerName: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ return "bl51" + compilerExtension;
+ }
+ }
+ linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
+
+ property string archiverName: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ return "lib51" + compilerExtension;
+ }
+ }
+ property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName)
+
+ runtimeLibrary: "static"
+
+ staticLibrarySuffix: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ return ".lib";
+ }
+ }
+
+ executableSuffix: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ return ".abs";
+ }
+ }
+
+ property string objectSuffix: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ return ".obj";
+ }
+ }
+
+ imageFormat: {
+ switch (qbs.architecture) {
+ case "mcs51":
+ // Keil OMF51 or OMF2 Object Module Format (which is an
+ // extension of the original Intel OMF51).
+ return "omf";
+ }
+ }
+
+ enableExceptions: false
+ enableRtti: false
+
+ Rule {
+ id: assembler
+ inputs: ["asm"]
+
+ Artifact {
+ fileTags: ["obj"]
+ filePath: Utilities.getHash(input.baseDir) + "/"
+ + input.fileName + input.cpp.objectSuffix
+ }
+
+ prepare: KEIL.prepareAssembler.apply(KEIL, arguments);
+ }
+
+ FileTagger {
+ condition: qbs.architecture === "mcs51";
+ patterns: ["*.a51", "*.A51"]
+ fileTags: ["asm"]
+ }
+
+ Rule {
+ id: compiler
+ inputs: ["cpp", "c"]
+ auxiliaryInputs: ["hpp"]
+
+ Artifact {
+ fileTags: ["obj"]
+ filePath: Utilities.getHash(input.baseDir) + "/"
+ + input.fileName + input.cpp.objectSuffix
+ }
+
+ prepare: KEIL.prepareCompiler.apply(KEIL, arguments);
+ }
+
+ Rule {
+ id: applicationLinker
+ multiplex: true
+ inputs: ["obj", "linkerscript"]
+
+ outputFileTags: {
+ var tags = ["application"];
+ if (product.moduleProperty("cpp", "generateMapFile"))
+ tags.push("map_file");
+ return tags;
+ }
+ outputArtifacts: {
+ var app = {
+ fileTags: ["application"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ PathTools.applicationFilePath(product))
+ };
+ var artifacts = [app];
+ if (product.cpp.generateMapFile) {
+ artifacts.push({
+ fileTags: ["map_file"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ product.targetName + ".map")
+ });
+ }
+ return artifacts;
+ }
+
+ prepare:KEIL.prepareLinker.apply(KEIL, arguments);
+ }
+
+ Rule {
+ id: staticLibraryLinker
+ multiplex: true
+ inputs: ["obj"]
+ inputsFromDependencies: ["staticlibrary"]
+
+ Artifact {
+ fileTags: ["staticlibrary"]
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ PathTools.staticLibraryFilePath(product))
+ }
+
+ prepare: KEIL.prepareArchiver.apply(KEIL, arguments);
+ }
+}