forked from qt-creator/qt-creator
McuSupport: Set ARM debugger in MCU kits
... create one if necessary. Change-Id: I0b89d54429834db7b76be0a76d260152efd1ad03 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
add_qtc_plugin(McuSupport
|
add_qtc_plugin(McuSupport
|
||||||
DEPENDS Qt5::Core
|
DEPENDS Qt5::Core
|
||||||
PLUGIN_DEPENDS Core ProjectExplorer CMakeProjectManager
|
PLUGIN_DEPENDS Core ProjectExplorer Debugger CMakeProjectManager
|
||||||
SOURCES
|
SOURCES
|
||||||
mcusupport.qrc
|
mcusupport.qrc
|
||||||
mcusupport_global.h
|
mcusupport_global.h
|
||||||
|
@@ -9,8 +9,8 @@ QtcPlugin {
|
|||||||
|
|
||||||
Depends { name: "Core" }
|
Depends { name: "Core" }
|
||||||
Depends { name: "ProjectExplorer" }
|
Depends { name: "ProjectExplorer" }
|
||||||
|
Depends { name: "Debugger" }
|
||||||
Depends { name: "CMakeProjectManager" }
|
Depends { name: "CMakeProjectManager" }
|
||||||
Depends { name: "QtSupport" }
|
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
"mcusupport.qrc",
|
"mcusupport.qrc",
|
||||||
|
@@ -7,4 +7,5 @@ QTC_LIB_DEPENDS += \
|
|||||||
QTC_PLUGIN_DEPENDS += \
|
QTC_PLUGIN_DEPENDS += \
|
||||||
coreplugin \
|
coreplugin \
|
||||||
projectexplorer \
|
projectexplorer \
|
||||||
|
debugger \
|
||||||
cmakeprojectmanager
|
cmakeprojectmanager
|
||||||
|
@@ -28,6 +28,9 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <cmakeprojectmanager/cmakekitinformation.h>
|
#include <cmakeprojectmanager/cmakekitinformation.h>
|
||||||
|
#include <debugger/debuggeritem.h>
|
||||||
|
#include <debugger/debuggeritemmanager.h>
|
||||||
|
#include <debugger/debuggerkitinformation.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
@@ -623,6 +626,27 @@ static void setKitToolchains(ProjectExplorer::Kit *k, const QString &armGccPath)
|
|||||||
ToolChainKitAspect::setToolChain(k, cxxTc);
|
ToolChainKitAspect::setToolChain(k, cxxTc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setKitDebugger(ProjectExplorer::Kit *k, const QString &armGccPath)
|
||||||
|
{
|
||||||
|
using namespace Debugger;
|
||||||
|
|
||||||
|
const Utils::FilePath command = Utils::FilePath::fromUserInput(
|
||||||
|
Utils::HostOsInfo::withExecutableSuffix(armGccPath + "/bin/arm-none-eabi-gdb-py"));
|
||||||
|
const DebuggerItem *debugger = DebuggerItemManager::findByCommand(command);
|
||||||
|
QVariant debuggerId;
|
||||||
|
if (!debugger) {
|
||||||
|
DebuggerItem newDebugger;
|
||||||
|
newDebugger.setCommand(command);
|
||||||
|
newDebugger.setUnexpandedDisplayName(
|
||||||
|
McuSupportOptionsPage::tr("Arm GDB at %1").arg(command.toUserOutput()));
|
||||||
|
debuggerId = DebuggerItemManager::registerDebugger(newDebugger);
|
||||||
|
} else {
|
||||||
|
debuggerId = debugger->id();
|
||||||
|
}
|
||||||
|
|
||||||
|
DebuggerKitAspect::setDebugger(k, debuggerId);
|
||||||
|
}
|
||||||
|
|
||||||
static void setKitDevice(ProjectExplorer::Kit *k)
|
static void setKitDevice(ProjectExplorer::Kit *k)
|
||||||
{
|
{
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -650,7 +674,7 @@ static void setKitEnvironment(ProjectExplorer::Kit *k, const BoardOptions* board
|
|||||||
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
|
EnvironmentKitAspect::setEnvironmentChanges(k, changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setCMakeOptions(ProjectExplorer::Kit *k, const BoardOptions* board)
|
static void setKitCMakeOptions(ProjectExplorer::Kit *k, const BoardOptions* board)
|
||||||
{
|
{
|
||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
|
|
||||||
@@ -674,9 +698,10 @@ static ProjectExplorer::Kit* boardKit(const BoardOptions* board, const QString &
|
|||||||
|
|
||||||
setKitProperties(k, board);
|
setKitProperties(k, board);
|
||||||
setKitToolchains(k, armGccPath);
|
setKitToolchains(k, armGccPath);
|
||||||
|
setKitDebugger(k, armGccPath);
|
||||||
setKitDevice(k);
|
setKitDevice(k);
|
||||||
setKitEnvironment(k, board);
|
setKitEnvironment(k, board);
|
||||||
setCMakeOptions(k, board);
|
setKitCMakeOptions(k, board);
|
||||||
|
|
||||||
k->setup();
|
k->setup();
|
||||||
k->fix();
|
k->fix();
|
||||||
|
Reference in New Issue
Block a user