aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/imports/qbs/Probes/IarProbe.qbs
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-08-15 18:41:07 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-08-19 09:07:01 +0000
commit379c22bd555aa5236b0cae91d18523b2aca20342 (patch)
treeb1b965f0bb421be5c284f413f0939918c4c7ad98 /share/qbs/imports/qbs/Probes/IarProbe.qbs
parentbce7328b597443df77855e6afd587c268ced91f4 (diff)
baremetal: Improve JS code in IAR module a bit
* Move an architecture-specific code to a functions in the iar.js file. * Remove the redundant copy-paste code. * Align order for assembler, compiler, linker and archiver flags to the unified form, like: <inputs> <outputs> <defines> <includes> <flags> Change-Id: Ibfdc536f78d1145f6e1190da33f67b0fb7063f05 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Richard Weickelt <richard@weickelt.de>
Diffstat (limited to 'share/qbs/imports/qbs/Probes/IarProbe.qbs')
-rw-r--r--share/qbs/imports/qbs/Probes/IarProbe.qbs41
1 files changed, 12 insertions, 29 deletions
diff --git a/share/qbs/imports/qbs/Probes/IarProbe.qbs b/share/qbs/imports/qbs/Probes/IarProbe.qbs
index 4ac05551c..d261e9065 100644
--- a/share/qbs/imports/qbs/Probes/IarProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/IarProbe.qbs
@@ -65,42 +65,25 @@ PathProbe {
compilerFilePath, tag);
}
- // FIXME: Do we need dump the default paths for both C
- // and C++ languages?
- var defaultPaths = IAR.dumpDefaultPaths(
- compilerFilePath, languages[0]);
-
var macros = compilerDefinesByLanguage["c"]
|| compilerDefinesByLanguage["cpp"];
architecture = IAR.guessArchitecture(macros);
endianness = IAR.guessEndianness(macros);
- includePaths = defaultPaths.includePaths;
- var version = parseInt(macros["__VER__"], 10);
+ // FIXME: Do we need dump the default paths for both C
+ // and C++ languages?
+ var defaultPaths = IAR.dumpDefaultPaths(
+ compilerFilePath, languages[0]);
- if (architecture === "arm") {
- versionMajor = parseInt(version / 1000000);
- versionMinor = parseInt(version / 1000) % 1000;
- versionPatch = parseInt(version) % 1000;
- } else if (architecture === "mcs51") {
- versionMajor = parseInt(version / 100);
- versionMinor = parseInt(version % 100);
- versionPatch = 0;
- } else if (architecture === "avr") {
- versionMajor = parseInt(version / 100);
- versionMinor = parseInt(version % 100);
- versionPatch = 0;
- } else if (architecture === "stm8") {
- versionMajor = parseInt(version / 100);
- versionMinor = parseInt(version % 100);
- versionPatch = 0;
- } else if (architecture === "msp430") {
- versionMajor = parseInt(version / 100);
- versionMinor = parseInt(version % 100);
- versionPatch = 0;
- }
+ includePaths = defaultPaths.includePaths;
- found = version && architecture && endianness;
+ var version = IAR.guessVersion(macros, architecture);
+ if (version) {
+ versionMajor = version.major;
+ versionMinor = version.minor;
+ versionPatch = version.patch;
+ found = version && architecture && endianness;
+ }
}
}