diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-01-10 18:56:42 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-01-23 16:52:03 +0000 |
commit | 133901f4658caaa2bce042e33e38914682fa4043 (patch) | |
tree | 6b2b1cbc3d30c4a4da71f18b841f021e91f5cce2 /share/qbs/modules/cpp/iar.js | |
parent | c2833b1a009bc7c382b30d94109b9b7a25a404a6 (diff) |
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 <richard@weickelt.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/iar.js')
-rw-r--r-- | share/qbs/modules/cpp/iar.js | 68 |
1 files changed, 52 insertions, 16 deletions
diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index c36fa88d0..5b358b332 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -43,6 +43,8 @@ function guessArchitecture(macros) { if (macros["__ICCARM__"] === "1") return "arm"; + else if (macros["__ICC8051__"] === "1") + return "mcs51"; } function guessEndianness(macros) @@ -159,25 +161,30 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { if (tag === "cpp") args.push("--warn_about_c_style_casts"); } - if (input.cpp.treatWarningsAsErrors) { + if (input.cpp.treatWarningsAsErrors) args.push("--warnings_are_errors"); - } // Choose byte order. var endianness = input.cpp.endianness; - if (endianness) - args.push("--endian=" + endianness); + if (endianness) { + if (input.qbs.architecture === "arm") + args.push("--endian=" + endianness); + } if (tag === "c") { // Language version. if (input.cpp.cLanguageVersion === "c89") args.push("--c89"); } else if (tag === "cpp") { - args.push("--c++"); - if (!input.cpp.enableExceptions) - args.push("--no_exceptions"); - if (!input.cpp.enableRtti) - args.push("--no_rtti"); + if (input.qbs.architecture === "arm") { + args.push("--c++"); + if (!input.cpp.enableExceptions) + args.push("--no_exceptions"); + if (!input.cpp.enableRtti) + args.push("--no_rtti"); + } else if (input.qbs.architecture === "mcs51") { + args.push("--ec++"); + } } var allDefines = []; @@ -229,6 +236,15 @@ function assemblerFlags(project, product, input, output, explicitlyDependsOn) { else args.push("-w+"); + var allIncludePaths = []; + var systemIncludePaths = input.cpp.systemIncludePaths; + if (systemIncludePaths) + allIncludePaths = allIncludePaths.uniqueConcat(systemIncludePaths); + var compilerIncludePaths = input.cpp.compilerIncludePaths; + if (compilerIncludePaths) + allIncludePaths = allIncludePaths.uniqueConcat(compilerIncludePaths); + args = args.concat(allIncludePaths.map(function(include) { return "-I" + include })); + args.push("-o", output.filePath); args.push("-S"); // Silent operation. @@ -248,8 +264,12 @@ function linkerFlags(project, product, input, outputs) { args.push("-o", outputs.application[0].filePath); - if (product.cpp.generateMapFile) - args.push("--map", outputs.map_file[0].filePath); + if (product.cpp.generateMapFile) { + if (product.qbs.architecture === "arm") + args.push("--map", outputs.map_file[0].filePath); + else if (product.qbs.architecture === "mcs51") + args.push("-l", outputs.map_file[0].filePath); + } var allLibraryPaths = []; var libraryPaths = product.cpp.libraryPaths; @@ -264,15 +284,31 @@ function linkerFlags(project, product, input, outputs) { if (libraryDependencies) args = args.concat(libraryDependencies.map(function(dep) { return dep.filePath })); + if (product.cpp.debugInformation) { + if (product.qbs.architecture === "mcs51") + args.push("-rt"); + } + var linkerScripts = inputs.linkerscript ? inputs.linkerscript.map(function(a) { return a.filePath; }) : []; - for (i in linkerScripts) - args.push("--config", linkerScripts[i]); + for (i in linkerScripts) { + if (product.qbs.architecture === "arm") + args.push("--config", linkerScripts[i]); + else if (product.qbs.architecture === "mcs51") + args.push("-f", linkerScripts[i]); + } - if (product.cpp.entryPoint) - args.push("--entry", product.cpp.entryPoint); + if (product.cpp.entryPoint) { + if (product.qbs.architecture === "arm") + args.push("--entry", product.cpp.entryPoint); + else if (product.qbs.architecture === "mcs51") + args.push("-s", product.cpp.entryPoint); + } - args.push("--silent"); // Silent operation. + if (product.qbs.architecture === "arm") + args.push("--silent"); // Silent operation. + else if (product.qbs.architecture === "mcs51") + args.push("-S"); // Silent operation. args = args.concat(ModUtils.moduleProperty(product, "driverLinkerFlags")); return args; |