forked from qt-creator/qt-creator
McuSupport: Introduce new implementation stub
New/legacy implementation will be chosen based on contents of input json file. Change-Id: I989fa667c43123f831cc77320684413cab7652df Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -12,12 +12,14 @@ add_qtc_plugin(McuSupport
|
||||
mcusupportoptionspage.cpp mcusupportoptionspage.h
|
||||
mcupackage.cpp mcupackage.h
|
||||
mcutarget.cpp mcutarget.h
|
||||
mcutargetfactorylegacy.cpp mcutargetfactorylegacy.h
|
||||
mcutargetfactory.cpp mcutargetfactory.h
|
||||
mcusupportplugin.cpp mcusupportplugin.h
|
||||
mcusupportsdk.cpp mcusupportsdk.h
|
||||
mcusupportrunconfiguration.cpp mcusupportrunconfiguration.h
|
||||
mcusupportversiondetection.cpp mcusupportversiondetection.h
|
||||
mcutargetdescription.h
|
||||
mcuhelpers.cpp mcuhelpers.h
|
||||
)
|
||||
|
||||
add_subdirectory(test)
|
||||
|
55
src/plugins/mcusupport/mcuabstracttargetfactory.h
Normal file
55
src/plugins/mcusupport/mcuabstracttargetfactory.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mcusupport_global.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QPair>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace McuSupport::Internal {
|
||||
|
||||
class McuAbstractPackage;
|
||||
class McuToolChainPackage;
|
||||
|
||||
namespace Sdk {
|
||||
struct McuTargetDescription;
|
||||
|
||||
class McuAbstractTargetFactory
|
||||
{
|
||||
public:
|
||||
using Ptr = std::unique_ptr<McuAbstractTargetFactory>;
|
||||
~McuAbstractTargetFactory() = default;
|
||||
|
||||
virtual QPair<Targets, Packages> createTargets(const McuTargetDescription &) = 0;
|
||||
using AdditionalPackages
|
||||
= QPair<QHash<QString, McuToolChainPackage *>, QHash<QString, McuAbstractPackage *>>;
|
||||
virtual AdditionalPackages getAdditionalPackages() const { return {}; }
|
||||
}; // struct McuAbstractTargetFactory
|
||||
} // namespace Sdk
|
||||
} // namespace McuSupport::Internal
|
42
src/plugins/mcusupport/mcuhelpers.cpp
Normal file
42
src/plugins/mcusupport/mcuhelpers.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "mcuhelpers.h"
|
||||
#include "mcutargetdescription.h"
|
||||
|
||||
namespace McuSupport {
|
||||
|
||||
Internal::McuTarget::OS deduceOperatingSystem(const Internal::Sdk::McuTargetDescription &desc)
|
||||
{
|
||||
using OS = Internal::McuTarget::OS;
|
||||
using TargetType = Internal::Sdk::McuTargetDescription::TargetType;
|
||||
if (desc.platform.type == TargetType::Desktop)
|
||||
return OS::Desktop;
|
||||
else if (!desc.freeRTOS.envVar.isEmpty())
|
||||
return OS::FreeRTOS;
|
||||
return OS::BareMetal;
|
||||
}
|
||||
|
||||
} //namespace McuSupport
|
40
src/plugins/mcusupport/mcuhelpers.h
Normal file
40
src/plugins/mcusupport/mcuhelpers.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mcutarget.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace McuSupport {
|
||||
|
||||
namespace Internal::Sdk {
|
||||
struct McuTargetDescription;
|
||||
}
|
||||
|
||||
Internal::McuTarget::OS deduceOperatingSystem(const Internal::Sdk::McuTargetDescription &);
|
||||
|
||||
}; // namespace McuSupport
|
@@ -29,8 +29,6 @@
|
||||
#include <utils/environmentfwd.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QVersionNumber>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -41,7 +39,6 @@ namespace McuSupport {
|
||||
namespace Internal {
|
||||
|
||||
class McuAbstractPackage;
|
||||
class McuToolChainPackage;
|
||||
class McuTarget;
|
||||
|
||||
namespace McuKitManager {
|
||||
|
@@ -64,8 +64,6 @@ public:
|
||||
const bool addToPath = false,
|
||||
const Utils::FilePath &relativePathModifier = Utils::FilePath());
|
||||
|
||||
~McuPackage() override = default;
|
||||
|
||||
QString label() const override;
|
||||
const QString &cmakeVariableName() const override;
|
||||
const QString &environmentVariableName() const override;
|
||||
|
@@ -25,6 +25,10 @@ QtcPlugin {
|
||||
"mcutarget.h",
|
||||
"mcutargetfactory.cpp",
|
||||
"mcutargetfactory.h",
|
||||
"mcutargetfactorylegacy.cpp",
|
||||
"mcutargetfactorylegacy.h",
|
||||
"mcutargetfactory.cpp",
|
||||
"mcutargetfactory.h",
|
||||
"mcusupport.qrc",
|
||||
"mcusupport_global.h",
|
||||
"mcusupportconstants.h",
|
||||
@@ -46,7 +50,9 @@ QtcPlugin {
|
||||
"mcusupportversiondetection.h",
|
||||
"mcutargetdescription.h",
|
||||
"mcukitinformation.cpp",
|
||||
"mcukitinformation.h"
|
||||
"mcukitinformation.h",
|
||||
"mcuhelpers.h",
|
||||
"mcuhelpers.cpp",
|
||||
]
|
||||
|
||||
Group {
|
||||
|
@@ -26,9 +26,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QList>
|
||||
#include <QVersionNumber>
|
||||
|
||||
#if defined(MCUSUPPORT_LIBRARY)
|
||||
#define MCUSUPPORTSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
#define MCUSUPPORTSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
namespace McuSupport::Internal {
|
||||
|
||||
class McuTarget;
|
||||
class McuAbstractPackage;
|
||||
|
||||
using Targets = QList<McuTarget*>;
|
||||
using Packages = QList<McuAbstractPackage*>;
|
||||
static const QVersionNumber legacyVersion {2, 0, 0};
|
||||
|
||||
}
|
||||
|
@@ -25,13 +25,13 @@
|
||||
|
||||
#include "mcusupportoptions.h"
|
||||
|
||||
#include "mcupackage.h"
|
||||
#include "mcutarget.h"
|
||||
#include "mcukitmanager.h"
|
||||
#include "mcukitinformation.h"
|
||||
#include "mcukitmanager.h"
|
||||
#include "mcupackage.h"
|
||||
#include "mcusupportconstants.h"
|
||||
#include "mcusupportsdk.h"
|
||||
#include "mcusupportplugin.h"
|
||||
#include "mcusupportsdk.h"
|
||||
#include "mcutarget.h"
|
||||
|
||||
#include <cmakeprojectmanager/cmakekitinformation.h>
|
||||
#include <cmakeprojectmanager/cmaketoolmanager.h>
|
||||
@@ -57,7 +57,6 @@ void McuSdkRepository::deletePackagesAndTargets()
|
||||
{
|
||||
qDeleteAll(packages);
|
||||
packages.clear();
|
||||
qDeleteAll(mcuTargets);
|
||||
mcuTargets.clear();
|
||||
}
|
||||
|
||||
@@ -125,8 +124,7 @@ void McuSupportOptions::registerExamples()
|
||||
|
||||
const QVersionNumber &McuSupportOptions::minimalQulVersion()
|
||||
{
|
||||
static const QVersionNumber v({2, 0});
|
||||
return v;
|
||||
return legacyVersion;
|
||||
}
|
||||
|
||||
void McuSupportOptions::setQulDir(const FilePath &dir)
|
||||
@@ -176,7 +174,7 @@ void McuSupportOptions::deletePackagesAndTargets()
|
||||
|
||||
void McuSupportOptions::checkUpgradeableKits()
|
||||
{
|
||||
if (!qtForMCUsSdkPackage->isValidStatus() || sdkRepository.mcuTargets.length() == 0)
|
||||
if (!qtForMCUsSdkPackage->isValidStatus() || sdkRepository.mcuTargets.size() == 0)
|
||||
return;
|
||||
|
||||
if (Utils::anyOf(sdkRepository.mcuTargets, [this](const McuTarget *target) {
|
||||
|
@@ -25,12 +25,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/environmentfwd.h>
|
||||
#include "mcusupport_global.h"
|
||||
#include "mcukitmanager.h"
|
||||
#include "mcusupport_global.h"
|
||||
|
||||
#include <utils/environmentfwd.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QVersionNumber>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QWidget)
|
||||
@@ -50,15 +50,11 @@ namespace McuSupport {
|
||||
namespace Internal {
|
||||
|
||||
class McuAbstractPackage;
|
||||
class McuToolChainPackage;
|
||||
class McuTarget;
|
||||
|
||||
class McuSdkRepository
|
||||
struct McuSdkRepository
|
||||
{
|
||||
public:
|
||||
QVector<McuAbstractPackage *> packages;
|
||||
QVector<McuTarget *> mcuTargets;
|
||||
|
||||
Packages packages;
|
||||
Targets mcuTargets;
|
||||
void deletePackagesAndTargets();
|
||||
};
|
||||
|
||||
@@ -91,6 +87,7 @@ public:
|
||||
void setAutomaticKitCreationEnabled(const bool enabled);
|
||||
void writeGeneralSettings() const;
|
||||
static bool automaticKitCreationFromSettings();
|
||||
|
||||
private:
|
||||
void deletePackagesAndTargets();
|
||||
|
||||
@@ -99,6 +96,5 @@ signals:
|
||||
void packagesChanged();
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace McuSupport
|
||||
|
@@ -146,8 +146,7 @@ McuSupportOptionsWidget::McuSupportOptionsWidget()
|
||||
m_kitAutomaticCreationCheckBox = new QCheckBox(
|
||||
tr("Automatically create kits for all available targets on start"));
|
||||
connect(m_kitAutomaticCreationCheckBox, &QCheckBox::stateChanged, this, [this](int state) {
|
||||
m_options.setAutomaticKitCreationEnabled(
|
||||
state == Qt::CheckState::Checked);
|
||||
m_options.setAutomaticKitCreationEnabled(state == Qt::CheckState::Checked);
|
||||
});
|
||||
mainLayout->addWidget(m_kitAutomaticCreationCheckBox);
|
||||
}
|
||||
@@ -171,7 +170,9 @@ McuSupportOptionsWidget::McuSupportOptionsWidget()
|
||||
connect(m_kitUpdatePushButton, &QPushButton::clicked, this, [this] {
|
||||
for (auto kit :
|
||||
McuKitManager::upgradeableKits(currentMcuTarget(), m_options.qtForMCUsSdkPackage))
|
||||
McuKitManager::upgradeKitInPlace(kit, currentMcuTarget(), m_options.qtForMCUsSdkPackage);
|
||||
McuKitManager::upgradeKitInPlace(kit,
|
||||
currentMcuTarget(),
|
||||
m_options.qtForMCUsSdkPackage);
|
||||
updateStatus();
|
||||
});
|
||||
vLayout->addWidget(m_kitCreationPushButton);
|
||||
@@ -223,9 +224,10 @@ void McuSupportOptionsWidget::updateStatus()
|
||||
if (mcuTargetValid) {
|
||||
const bool hasMatchingKits
|
||||
= !McuKitManager::matchingKits(mcuTarget, m_options.qtForMCUsSdkPackage).isEmpty();
|
||||
const bool hasUpgradeableKits = !hasMatchingKits &&
|
||||
!McuKitManager::upgradeableKits(
|
||||
mcuTarget, m_options.qtForMCUsSdkPackage).isEmpty();
|
||||
const bool hasUpgradeableKits
|
||||
= !hasMatchingKits
|
||||
&& !McuKitManager::upgradeableKits(mcuTarget, m_options.qtForMCUsSdkPackage)
|
||||
.isEmpty();
|
||||
|
||||
m_kitCreationPushButton->setEnabled(!hasMatchingKits);
|
||||
m_kitUpdatePushButton->setEnabled(hasUpgradeableKits);
|
||||
@@ -316,8 +318,9 @@ void McuSupportOptionsWidget::populateMcuTargetsComboBox()
|
||||
m_options.populatePackagesAndTargets();
|
||||
m_mcuTargetsComboBox->clear();
|
||||
m_mcuTargetsComboBox->addItems(
|
||||
Utils::transform<QStringList>(m_options.sdkRepository.mcuTargets,
|
||||
[](McuTarget *t) { return McuKitManager::generateKitNameFromTarget(t); }));
|
||||
Utils::transform<QStringList>(m_options.sdkRepository.mcuTargets, [](McuTarget *t) {
|
||||
return McuKitManager::generateKitNameFromTarget(t);
|
||||
}));
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "mcutarget.h"
|
||||
#include "mcutargetdescription.h"
|
||||
#include "mcutargetfactory.h"
|
||||
#include "mcutargetfactorylegacy.h"
|
||||
|
||||
#include <baremetal/baremetalconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -50,12 +51,20 @@
|
||||
#include <QJsonObject>
|
||||
#include <QVariant>
|
||||
|
||||
#include <ciso646>
|
||||
#include <memory>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace McuSupport {
|
||||
namespace Internal {
|
||||
namespace Sdk {
|
||||
|
||||
namespace {
|
||||
const char CMAKE_ENTRIES[]{"cmakeEntries"};
|
||||
const char ID[]{"id"};
|
||||
} // namespace
|
||||
|
||||
static FilePath findInProgramFiles(const QString &folder)
|
||||
{
|
||||
for (auto envVar : {"ProgramFiles", "ProgramFiles(x86)", "ProgramW6432"}) {
|
||||
@@ -68,7 +77,7 @@ static FilePath findInProgramFiles(const QString &folder)
|
||||
return {};
|
||||
}
|
||||
|
||||
McuPackage *createQtForMCUsPackage()
|
||||
McuAbstractPackage *createQtForMCUsPackage()
|
||||
{
|
||||
return new McuPackage(McuPackage::tr("Qt for MCUs SDK"),
|
||||
FileUtils::homePath(), // defaultPath
|
||||
@@ -95,11 +104,10 @@ static McuPackageVersionDetector *generatePackageVersionDetector(const QString &
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
/// 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".
|
||||
McuPackage *createBoardSdkPackage(const McuTargetDescription &desc)
|
||||
McuAbstractPackage *createBoardSdkPackage(const McuTargetDescription &desc)
|
||||
{
|
||||
const auto generateSdkName = [](const QString &envVar) {
|
||||
qsizetype postfixPos = envVar.indexOf("_SDK_PATH");
|
||||
@@ -137,7 +145,7 @@ McuPackage *createBoardSdkPackage(const McuTargetDescription &desc)
|
||||
versionDetector);
|
||||
}
|
||||
|
||||
McuPackage *createFreeRTOSSourcesPackage(const QString &envVar,
|
||||
McuAbstractPackage *createFreeRTOSSourcesPackage(const QString &envVar,
|
||||
const FilePath &boardSdkDir,
|
||||
const QString &freeRTOSBoardSdkSubDir)
|
||||
{
|
||||
@@ -152,14 +160,13 @@ McuPackage *createFreeRTOSSourcesPackage(const QString &envVar,
|
||||
return new McuPackage(QString::fromLatin1("FreeRTOS Sources (%1)").arg(envVarPrefix),
|
||||
defaultPath,
|
||||
{}, // detection path
|
||||
QString::fromLatin1("FreeRTOSSourcePackage_%1").arg(envVarPrefix), // settings key
|
||||
QString::fromLatin1("FreeRTOSSourcePackage_%1")
|
||||
.arg(envVarPrefix), // settings key
|
||||
"FREERTOS_DIR", // cmake var
|
||||
envVar, // env var
|
||||
"https://freertos.org"); // download url
|
||||
|
||||
}
|
||||
|
||||
|
||||
McuToolChainPackage *createUnsupportedToolChainPackage()
|
||||
{
|
||||
return new McuToolChainPackage({}, {}, {}, {}, McuToolChainPackage::ToolChainType::Unsupported);
|
||||
@@ -300,10 +307,8 @@ static McuPackage *createStm32CubeProgrammerPackage()
|
||||
}
|
||||
|
||||
const FilePath detectionPath = FilePath::fromString(
|
||||
QLatin1String(Utils::HostOsInfo::isWindowsHost()
|
||||
? "/bin/STM32_Programmer_CLI.exe"
|
||||
: "/bin/STM32_Programmer.sh")
|
||||
);
|
||||
QLatin1String(Utils::HostOsInfo::isWindowsHost() ? "/bin/STM32_Programmer_CLI.exe"
|
||||
: "/bin/STM32_Programmer.sh"));
|
||||
|
||||
auto result
|
||||
= new McuPackage(McuPackage::tr("STM32CubeProgrammer"),
|
||||
@@ -345,7 +350,8 @@ static McuPackage *createMcuXpressoIdePackage()
|
||||
|
||||
return new McuPackage("MCUXpresso IDE",
|
||||
defaultPath,
|
||||
FilePath("ide/binaries/crt_emu_cm_redlink").withExecutableSuffix(), // detection path
|
||||
FilePath("ide/binaries/crt_emu_cm_redlink")
|
||||
.withExecutableSuffix(), // detection path
|
||||
"MCUXpressoIDE", // settings key
|
||||
"MCUXPRESSO_IDE_PATH", // cmake var
|
||||
envVar,
|
||||
@@ -406,10 +412,11 @@ static McuPackage *createRenesasProgrammerPackage()
|
||||
return result;
|
||||
}
|
||||
|
||||
QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescription> &descriptions,
|
||||
QVector<McuAbstractPackage *> *packages)
|
||||
static McuAbstractTargetFactory::Ptr createFactory(bool isLegacy)
|
||||
{
|
||||
const QHash<QString, McuToolChainPackage *> tcPkgs = {
|
||||
McuAbstractTargetFactory::Ptr result;
|
||||
if (isLegacy) {
|
||||
static const QHash<QString, McuToolChainPackage *> tcPkgs = {
|
||||
{{"armgcc"}, createArmGccToolchainPackage()},
|
||||
{{"greenhills"}, createGhsToolchainPackage()},
|
||||
{{"iar"}, createIarToolChainPackage()},
|
||||
@@ -420,31 +427,43 @@ QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescription> &
|
||||
|
||||
// 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 = {
|
||||
static const QHash<QString, McuAbstractPackage *> vendorPkgs = {
|
||||
{{"ST"}, createStm32CubeProgrammerPackage()},
|
||||
{{"NXP"}, createMcuXpressoIdePackage()},
|
||||
{{"CYPRESS"}, createCypressProgrammerPackage()},
|
||||
{{"RENESAS"}, createRenesasProgrammerPackage()},
|
||||
};
|
||||
|
||||
McuTargetFactory targetFactory(tcPkgs, vendorPkgs);
|
||||
QVector<McuTarget *> mcuTargets;
|
||||
result = std::make_unique<McuTargetFactoryLegacy>(tcPkgs, vendorPkgs);
|
||||
} else {
|
||||
result = std::make_unique<McuTargetFactory>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
for (const auto &desc : descriptions) {
|
||||
auto newTargets = targetFactory.createTargets(desc);
|
||||
mcuTargets.append(newTargets);
|
||||
QPair<Targets, Packages> targetsFromDescriptions(const QList<McuTargetDescription> &descriptions,
|
||||
bool isLegacy)
|
||||
{
|
||||
Targets mcuTargets;
|
||||
Packages mcuPackages;
|
||||
|
||||
McuAbstractTargetFactory::Ptr targetFactory = createFactory(isLegacy);
|
||||
for (const McuTargetDescription &desc : descriptions) {
|
||||
auto [targets, packages] = targetFactory->createTargets(desc);
|
||||
mcuTargets.append(targets);
|
||||
mcuPackages.append(packages);
|
||||
}
|
||||
|
||||
packages->append(
|
||||
Utils::transform<QVector<McuAbstractPackage *>>(tcPkgs.values(),
|
||||
[&](McuToolChainPackage *tcPkg) {
|
||||
return tcPkg;
|
||||
}));
|
||||
for (auto *package : vendorPkgs)
|
||||
packages->append(package);
|
||||
packages->append(targetFactory.getMcuPackages());
|
||||
|
||||
return mcuTargets;
|
||||
if (isLegacy) {
|
||||
auto [toolchainPkgs, vendorPkgs]{targetFactory->getAdditionalPackages()};
|
||||
for (McuAbstractPackage *package : toolchainPkgs) {
|
||||
mcuPackages.emplace_back(package);
|
||||
}
|
||||
for (McuAbstractPackage *package : vendorPkgs) {
|
||||
mcuPackages.emplace_back(package);
|
||||
}
|
||||
}
|
||||
return {mcuTargets, mcuPackages};
|
||||
}
|
||||
|
||||
Utils::FilePath kitsPath(const Utils::FilePath &dir)
|
||||
@@ -458,6 +477,24 @@ static QFileInfoList targetDescriptionFiles(const Utils::FilePath &dir)
|
||||
return kitsDir.entryInfoList();
|
||||
}
|
||||
|
||||
static QList<PackageDescription> parsePackages(const QJsonArray &cmakeEntries)
|
||||
{
|
||||
QList<PackageDescription> result;
|
||||
for (const auto& cmakeEntryRef : cmakeEntries) {
|
||||
const QJsonObject cmakeEntry{cmakeEntryRef.toObject()};
|
||||
result.push_back({cmakeEntry[ID].toString(),
|
||||
cmakeEntry["envVar"].toString(),
|
||||
cmakeEntry["cmakeVar"].toString(),
|
||||
cmakeEntry["description"].toString(),
|
||||
cmakeEntry["setting"].toString(),
|
||||
FilePath::fromString(cmakeEntry["defaultValue"].toString()),
|
||||
FilePath::fromString(cmakeEntry["validation"].toString()),
|
||||
{},
|
||||
false});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
||||
{
|
||||
const QJsonDocument document = QJsonDocument::fromJson(data);
|
||||
@@ -469,6 +506,11 @@ McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
||||
const QJsonObject boardSdk = target.value("boardSdk").toObject();
|
||||
const QJsonObject freeRTOS = target.value("freeRTOS").toObject();
|
||||
|
||||
QJsonArray cmakeEntries = freeRTOS.value(CMAKE_ENTRIES).toArray();
|
||||
cmakeEntries.append(toolchain.value(CMAKE_ENTRIES).toArray());
|
||||
cmakeEntries.append(boardSdk.value(CMAKE_ENTRIES).toArray());
|
||||
const QList<PackageDescription> freeRtosEntries = parsePackages(cmakeEntries);
|
||||
|
||||
const QVariantList toolchainVersions = toolchain.value("versions").toArray().toVariantList();
|
||||
const auto toolchainVersionsList = Utils::transform<QStringList>(toolchainVersions,
|
||||
[&](const QVariant &version) {
|
||||
@@ -497,30 +539,26 @@ McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
||||
platformName == "Desktop" ? McuTargetDescription::TargetType::Desktop
|
||||
: McuTargetDescription::TargetType::MCU,
|
||||
},
|
||||
{
|
||||
toolchain.value("id").toString(),
|
||||
toolchainVersionsList,
|
||||
},
|
||||
{toolchain.value("id").toString(), toolchainVersionsList, {}},
|
||||
{
|
||||
boardSdk.value("name").toString(),
|
||||
boardSdk.value("defaultPath").toString(),
|
||||
boardSdk.value("envVar").toString(),
|
||||
boardSdkVersionsList,
|
||||
{},
|
||||
},
|
||||
{
|
||||
freeRTOS.value("envVar").toString(),
|
||||
freeRTOS.value("boardSdkSubDir").toString(),
|
||||
freeRtosEntries,
|
||||
}};
|
||||
}
|
||||
|
||||
// https://doc.qt.io/qtcreator/creator-developing-mcu.html#supported-qt-for-mcus-sdks
|
||||
static const QString legacySupportVersionFor(const QString &sdkVersion)
|
||||
{
|
||||
static const QHash<QString, QString> oldSdkQtcRequiredVersion = {
|
||||
{{"1.0"}, {"4.11.x"}},
|
||||
{{"1.1"}, {"4.12.0 or 4.12.1"}},
|
||||
{{"1.2"}, {"4.12.2 or 4.12.3"}}
|
||||
};
|
||||
static const QHash<QString, QString> oldSdkQtcRequiredVersion
|
||||
= {{{"1.0"}, {"4.11.x"}}, {{"1.1"}, {"4.12.0 or 4.12.1"}}, {{"1.2"}, {"4.12.2 or 4.12.3"}}};
|
||||
if (oldSdkQtcRequiredVersion.contains(sdkVersion))
|
||||
return oldSdkQtcRequiredVersion.value(sdkVersion);
|
||||
|
||||
@@ -553,6 +591,8 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
||||
{
|
||||
QList<McuTargetDescription> descriptions;
|
||||
|
||||
bool isLegacy = false;
|
||||
|
||||
auto descriptionFiles = targetDescriptionFiles(dir);
|
||||
for (const QFileInfo &fileInfo : descriptionFiles) {
|
||||
QFile file(fileInfo.absoluteFilePath());
|
||||
@@ -569,7 +609,12 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
||||
false);
|
||||
continue;
|
||||
}
|
||||
if (QVersionNumber::fromString(desc.qulVersion) < McuSupportOptions::minimalQulVersion()) {
|
||||
|
||||
const auto qulVersion{QVersionNumber::fromString(desc.qulVersion)};
|
||||
if (qulVersion == McuSupportOptions::minimalQulVersion())
|
||||
isLegacy = true;
|
||||
|
||||
if (qulVersion < McuSupportOptions::minimalQulVersion()) {
|
||||
const QString legacyVersion = legacySupportVersionFor(desc.qulVersion);
|
||||
const QString qtcSupportText
|
||||
= !legacyVersion.isEmpty()
|
||||
@@ -601,14 +646,14 @@ void targetsAndPackages(const Utils::FilePath &dir, McuSdkRepository *repo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repo->mcuTargets.append(targetsFromDescriptions(descriptions, &(repo->packages)));
|
||||
std::tie(repo->mcuTargets, repo->packages) = targetsFromDescriptions(descriptions, isLegacy);
|
||||
|
||||
// Keep targets sorted lexicographically
|
||||
std::sort(repo->mcuTargets.begin(),
|
||||
repo->mcuTargets.end(),
|
||||
[](const McuTarget *lhs, const McuTarget *rhs) {
|
||||
return McuKitManager::generateKitNameFromTarget(lhs) < McuKitManager::generateKitNameFromTarget(rhs);
|
||||
return McuKitManager::generateKitNameFromTarget(lhs)
|
||||
< McuKitManager::generateKitNameFromTarget(rhs);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -25,19 +25,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mcusupport_global.h"
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QPair>
|
||||
#include <QSettings>
|
||||
#include <QVector>
|
||||
|
||||
namespace McuSupport {
|
||||
namespace Internal {
|
||||
namespace McuSupport::Internal {
|
||||
|
||||
constexpr int MAX_COMPATIBILITY_VERSION{1};
|
||||
|
||||
class McuSdkRepository;
|
||||
class McuAbstractPackage;
|
||||
class McuPackage;
|
||||
class McuToolChainPackage;
|
||||
class McuTarget;
|
||||
|
||||
@@ -45,15 +45,14 @@ namespace Sdk {
|
||||
|
||||
struct McuTargetDescription;
|
||||
|
||||
McuPackage *createQtForMCUsPackage();
|
||||
McuAbstractPackage *createQtForMCUsPackage();
|
||||
|
||||
bool checkDeprecatedSdkError(const Utils::FilePath &qulDir, QString &message);
|
||||
|
||||
void targetsAndPackages(const Utils::FilePath &qulDir, McuSdkRepository *repo);
|
||||
|
||||
McuTargetDescription parseDescriptionJson(const QByteArray &);
|
||||
QVector<McuTarget *> targetsFromDescriptions(const QList<McuTargetDescription> &,
|
||||
QVector<McuAbstractPackage *> *);
|
||||
QPair<Targets, Packages> targetsFromDescriptions(const QList<McuTargetDescription> &, bool isLegacy);
|
||||
|
||||
Utils::FilePath kitsPath(const Utils::FilePath &dir);
|
||||
|
||||
@@ -62,11 +61,10 @@ Utils::FilePath packagePathFromSettings(const QString &settingsKey,
|
||||
const Utils::FilePath &defaultPath);
|
||||
|
||||
McuToolChainPackage *createUnsupportedToolChainPackage();
|
||||
McuPackage *createBoardSdkPackage(const McuTargetDescription &desc);
|
||||
McuPackage *createFreeRTOSSourcesPackage(const QString &envVar,
|
||||
McuAbstractPackage *createBoardSdkPackage(const McuTargetDescription &desc);
|
||||
McuAbstractPackage *createFreeRTOSSourcesPackage(const QString &envVar,
|
||||
const Utils::FilePath &boardSdkDir,
|
||||
const QString &freeRTOSBoardSdkSubDir);
|
||||
|
||||
} // namespace Sdk
|
||||
} // namespace Internal
|
||||
} // namespace McuSupport
|
||||
} // namespace McuSupport::Internal
|
||||
|
@@ -37,7 +37,7 @@ namespace McuSupport::Internal {
|
||||
McuTarget::McuTarget(const QVersionNumber &qulVersion,
|
||||
const Platform &platform,
|
||||
OS os,
|
||||
const QVector<McuAbstractPackage *> &packages,
|
||||
const Packages& packages,
|
||||
const McuToolChainPackage *toolChainPackage,
|
||||
int colorDepth)
|
||||
: m_qulVersion(qulVersion)
|
||||
@@ -48,7 +48,7 @@ McuTarget::McuTarget(const QVersionNumber &qulVersion,
|
||||
, m_colorDepth(colorDepth)
|
||||
{}
|
||||
|
||||
const QVector<McuAbstractPackage *> &McuTarget::packages() const
|
||||
const Packages &McuTarget::packages() const
|
||||
{
|
||||
return m_packages;
|
||||
}
|
||||
|
@@ -25,6 +25,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mcupackage.h"
|
||||
#include "mcusupport_global.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QVersionNumber>
|
||||
|
||||
@@ -39,7 +42,6 @@ class InfoLabel;
|
||||
|
||||
namespace McuSupport::Internal {
|
||||
|
||||
class McuAbstractPackage;
|
||||
class McuToolChainPackage;
|
||||
|
||||
class McuTarget : public QObject
|
||||
@@ -61,12 +63,12 @@ public:
|
||||
McuTarget(const QVersionNumber &qulVersion,
|
||||
const Platform &platform,
|
||||
OS os,
|
||||
const QVector<McuAbstractPackage *> &packages,
|
||||
const Packages& packages,
|
||||
const McuToolChainPackage *toolChainPackage,
|
||||
int colorDepth = UnspecifiedColorDepth);
|
||||
|
||||
const QVersionNumber &qulVersion() const;
|
||||
const QVector<McuAbstractPackage *> &packages() const;
|
||||
const Packages &packages() const;
|
||||
const McuToolChainPackage *toolChainPackage() const;
|
||||
const Platform &platform() const;
|
||||
OS os() const;
|
||||
@@ -78,10 +80,9 @@ private:
|
||||
const QVersionNumber m_qulVersion;
|
||||
const Platform m_platform;
|
||||
const OS m_os;
|
||||
const QVector<McuAbstractPackage *> m_packages;
|
||||
const McuToolChainPackage *m_toolChainPackage;
|
||||
const Packages m_packages;
|
||||
const McuToolChainPackage* m_toolChainPackage;
|
||||
const int m_colorDepth;
|
||||
}; // class McuTarget
|
||||
|
||||
|
||||
} // namespace McuSupport::Internal
|
||||
|
@@ -25,12 +25,27 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <QVersionNumber>
|
||||
|
||||
namespace McuSupport::Internal::Sdk {
|
||||
|
||||
struct PackageDescription
|
||||
{
|
||||
QString label;
|
||||
QString envVar;
|
||||
QString cmakeVar;
|
||||
QString description;
|
||||
QString setting;
|
||||
Utils::FilePath defaultPath;
|
||||
Utils::FilePath validationPath;
|
||||
QList<QVersionNumber> versions;
|
||||
bool shouldAddToSystemPath;
|
||||
}; //struct PackageDescription
|
||||
|
||||
struct McuTargetDescription
|
||||
{
|
||||
enum class TargetType { MCU, Desktop };
|
||||
@@ -49,6 +64,7 @@ struct McuTargetDescription
|
||||
{
|
||||
QString id;
|
||||
QStringList versions;
|
||||
QList<PackageDescription> packages;
|
||||
} toolchain;
|
||||
struct
|
||||
{
|
||||
@@ -56,11 +72,13 @@ struct McuTargetDescription
|
||||
QString defaultPath;
|
||||
QString envVar;
|
||||
QStringList versions;
|
||||
QList<PackageDescription> packages;
|
||||
} boardSdk;
|
||||
struct
|
||||
{
|
||||
QString envVar;
|
||||
QString boardSdkSubDir;
|
||||
QList<PackageDescription> packages;
|
||||
} freeRTOS;
|
||||
};
|
||||
|
||||
|
@@ -24,91 +24,62 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "mcutargetfactory.h"
|
||||
#include "mcuhelpers.h"
|
||||
#include "mcupackage.h"
|
||||
#include "mcusupportsdk.h"
|
||||
#include "mcusupportversiondetection.h"
|
||||
#include "mcutarget.h"
|
||||
#include "mcutargetdescription.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <QVersionNumber>
|
||||
|
||||
namespace McuSupport::Internal::Sdk {
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
QVector<McuAbstractPackage *> McuTargetFactory::getMcuPackages() const
|
||||
QPair<Targets, Packages> McuTargetFactory::createTargets(const McuTargetDescription &desc)
|
||||
{
|
||||
QVector<McuAbstractPackage *> packages;
|
||||
for (auto *package : qAsConst(boardSdkPkgs))
|
||||
packages.append(package);
|
||||
for (auto *package : qAsConst(freeRTOSPkgs))
|
||||
packages.append(package);
|
||||
Targets mcuTargets;
|
||||
Packages packages;
|
||||
|
||||
for (int colorDepth : desc.platform.colorDepths) {
|
||||
const McuTarget::Platform platform(
|
||||
{desc.platform.id, desc.platform.name, desc.platform.vendor});
|
||||
|
||||
Packages targetPackages = createPackages(desc);
|
||||
packages.append(targetPackages);
|
||||
mcuTargets.emplace_back(new McuTarget{QVersionNumber::fromString(desc.qulVersion),
|
||||
platform,
|
||||
deduceOperatingSystem(desc),
|
||||
targetPackages,
|
||||
new McuToolChainPackage{{}, {}, {}, {}, {}},
|
||||
colorDepth});
|
||||
}
|
||||
return {mcuTargets, packages};
|
||||
}
|
||||
|
||||
QList<PackageDescription> aggregatePackageEntries(const McuTargetDescription &desc)
|
||||
{
|
||||
QList<PackageDescription> result;
|
||||
result.append(desc.boardSdk.packages);
|
||||
result.append(desc.freeRTOS.packages);
|
||||
result.append(desc.toolchain.packages);
|
||||
return result;
|
||||
}
|
||||
|
||||
Packages McuTargetFactory::createPackages(const McuTargetDescription &desc)
|
||||
{
|
||||
Packages packages;
|
||||
QList<PackageDescription> packageDescriptions = aggregatePackageEntries(desc);
|
||||
|
||||
for (const PackageDescription &pkgDesc : packageDescriptions) {
|
||||
packages.emplace_back(new McuPackage{
|
||||
pkgDesc.label,
|
||||
pkgDesc.defaultPath,
|
||||
pkgDesc.validationPath,
|
||||
pkgDesc.setting,
|
||||
pkgDesc.cmakeVar,
|
||||
pkgDesc.envVar,
|
||||
});
|
||||
}
|
||||
|
||||
return packages;
|
||||
}
|
||||
|
||||
QVector<McuTarget *> McuTargetFactory::createTargets(const McuTargetDescription &desc)
|
||||
{
|
||||
// OS deduction
|
||||
const auto os = [&] {
|
||||
if (desc.platform.type == McuTargetDescription::TargetType::Desktop)
|
||||
return McuTarget::OS::Desktop;
|
||||
else if (!desc.freeRTOS.envVar.isEmpty())
|
||||
return McuTarget::OS::FreeRTOS;
|
||||
return McuTarget::OS::BareMetal;
|
||||
}();
|
||||
|
||||
QVector<McuTarget *> mcuTargets;
|
||||
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchain.id);
|
||||
if (tcPkg)
|
||||
tcPkg->setVersions(desc.toolchain.versions);
|
||||
else
|
||||
tcPkg = createUnsupportedToolChainPackage();
|
||||
for (int colorDepth : desc.platform.colorDepths) {
|
||||
QVector<McuAbstractPackage *> required3rdPartyPkgs;
|
||||
// Desktop toolchains don't need any additional settings
|
||||
if (tcPkg && !tcPkg->isDesktopToolchain()
|
||||
&& tcPkg->toolchainType() != McuToolChainPackage::ToolChainType::Unsupported)
|
||||
required3rdPartyPkgs.append(tcPkg);
|
||||
|
||||
// Add setting specific to platform IDE
|
||||
if (vendorPkgs.contains(desc.platform.vendor))
|
||||
required3rdPartyPkgs.push_back(vendorPkgs.value(desc.platform.vendor));
|
||||
|
||||
// Board SDK specific settings
|
||||
FilePath boardSdkDefaultPath;
|
||||
if (!desc.boardSdk.envVar.isEmpty()) {
|
||||
if (!boardSdkPkgs.contains(desc.boardSdk.envVar)) {
|
||||
auto boardSdkPkg = createBoardSdkPackage(desc);
|
||||
boardSdkPkgs.insert(desc.boardSdk.envVar, boardSdkPkg);
|
||||
}
|
||||
auto boardSdkPkg = boardSdkPkgs.value(desc.boardSdk.envVar);
|
||||
boardSdkPkg->setVersions(desc.boardSdk.versions);
|
||||
boardSdkDefaultPath = boardSdkPkg->defaultPath();
|
||||
required3rdPartyPkgs.append(boardSdkPkg);
|
||||
}
|
||||
|
||||
// Free RTOS specific settings
|
||||
if (!desc.freeRTOS.envVar.isEmpty()) {
|
||||
if (!freeRTOSPkgs.contains(desc.freeRTOS.envVar)) {
|
||||
freeRTOSPkgs.insert(desc.freeRTOS.envVar,
|
||||
createFreeRTOSSourcesPackage(desc.freeRTOS.envVar,
|
||||
boardSdkDefaultPath,
|
||||
desc.freeRTOS.boardSdkSubDir));
|
||||
}
|
||||
required3rdPartyPkgs.append(freeRTOSPkgs.value(desc.freeRTOS.envVar));
|
||||
}
|
||||
|
||||
const McuTarget::Platform platform(
|
||||
{desc.platform.id, desc.platform.name, desc.platform.vendor});
|
||||
auto mcuTarget = new McuTarget(QVersionNumber::fromString(desc.qulVersion),
|
||||
platform,
|
||||
os,
|
||||
required3rdPartyPkgs,
|
||||
tcPkg,
|
||||
colorDepth);
|
||||
mcuTargets.append(mcuTarget);
|
||||
}
|
||||
return mcuTargets;
|
||||
}
|
||||
} // namespace McuSupport::Internal::Sdk
|
||||
|
@@ -25,39 +25,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QHash>
|
||||
#include <QVector>
|
||||
#include "mcuabstracttargetfactory.h"
|
||||
|
||||
namespace McuSupport::Internal {
|
||||
namespace McuSupport::Internal::Sdk {
|
||||
|
||||
class McuAbstractPackage;
|
||||
class McuPackage;
|
||||
class McuTarget;
|
||||
class McuToolChainPackage;
|
||||
|
||||
namespace Sdk {
|
||||
|
||||
struct McuTargetDescription;
|
||||
|
||||
class McuTargetFactory
|
||||
class McuTargetFactory : public McuAbstractTargetFactory
|
||||
{
|
||||
public:
|
||||
McuTargetFactory(const QHash<QString, McuToolChainPackage *> &tcPkgs,
|
||||
const QHash<QString, McuPackage *> &vendorPkgs)
|
||||
: tcPkgs(tcPkgs)
|
||||
, vendorPkgs(vendorPkgs)
|
||||
{}
|
||||
|
||||
QVector<McuTarget *> createTargets(const McuTargetDescription &description);
|
||||
QVector<McuAbstractPackage *> getMcuPackages() const;
|
||||
|
||||
private:
|
||||
const QHash<QString, McuToolChainPackage *> &tcPkgs;
|
||||
const QHash<QString, McuPackage *> &vendorPkgs;
|
||||
|
||||
QHash<QString, McuPackage *> boardSdkPkgs;
|
||||
QHash<QString, McuPackage *> freeRTOSPkgs;
|
||||
QPair<Targets, Packages> createTargets(const McuTargetDescription &) override;
|
||||
Packages createPackages(const McuTargetDescription &);
|
||||
}; // struct McuTargetFactory
|
||||
|
||||
} // namespace Sdk
|
||||
} // namespace McuSupport::Internal
|
||||
} // namespace McuSupport::Internal::Sdk
|
||||
|
105
src/plugins/mcusupport/mcutargetfactorylegacy.cpp
Normal file
105
src/plugins/mcusupport/mcutargetfactorylegacy.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "mcutargetfactorylegacy.h"
|
||||
#include "mcuhelpers.h"
|
||||
#include "mcupackage.h"
|
||||
#include "mcusupportsdk.h"
|
||||
#include "mcusupportversiondetection.h"
|
||||
#include "mcutarget.h"
|
||||
#include "mcutargetdescription.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <QVersionNumber>
|
||||
|
||||
namespace McuSupport::Internal::Sdk {
|
||||
|
||||
QPair<Targets, Packages> McuTargetFactoryLegacy::createTargets(const McuTargetDescription &desc)
|
||||
{
|
||||
QHash<QString, McuAbstractPackage *> boardSdkPkgs;
|
||||
QHash<QString, McuAbstractPackage *> freeRTOSPkgs;
|
||||
Targets mcuTargets;
|
||||
Packages packages;
|
||||
McuToolChainPackage *tcPkg = tcPkgs.value(desc.toolchain.id);
|
||||
if (tcPkg) {
|
||||
tcPkg->setVersions(desc.toolchain.versions);
|
||||
} else {
|
||||
tcPkg = createUnsupportedToolChainPackage();
|
||||
}
|
||||
for (int colorDepth : desc.platform.colorDepths) {
|
||||
Packages required3rdPartyPkgs;
|
||||
// Desktop toolchains don't need any additional settings
|
||||
if (tcPkg && !tcPkg->isDesktopToolchain()
|
||||
&& tcPkg->toolchainType() != McuToolChainPackage::ToolChainType::Unsupported) {
|
||||
required3rdPartyPkgs.emplace_back(tcPkg);
|
||||
}
|
||||
|
||||
// Add setting specific to platform IDE.
|
||||
if (vendorPkgs.contains(desc.platform.vendor)) {
|
||||
required3rdPartyPkgs.emplace_back(vendorPkgs.value(desc.platform.vendor));
|
||||
}
|
||||
|
||||
// Board SDK specific settings
|
||||
Utils::FilePath boardSdkDefaultPath;
|
||||
if (!desc.boardSdk.envVar.isEmpty()) {
|
||||
if (!boardSdkPkgs.contains(desc.boardSdk.envVar)) {
|
||||
const McuAbstractPackage *boardSdkPkg = createBoardSdkPackage(desc);
|
||||
boardSdkPkgs.emplace(desc.boardSdk.envVar, boardSdkPkg);
|
||||
}
|
||||
McuAbstractPackage *boardSdkPkg{boardSdkPkgs.value(desc.boardSdk.envVar)};
|
||||
boardSdkPkg->setVersions(desc.boardSdk.versions);
|
||||
boardSdkDefaultPath = boardSdkPkg->defaultPath();
|
||||
required3rdPartyPkgs.emplace_back(boardSdkPkg);
|
||||
}
|
||||
|
||||
// Free RTOS specific settings.
|
||||
if (!desc.freeRTOS.envVar.isEmpty()) {
|
||||
if (!freeRTOSPkgs.contains(desc.freeRTOS.envVar)) {
|
||||
freeRTOSPkgs.emplace(desc.freeRTOS.envVar,
|
||||
createFreeRTOSSourcesPackage(desc.freeRTOS.envVar,
|
||||
boardSdkDefaultPath,
|
||||
desc.freeRTOS.boardSdkSubDir));
|
||||
}
|
||||
required3rdPartyPkgs.emplace_back(freeRTOSPkgs.value(desc.freeRTOS.envVar));
|
||||
}
|
||||
|
||||
packages.append(required3rdPartyPkgs);
|
||||
const McuTarget::Platform platform(
|
||||
{desc.platform.id, desc.platform.name, desc.platform.vendor});
|
||||
mcuTargets.push_back(new McuTarget{QVersionNumber::fromString(desc.qulVersion),
|
||||
platform,
|
||||
deduceOperatingSystem(desc),
|
||||
required3rdPartyPkgs,
|
||||
tcPkg,
|
||||
colorDepth});
|
||||
}
|
||||
return {mcuTargets, packages};
|
||||
}
|
||||
|
||||
McuTargetFactoryLegacy::AdditionalPackages McuTargetFactoryLegacy::getAdditionalPackages() const
|
||||
{
|
||||
return {tcPkgs, vendorPkgs};
|
||||
}
|
||||
} // namespace McuSupport::Internal::Sdk
|
54
src/plugins/mcusupport/mcutargetfactorylegacy.h
Normal file
54
src/plugins/mcusupport/mcutargetfactorylegacy.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mcuabstracttargetfactory.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QPair>
|
||||
|
||||
namespace McuSupport::Internal::Sdk {
|
||||
|
||||
class McuTargetFactoryLegacy : public McuAbstractTargetFactory
|
||||
{
|
||||
public:
|
||||
McuTargetFactoryLegacy(const QHash<QString, McuToolChainPackage *> &tcPkgs,
|
||||
const QHash<QString, McuAbstractPackage *> &vendorPkgs)
|
||||
: tcPkgs(tcPkgs)
|
||||
, vendorPkgs(vendorPkgs)
|
||||
{}
|
||||
|
||||
QPair<Targets, Packages> createTargets(const McuTargetDescription &) override;
|
||||
using AdditionalPackages
|
||||
= QPair<QHash<QString, McuToolChainPackage *>, QHash<QString, McuAbstractPackage *>>;
|
||||
AdditionalPackages getAdditionalPackages() const override;
|
||||
|
||||
private:
|
||||
const QHash<QString, McuToolChainPackage *> tcPkgs;
|
||||
const QHash<QString, McuAbstractPackage *> vendorPkgs;
|
||||
}; // struct McuTargetFactoryLegacy
|
||||
|
||||
} // namespace McuSupport::Internal::Sdk
|
@@ -36,7 +36,7 @@ constexpr auto armgcc_nxp_1050_json = R"({
|
||||
],
|
||||
"pathEntries": [],
|
||||
"environmentEntries": [],
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"id": "Qul_DIR",
|
||||
"description": "Qt for MCUs SDK",
|
||||
@@ -62,7 +62,7 @@ constexpr auto armgcc_nxp_1050_json = R"({
|
||||
"versions": [
|
||||
"9.3.1"
|
||||
],
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"id": "ARMGCC_DIR",
|
||||
"description": "GNU Arm Embedded Toolchain",
|
||||
@@ -86,7 +86,7 @@ constexpr auto armgcc_nxp_1050_json = R"({
|
||||
"versions": [
|
||||
"2.10.0"
|
||||
],
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"id": "NXP_SDK_DIR",
|
||||
"description": "Board SDK for MIMXRT1050-EVK",
|
||||
@@ -98,7 +98,7 @@ constexpr auto armgcc_nxp_1050_json = R"({
|
||||
},
|
||||
"freeRTOS": {
|
||||
"envVar": "IMXRT1050_FREERTOS_DIR",
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"id": "NXP_FREERTOS_DIR",
|
||||
"description": "FreeRTOS SDK for MIMXRT1050-EVK",
|
||||
|
@@ -29,13 +29,14 @@ constexpr auto armgcc_nxp_1064_json = R"({
|
||||
"compatVersion": "1",
|
||||
"qulVersion": "2.0.0",
|
||||
"boardSdk": {
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"cmakeOptionName": "QUL_BOARD_SDK_DIR",
|
||||
"description": "Board SDK for MIMXRT1064-EVK",
|
||||
"id": "NXP_SDK_DIR",
|
||||
"optional": false,
|
||||
"type": "path"
|
||||
"type": "path",
|
||||
"versions": ["2.10.0"]
|
||||
}
|
||||
],
|
||||
"envVar": "EVK_MIMXRT1064_SDK_PATH",
|
||||
@@ -43,10 +44,12 @@ constexpr auto armgcc_nxp_1064_json = R"({
|
||||
},
|
||||
"compatVersion": "1",
|
||||
"freeRTOS": {
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"cmakeOptionName": "FREERTOS_DIR",
|
||||
"envVar": "IMXRT1064_FREERTOS_DIR",
|
||||
"cmakeVar": "FREERTOS_DIR",
|
||||
"defaultValue": "$QUL_BOARD_SDK_DIR/rtos/freertos/freertos_kernel",
|
||||
"label": "FreeRTOS Sources (IMXRT1064) ",
|
||||
"description": "FreeRTOS SDK for MIMXRT1064-EVK",
|
||||
"id": "NXP_FREERTOS_DIR",
|
||||
"optional": false,
|
||||
@@ -56,7 +59,7 @@ constexpr auto armgcc_nxp_1064_json = R"({
|
||||
"envVar": "IMXRT1064_FREERTOS_DIR"
|
||||
},
|
||||
"platform": {
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"cmakeOptionName": "Qul_ROOT",
|
||||
"description": "Qt for MCUs SDK",
|
||||
@@ -80,7 +83,7 @@ constexpr auto armgcc_nxp_1064_json = R"({
|
||||
},
|
||||
"qulVersion": "2.0.0",
|
||||
"toolchain": {
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"cmakeOptionName": "QUL_TARGET_TOOLCHAIN_DIR",
|
||||
"description": "IAR ARM Compiler",
|
||||
|
@@ -47,7 +47,7 @@ constexpr auto iar_stm32f469i_metal_json = R"({
|
||||
}
|
||||
],
|
||||
"environmentEntries": [],
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"id": "Qul_DIR",
|
||||
"description": "Qt for MCUs SDK",
|
||||
@@ -62,7 +62,7 @@ constexpr auto iar_stm32f469i_metal_json = R"({
|
||||
"versions": [
|
||||
"8.50.9"
|
||||
],
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"id": "IARToolchain",
|
||||
"envVar": "IAR_ARM_COMPILER_DIR",
|
||||
@@ -87,7 +87,7 @@ constexpr auto iar_stm32f469i_metal_json = R"({
|
||||
"versions": [
|
||||
"1.25.0"
|
||||
],
|
||||
"cmakeCacheEntries": [
|
||||
"cmakeEntries": [
|
||||
{
|
||||
"id": "ST_SDK_DIR",
|
||||
"description": "Board SDK for STM32F469I-Discovery",
|
||||
|
@@ -29,10 +29,13 @@
|
||||
#include "armgcc_stm32f769i_freertos_json.h"
|
||||
#include "armgcc_stm32h750b_metal_json.h"
|
||||
#include "iar_stm32f469i_metal_json.h"
|
||||
#include "mcuhelpers.h"
|
||||
#include "mcukitmanager.h"
|
||||
#include "mcusupportconstants.h"
|
||||
#include "mcusupportsdk.h"
|
||||
#include "mcutargetdescription.h"
|
||||
#include "mcutargetfactory.h"
|
||||
#include "mcutargetfactorylegacy.h"
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
@@ -42,35 +45,35 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <qtestcase.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <ciso646>
|
||||
|
||||
namespace McuSupport::Internal::Test {
|
||||
|
||||
namespace {
|
||||
// clazy:excludeall=non-pod-global-static
|
||||
static const QString nxp1050FreeRtosEnvVar{"IMXRT1050_FREERTOS_DIR"};
|
||||
static const QString nxp1064FreeRtosEnvVar{"IMXRT1064_FREERTOS_DIR"};
|
||||
static const QString nxp1170FreeRtosEnvVar{"EVK_MIMXRT1170_FREERTOS_PATH"};
|
||||
static const QString stm32f7FreeRtosEnvVar{"STM32F7_FREERTOS_DIR"};
|
||||
static const QString stm32f7{"STM32F7"};
|
||||
static const QString nxp1170{"EVK_MIMXRT1170"};
|
||||
static const QString nxp1050{"IMXRT1050"};
|
||||
static const QString nxp1064{"IMXRT1064"};
|
||||
|
||||
static const QStringList jsonFiles{QString::fromUtf8(armgcc_nxp_1050_json),
|
||||
QString::fromUtf8(armgcc_nxp_1064_json)};
|
||||
const QString freeRtosCMakeVar{"FREERTOS_DIR"};
|
||||
const QString nxp1050FreeRtosEnvVar{"IMXRT1050_FREERTOS_DIR"};
|
||||
const QString nxp1064FreeRtosEnvVar{"IMXRT1064_FREERTOS_DIR"};
|
||||
const QString nxp1170FreeRtosEnvVar{"EVK_MIMXRT1170_FREERTOS_PATH"};
|
||||
const QString stm32f7FreeRtosEnvVar{"STM32F7_FREERTOS_DIR"};
|
||||
const QString stm32f7{"STM32F7"};
|
||||
const QString nxp1170{"EVK_MIMXRT1170_"};
|
||||
const QString nxp1050{"IMXRT1050"};
|
||||
const QString nxp1064{"IMXRT1064"};
|
||||
const QStringList jsonFiles{armgcc_nxp_1050_json, armgcc_nxp_1064_json};
|
||||
constexpr bool RUN_LEGACY{true};
|
||||
constexpr int colorDepth{32};
|
||||
const QString id{"id"};
|
||||
} // namespace
|
||||
|
||||
using CMakeProjectManager::CMakeConfigItem;
|
||||
using CMakeProjectManager::CMakeConfigurationKitAspect;
|
||||
using ProjectExplorer::EnvironmentKitAspect;
|
||||
using ProjectExplorer::KitManager;
|
||||
using testing::Return;
|
||||
using testing::ReturnRef;
|
||||
using Utils::FilePath;
|
||||
|
||||
void McuSupportTest::initTestCase()
|
||||
{
|
||||
}
|
||||
void McuSupportTest::initTestCase() {}
|
||||
|
||||
void McuSupportTest::test_parseBasicInfoFromJson()
|
||||
{
|
||||
@@ -80,6 +83,15 @@ void McuSupportTest::test_parseBasicInfoFromJson()
|
||||
QVERIFY(description.freeRTOS.boardSdkSubDir.isEmpty());
|
||||
}
|
||||
|
||||
void McuSupportTest::test_parseCmakeEntries()
|
||||
{
|
||||
const auto description{Sdk::parseDescriptionJson(armgcc_nxp_1064_json)};
|
||||
|
||||
QVERIFY(not description.freeRTOS.packages.isEmpty());
|
||||
auto &freeRtosPackage = description.freeRTOS.packages[0];
|
||||
QCOMPARE(freeRtosPackage.envVar, nxp1064FreeRtosEnvVar);
|
||||
}
|
||||
|
||||
void McuSupportTest::test_addNewKit()
|
||||
{
|
||||
const QString cmakeVar = "CMAKE_SDK";
|
||||
@@ -89,10 +101,10 @@ void McuSupportTest::test_addNewKit()
|
||||
"sdk", // settingsKey
|
||||
cmakeVar, // cmake var
|
||||
{}}; // env var
|
||||
Kit kit;
|
||||
ProjectExplorer::Kit kit;
|
||||
|
||||
McuToolChainPackage toolchainPackage{
|
||||
{}, // label
|
||||
McuToolChainPackage
|
||||
toolchainPackage{{}, // label
|
||||
{}, // defaultPath
|
||||
{}, // detectionPath
|
||||
{}, // settingsKey
|
||||
@@ -115,15 +127,17 @@ void McuSupportTest::test_addNewKit()
|
||||
|
||||
QCOMPARE(kitAddedSpy.count(), 1);
|
||||
QList<QVariant> arguments = kitAddedSpy.takeFirst();
|
||||
auto *createdKit = qvariant_cast<Kit *>(arguments.at(0));
|
||||
auto *createdKit = qvariant_cast<ProjectExplorer::Kit *>(arguments.at(0));
|
||||
QVERIFY(createdKit != nullptr);
|
||||
QCOMPARE(createdKit, newKit);
|
||||
|
||||
const auto config = CMakeConfigurationKitAspect::configuration(newKit);
|
||||
QVERIFY(config.size() > 0);
|
||||
QVERIFY(Utils::indexOf(config.toVector(), [&cmakeVar](const CMakeConfigItem &item) {
|
||||
QVERIFY(Utils::indexOf(config.toVector(),
|
||||
[&cmakeVar](const CMakeConfigItem &item) {
|
||||
return item.key == cmakeVar.toUtf8();
|
||||
}) != -1);
|
||||
})
|
||||
!= -1);
|
||||
}
|
||||
|
||||
void McuSupportTest::test_createPackagesWithCorrespondingSettings_data()
|
||||
@@ -164,9 +178,8 @@ void McuSupportTest::test_createPackagesWithCorrespondingSettings_data()
|
||||
void McuSupportTest::test_createPackagesWithCorrespondingSettings()
|
||||
{
|
||||
QFETCH(QString, json);
|
||||
const auto description = Sdk::parseDescriptionJson(json.toLocal8Bit());
|
||||
QVector<McuAbstractPackage *> packages;
|
||||
const auto targets = Sdk::targetsFromDescriptions({description}, &packages);
|
||||
const Sdk::McuTargetDescription description = Sdk::parseDescriptionJson(json.toLocal8Bit());
|
||||
const auto [targets, packages]{Sdk::targetsFromDescriptions({description}, RUN_LEGACY)};
|
||||
Q_UNUSED(targets);
|
||||
|
||||
QSet<QString> settings = Utils::transform<QSet<QString>>(packages, [](const auto &package) {
|
||||
@@ -176,4 +189,111 @@ void McuSupportTest::test_createPackagesWithCorrespondingSettings()
|
||||
QVERIFY(settings.contains(expectedSettings));
|
||||
}
|
||||
|
||||
void McuSupportTest::test_createFreeRtosPackageWithCorrectSetting_data()
|
||||
{
|
||||
QTest::addColumn<QString>("freeRtosEnvVar");
|
||||
QTest::addColumn<QString>("expectedSettingsKey");
|
||||
|
||||
QTest::newRow("nxp1050") << nxp1050FreeRtosEnvVar
|
||||
<< QString{Constants::SETTINGS_KEY_FREERTOS_PREFIX}.append(nxp1050);
|
||||
QTest::newRow("nxp1064") << nxp1064FreeRtosEnvVar
|
||||
<< QString{Constants::SETTINGS_KEY_FREERTOS_PREFIX}.append(nxp1064);
|
||||
QTest::newRow("nxp1170") << nxp1170FreeRtosEnvVar
|
||||
<< QString{Constants::SETTINGS_KEY_FREERTOS_PREFIX}.append(nxp1170);
|
||||
QTest::newRow("stm32f7") << stm32f7FreeRtosEnvVar
|
||||
<< QString{Constants::SETTINGS_KEY_FREERTOS_PREFIX}.append(stm32f7);
|
||||
}
|
||||
|
||||
//TODO(piotr.mucko): Enable when mcutargetfactory is delivered.
|
||||
void McuSupportTest::test_createFreeRtosPackageWithCorrectSetting()
|
||||
{
|
||||
// Sdk::targetsAndPackages(jsonFile, &mcuSdkRepo);
|
||||
//
|
||||
// QVector<Package *> mcuPackages;
|
||||
// auto mcuTargets = Sdk::targetsFromDescriptions({description}, &mcuPackages);
|
||||
// QVERIFY(mcuPackages contains freertos package)
|
||||
// QVERIFY(freertos package is not empty & has proper value)
|
||||
|
||||
// McuSupportOptions mcuSuportOptions{};
|
||||
// mcuSuportOptions.createAutomaticKits();
|
||||
|
||||
QFETCH(QString, freeRtosEnvVar);
|
||||
QFETCH(QString, expectedSettingsKey);
|
||||
|
||||
auto *package{Sdk::createFreeRTOSSourcesPackage(freeRtosEnvVar, FilePath{}, QString{})};
|
||||
QVERIFY(package != nullptr);
|
||||
|
||||
QCOMPARE(package->settingsKey(), expectedSettingsKey);
|
||||
|
||||
// QVERIFY(freertos package is not empty & has proper value)
|
||||
// static McuPackage *createFreeRTOSSourcesPackage(const QString &envVar,
|
||||
// const FilePath &boardSdkDir,
|
||||
// const QString &freeRTOSBoardSdkSubDir)
|
||||
// createFreeRtosPackage
|
||||
// verify that package's setting is Package_FreeRTOSSourcePackage_IMXRT1064.
|
||||
//TODO(me): write settings
|
||||
// auto *freeRtosPackage
|
||||
// = new McuPackage;
|
||||
// freeRtosPackage->writeToSettings();
|
||||
//TODO(me): verify that setting is the same as in 2.0.0
|
||||
}
|
||||
|
||||
void McuSupportTest::test_createTargetsTheNewWay_data() {}
|
||||
|
||||
void McuSupportTest::test_createTargetsTheNewWay()
|
||||
{
|
||||
Sdk::PackageDescription packageDescription{id,
|
||||
nxp1064FreeRtosEnvVar,
|
||||
freeRtosCMakeVar,
|
||||
"setting",
|
||||
"Freertos directory",
|
||||
"/opt/freertos/1064",
|
||||
"",
|
||||
{},
|
||||
true};
|
||||
|
||||
Sdk::McuTargetDescription description{
|
||||
"2.0.1",
|
||||
"2",
|
||||
{id, "", "", {colorDepth}, Sdk::McuTargetDescription::TargetType::MCU},
|
||||
{}, // toolchain
|
||||
{}, // boardSDK
|
||||
{"", "", {packageDescription}}, //freertos
|
||||
};
|
||||
|
||||
Sdk::McuTargetFactory targetFactory{};
|
||||
const auto [targets, packages]{targetFactory.createTargets(description)};
|
||||
QVERIFY(not targets.empty());
|
||||
QCOMPARE(targets.at(0)->colorDepth(), colorDepth);
|
||||
const auto &tgtPackages{targets.at(0)->packages()};
|
||||
QVERIFY(not tgtPackages.empty());
|
||||
const auto rtosPackage{tgtPackages.first()};
|
||||
QCOMPARE(rtosPackage->environmentVariableName(), nxp1064FreeRtosEnvVar);
|
||||
}
|
||||
|
||||
void McuSupportTest::test_createPackages()
|
||||
{
|
||||
Sdk::PackageDescription packageDescription{id,
|
||||
nxp1064FreeRtosEnvVar,
|
||||
freeRtosCMakeVar,
|
||||
"Freertos directory",
|
||||
"setting",
|
||||
"/opt/freertos/1064",
|
||||
"",
|
||||
{},
|
||||
true};
|
||||
Sdk::McuTargetDescription targetDescription{
|
||||
"2.0.1",
|
||||
"2",
|
||||
{id, id, id, {colorDepth}, Sdk::McuTargetDescription::TargetType::MCU},
|
||||
{}, // toolchain
|
||||
{}, // boardSDK
|
||||
{"", "", {packageDescription}}, //freertos
|
||||
};
|
||||
|
||||
Sdk::McuTargetFactory targetFactory;
|
||||
const auto packages{targetFactory.createPackages(targetDescription)};
|
||||
QVERIFY(not packages.empty());
|
||||
}
|
||||
|
||||
} // namespace McuSupport::Internal::Test
|
||||
|
@@ -43,8 +43,6 @@
|
||||
|
||||
namespace McuSupport::Internal::Test {
|
||||
|
||||
using ProjectExplorer::Kit;
|
||||
|
||||
class McuSupportTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -56,6 +54,12 @@ private slots:
|
||||
void test_parseBasicInfoFromJson();
|
||||
void test_createPackagesWithCorrespondingSettings();
|
||||
void test_createPackagesWithCorrespondingSettings_data();
|
||||
void test_createFreeRtosPackageWithCorrectSetting_data();
|
||||
void test_createFreeRtosPackageWithCorrectSetting();
|
||||
void test_createTargetsTheNewWay_data();
|
||||
void test_createTargetsTheNewWay();
|
||||
void test_createPackages();
|
||||
void test_parseCmakeEntries();
|
||||
|
||||
private:
|
||||
QVersionNumber currentQulVersion{2, 0};
|
||||
@@ -67,7 +71,6 @@ private:
|
||||
const QString freeRtosEnvVar{"EVK_MIMXRT1170_FREERTOS_PATH"};
|
||||
const QString freeRtosCmakeVar{"FREERTOS_DIR"};
|
||||
const QString defaultfreeRtosPath{"/opt/freertos/default"};
|
||||
|
||||
}; // class McuSupportTest
|
||||
|
||||
} // namespace McuSupport::Internal::Test
|
||||
|
Reference in New Issue
Block a user