BareMetal: Long live support for KEIL uVision v5.x debugger

This patch adds debugger integration from the KEIL uVision IDE:

* http://www2.keil.com/mdk5/uvision/

This IDE has the uVision Socket Interface (UVSC) that allows
to the applications configuration, building and debugging:

* http://www.keil.com/appnotes/docs/apnt_198.asp

Besides, it provides a binary client libraries for Windows, which
are implements some API which we are use in this patch.

Currently implemented the following features:

* Enumeration of a stack frames.
* Enumeration of a threads (tasks).
* Registers view (read/write).
* Local variables view (read/write).
* Watchers view (read/write).
* Disassembler view.
* Current location marker.
* Break-points.
* Step-in.
* Step-over.
* Step-out.
* Step-by-instruction.
* Start/stop/pause/continue debugger.
* Auto-detection for the installed uVision instances (as debuggers).
* Wizard for choosing and configuring of the UVSC debug providers.

At this moment added support only for the 32-bit ARM devices, provided
by the STMicroelectronics:

https://www.st.com/en/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus.html

For this are implemented two debugger providers:

* Simulator - allow to simulate the target device.
* ST-Link v2 - it is a HW debugger.

This implementation tested only with the QBS using the following
target boards:

* NUCLEO-F767ZI (based on STM32F767ZIT6 MCU).
* STM32F4DISCOVERY (based on STM32F407VG MCU).
* STM32F103x (based on STM32F103C8T6 MCU).

A more detailed information about this patch can be found in a
bug-tracker.

Fixes: QTCREATORBUG-23426
Change-Id: Ie36a1f7430b56c33d6665cc35e43fe9bd95d28f1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Denis Shienkov
2020-01-24 17:08:27 +03:00
parent 13c6e5df28
commit 96c1fbcd0a
60 changed files with 8992 additions and 16 deletions

View File

@@ -92,6 +92,7 @@ public:
void readDebuggers(const FilePath &fileName, bool isSystem);
void autoDetectCdbDebuggers();
void autoDetectGdbOrLldbDebuggers();
void autoDetectUvscDebuggers();
QString uniqueDisplayName(const QString &base);
PersistentSettingsWriter m_writer;
@@ -788,6 +789,47 @@ void DebuggerItemManagerPrivate::autoDetectGdbOrLldbDebuggers()
}
}
void DebuggerItemManagerPrivate::autoDetectUvscDebuggers()
{
if (!HostOsInfo::isWindowsHost())
return;
// Registry token for the "KEIL uVision" instance.
static const char kRegistryToken[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" \
"Windows\\CurrentVersion\\Uninstall\\Keil \u00B5Vision4";
QSettings registry(QLatin1String(kRegistryToken), QSettings::NativeFormat);
const auto productGroups = registry.childGroups();
for (const QString &productKey : productGroups) {
if (!productKey.startsWith("App"))
continue;
registry.beginGroup(productKey);
const QDir rootPath(registry.value("Directory").toString());
registry.endGroup();
const FilePath uVision = FilePath::fromString(
rootPath.absoluteFilePath("UV4/UV4.exe"));
if (!uVision.exists())
continue;
if (DebuggerItemManager::findByCommand(uVision))
continue;
QString errorMsg;
const QString uVisionVersion = winGetDLLVersion(
WinDLLFileVersion, uVision.toString(), &errorMsg);
DebuggerItem item;
item.createId();
item.setAutoDetected(true);
item.setCommand(uVision);
item.setVersion(uVisionVersion);
item.setEngineType(UvscEngineType);
item.setUnexpandedDisplayName(
uniqueDisplayName(tr("Auto-detected uVision at %1")
.arg(uVision.toUserOutput())));
m_model->addDebugger(item);
}
}
static FilePath userSettingsFileName()
{
return FilePath::fromString(ICore::userResourcePath() + DEBUGGER_FILENAME);
@@ -894,6 +936,7 @@ void DebuggerItemManagerPrivate::restoreDebuggers()
// Auto detect current.
autoDetectCdbDebuggers();
autoDetectGdbOrLldbDebuggers();
autoDetectUvscDebuggers();
}
void DebuggerItemManagerPrivate::saveDebuggers()