summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-09-27 19:04:46 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-10-11 18:11:49 +0000
commit6835c7701766fbd747b68d5a598867359d9b9115 (patch)
treead50f894336dd2ac7c98e9a692288fdc4eed74f3
parent9576d5ad5184bb986f30faa8af8cb791da062459 (diff)
baremetal: Improve artifact creation code for IAR EW module
... to move this code to a separate helper functions. Change-Id: I56678be39df931105b04bec1340aa7ba09e523d9 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/modules/cpp/iar.js39
-rw-r--r--share/qbs/modules/cpp/iar.qbs56
2 files changed, 45 insertions, 50 deletions
diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js
index b787901b2..bff0739b1 100644
--- a/share/qbs/modules/cpp/iar.js
+++ b/share/qbs/modules/cpp/iar.js
@@ -339,6 +339,41 @@ function collectLibraryDependencies(product) {
return result;
}
+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 + ".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));
@@ -552,7 +587,7 @@ function linkerFlags(project, product, input, outputs) {
args.push("--silent");
// Map file generation flag.
if (product.cpp.generateLinkerMapFile)
- args.push("--map", outputs.map_file[0].filePath);
+ args.push("--map", outputs.mem_map[0].filePath);
// Entry point flag.
if (product.cpp.entryPoint)
args.push("--entry", product.cpp.entryPoint);
@@ -569,7 +604,7 @@ function linkerFlags(project, product, input, outputs) {
args.push("-rt");
// Map file generation flag.
if (product.cpp.generateLinkerMapFile)
- args.push("-l", outputs.map_file[0].filePath);
+ args.push("-l", outputs.mem_map[0].filePath);
// Entry point flag.
if (product.cpp.entryPoint)
args.push("-s", product.cpp.entryPoint);
diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs
index fef84fe1b..e006856bf 100644
--- a/share/qbs/modules/cpp/iar.qbs
+++ b/share/qbs/modules/cpp/iar.qbs
@@ -99,13 +99,8 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
-
- Artifact {
- fileTags: ["obj"]
- filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + input.cpp.objectSuffix
- }
-
+ outputFileTags: ["obj"]
+ outputArtifacts: IAR.compilerOutputArtifacts(input)
prepare: IAR.prepareAssembler.apply(IAR, arguments)
}
@@ -118,13 +113,8 @@ CppModule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
-
- Artifact {
- fileTags: ["obj"]
- filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + input.cpp.objectSuffix
- }
-
+ outputFileTags: ["obj"]
+ outputArtifacts: IAR.compilerOutputArtifacts(input)
prepare: IAR.prepareCompiler.apply(IAR, arguments)
}
@@ -133,32 +123,8 @@ CppModule {
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
-
- outputFileTags: {
- var tags = ["application"];
- if (product.moduleProperty("cpp", "generateLinkerMapFile"))
- 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.generateLinkerMapFile) {
- artifacts.push({
- fileTags: ["map_file"],
- filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- product.targetName + ".map")
- });
- }
- return artifacts;
- }
-
+ outputFileTags: ["application", "mem_map"]
+ outputArtifacts: IAR.applicationLinkerOutputArtifacts(product)
prepare: IAR.prepareLinker.apply(IAR, arguments)
}
@@ -167,14 +133,8 @@ CppModule {
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary"]
-
- Artifact {
- fileTags: ["staticlibrary"]
- filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- PathTools.staticLibraryFilePath(product))
- }
-
+ outputFileTags: ["staticlibrary"]
+ outputArtifacts: IAR.staticLibraryLinkerOutputArtifacts(product)
prepare: IAR.prepareArchiver.apply(IAR, arguments)
}
}