summaryrefslogtreecommitdiff
path: root/share/qbs/modules
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-09-27 18:46:42 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-09-30 16:31:25 +0000
commit51d8271a301b5767f797e57e73ba425a64b3a359 (patch)
tree042e5bab9fb1a04f20f51371af6a8ebaa21ce975 /share/qbs/modules
parentde2a49bb6d90ac5bcd414a3a30cce7db212e0c80 (diff)
downloadqbs-51d8271a301b5767f797e57e73ba425a64b3a359.tar.gz
baremetal: Fix missed linker artifact for C51 compiler
We need to add a file with extension '.m51' which is a map file, generated by BL51 linker for 8051 architecture. Also the artifacts creation code is refactored and improved a bit. Change-Id: I49b487acf87263dde818696d5a3478333839c30b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/modules')
-rw-r--r--share/qbs/modules/cpp/keil.js39
-rw-r--r--share/qbs/modules/cpp/keil.qbs66
2 files changed, 50 insertions, 55 deletions
diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js
index c19fdd738..82c4400c0 100644
--- a/share/qbs/modules/cpp/keil.js
+++ b/share/qbs/modules/cpp/keil.js
@@ -33,6 +33,7 @@ var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
+var PathTools = require("qbs.PathTools");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
@@ -246,6 +247,42 @@ function filterStdOutput(cmd) {
};
}
+function compilerOutputArtifacts(input) {
+ var obj = {
+ fileTags: ["obj"],
+ filePath: Utilities.getHash(input.baseDir) + "/"
+ + input.fileName + input.cpp.objectSuffix
+ };
+ return [obj];
+}
+
+function applicationLinkerOutputArtifacts(product) {
+ var app = {
+ fileTags: ["application"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ PathTools.applicationFilePath(product))
+ };
+ var mem_map = {
+ fileTags: ["mem_map"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ product.targetName
+ + (product.cpp.architecture === "mcs51" ? ".m51" : ".map"))
+ };
+ return [app, mem_map]
+}
+
+function staticLibraryLinkerOutputArtifacts(product) {
+ var staticLib = {
+ fileTags: ["staticlibrary"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ PathTools.staticLibraryFilePath(product))
+ };
+ return [staticLib]
+}
+
function compilerFlags(project, product, input, output, explicitlyDependsOn) {
// Determine which C-language we"re compiling.
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
@@ -474,7 +511,7 @@ function linkerFlags(project, product, input, outputs) {
args.push("--output", outputs.application[0].filePath);
if (product.cpp.generateMapFile)
- args.push("--list", outputs.map_file[0].filePath);
+ args.push("--list", outputs.mem_map[0].filePath);
var libraryPaths = product.cpp.libraryPaths;
if (libraryPaths)
diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs
index 10bc39e12..c87bf05f8 100644
--- a/share/qbs/modules/cpp/keil.qbs
+++ b/share/qbs/modules/cpp/keil.qbs
@@ -32,9 +32,7 @@ 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 {
@@ -164,14 +162,9 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
-
- Artifact {
- fileTags: ["obj"]
- filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + input.cpp.objectSuffix
- }
-
- prepare: KEIL.prepareAssembler.apply(KEIL, arguments);
+ outputFileTags: ["obj"]
+ outputArtifacts: KEIL.compilerOutputArtifacts(input)
+ prepare: KEIL.prepareAssembler.apply(KEIL, arguments)
}
FileTagger {
@@ -190,47 +183,18 @@ CppModule {
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);
+ outputFileTags: ["obj"]
+ outputArtifacts: KEIL.compilerOutputArtifacts(input)
+ 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);
+ outputFileTags: ["application", "mem_map"]
+ outputArtifacts: KEIL.applicationLinkerOutputArtifacts(product)
+ prepare: KEIL.prepareLinker.apply(KEIL, arguments)
}
Rule {
@@ -238,14 +202,8 @@ CppModule {
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary"]
-
- Artifact {
- fileTags: ["staticlibrary"]
- filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- PathTools.staticLibraryFilePath(product))
- }
-
- prepare: KEIL.prepareArchiver.apply(KEIL, arguments);
+ outputFileTags: ["staticlibrary"]
+ outputArtifacts: KEIL.staticLibraryLinkerOutputArtifacts(product)
+ prepare: KEIL.prepareArchiver.apply(KEIL, arguments)
}
}