From 133901f4658caaa2bce042e33e38914682fa4043 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Thu, 10 Jan 2019 18:56:42 +0300 Subject: bare-metal: Add IAR 8051 toolchain support This commit adds a basic support of the IAR Embedded Workbench toolchain for the 8051 processors family. To use it with Qt Creator, it is enough to add there a desired Kit with a custom IAR C/C++ compiler, and then set the following in the Kit's Qbs profile settings: * Key: qbs.toolchainType * Value: iar Tested with EW for 8051 v10.10.1 on Windows using the simple projects samples which are comes with the default IAR installer. Change-Id: I5ef1cc047c27a7fce4a6841331a67e8dd0f0453e Reviewed-by: Richard Weickelt Reviewed-by: Christian Kandeler --- share/qbs/modules/cpp/iar.qbs | 61 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-) (limited to 'share/qbs/modules/cpp/iar.qbs') diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs index b91bd6022..df5218838 100644 --- a/share/qbs/modules/cpp/iar.qbs +++ b/share/qbs/modules/cpp/iar.qbs @@ -80,6 +80,8 @@ CppModule { switch (qbs.architecture) { case "arm": return "iccarm" + compilerExtension; + case "mcs51": + return "icc8051" + compilerExtension; } } compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName) @@ -88,6 +90,8 @@ CppModule { switch (qbs.architecture) { case "arm": return "iasmarm" + compilerExtension; + case "mcs51": + return "a8051" + compilerExtension; } } assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName) @@ -96,6 +100,8 @@ CppModule { switch (qbs.architecture) { case "arm": return "ilinkarm" + compilerExtension; + case "mcs51": + return "xlink" + compilerExtension; } } linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName) @@ -104,14 +110,50 @@ CppModule { switch (qbs.architecture) { case "arm": return "iarchive" + compilerExtension; + case "mcs51": + return "xlib" + compilerExtension; } } property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName) runtimeLibrary: "static" - staticLibrarySuffix: ".a" - executableSuffix: ".out" - imageFormat: "elf" + + staticLibrarySuffix: { + switch (qbs.architecture) { + case "arm": + return ".a"; + case "mcs51": + return ".r51"; + } + } + + executableSuffix: { + switch (qbs.architecture) { + case "arm": + return ".out"; + case "mcs51": + return qbs.debugInformation ? ".d51" : ".a51"; + } + } + + property string objectSuffix: { + switch (qbs.architecture) { + case "arm": + return ".o"; + case "mcs51": + return ".r51"; + } + } + + imageFormat: { + switch (qbs.architecture) { + case "arm": + return "elf"; + case "mcs51": + return "ubrof"; + } + } + enableExceptions: false enableRtti: false @@ -121,17 +163,25 @@ CppModule { Artifact { fileTags: ["obj"] - filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".o" + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + input.cpp.objectSuffix } prepare: IAR.prepareAssembler.apply(IAR, arguments); } FileTagger { + condition: qbs.architecture === "arm"; patterns: "*.s" fileTags: ["asm"] } + FileTagger { + condition: qbs.architecture === "mcs51"; + patterns: ["*.s51", "*.asm"] + fileTags: ["asm"] + } + Rule { id: compiler inputs: ["cpp", "c"] @@ -139,7 +189,8 @@ CppModule { Artifact { fileTags: ["obj"] - filePath: Utilities.getHash(input.baseDir) + "/" + input.fileName + ".o" + filePath: Utilities.getHash(input.baseDir) + "/" + + input.fileName + input.cpp.objectSuffix } prepare: IAR.prepareCompiler.apply(IAR, arguments); -- cgit v1.2.3