forked from qt-creator/qt-creator
Add support for the Cypress traveo II kit
Fixes: UL-4242
Change-Id: I0b492a3edd6a1dce9d214e6490e174050c3fdb30
Reviewed-by: <christiaan.janssen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
(cherry picked from commit d98feae8f6
)
This commit is contained in:
committed by
Erik Verbruggen
parent
27a8cb376e
commit
b7218a34dd
@@ -412,11 +412,14 @@ ToolChain *McuToolChainPackage::toolChain(Id language) const
|
|||||||
|
|
||||||
QString McuToolChainPackage::toolChainName() const
|
QString McuToolChainPackage::toolChainName() const
|
||||||
{
|
{
|
||||||
return QLatin1String(m_type == TypeArmGcc
|
switch (m_type) {
|
||||||
? "armgcc" : m_type == McuToolChainPackage::TypeIAR
|
case TypeArmGcc: return QLatin1String("armgcc");
|
||||||
? "iar" : m_type == McuToolChainPackage::TypeKEIL
|
case TypeIAR: return QLatin1String("iar");
|
||||||
? "keil" : m_type == McuToolChainPackage::TypeGHS
|
case TypeKEIL: return QLatin1String("keil");
|
||||||
? "ghs" : "unsupported");
|
case TypeGHS: return QLatin1String("ghs");
|
||||||
|
case TypeGHSArm: return QLatin1String("ghs-arm");
|
||||||
|
default: return QLatin1String("unsupported");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString McuToolChainPackage::cmakeToolChainFileName() const
|
QString McuToolChainPackage::cmakeToolChainFileName() const
|
||||||
|
@@ -126,6 +126,7 @@ public:
|
|||||||
TypeGHS,
|
TypeGHS,
|
||||||
TypeMSVC,
|
TypeMSVC,
|
||||||
TypeGCC,
|
TypeGCC,
|
||||||
|
TypeGHSArm,
|
||||||
TypeUnsupported
|
TypeUnsupported
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -134,6 +134,23 @@ static McuToolChainPackage *createGhsToolchainPackage()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static McuToolChainPackage *createGhsArmToolchainPackage()
|
||||||
|
{
|
||||||
|
const char envVar[] = "GHS_ARM_COMPILER_DIR";
|
||||||
|
|
||||||
|
const QString defaultPath =
|
||||||
|
qEnvironmentVariableIsSet(envVar) ? qEnvironmentVariable(envVar) : QDir::homePath();
|
||||||
|
|
||||||
|
auto result = new McuToolChainPackage(
|
||||||
|
"Green Hills Compiler for ARM",
|
||||||
|
defaultPath,
|
||||||
|
Utils::HostOsInfo::withExecutableSuffix("cxarm"),
|
||||||
|
"GHSArmToolchain",
|
||||||
|
McuToolChainPackage::TypeGHSArm);
|
||||||
|
result->setEnvironmentVariableName(envVar);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static McuToolChainPackage *createIarToolChainPackage()
|
static McuToolChainPackage *createIarToolChainPackage()
|
||||||
{
|
{
|
||||||
const char envVar[] = "IAR_ARM_COMPILER_DIR";
|
const char envVar[] = "IAR_ARM_COMPILER_DIR";
|
||||||
@@ -248,6 +265,35 @@ static McuPackage *createMcuXpressoIdePackage()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static McuPackage *createCypressProgrammerPackage()
|
||||||
|
{
|
||||||
|
const char envVar[] = "CYPRESS_AUTO_FLASH_UTILITY_DIR";
|
||||||
|
|
||||||
|
QString defaultPath;
|
||||||
|
if (qEnvironmentVariableIsSet(envVar)) {
|
||||||
|
defaultPath = qEnvironmentVariable(envVar);
|
||||||
|
} else if (Utils::HostOsInfo::isWindowsHost()) {
|
||||||
|
auto candidate = findInProgramFiles(QLatin1String("/Cypress/Cypress Auto Flash Utility 1.0/"));
|
||||||
|
if (QFileInfo::exists(candidate)) {
|
||||||
|
defaultPath = candidate;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
defaultPath = QLatin1String("/usr");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defaultPath.isEmpty()) {
|
||||||
|
defaultPath = QDir::homePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto result = new McuPackage(
|
||||||
|
"Cypress Auto Flash Utility",
|
||||||
|
defaultPath,
|
||||||
|
Utils::HostOsInfo::withExecutableSuffix("/bin/openocd"),
|
||||||
|
"CypressAutoFlashUtil");
|
||||||
|
result->setEnvironmentVariableName(envVar);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
struct McuTargetDescription
|
struct McuTargetDescription
|
||||||
{
|
{
|
||||||
enum class TargetType {
|
enum class TargetType {
|
||||||
@@ -269,6 +315,9 @@ struct McuTargetDescription
|
|||||||
TargetType type;
|
TargetType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Create the McuPackage by checking the "boardSdk" property in the JSON file for the board.
|
||||||
|
/// The name of the environment variable pointing to the the SDK for the board will be defined in the "envVar" property
|
||||||
|
/// inside the "boardSdk".
|
||||||
static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
|
static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc)
|
||||||
{
|
{
|
||||||
const auto generateSdkName = [](const QString& envVar) {
|
const auto generateSdkName = [](const QString& envVar) {
|
||||||
@@ -495,11 +544,15 @@ static QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescrip
|
|||||||
{{"iar"}, createIarToolChainPackage()},
|
{{"iar"}, createIarToolChainPackage()},
|
||||||
{{"msvc"}, createMsvcToolChainPackage()},
|
{{"msvc"}, createMsvcToolChainPackage()},
|
||||||
{{"gcc"}, createGccToolChainPackage()},
|
{{"gcc"}, createGccToolChainPackage()},
|
||||||
|
{{"arm-greenhills"}, createGhsArmToolchainPackage()},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Note: the vendor name (the key of the hash) is case-sensitive. It has to match the "platformVendor" key in the
|
||||||
|
// json file.
|
||||||
const QHash<QString, McuPackage *> vendorPkgs = {
|
const QHash<QString, McuPackage *> vendorPkgs = {
|
||||||
{{"ST"}, createStm32CubeProgrammerPackage()},
|
{{"ST"}, createStm32CubeProgrammerPackage()},
|
||||||
{{"NXP"}, createMcuXpressoIdePackage()},
|
{{"NXP"}, createMcuXpressoIdePackage()},
|
||||||
|
{{"CYPRESS"}, createCypressProgrammerPackage()},
|
||||||
};
|
};
|
||||||
|
|
||||||
McuTargetFactory targetFactory(tcPkgs, vendorPkgs);
|
McuTargetFactory targetFactory(tcPkgs, vendorPkgs);
|
||||||
|
Reference in New Issue
Block a user