Commit c562dce3 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Abi: Support Atmel AVR architecture

Change-Id: Ib2c894311d7318a9226ca2ac40001c4f96606f6e
Reviewed-by: Oswald Buddenhagen's avatarOswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 2fed425c
...@@ -353,6 +353,10 @@ Abi::Abi(const Architecture &a, const OS &o, ...@@ -353,6 +353,10 @@ Abi::Abi(const Architecture &a, const OS &o,
if (m_osFlavor != GenericQnxFlavor) if (m_osFlavor != GenericQnxFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case BareMetalOS:
if (m_osFlavor != GenericBareMetalFlavor)
m_osFlavor = GenericBareMetalFlavor;
break;
} }
} }
...@@ -368,6 +372,8 @@ Abi::Abi(const QString &abiString) : ...@@ -368,6 +372,8 @@ Abi::Abi(const QString &abiString) :
m_architecture = ArmArchitecture; m_architecture = ArmArchitecture;
else if (abiParts.at(0) == "aarch64") else if (abiParts.at(0) == "aarch64")
m_architecture = ArmArchitecture; m_architecture = ArmArchitecture;
else if (abiParts.at(0) == "avr")
m_architecture = AvrArchitecture;
else if (abiParts.at(0) == "x86") else if (abiParts.at(0) == "x86")
m_architecture = X86Architecture; m_architecture = X86Architecture;
else if (abiParts.at(0) == "mips") else if (abiParts.at(0) == "mips")
...@@ -512,6 +518,12 @@ Abi Abi::abiFromTargetTriplet(const QString &triple) ...@@ -512,6 +518,12 @@ Abi Abi::abiFromTargetTriplet(const QString &triple)
} else if (p.startsWith("aarch64")) { } else if (p.startsWith("aarch64")) {
arch = ArmArchitecture; arch = ArmArchitecture;
width = 64; width = 64;
} else if (p == "avr") {
arch = AvrArchitecture;
os = BareMetalOS;
flavor = GenericBareMetalFlavor;
format = ElfFormat;
width = 16;
} else if (p.startsWith("mips")) { } else if (p.startsWith("mips")) {
arch = MipsArchitecture; arch = MipsArchitecture;
width = p.contains("64") ? 64 : 32; width = p.contains("64") ? 64 : 32;
...@@ -657,6 +669,8 @@ QString Abi::toString(const Architecture &a) ...@@ -657,6 +669,8 @@ QString Abi::toString(const Architecture &a)
switch (a) { switch (a) {
case ArmArchitecture: case ArmArchitecture:
return QLatin1String("arm"); return QLatin1String("arm");
case AvrArchitecture:
return QLatin1String("avr");
case X86Architecture: case X86Architecture:
return QLatin1String("x86"); return QLatin1String("x86");
case MipsArchitecture: case MipsArchitecture:
...@@ -690,6 +704,8 @@ QString Abi::toString(const OS &o) ...@@ -690,6 +704,8 @@ QString Abi::toString(const OS &o)
return QLatin1String("vxworks"); return QLatin1String("vxworks");
case QnxOS: case QnxOS:
return QLatin1String("qnx"); return QLatin1String("qnx");
case BareMetalOS:
return QLatin1String("baremetal");
case UnknownOS: // fall through! case UnknownOS: // fall through!
default: default:
return QLatin1String("unknown"); return QLatin1String("unknown");
...@@ -736,6 +752,7 @@ QString Abi::toString(const OSFlavor &of) ...@@ -736,6 +752,7 @@ QString Abi::toString(const OSFlavor &of)
case VxWorksFlavor: case VxWorksFlavor:
return QLatin1String("vxworks"); return QLatin1String("vxworks");
case GenericQnxFlavor: case GenericQnxFlavor:
case GenericBareMetalFlavor:
return QLatin1String("generic"); return QLatin1String("generic");
case UnknownFlavor: // fall through! case UnknownFlavor: // fall through!
default: default:
...@@ -787,6 +804,8 @@ QList<Abi::OSFlavor> Abi::flavorsForOs(const Abi::OS &o) ...@@ -787,6 +804,8 @@ QList<Abi::OSFlavor> Abi::flavorsForOs(const Abi::OS &o)
return {VxWorksFlavor, UnknownFlavor}; return {VxWorksFlavor, UnknownFlavor};
case QnxOS: case QnxOS:
return {GenericQnxFlavor, UnknownFlavor}; return {GenericQnxFlavor, UnknownFlavor};
case BareMetalOS:
return {GenericBareMetalFlavor};
case UnknownOS: case UnknownOS:
return {UnknownFlavor}; return {UnknownFlavor};
default: default:
...@@ -1207,6 +1226,11 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet_data() ...@@ -1207,6 +1226,11 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet_data()
QTest::newRow("aarch64-unknown-linux-gnu") << int(Abi::ArmArchitecture) QTest::newRow("aarch64-unknown-linux-gnu") << int(Abi::ArmArchitecture)
<< int(Abi::LinuxOS) << int(Abi::GenericLinuxFlavor) << int(Abi::LinuxOS) << int(Abi::GenericLinuxFlavor)
<< int(Abi::ElfFormat) << 64; << int(Abi::ElfFormat) << 64;
// Yes, that's the entire triplet
QTest::newRow("avr") << int(Abi::AvrArchitecture)
<< int(Abi::BareMetalOS) << int(Abi::GenericBareMetalFlavor)
<< int(Abi::ElfFormat) << 16;
} }
void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet() void ProjectExplorer::ProjectExplorerPlugin::testAbiFromTargetTriplet()
......
...@@ -48,6 +48,7 @@ public: ...@@ -48,6 +48,7 @@ public:
MipsArchitecture, MipsArchitecture,
PowerPCArchitecture, PowerPCArchitecture,
ShArchitecture, ShArchitecture,
AvrArchitecture,
UnknownArchitecture UnknownArchitecture
}; };
...@@ -59,6 +60,7 @@ public: ...@@ -59,6 +60,7 @@ public:
WindowsOS, WindowsOS,
VxWorks, VxWorks,
QnxOS, QnxOS,
BareMetalOS,
UnknownOS UnknownOS
}; };
...@@ -90,10 +92,10 @@ public: ...@@ -90,10 +92,10 @@ public:
WindowsMSysFlavor, WindowsMSysFlavor,
WindowsCEFlavor, WindowsCEFlavor,
// Embedded
VxWorksFlavor, VxWorksFlavor,
// QNX
GenericQnxFlavor, GenericQnxFlavor,
GenericBareMetalFlavor,
UnknownFlavor UnknownFlavor
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment