From 79c5b99a51994e84c98fee02ce60fbfe6ab71054 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sun, 30 May 2021 21:27:04 +0300 Subject: baremetal: Long live COSMIC toolchain for COLDFIRE architecture This patch adds support for Cosmic Software compiler for the bare metal platforms: * https://www.cosmicsoftware.com/download.php Note that this compiler only works on Windows host platforms. Also the COSMIC toolchain has been added to the Github CI. Fixes: QBS-1648 Change-Id: I39dfeef1c5696e69bed8969890cf4f8fdb3c2741 Reviewed-by: Ivan Komissarov --- .github/workflows/main.yml | 3 ++ share/qbs/modules/cpp/cosmic.js | 34 +++++++++++++++++----- src/app/qbs-setup-toolchains/cosmicprobe.cpp | 7 +++-- .../one-object-asm-application/m68k-cosmic.s | 5 ++++ .../one-object-asm-application.qbs | 2 ++ 5 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-cosmic.s diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72827d81e..6d0bfad56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -544,6 +544,9 @@ jobs: - name: cosmic-4_8_11-hcs12 run: QBS_AUTOTEST_PROFILE=cosmic-4_8_11-hcs12 scripts/test-baremetal.sh release/install-root/bin shell: bash + - name: cosmic-4_1_0-m68k + run: QBS_AUTOTEST_PROFILE=cosmic-4_1_0-m68k scripts/test-baremetal.sh release/install-root/bin + shell: bash test-macos: name: ${{ matrix.config.name }} diff --git a/share/qbs/modules/cpp/cosmic.js b/share/qbs/modules/cpp/cosmic.js index acb3e4d5d..ca8cc5a14 100644 --- a/share/qbs/modules/cpp/cosmic.js +++ b/share/qbs/modules/cpp/cosmic.js @@ -47,6 +47,8 @@ function compilerName(qbs) { return "cx6808"; else if (architecture === "hcs12") return "cx6812"; + else if (architecture === "m68k") + return "cx332"; throw "Unable to deduce compiler name for unsupported architecture: '" + architecture + "'"; } @@ -61,6 +63,8 @@ function assemblerName(qbs) { return "ca6808"; else if (architecture === "hcs12") return "ca6812"; + else if (architecture === "m68k") + return "ca332"; throw "Unable to deduce assembler name for unsupported architecture: '" + architecture + "'"; } @@ -70,7 +74,8 @@ function linkerName(qbs) { if (architecture.startsWith("arm") || architecture === "stm8" || architecture === "hcs8" - || architecture === "hcs12") { + || architecture === "hcs12" + || architecture === "m68k") { return "clnk"; } throw "Unable to deduce linker name for unsupported architecture: '" @@ -82,7 +87,8 @@ function listerName(qbs) { if (architecture.startsWith("arm") || architecture === "stm8" || architecture === "hcs8" - || architecture === "hcs12") { + || architecture === "hcs12" + || architecture === "m68k") { return "clabs"; } throw "Unable to deduce lister name for unsupported architecture: '" @@ -94,7 +100,8 @@ function archiverName(qbs) { if (architecture.startsWith("arm") || architecture === "stm8" || architecture === "hcs8" - || architecture === "hcs12") { + || architecture === "hcs12" + || architecture === "m68k") { return "clib"; } throw "Unable to deduce archiver name for unsupported architecture: '" @@ -111,6 +118,8 @@ function staticLibrarySuffix(qbs) { return ".h08"; else if (architecture === "hcs12") return ".h12"; + else if (architecture === "m68k") + return ".332"; throw "Unable to deduce static library suffix for unsupported architecture: '" + architecture + "'"; } @@ -125,6 +134,8 @@ function executableSuffix(qbs) { return ".h08"; else if (architecture === "hcs12") return ".h12"; + else if (architecture === "m68k") + return ".332"; throw "Unable to deduce executable suffix for unsupported architecture: '" + architecture + "'"; } @@ -134,7 +145,8 @@ function objectSuffix(qbs) { if (architecture.startsWith("arm") || architecture === "stm8" || architecture === "hcs8" - || architecture === "hcs12") { + || architecture === "hcs12" + || architecture === "m68k") { return ".o"; } throw "Unable to deduce object file suffix for unsupported architecture: '" @@ -146,7 +158,8 @@ function imageFormat(qbs) { if (architecture.startsWith("arm") || architecture === "stm8" || architecture === "hcs8" - || architecture === "hcs12") { + || architecture === "hcs12" + || architecture === "m68k") { return "cosmic"; } throw "Unable to deduce image format for unsupported architecture: '" @@ -163,6 +176,8 @@ function guessArchitecture(compilerFilePath) { return "hcs8"; else if (baseName === "cx6812") return "hcs12"; + else if (baseName === "cx332") + return "m68k"; throw "Unable to deduce architecture for unsupported compiler: '" + baseName + "'"; } @@ -210,7 +225,7 @@ function dumpVersion(compilerFilePath) { p.exec(compilerFilePath, ["-vers"]); // COSMIC compiler use the errors output! var output = p.readStdErr(); - var match = output.match(/^COSMIC.+V(\d+)\.?(\d+)\.?(\*|\d+)/); + var match = output.match(/^COSMIC.+V(\d+)\.?(\d+)\.?(\*|\d+)?/); if (match) { var major = match[1] ? parseInt(match[1], 10) : 0; var minor = match[2] ? parseInt(match[2], 10) : 0; @@ -224,7 +239,8 @@ function guessEndianness(architecture) { if (architecture.startsWith("arm") || architecture === "stm8" || architecture === "hcs8" - || architecture === "hcs12") { + || architecture === "hcs12" + || architecture === "m68k") { return "big"; } throw "Unable to deduce endianness for unsupported architecture: '" @@ -251,6 +267,10 @@ function dumpDefaultPaths(compilerFilePath, architecture) { includePath = FileInfo.joinPaths(rootPath, "h6812"); if (File.exists(includePath)) includePaths.push(includePath); + } else if (architecture === "m68k") { + includePath = FileInfo.joinPaths(rootPath, "h332"); + if (File.exists(includePath)) + includePaths.push(includePath); } var libraryPaths = []; diff --git a/src/app/qbs-setup-toolchains/cosmicprobe.cpp b/src/app/qbs-setup-toolchains/cosmicprobe.cpp index 9e7621245..a41b21ee8 100644 --- a/src/app/qbs-setup-toolchains/cosmicprobe.cpp +++ b/src/app/qbs-setup-toolchains/cosmicprobe.cpp @@ -59,7 +59,8 @@ using Internal::HostOsInfo; static QStringList knownCosmicCompilerNames() { return {QStringLiteral("cxcorm"), QStringLiteral("cxstm8"), - QStringLiteral("cx6808"), QStringLiteral("cx6812")}; + QStringLiteral("cx6808"), QStringLiteral("cx6812"), + QStringLiteral("cx332")}; } static QString guessCosmicArchitecture(const QFileInfo &compiler) @@ -73,6 +74,8 @@ static QString guessCosmicArchitecture(const QFileInfo &compiler) return QStringLiteral("hcs8"); if (baseName == QLatin1String("cx6812")) return QStringLiteral("hcs12"); + if (baseName == QLatin1String("cx332")) + return QStringLiteral("m68k"); return {}; } @@ -121,7 +124,7 @@ static Version dumpCosmicCompilerVersion(const QFileInfo &compiler) } const QByteArray output = p.readAllStandardError(); - const QRegularExpression re(QLatin1String("^COSMIC.+V(\\d+)\\.?(\\d+)\\.?(\\*|\\d+)")); + const QRegularExpression re(QLatin1String("^COSMIC.+V(\\d+)\\.?(\\d+)\\.?(\\*|\\d+)?")); const QRegularExpressionMatch match = re.match(QString::fromLatin1(output)); if (!match.hasMatch()) return Version{}; diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-cosmic.s b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-cosmic.s new file mode 100644 index 000000000..811b1d79e --- /dev/null +++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/m68k-cosmic.s @@ -0,0 +1,5 @@ +_main: + .dcall "8,0,_main" + rts + xdef _main + end diff --git a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs index d88f9e44e..e8805225c 100644 --- a/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs +++ b/tests/auto/blackbox/testdata-baremetal/one-object-asm-application/one-object-asm-application.qbs @@ -11,6 +11,8 @@ BareMetalApplication { return true; if (qbs.architecture === "hcs12") return true; + if (qbs.architecture === "m68k") + return true; } else if (qbs.toolchainType === "keil") { if (qbs.architecture.startsWith("arm")) return true; -- cgit v1.2.3