aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-08-14 11:48:13 +0200
committerhjk <hjk@qt.io>2019-09-30 15:04:32 +0000
commitb0ea4311e8c2394e4ce4d039622ae4182742d6a8 (patch)
tree5169a2bb3a28f4157e15c0bd1b2119ad6f3305e6 /src
parent6b73eec05bceba0dd370bbfb7927bf5681c00709 (diff)
Short live McuSupport
Medium term to be merged with BareMetal/RemoteLinux/... Change-Id: I444c65bcfa8e3cf8642ff64e964459720814860a Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/CMakeLists.txt1
-rw-r--r--src/plugins/mcusupport/CMakeLists.txt12
-rw-r--r--src/plugins/mcusupport/McuSupport.json.in20
-rw-r--r--src/plugins/mcusupport/images/mcusupportdevice.pngbin0 -> 238 bytes
-rw-r--r--src/plugins/mcusupport/images/mcusupportdevice@2x.pngbin0 -> 431 bytes
-rw-r--r--src/plugins/mcusupport/images/mcusupportdevicesmall.pngbin0 -> 163 bytes
-rw-r--r--src/plugins/mcusupport/images/mcusupportdevicesmall@2x.pngbin0 -> 274 bytes
-rw-r--r--src/plugins/mcusupport/mcusupport.pro22
-rw-r--r--src/plugins/mcusupport/mcusupport.qbs28
-rw-r--r--src/plugins/mcusupport/mcusupport.qrc13
-rw-r--r--src/plugins/mcusupport/mcusupport_dependencies.pri10
-rw-r--r--src/plugins/mcusupport/mcusupport_global.h34
-rw-r--r--src/plugins/mcusupport/mcusupportconstants.h49
-rw-r--r--src/plugins/mcusupport/mcusupportdevice.cpp72
-rw-r--r--src/plugins/mcusupport/mcusupportdevice.h57
-rw-r--r--src/plugins/mcusupport/mcusupportoptionspage.cpp672
-rw-r--r--src/plugins/mcusupport/mcusupportoptionspage.h51
-rw-r--r--src/plugins/mcusupport/mcusupportplugin.cpp89
-rw-r--r--src/plugins/mcusupport/mcusupportplugin.h49
-rw-r--r--src/plugins/mcusupport/mcusupportrunconfiguration.cpp91
-rw-r--r--src/plugins/mcusupport/mcusupportrunconfiguration.h43
-rw-r--r--src/plugins/mcusupport/wizards/application/CMakeLists.txt10
-rw-r--r--src/plugins/mcusupport/wizards/application/main.qml.tpl13
-rw-r--r--src/plugins/mcusupport/wizards/application/wizard.json58
-rw-r--r--src/plugins/mcusupport/wizards/icon.pngbin0 -> 612 bytes
-rw-r--r--src/plugins/mcusupport/wizards/icon@2x.pngbin0 -> 1072 bytes
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/plugins.qbs1
-rw-r--r--src/tools/icons/qtcreatoricons.svg258
29 files changed, 1579 insertions, 77 deletions
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index d1eae35d24a..8d3f734c2b6 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -85,3 +85,4 @@ add_subdirectory(boot2qt)
add_subdirectory(qmldesigner)
add_subdirectory(qnx)
add_subdirectory(webassembly)
+add_subdirectory(mcusupport)
diff --git a/src/plugins/mcusupport/CMakeLists.txt b/src/plugins/mcusupport/CMakeLists.txt
new file mode 100644
index 00000000000..deed8605aec
--- /dev/null
+++ b/src/plugins/mcusupport/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_qtc_plugin(McuSupport
+ DEPENDS Qt5::Core
+ PLUGIN_DEPENDS Core ProjectExplorer CMakeProjectManager
+ SOURCES
+ mcusupport.qrc
+ mcusupport_global.h
+ mcusupportconstants.h
+ mcusupportdevice.cpp mcusupportdevice.h
+ mcusupportoptionspage.cpp mcusupportoptionspage.h
+ mcusupportplugin.cpp mcusupportplugin.h
+ mcusupportrunconfiguration.cpp mcusupportrunconfiguration.h
+)
diff --git a/src/plugins/mcusupport/McuSupport.json.in b/src/plugins/mcusupport/McuSupport.json.in
new file mode 100644
index 00000000000..a2f42400394
--- /dev/null
+++ b/src/plugins/mcusupport/McuSupport.json.in
@@ -0,0 +1,20 @@
+{
+ \"Name\" : \"McuSupport\",
+ \"Version\" : \"$$QTCREATOR_VERSION\",
+ \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
+ \"Experimental\" : true,
+ \"Vendor\" : \"The Qt Company Ltd\",
+ \"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\",
+ \"License\" : [ \"Commercial Usage\",
+ \"\",
+ \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt 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.\",
+ \"\",
+ \"GNU General Public License Usage\",
+ \"\",
+ \"Alternatively, this plugin 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 plugin. 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.\"
+ ],
+ \"Category\" : \"Device Support\",
+ \"Description\" : \"Helper for MCU related projects.\",
+ \"Url\" : \"http://www.qt.io\",
+ $$dependencyList
+}
diff --git a/src/plugins/mcusupport/images/mcusupportdevice.png b/src/plugins/mcusupport/images/mcusupportdevice.png
new file mode 100644
index 00000000000..821be66aa4f
--- /dev/null
+++ b/src/plugins/mcusupport/images/mcusupportdevice.png
Binary files differ
diff --git a/src/plugins/mcusupport/images/mcusupportdevice@2x.png b/src/plugins/mcusupport/images/mcusupportdevice@2x.png
new file mode 100644
index 00000000000..b516eb127b6
--- /dev/null
+++ b/src/plugins/mcusupport/images/mcusupportdevice@2x.png
Binary files differ
diff --git a/src/plugins/mcusupport/images/mcusupportdevicesmall.png b/src/plugins/mcusupport/images/mcusupportdevicesmall.png
new file mode 100644
index 00000000000..9f18e7e248e
--- /dev/null
+++ b/src/plugins/mcusupport/images/mcusupportdevicesmall.png
Binary files differ
diff --git a/src/plugins/mcusupport/images/mcusupportdevicesmall@2x.png b/src/plugins/mcusupport/images/mcusupportdevicesmall@2x.png
new file mode 100644
index 00000000000..5758823f086
--- /dev/null
+++ b/src/plugins/mcusupport/images/mcusupportdevicesmall@2x.png
Binary files differ
diff --git a/src/plugins/mcusupport/mcusupport.pro b/src/plugins/mcusupport/mcusupport.pro
new file mode 100644
index 00000000000..9bb79364f86
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupport.pro
@@ -0,0 +1,22 @@
+include(../../qtcreatorplugin.pri)
+
+DEFINES += MCUSUPPORT_LIBRARY
+
+QT += gui network
+
+HEADERS += \
+ mcusupport_global.h \
+ mcusupportconstants.h \
+ mcusupportdevice.h \
+ mcusupportoptionspage.h \
+ mcusupportplugin.h \
+ mcusupportrunconfiguration.h
+
+SOURCES += \
+ mcusupportdevice.cpp \
+ mcusupportoptionspage.cpp \
+ mcusupportplugin.cpp \
+ mcusupportrunconfiguration.cpp
+
+RESOURCES += \
+ mcusupport.qrc
diff --git a/src/plugins/mcusupport/mcusupport.qbs b/src/plugins/mcusupport/mcusupport.qbs
new file mode 100644
index 00000000000..cb8ef1afcee
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupport.qbs
@@ -0,0 +1,28 @@
+import qbs 1.0
+
+QtcPlugin {
+ name: "McuSupport"
+
+ Depends { name: "Qt.core" }
+ Depends { name: "Qt.widgets" }
+ Depends { name: "Utils" }
+
+ Depends { name: "Core" }
+ Depends { name: "ProjectExplorer" }
+ Depends { name: "CMakeProjectManager" }
+ Depends { name: "QtSupport" }
+
+ files: [
+ "mcusupport.qrc",
+ "mcusupport_global.h",
+ "mcusupportconstants.h",
+ "mcusupportdevice.cpp",
+ "mcusupportdevice.h",
+ "mcusupportoptionspage.cpp",
+ "mcusupportoptionspage.h",
+ "mcusupportplugin.cpp",
+ "mcusupportplugin.h",
+ "mcusupportrunconfiguration.cpp",
+ "mcusupportrunconfiguration.h",
+ ]
+}
diff --git a/src/plugins/mcusupport/mcusupport.qrc b/src/plugins/mcusupport/mcusupport.qrc
new file mode 100644
index 00000000000..c38ede5929c
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupport.qrc
@@ -0,0 +1,13 @@
+<RCC>
+ <qresource prefix="/mcusupport">
+ <file>images/mcusupportdevice.png</file>
+ <file>images/mcusupportdevice@2x.png</file>
+ <file>images/mcusupportdevicesmall.png</file>
+ <file>images/mcusupportdevicesmall@2x.png</file>
+ <file>wizards/icon.png</file>
+ <file>wizards/icon@2x.png</file>
+ <file>wizards/application/CMakeLists.txt</file>
+ <file>wizards/application/main.qml.tpl</file>
+ <file>wizards/application/wizard.json</file>
+ </qresource>
+</RCC>
diff --git a/src/plugins/mcusupport/mcusupport_dependencies.pri b/src/plugins/mcusupport/mcusupport_dependencies.pri
new file mode 100644
index 00000000000..b6fd4f9e6b6
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupport_dependencies.pri
@@ -0,0 +1,10 @@
+QTC_PLUGIN_NAME = McuSupport
+
+QTC_LIB_DEPENDS += \
+ extensionsystem \
+ utils
+
+QTC_PLUGIN_DEPENDS += \
+ coreplugin \
+ projectexplorer \
+ cmakeprojectmanager
diff --git a/src/plugins/mcusupport/mcusupport_global.h b/src/plugins/mcusupport/mcusupport_global.h
new file mode 100644
index 00000000000..3039bf660b6
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupport_global.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <QtGlobal>
+
+#if defined(MCUSUPPORT_LIBRARY)
+# define MCUSUPPORTSHARED_EXPORT Q_DECL_EXPORT
+#else
+# define MCUSUPPORTSHARED_EXPORT Q_DECL_IMPORT
+#endif
diff --git a/src/plugins/mcusupport/mcusupportconstants.h b/src/plugins/mcusupport/mcusupportconstants.h
new file mode 100644
index 00000000000..2cc5bee41a1
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportconstants.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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
+
+namespace McuSupport {
+namespace Constants {
+
+const char TOOLCHAIN_TYPEID[] = "McuSupport.ToolChain.ARM-GCC";
+const char DEVICE_TYPE[] = "McuSupport.DeviceType";
+const char DEVICE_ID[] = "McuSupport.Device";
+const char MCUSUPPORT_QT_VERSION[] = "Qt4ProjectManager.QtVersion.McuSupport";
+const char RUNCONFIGURATION[] = "McuSupport.RunConfiguration";
+const char SETTINGS_ID[] = "CC.McuSupport.Configuration";
+const char KIT_BOARD_MODEL_KEY[] = "McuSupport.BoardModel";
+
+const char ENVVAR_ARMGCC_DIR[] = "ARMGCC_DIR";
+const char ENVVAR_STM32CUBE_FW_F7_SDK_PATH[] = "STM32Cube_FW_F7_SDK_PATH";
+
+const char SETTINGS_GROUP[] = "McuSupport";
+const char SETTINGS_KEY_PACKAGE_PREFIX[] = "package_";
+const char SETTINGS_KEY_PACKAGE_ARMGCC[] = "ArmGcc";
+const char SETTINGS_KEY_STM32CUBE_FW_F7_SDK_PATH[] = "STM32Cube_FW_F7_SDK_PATH";
+const char SETTINGS_KEY_STM32CUBE_PROGRAMMER_PATH[] = "STM32Cube_Cube_Programmer_Path";
+
+} // namespace McuSupport
+} // namespace Constants
diff --git a/src/plugins/mcusupport/mcusupportdevice.cpp b/src/plugins/mcusupport/mcusupportdevice.cpp
new file mode 100644
index 00000000000..17fb3d2471c
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportdevice.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "mcusupportconstants.h"
+#include "mcusupportdevice.h"
+
+#include <projectexplorer/devicesupport/deviceprocess.h>
+#include <projectexplorer/runcontrol.h>
+
+using namespace ProjectExplorer;
+using namespace Utils;
+
+namespace McuSupport {
+namespace Internal {
+
+McuSupportDevice::McuSupportDevice()
+{
+ setupId(IDevice::AutoDetected, Constants::DEVICE_ID);
+ setType(Constants::DEVICE_TYPE);
+ const QString displayNameAndType = tr("MCU Device");
+ setDefaultDisplayName(displayNameAndType);
+ setDisplayType(displayNameAndType);
+ setDeviceState(IDevice::DeviceStateUnknown);
+ setMachineType(IDevice::Hardware);
+ setOsType(Utils::OsTypeOther);
+}
+
+ProjectExplorer::IDevice::Ptr McuSupportDevice::create()
+{
+ auto device = new McuSupportDevice;
+ return ProjectExplorer::IDevice::Ptr(device);
+}
+
+McuSupportDeviceFactory::McuSupportDeviceFactory()
+ : ProjectExplorer::IDeviceFactory(Constants::DEVICE_TYPE)
+{
+ setDisplayName(tr("MCU Device"));
+ setCombinedIcon(":/mcusupport/images/mcusupportdevicesmall.png",
+ ":/mcusupport/images/mcusupportdevice.png");
+ setCanCreate(true);
+ setConstructionFunction(&McuSupportDevice::create);
+}
+
+ProjectExplorer::IDevice::Ptr McuSupportDeviceFactory::create() const
+{
+ return McuSupportDevice::create();
+}
+
+} // namespace Internal
+} // namespace McuSupport
diff --git a/src/plugins/mcusupport/mcusupportdevice.h b/src/plugins/mcusupport/mcusupportdevice.h
new file mode 100644
index 00000000000..50c505eb489
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportdevice.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <projectexplorer/devicesupport/desktopdevice.h>
+
+#include <QCoreApplication>
+
+namespace McuSupport {
+namespace Internal {
+
+class McuSupportDevice : public ProjectExplorer::DesktopDevice
+{
+ Q_DECLARE_TR_FUNCTIONS(McuSupport::Internal::McuSupportDevice)
+
+public:
+ static ProjectExplorer::IDevice::Ptr create();
+
+private:
+ McuSupportDevice();
+};
+
+class McuSupportDeviceFactory : public ProjectExplorer::IDeviceFactory
+{
+ Q_OBJECT
+
+public:
+ McuSupportDeviceFactory();
+
+ ProjectExplorer::IDevice::Ptr create() const override;
+};
+
+} // namespace Internal
+} // namespace McuSupport
diff --git a/src/plugins/mcusupport/mcusupportoptionspage.cpp b/src/plugins/mcusupport/mcusupportoptionspage.cpp
new file mode 100644
index 00000000000..4e1b6fda893
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportoptionspage.cpp
@@ -0,0 +1,672 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
+** Contact: BlackBerry (qt@blackberry.com)
+**
+** 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 "mcusupportconstants.h"
+#include "mcusupportoptionspage.h"
+
+#include <coreplugin/icore.h>
+#include <cmakeprojectmanager/cmakekitinformation.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/toolchain.h>
+#include <projectexplorer/toolchainmanager.h>
+#include <projectexplorer/kitmanager.h>
+#include <projectexplorer/kitinformation.h>
+#include <projectexplorer/devicesupport/devicemanager.h>
+#include <utils/algorithm.h>
+#include <utils/fileutils.h>
+#include <utils/pathchooser.h>
+#include <utils/qtcassert.h>
+#include <utils/utilsicons.h>
+
+#include <QAction>
+#include <QComboBox>
+#include <QDebug>
+#include <QDesktopServices>
+#include <QDir>
+#include <QFileInfo>
+#include <QFormLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QSizePolicy>
+#include <QToolButton>
+#include <QVBoxLayout>
+#include <QVariant>
+
+namespace McuSupport {
+namespace Internal {
+
+class PackageOptions : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum Status {
+ InvalidPath,
+ ValidPathInvalidPackage,
+ ValidPackage
+ };
+
+ PackageOptions(const QString &label, const QString &defaultPath, const QString &detectionPath,
+ const QString &settingsKey);
+
+ QString path() const;
+ QString label() const;
+ QString detectionPath() const;
+ Status status() const;
+ void setDownloadUrl(const QUrl &url);
+ void setEnvironmentVariableName(const QString &name);
+ void setAddToPath(bool addToPath);
+ bool addToPath() const;
+ void writeToSettings() const;
+
+ QWidget *widget();
+
+
+ QString environmentVariableName() const;
+
+signals:
+ void changed();
+
+private:
+ void updateStatus();
+
+ QWidget *m_widget = nullptr;
+ Utils::PathChooser *m_fileChooser = nullptr;
+ QLabel *m_statusIcon = nullptr;
+ QLabel *m_statusLabel = nullptr;
+
+ const QString m_label;
+ const QString m_defaultPath;
+ const QString m_detectionPath;
+ const QString m_settingsKey;
+
+ QString m_path;
+ QUrl m_downloadUrl;
+ QString m_environmentVariableName;
+ bool m_addToPath = false;
+
+ Status m_status = InvalidPath;
+};
+
+PackageOptions::PackageOptions(const QString &label, const QString &defaultPath,
+ const QString &detectionPath, const QString &settingsKey)
+ : m_label(label)
+ , m_defaultPath(defaultPath)
+ , m_detectionPath(detectionPath)
+ , m_settingsKey(settingsKey)
+{
+ QSettings *s = Core::ICore::settings();
+ s->beginGroup(Constants::SETTINGS_GROUP);
+ m_path = s->value(QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX) + m_settingsKey,
+ m_defaultPath).toString();
+ s->endGroup();
+}
+
+QString PackageOptions::path() const
+{
+ return m_fileChooser->path();
+}
+
+QString PackageOptions::label() const
+{
+ return m_label;
+}
+
+QString PackageOptions::detectionPath() const
+{
+ return m_detectionPath;
+}
+
+QWidget *PackageOptions::widget()
+{
+ if (m_widget)
+ return m_widget;
+
+ m_widget = new QWidget;
+ m_fileChooser = new Utils::PathChooser;
+ QObject::connect(m_fileChooser, &Utils::PathChooser::pathChanged,
+ [this](){
+ updateStatus();
+ emit changed();
+ });
+
+ auto layout = new QGridLayout(m_widget);
+ layout->setContentsMargins(0, 0, 0, 0);
+ m_statusIcon = new QLabel;
+ m_statusIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
+ m_statusIcon->setAlignment(Qt::AlignTop);
+ m_statusLabel = new QLabel;
+ m_statusLabel->setWordWrap(true);
+ m_statusLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+
+ if (!m_downloadUrl.isEmpty()) {
+ auto downLoadButton = new QToolButton;
+ downLoadButton->setIcon(Utils::Icons::DOWNLOAD.icon());
+ downLoadButton->setToolTip(McuSupportOptionsPage::tr("Download from \"%1\"")
+ .arg(m_downloadUrl.toString()));
+ QObject::connect(downLoadButton, &QToolButton::pressed, [this]{
+ QDesktopServices::openUrl(m_downloadUrl);
+ });
+ layout->addWidget(downLoadButton, 0, 2);
+ }
+
+ layout->addWidget(m_fileChooser, 0, 0, 1, 2);
+ layout->addWidget(m_statusIcon, 1, 0);
+ layout->addWidget(m_statusLabel, 1, 1, 1, -1);
+
+ m_fileChooser->setPath(m_path); // Triggers updateStatus() call
+ return m_widget;
+}
+
+PackageOptions::Status PackageOptions::status() const
+{
+ return m_status;
+}
+
+void PackageOptions::setDownloadUrl(const QUrl &url)
+{
+ m_downloadUrl = url;
+}
+
+void PackageOptions::setEnvironmentVariableName(const QString &name)
+{
+ m_environmentVariableName = name;
+}
+
+QString PackageOptions::environmentVariableName() const
+{
+ return m_environmentVariableName;
+}
+
+void PackageOptions::setAddToPath(bool addToPath)
+{
+ m_addToPath = addToPath;
+}
+
+bool PackageOptions::addToPath() const
+{
+ return m_addToPath;
+}
+
+void PackageOptions::writeToSettings() const
+{
+ if (m_path.compare(m_defaultPath) == 0)
+ return;
+ QSettings *s = Core::ICore::settings();
+ s->beginGroup(Constants::SETTINGS_GROUP);
+ s->setValue(QLatin1String(Constants::SETTINGS_KEY_PACKAGE_PREFIX) + m_settingsKey, m_path);
+ s->endGroup();
+}
+
+void PackageOptions::updateStatus()
+{
+ m_path = m_fileChooser->rawPath();
+ const bool validPath = m_fileChooser->isValid();
+ const Utils::FilePath detectionPath = Utils::FilePath::fromString(
+ m_fileChooser->path() + "/" + m_detectionPath);
+ const QString displayDetectionPath = Utils::FilePath::fromString(m_detectionPath).toUserOutput();
+ const bool validPackage = detectionPath.exists();
+
+ m_status = validPath ? (validPackage ? ValidPackage : ValidPathInvalidPackage) : InvalidPath;
+
+ static const QPixmap okIcon = Utils::Icons::OK.pixmap();
+ static const QPixmap notOkIcon = Utils::Icons::BROKEN.pixmap();
+ m_statusIcon->setPixmap(m_status == ValidPackage ? okIcon : notOkIcon);
+
+ QString statusText;
+ switch (m_status) {
+ case ValidPackage:
+ statusText = McuSupportOptionsPage::tr(
+ "Path is valid, \"%1\" was found.").arg(displayDetectionPath);
+ break;
+ case ValidPathInvalidPackage:
+ statusText = McuSupportOptionsPage::tr(
+ "Path exists, but does not contain \"%1\".").arg(displayDetectionPath);
+ break;
+ case InvalidPath:
+ statusText = McuSupportOptionsPage::tr("Path does not exist.");
+ break;
+ }
+ m_statusLabel->setText(statusText);
+}
+
+class BoardOptions : public QObject
+{
+ Q_OBJECT
+
+public:
+ BoardOptions(const QString &model, const QString &toolChainFile,
+ const QVector<PackageOptions *> &packages);
+
+ QString model() const;
+ QString toolChainFile() const;
+ QVector<PackageOptions *> packages() const;
+
+private:
+ const QString m_model;
+ const QString m_toolChainFile;
+ const QVector<PackageOptions*> m_packages;
+};
+
+BoardOptions::BoardOptions(const QString &model, const QString &toolChainFileName,
+ const QVector<PackageOptions*> &packages)
+ : m_model(model)
+ , m_toolChainFile(toolChainFileName)
+ , m_packages(packages)
+{
+}
+
+QString BoardOptions::model() const
+{
+ return m_model;
+}
+
+QString BoardOptions::toolChainFile() const
+{
+ return m_toolChainFile;
+}
+
+QVector<PackageOptions *> BoardOptions::packages() const
+{
+ return m_packages;
+}
+
+class McuSupportOptions : public QObject
+{
+ Q_OBJECT
+
+public:
+ McuSupportOptions(QObject *parent = nullptr);
+ ~McuSupportOptions() override;
+
+ QVector<BoardOptions*> validBoards() const;
+
+ QVector<PackageOptions*> packages;
+ QVector<BoardOptions*> boards;
+ PackageOptions* toolchainPackage = nullptr;
+
+signals:
+ void changed();
+};
+
+McuSupportOptions::McuSupportOptions(QObject *parent)
+ : QObject(parent)
+{
+ auto qulPackage = new PackageOptions(
+ McuSupportOptionsPage::tr("Qt MCU SDK"),
+ QDir::homePath(),
+ Utils::HostOsInfo::withExecutableSuffix("bin/qmltocpp"),
+ "qulSdk");
+ qulPackage->setEnvironmentVariableName("Qul_DIR");
+
+ const QString armGccDefaultPath =
+ Utils::HostOsInfo::isWindowsHost() ?
+ QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles(x86)"))
+ + "/GNU Tools ARM Embedded/"
+ : QString("%{Env:ARMGCC_DIR}");
+ auto armGcc = new PackageOptions(
+ McuSupportOptionsPage::tr("GNU Arm Embedded Toolchain"),
+ armGccDefaultPath,
+ Utils::HostOsInfo::withExecutableSuffix("bin/arm-none-eabi-g++"),
+ Constants::SETTINGS_KEY_PACKAGE_ARMGCC);
+ armGcc->setDownloadUrl(
+ QUrl::fromUserInput("https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads"));
+ armGcc->setEnvironmentVariableName("ARMGCC_DIR");
+ toolchainPackage = armGcc;
+
+ auto stm32CubeFwF7Sdk = new PackageOptions(
+ McuSupportOptionsPage::tr("STM32Cube SDK"),
+ "%{Env:STM32Cube_FW_F7_SDK_PATH}",
+ "Drivers/STM32F7xx_HAL_Driver",
+ "stm32CubeFwF7Sdk");
+ stm32CubeFwF7Sdk->setDownloadUrl(
+ QUrl::fromUserInput("https://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-mcu-packages/stm32cubef7.html"));
+ stm32CubeFwF7Sdk->setEnvironmentVariableName("STM32Cube_FW_F7_SDK_PATH");
+
+ const QString stm32CubeProgrammerDefaultPath =
+ Utils::HostOsInfo::isWindowsHost() ?
+ QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles"))
+ + "/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
+ : QDir::homePath();
+ auto stm32CubeProgrammer = new PackageOptions(
+ McuSupportOptionsPage::tr("STM32CubeProgrammer"),
+ stm32CubeProgrammerDefaultPath,
+ "bin",
+ "stm32CubeProgrammer");
+ stm32CubeProgrammer->setDownloadUrl(
+ QUrl::fromUserInput("https://www.st.com/en/development-tools/stm32cubeprog.html"));
+ stm32CubeProgrammer->setAddToPath(true);
+
+ auto evkbImxrt1050Sdk = new PackageOptions(
+ McuSupportOptionsPage::tr("NXP EVKB-IMXRT1050 SDK"),
+ "%{Env:EVKB_IMXRT1050_SDK_PATH}",
+ "EVKB-IMXRT1050_manifest_v3_5.xml",
+ "evkbImxrt1050Sdk");
+ evkbImxrt1050Sdk->setDownloadUrl(
+ QUrl::fromUserInput("https://mcuxpresso.nxp.com/en/welcome"));
+
+ const QString seggerJLinkDefaultPath =
+ Utils::HostOsInfo::isWindowsHost() ?
+ QDir::fromNativeSeparators(qEnvironmentVariable("ProgramFiles")) + "/SEGGER/JLink"
+ : QString("%{Env:SEGGER_JLINK_SOFTWARE_AND_DOCUMENTATION_PATH}");
+ auto seggerJLink = new PackageOptions(
+ McuSupportOptionsPage::tr("SEGGER JLink"),
+ seggerJLinkDefaultPath,
+ Utils::HostOsInfo::withExecutableSuffix("JLink"),
+ "seggerJLink");
+ seggerJLink->setDownloadUrl(
+ QUrl::fromUserInput("https://www.segger.com/downloads/jlink"));
+
+ auto stmPackages = {armGcc, stm32CubeFwF7Sdk, stm32CubeProgrammer, qulPackage};
+ auto nxpPackages = {armGcc, evkbImxrt1050Sdk, seggerJLink, qulPackage};
+ packages = {armGcc, stm32CubeFwF7Sdk, stm32CubeProgrammer,
+ evkbImxrt1050Sdk, seggerJLink,
+ qulPackage};
+
+ boards.append(new BoardOptions(
+ "stm32f7508", "CMake/stm32f7508-discovery.cmake", stmPackages));
+ boards.append(new BoardOptions(
+ "stm32f769i", "CMake/stm32f769i-discovery.cmake", stmPackages));
+ boards.append(new BoardOptions(
+ "evkbimxrt1050", "CMake/evkbimxrt1050-toolchain.cmake", nxpPackages));
+
+ for (auto package : packages)
+ connect(package, &PackageOptions::changed, [this](){
+ emit changed();
+ });
+}
+
+McuSupportOptions::~McuSupportOptions()
+{
+ qDeleteAll(packages);
+ packages.clear();
+ qDeleteAll(boards);
+ boards.clear();
+}
+
+QVector<BoardOptions *> McuSupportOptions::validBoards() const
+{
+ return Utils::filtered(boards, [](BoardOptions *board){
+ return !Utils::anyOf(board->packages(), [](PackageOptions *package){
+ return package->status() != PackageOptions::ValidPackage;});
+ });
+}
+
+class McuSupportOptionsWidget : public QWidget
+{
+public:
+ McuSupportOptionsWidget(const McuSupportOptions *options, QWidget *parent = nullptr);
+
+ void updateStatus();
+ void showBoardPackages(int boardIndex);
+
+private:
+ QString m_armGccPath;
+ const McuSupportOptions *m_options;
+ int m_currentBoardIndex = 0;
+ QMap <PackageOptions*, QWidget*> m_packageWidgets;
+ QMap <BoardOptions*, QWidget*> m_boardPacketWidgets;
+ QFormLayout *m_packagesLayout = nullptr;
+ QLabel *m_statusLabel = nullptr;
+};
+
+McuSupportOptionsWidget::McuSupportOptionsWidget(const McuSupportOptions *options, QWidget *parent)
+ : QWidget(parent)
+ , m_options(options)
+{
+ auto mainLayout = new QVBoxLayout(this);
+
+ auto boardChooserlayout = new QHBoxLayout;
+ auto boardChooserLabel = new QLabel(McuSupportOptionsPage::tr("MCU board:"));
+ boardChooserlayout->addWidget(boardChooserLabel);
+ auto boardComboBox = new QComboBox;
+ boardChooserLabel->setBuddy(boardComboBox);
+ boardChooserLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
+ boardComboBox->addItems(Utils::transform<QStringList>(m_options->boards, [](BoardOptions *b){
+ return b->model();}));
+ boardChooserlayout->addWidget(boardComboBox);
+ mainLayout->addLayout(boardChooserlayout);
+
+ auto m_packagesGroupBox = new QGroupBox(McuSupportOptionsPage::tr("Packages"));
+ mainLayout->addWidget(m_packagesGroupBox);
+ m_packagesLayout = new QFormLayout;
+ m_packagesGroupBox->setLayout(m_packagesLayout);
+
+ m_statusLabel = new QLabel;
+ mainLayout->addWidget(m_statusLabel);
+ m_statusLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ m_statusLabel->setWordWrap(true);
+ m_statusLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+
+ connect(options, &McuSupportOptions::changed, this, &McuSupportOptionsWidget::updateStatus);
+ connect(boardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &McuSupportOptionsWidget::showBoardPackages);
+
+ showBoardPackages(m_currentBoardIndex);
+}
+
+static QString ulOfBoardModels(const QVector<BoardOptions*> &validBoards)
+{
+ return "<ul><li>"
+ + Utils::transform<QStringList>(validBoards,[](BoardOptions* board)
+ {return board->model();}).join("</li><li>")
+ + "</li></ul>";
+}
+
+void McuSupportOptionsWidget::updateStatus()
+{
+ const QVector<BoardOptions*> validBoards = m_options->validBoards();
+ m_statusLabel->setText(validBoards.isEmpty()
+ ? McuSupportOptionsPage::tr("No devices and kits can currently be generated. "
+ "Select a board and provide the package paths. "
+ "Afterwards, press Apply to generate device and kit for "
+ "your board.")
+ : McuSupportOptionsPage::tr("Devices and kits for the following boards can be generated: "
+ "%1 "
+ "Press Apply to generate device and kit for "
+ "your board.").arg(ulOfBoardModels(validBoards)));
+}
+
+void McuSupportOptionsWidget::showBoardPackages(int boardIndex)
+{
+ while (m_packagesLayout->rowCount() > 0) {
+ QFormLayout::TakeRowResult row = m_packagesLayout->takeRow(0);
+ row.labelItem->widget()->hide();
+ row.fieldItem->widget()->hide();
+ }
+
+ const BoardOptions *currentBoard = m_options->boards.at(boardIndex);
+
+ for (auto package : m_options->packages) {
+ QWidget *packageWidget = package->widget();
+ if (!currentBoard->packages().contains(package))
+ continue;
+ m_packagesLayout->addRow(package->label(), packageWidget);
+ packageWidget->show();
+ }
+}
+
+McuSupportOptionsPage::McuSupportOptionsPage(QObject* parent)
+ : Core::IOptionsPage(parent)
+{
+ setId(Core::Id(Constants::SETTINGS_ID));
+ setDisplayName(tr("MCU"));
+ setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
+}
+
+QWidget* McuSupportOptionsPage::widget()
+{
+ if (!m_options)
+ m_options = new McuSupportOptions(this);
+ if (!m_widget)
+ m_widget = new McuSupportOptionsWidget(m_options);
+ return m_widget;
+}
+
+static ProjectExplorer::ToolChain* armGccToolchain(const Utils::FilePath &path, Core::Id language)
+{
+ using namespace ProjectExplorer;
+
+ ToolChain *toolChain = ToolChainManager::toolChain([&path, language](const ToolChain *t){
+ return t->compilerCommand() == path && t->language() == language;
+ });
+ if (!toolChain) {
+ ToolChainFactory *gccFactory =
+ Utils::findOrDefault(ToolChainFactory::allToolChainFactories(), [](ToolChainFactory *f){
+ return f->supportedToolChainType() == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID;
+ });
+ if (gccFactory) {
+ const QList<ToolChain*> detected = gccFactory->detectForImport({path, language});
+ if (!detected.isEmpty()) {
+ toolChain = detected.first();
+ toolChain->setDetection(ToolChain::ManualDetection);
+ toolChain->setDisplayName("Arm GCC");
+ ToolChainManager::registerToolChain(toolChain);
+ }
+ }
+ }
+
+ return toolChain;
+}
+
+static void setKitProperties(ProjectExplorer::Kit *k, const BoardOptions* board)
+{
+ using namespace ProjectExplorer;
+
+ k->setUnexpandedDisplayName("Qt MCU - " + board->model());
+ k->setValue(Constants::KIT_BOARD_MODEL_KEY, board->model());
+ k->setAutoDetected(false);
+ k->setIrrelevantAspects({
+ SysRootKitAspect::id(),
+ "QtSupport.QtInformation" // QtKitAspect::id()
+ });
+}
+
+static void setKitToolchains(ProjectExplorer::Kit *k, const QString &armGccPath)
+{
+ using namespace ProjectExplorer;
+
+ const QString compileNameScheme = Utils::HostOsInfo::withExecutableSuffix(
+ armGccPath + "/bin/arm-none-eabi-%1");
+ ToolChain *cTc = armGccToolchain(
+ Utils::FilePath::fromUserInput(compileNameScheme.arg("gcc")),
+ ProjectExplorer::Constants::C_LANGUAGE_ID);
+ ToolChain *cxxTc = armGccToolchain(
+ Utils::FilePath::fromUserInput(compileNameScheme.arg("g++")),
+ ProjectExplorer::Constants::CXX_LANGUAGE_ID);
+ ToolChainKitAspect::setToolChain(k, cTc);
+ ToolChainKitAspect::setToolChain(k, cxxTc);
+}
+
+static void setKitDevice(ProjectExplorer::Kit *k)
+{
+ using namespace ProjectExplorer;
+
+ DeviceTypeKitAspect::setDeviceTypeId(k, Constants::DEVICE_TYPE);
+}
+
+static void setKitEnvironment(ProjectExplorer::Kit *k, const BoardOptions* board)
+{
+ using namespace ProjectExplorer;
+
+ Utils::EnvironmentItems changes;
+ QStringList pathAdditions;
+ for (auto package : board->packages()) {
+ if (package->addToPath())
+ pathAdditions.append(QDir::toNativeSeparators(package->path()));
+ if (!package->environmentVariableName().isEmpty())
+ changes.append({package->environmentVariableName(),
+ QDir::toNativeSeparators(package->path())});
+ }
+ if (!pathAdditions.isEmpty()) {
+ pathAdditions.append("${Path}");
+ changes.append({"Path", pathAdditions.join(Utils::HostOsInfo::pathListSeparator())});
+ }
+ EnvironmentKitAspect::setEnvironmentChanges(k, changes);
+}
+
+static void setCMakeOptions(ProjectExplorer::Kit *k, const BoardOptions* board)
+{
+ using namespace CMakeProjectManager;
+
+ CMakeConfig config = CMakeConfigurationKitAspect::configuration(k);
+ config.append(CMakeConfigItem("CMAKE_TOOLCHAIN_FILE",
+ ("%{CurrentBuild:Env:Qul_DIR}/" +
+ board->toolChainFile()).toUtf8()));
+ CMakeConfigurationKitAspect::setConfiguration(k, config);
+}
+
+static ProjectExplorer::Kit* boardKit(const BoardOptions* board, const QString &armGccPath)
+{
+ using namespace ProjectExplorer;
+
+ Kit *kit = KitManager::kit([board](const Kit *k){
+ return board->model() == k->value(Constants::KIT_BOARD_MODEL_KEY).toString();
+ });
+ if (!kit) {
+ const auto init = [board, &armGccPath](Kit *k) {
+ KitGuard kitGuard(k);
+
+ setKitProperties(k, board);
+ setKitToolchains(k, armGccPath);
+ setKitDevice(k);
+ setKitEnvironment(k, board);
+ setCMakeOptions(k, board);
+
+ k->setup();
+ k->fix();
+ };
+ kit = KitManager::registerKit(init);
+ }
+ return kit;
+}
+
+void McuSupportOptionsPage::apply()
+{
+ for (auto package : m_options->packages)
+ package->writeToSettings();
+
+ QTC_ASSERT(m_options->toolchainPackage, return);
+
+ const QVector<BoardOptions*> validBoards = m_options->validBoards();
+
+ using namespace ProjectExplorer;
+
+ for (auto board : validBoards) {
+ Kit *kit = boardKit(board, m_options->toolchainPackage->path());
+ }
+}
+
+void McuSupportOptionsPage::finish()
+{
+ delete m_options;
+ m_options = nullptr;
+ delete m_widget;
+}
+
+} // Internal
+} // McuSupport
+
+#include "mcusupportoptionspage.moc"
diff --git a/src/plugins/mcusupport/mcusupportoptionspage.h b/src/plugins/mcusupport/mcusupportoptionspage.h
new file mode 100644
index 00000000000..6d92142e005
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportoptionspage.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
+** Contact: BlackBerry (qt@blackberry.com)
+**
+** 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 <coreplugin/dialogs/ioptionspage.h>
+
+#include <QPointer>
+
+namespace McuSupport {
+namespace Internal {
+
+class McuSupportOptionsPage : public Core::IOptionsPage
+{
+ Q_OBJECT
+
+public:
+ explicit McuSupportOptionsPage(QObject *parent = nullptr);
+ QWidget *widget() override;
+ void apply() override;
+ void finish() override;
+
+private:
+ QPointer<class McuSupportOptionsWidget> m_widget;
+ class McuSupportOptions *m_options = nullptr;
+};
+
+} // namespace Internal
+} // namespace McuSupport
diff --git a/src/plugins/mcusupport/mcusupportplugin.cpp b/src/plugins/mcusupport/mcusupportplugin.cpp
new file mode 100644
index 00000000000..68ec688c5f2
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportplugin.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "mcusupportplugin.h"
+#include "mcusupportconstants.h"
+#include "mcusupportdevice.h"
+#include "mcusupportoptionspage.h"
+#include "mcusupportrunconfiguration.h"
+
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/icontext.h>
+#include <coreplugin/icore.h>
+
+#include <projectexplorer/devicesupport/devicemanager.h>
+#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
+
+using namespace ProjectExplorer;
+
+namespace McuSupport {
+namespace Internal {
+
+class McuSupportPluginPrivate
+{
+public:
+ McuSupportDeviceFactory deviceFactory;
+ EmrunRunConfigurationFactory emrunRunConfigurationFactory;
+ RunWorkerFactory emrunRunWorkerFactory{
+ makeFlashAndRunWorker(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {Constants::RUNCONFIGURATION}
+ };
+ McuSupportOptionsPage optionsPage;
+};
+
+static McuSupportPluginPrivate *dd = nullptr;
+
+McuSupportPlugin::McuSupportPlugin()
+{
+ setObjectName("McuSupportPlugin");
+}
+
+McuSupportPlugin::~McuSupportPlugin()
+{
+ delete dd;
+ dd = nullptr;
+}
+
+bool McuSupportPlugin::initialize(const QStringList& arguments, QString* errorString)
+{
+ Q_UNUSED(arguments)
+ Q_UNUSED(errorString)
+
+ dd = new McuSupportPluginPrivate;
+
+ ProjectExplorer::JsonWizardFactory::addWizardPath(
+ Utils::FilePath::fromString(":/mcusupport/wizards/"));
+
+ return true;
+}
+
+void McuSupportPlugin::extensionsInitialized()
+{
+ ProjectExplorer::DeviceManager::instance()->addDevice(McuSupportDevice::create());
+}
+
+} // namespace Internal
+} // namespace McuSupport
diff --git a/src/plugins/mcusupport/mcusupportplugin.h b/src/plugins/mcusupport/mcusupportplugin.h
new file mode 100644
index 00000000000..9a5def94fbb
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportplugin.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <extensionsystem/iplugin.h>
+
+namespace McuSupport {
+namespace Internal {
+
+class McuSupportPlugin : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "McuSupport.json")
+
+public:
+ McuSupportPlugin();
+ ~McuSupportPlugin() override;
+
+ bool initialize(const QStringList &arguments, QString *errorString) override;
+ void extensionsInitialized() override;
+};
+
+} // namespace Internal
+} // namespace McuSupport
diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.cpp b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp
new file mode 100644
index 00000000000..2e05b9ff50d
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportrunconfiguration.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "mcusupportrunconfiguration.h"
+#include "mcusupportconstants.h"
+
+#include <projectexplorer/projectconfigurationaspects.h>
+#include <projectexplorer/buildconfiguration.h>
+#include <projectexplorer/devicesupport/devicemanager.h>
+#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/runcontrol.h>
+#include <projectexplorer/target.h>
+
+using namespace ProjectExplorer;
+using namespace Utils;
+
+namespace McuSupport {
+namespace Internal {
+
+static CommandLine flashAndRunCommand(Target *target)
+{
+ BuildConfiguration *bc = target->activeBuildConfiguration();
+
+ return CommandLine(bc->environment().searchInPath("cmake"), {});
+}
+
+class FlashAndRunConfiguration : public ProjectExplorer::RunConfiguration
+{
+public:
+ FlashAndRunConfiguration(Target *target, Core::Id id)
+ : RunConfiguration(target, id)
+ {
+ auto effectiveFlashAndRunCall = addAspect<BaseStringAspect>();
+ effectiveFlashAndRunCall->setLabelText(tr("Effective flash and run call:"));
+ effectiveFlashAndRunCall->setDisplayStyle(BaseStringAspect::TextEditDisplay);
+ effectiveFlashAndRunCall->setReadOnly(true);
+ }
+};
+
+class FlashAndRunWorker : public SimpleTargetRunner
+{
+public:
+ FlashAndRunWorker(RunControl *runControl)
+ : SimpleTargetRunner(runControl)
+ {
+ setStarter([this, runControl] {
+ CommandLine cmd = flashAndRunCommand(runControl->target());
+ Runnable r;
+ r.setCommandLine(cmd);
+ SimpleTargetRunner::doStart(r, {});
+ });
+ }
+};
+
+RunWorkerFactory::WorkerCreator makeFlashAndRunWorker()
+{
+ return RunWorkerFactory::make<FlashAndRunWorker>();
+}
+
+EmrunRunConfigurationFactory::EmrunRunConfigurationFactory()
+ : FixedRunConfigurationFactory(FlashAndRunConfiguration::tr("Flash and run"))
+{
+ registerRunConfiguration<FlashAndRunConfiguration>(Constants::RUNCONFIGURATION);
+ addSupportedTargetDeviceType(Constants::DEVICE_TYPE);
+}
+
+} // namespace Internal
+} // namespace McuSupport
diff --git a/src/plugins/mcusupport/mcusupportrunconfiguration.h b/src/plugins/mcusupport/mcusupportrunconfiguration.h
new file mode 100644
index 00000000000..2ab9c65380a
--- /dev/null
+++ b/src/plugins/mcusupport/mcusupportrunconfiguration.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <projectexplorer/runconfiguration.h>
+#include <projectexplorer/runcontrol.h>
+
+namespace McuSupport {
+namespace Internal {
+
+class EmrunRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
+{
+public:
+ EmrunRunConfigurationFactory();
+};
+
+ProjectExplorer::RunWorkerFactory::WorkerCreator makeFlashAndRunWorker();
+
+} // namespace Internal
+} // namespace McuSupport
diff --git a/src/plugins/mcusupport/wizards/application/CMakeLists.txt b/src/plugins/mcusupport/wizards/application/CMakeLists.txt
new file mode 100644
index 00000000000..bc7b4523db0
--- /dev/null
+++ b/src/plugins/mcusupport/wizards/application/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required (VERSION 3.13)
+
+project(%{ProjectName} VERSION 0.0.1 LANGUAGES CXX)
+
+find_package(Qul)
+
+add_executable(%{ProjectName})
+QUL_ADD_QML(%{ProjectName} %{MainQmlFile})
+
+target_link_libraries(%{ProjectName} Qul::QuickUltralite)
diff --git a/src/plugins/mcusupport/wizards/application/main.qml.tpl b/src/plugins/mcusupport/wizards/application/main.qml.tpl
new file mode 100644
index 00000000000..a9098ee8512
--- /dev/null
+++ b/src/plugins/mcusupport/wizards/application/main.qml.tpl
@@ -0,0 +1,13 @@
+pragma main;
+import QtQuick
+
+Rectangle {
+ width: 480
+ height: 272
+
+ Text {
+ anchors.centerIn: parent
+ color: "salmon"
+ text: "Hello World!"
+ }
+}
diff --git a/src/plugins/mcusupport/wizards/application/wizard.json b/src/plugins/mcusupport/wizards/application/wizard.json
new file mode 100644
index 00000000000..4583b48c2ba
--- /dev/null
+++ b/src/plugins/mcusupport/wizards/application/wizard.json
@@ -0,0 +1,58 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject" ],
+ "id": "A.McuSupportApplication",
+ "category": "F.Application",
+ "trDescription": "Creates an Mcu Support application with an empty UI.",
+ "trDisplayName": "Mcu Support Application",
+ "trDisplayCategory": "Application",
+ "icon": "../icon.png",
+ "enabled": true,
+
+ "options":
+ [
+ { "key": "MainQmlFile", "value": "%{ProjectName}.qml" },
+ { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Project Location",
+ "trShortTitle": "Location",
+ "typeId": "Project"
+ },
+ {
+ "trDisplayName": "Kit Selection",
+ "trShortTitle": "Kits",
+ "typeId": "Kits",
+ "enabled": "%{JS: !value('IsSubproject')}",
+ "data": {
+ "projectFilePath": "%{CMakeFile}"
+ }
+ },
+ {
+ "trDisplayName": "Project Management",
+ "trShortTitle": "Summary",
+ "typeId": "Summary"
+ }
+ ],
+ "generators":
+ [
+ {
+ "typeId": "File",
+ "data":
+ [
+ {
+ "source": "CMakeLists.txt",
+ "openAsProject": true
+ },
+ {
+ "source": "main.qml.tpl",
+ "target": "%{ProjectDirectory}/%{MainQmlFile}",
+ "openInEditor": true
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/plugins/mcusupport/wizards/icon.png b/src/plugins/mcusupport/wizards/icon.png
new file mode 100644
index 00000000000..ef9160b74cf
--- /dev/null
+++ b/src/plugins/mcusupport/wizards/icon.png
Binary files differ
diff --git a/src/plugins/mcusupport/wizards/icon@2x.png b/src/plugins/mcusupport/wizards/icon@2x.png
new file mode 100644
index 00000000000..0b1e6f875a2
--- /dev/null
+++ b/src/plugins/mcusupport/wizards/icon@2x.png
Binary files differ
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index ee2b1b5cf71..c07b02b1050 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -62,7 +62,8 @@ SUBDIRS = \
compilationdatabaseprojectmanager \
qmlpreview \
studiowelcome \
- webassembly
+ webassembly \
+ mcusupport
qtHaveModule(serialport) {
SUBDIRS += serialterminal
diff --git a/src/plugins/plugins.qbs b/src/plugins/plugins.qbs
index a048f7b8924..806f2895a19 100644
--- a/src/plugins/plugins.qbs
+++ b/src/plugins/plugins.qbs
@@ -46,6 +46,7 @@ Project {
"ios/ios.qbs",
"languageclient/languageclient.qbs",
"macros/macros.qbs",
+ "mcusupport/mcusupport.qbs",
"mercurial/mercurial.qbs",
"modeleditor/modeleditor.qbs",
"nim/nim.qbs",
diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg
index a846a4e26ee..95e4ce93efb 100644
--- a/src/tools/icons/qtcreatoricons.svg
+++ b/src/tools/icons/qtcreatoricons.svg
@@ -586,6 +586,18 @@
result="composite5"
id="feComposite4162" />
</filter>
+ <filter
+ style="color-interpolation-filters:sRGB;"
+ inkscape:label="Lightness-Contrast"
+ id="filter2749"
+ x="0"
+ y="0"
+ width="1"
+ height="1">
+ <feColorMatrix
+ values="0.66 0 0 0.35 0.0182292 0.02 0.66 0.02 0.35 0.0182292 0.08 0.08 0.66 0.35 0.02 0 0 0 1 0 "
+ id="feColorMatrix2747" />
+ </filter>
</defs>
<sodipodi:namedview
id="base"
@@ -2844,6 +2856,41 @@
transform="translate(169,-74)" />
</g>
<g
+ transform="translate(-245,-78)"
+ id="src/plugins/mcusupport/wizards/icon">
+ <g
+ id="g2653"
+ style="filter:url(#filter2749)">
+ <use
+ style="display:inline"
+ x="0"
+ y="0"
+ xlink:href="#transparentBackgroundRect_60_60"
+ id="use2529"
+ width="100%"
+ height="100%"
+ transform="translate(485,138)" />
+ <use
+ style="stroke-width:0.5"
+ height="100%"
+ width="100%"
+ id="use6254-7"
+ xlink:href="#baremetalchip_big"
+ y="0"
+ x="0"
+ transform="matrix(2,0,0,2,-631,-402)" />
+ <use
+ style="stroke-width:0.5"
+ transform="matrix(2,0,0,2,-514.5,199)"
+ x="0"
+ y="0"
+ xlink:href="#boottoqtscreen"
+ id="use6299-7"
+ width="100%"
+ height="100%" />
+ </g>
+ </g>
+ <g
id="src/plugins/coreplugin/images/settingscategory_core"
transform="translate(-364,-84)">
<use
@@ -9817,52 +9864,55 @@
id="use5913-0-8-1-5-6-8-1"
width="100%"
height="100%" />
- <path
- style="fill:#808080;fill-opacity:1;stroke:#000000;stroke-opacity:1"
- d="m 564.5,351.5 h 13 l 2,2 v 13 l -2,2 h -13 l -2,-2 v -13 z"
- id="rect5155"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccccccccc" />
+ <g
+ id="baremetalchip_big">
+ <path
+ sodipodi:nodetypes="ccccccccc"
+ inkscape:connector-curvature="0"
+ id="rect5155"
+ d="m 564.5,351.5 h 13 l 2,2 v 13 l -2,2 h -13 l -2,-2 v -13 z"
+ style="fill:#808080;stroke:#000000;stroke-width:1" />
+ <g
+ transform="translate(0.5,-4)"
+ id="g5189">
+ <path
+ sodipodi:nodetypes="cccccccccccccccccccc"
+ inkscape:connector-curvature="0"
+ d="m 565.5,352 h 1 v 3 h -1 z m 3,0 h 1 v 3 h -1 z m 3,0 h 1 v 3 h -1 z m 3,0 h 1 v 3 h -1 z"
+ style="color:#000000"
+ id="path5432-0" />
+ </g>
+ <use
+ height="100%"
+ width="100%"
+ transform="matrix(1,0,0,-1,0,720)"
+ id="use5200"
+ xlink:href="#g5189"
+ y="0"
+ x="0" />
+ <use
+ height="100%"
+ width="100%"
+ transform="rotate(90,571,360)"
+ id="use5202"
+ xlink:href="#g5189"
+ y="0"
+ x="0" />
+ <use
+ height="100%"
+ width="100%"
+ transform="rotate(-90,571,360)"
+ id="use5204"
+ xlink:href="#g5189"
+ y="0"
+ x="0" />
+ </g>
<circle
style="fill:#000000"
id="path5159"
cx="566"
cy="365"
r="1.5" />
- <g
- id="g5189"
- transform="translate(0.5,-4)">
- <path
- id="path5432-0"
- style="color:#000000"
- d="m 565.5,352 h 1 v 3 h -1 z m 3,0 h 1 v 3 h -1 z m 3,0 h 1 v 3 h -1 z m 3,0 h 1 v 3 h -1 z"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccccccccccccccccc" />
- </g>
- <use
- x="0"
- y="0"
- xlink:href="#g5189"
- id="use5200"
- transform="matrix(1,0,0,-1,0,720)"
- width="100%"
- height="100%" />
- <use
- x="0"
- y="0"
- xlink:href="#g5189"
- id="use5202"
- transform="rotate(90,571,360)"
- width="100%"
- height="100%" />
- <use
- x="0"
- y="0"
- xlink:href="#g5189"
- id="use5204"
- transform="rotate(-90,571,360)"
- width="100%"
- height="100%" />
<path
id="rect5208-6-6"
style="fill:#000000"
@@ -9881,42 +9931,45 @@
width="100%"
height="100%"
transform="translate(586,-73)" />
- <path
- style="fill:#999999;fill-opacity:1;stroke:#000000;stroke-width:0.5"
- d="m 575.5,367.25 h 6 l 1.25,1.25 v 6 l -1.25,1.25 h -6 l -1.25,-1.25 v -6 z"
- id="rect5492"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccccccccc" />
- <path
- id="rect5494-5"
- style="fill:#4d4d4d"
- d="m 580,365 h 1 v 2 h -1 z m -2,0 h 1 v 2 h -1 z m -2,0 h 1 v 2 h -1 z"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccccccccccccscc" />
- <use
- x="0"
- y="0"
- xlink:href="#rect5494-5"
- id="use5529"
- transform="rotate(90,578.5,371.5)"
- width="100%"
- height="100%" />
- <use
- x="0"
- y="0"
- xlink:href="#rect5494-5"
- id="use5531"
- transform="matrix(1,0,0,-1,0,743)"
- width="100%"
- height="100%" />
- <use
- x="0"
- y="0"
- xlink:href="#rect5494-5"
- id="use5533"
- transform="rotate(-90,578.5,371.5)"
- width="100%"
- height="100%" />
+ <g
+ id="baremetalchip_small">
+ <path
+ sodipodi:nodetypes="ccccccccc"
+ inkscape:connector-curvature="0"
+ id="rect5492"
+ d="m 575.5,367.25 h 6 l 1.25,1.25 v 6 l -1.25,1.25 h -6 l -1.25,-1.25 v -6 z"
+ style="fill:#999999;fill-opacity:1;stroke:#000000;stroke-width:0.5" />
+ <path
+ sodipodi:nodetypes="ccccccccccccscc"
+ inkscape:connector-curvature="0"
+ d="m 580,365 h 1 v 2 h -1 z m -2,0 h 1 v 2 h -1 z m -2,0 h 1 v 2 h -1 z"
+ style="fill:#4d4d4d"
+ id="rect5494-5" />
+ <use
+ height="100%"
+ width="100%"
+ transform="rotate(90,578.5,371.5)"
+ id="use5529"
+ xlink:href="#rect5494-5"
+ y="0"
+ x="0" />
+ <use
+ height="100%"
+ width="100%"
+ transform="matrix(1,0,0,-1,0,743)"
+ id="use5531"
+ xlink:href="#rect5494-5"
+ y="0"
+ x="0" />
+ <use
+ height="100%"
+ width="100%"
+ transform="rotate(-90,578.5,371.5)"
+ id="use5533"
+ xlink:href="#rect5494-5"
+ y="0"
+ x="0" />
+ </g>
<circle
style="fill:#000000"
id="path5159-4"
@@ -10368,6 +10421,59 @@
inkscape:connector-curvature="0" />
</g>
<g
+ transform="translate(-31.75,310.5)"
+ id="src/plugins/mcusupport/images/mcusupportdevice">
+ <use
+ transform="translate(458.75,5.5)"
+ style="display:inline"
+ x="0"
+ y="0"
+ xlink:href="#backgroundRect_32_28"
+ id="use6222"
+ width="100%"
+ height="100%" />
+ <use
+ transform="translate(-54.25,-299.5)"
+ x="0"
+ y="0"
+ xlink:href="#baremetalchip_big"
+ id="use6254"
+ width="100%"
+ height="100%" />
+ <use
+ height="100%"
+ width="100%"
+ id="use6299"
+ xlink:href="#boottoqtscreen"
+ y="0"
+ x="0"
+ transform="translate(4,1)" />
+ </g>
+ <g
+ id="src/plugins/mcusupport/images/mcusupportdevicesmall"
+ transform="translate(-102,27)">
+ <use
+ x="0"
+ y="0"
+ xlink:href="#backgroundRect"
+ id="use6230"
+ width="100%"
+ height="100%"
+ transform="translate(586,-73)" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#baremetalchip_small"
+ id="use6282"
+ width="100%"
+ height="100%" />
+ <path
+ style="fill:none;stroke:#ffffff;stroke-width:0.89999998"
+ inkscape:connector-curvature="0"
+ d="m 579.5,371.5 h 2.5 m -1.48438,-1.54688 -0.0227,2.94133 c 0.002,0.96521 0.83838,0.77673 1.50706,0.60555 m -3.69064,0 1.19887,1.38951 M 577.5,370.5 c 1,0 1,0.28518 1,1.5 0,1.21481 0,1.5 -1,1.5 -1,0 -1,-0.30273 -1,-1.5 0,-1.19726 0,-1.5 1,-1.5 z"
+ id="path6333" />
+ </g>
+ <g
id="src/plugins/winrt/images/winrtdevice"
transform="translate(-206,-74)">
<use