forked from qt-creator/qt-creator
BareMetal: Add support for Nordic Semiconductor devices in UVSC provider
This patch adds support for Nordic nRFx ARM devices family. Tested with J-Link debugger using the PCA10040 development board which contains nRF52832 chip. Change-Id: Iabcdd1c9678b631b58c56bf067f400324ec1915f Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -99,26 +99,31 @@ static QString buildAdapterOptions(const JLinkUvscAdapterOptions &opts)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString buildDllRegistryKey(const DriverSelection &driver)
|
|
||||||
{
|
|
||||||
const QFileInfo fi(driver.dll);
|
|
||||||
return fi.baseName();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString buildDllRegistryName(const DeviceSelection &device,
|
static QString buildDllRegistryName(const DeviceSelection &device,
|
||||||
const JLinkUvscAdapterOptions &opts)
|
const JLinkUvscAdapterOptions &opts)
|
||||||
{
|
{
|
||||||
if (device.algorithmIndex < 0 || device.algorithmIndex >= int(device.algorithms.size()))
|
if (device.algorithmIndex < 0 || device.algorithmIndex >= int(device.algorithms.size()))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const DeviceSelection::Algorithm algorithm = device.algorithms.at(device.algorithmIndex);
|
const DeviceSelection::Algorithm algorithm = device.algorithms.at(device.algorithmIndex);
|
||||||
const QFileInfo path(algorithm.path);
|
const QFileInfo path(algorithm.path);
|
||||||
const QString start = algorithm.start.startsWith("0x") ? algorithm.start.mid(2)
|
const QString flashStart = UvscServerProvider::adjustFlashAlgorithmProperty(algorithm.flashStart);
|
||||||
: algorithm.start;
|
const QString flashSize = UvscServerProvider::adjustFlashAlgorithmProperty(algorithm.flashSize);
|
||||||
const QString size = algorithm.size.startsWith("0x") ? algorithm.size.mid(2)
|
|
||||||
: algorithm.size;
|
|
||||||
const QString adaptOpts = buildAdapterOptions(opts);
|
const QString adaptOpts = buildAdapterOptions(opts);
|
||||||
return QStringLiteral(" %6 -FN1 -FF0%1 -FS0%2 -FL0%3 -FP0($$Device:%4$%5)")
|
|
||||||
.arg(path.fileName(), start, size, device.name, path.filePath(), adaptOpts);
|
QString content = QStringLiteral(" %6 -FN1 -FF0%1 -FS0%2 -FL0%3 -FP0($$Device:%4$%5)")
|
||||||
|
.arg(path.fileName(), flashStart, flashSize, device.name, path.filePath(), adaptOpts);
|
||||||
|
|
||||||
|
if (!algorithm.ramStart.isEmpty()) {
|
||||||
|
const QString ramStart = UvscServerProvider::adjustFlashAlgorithmProperty(algorithm.ramStart);
|
||||||
|
content += QStringLiteral(" -FD%1").arg(ramStart);
|
||||||
|
}
|
||||||
|
if (!algorithm.ramSize.isEmpty()) {
|
||||||
|
const QString ramSize = UvscServerProvider::adjustFlashAlgorithmProperty(algorithm.ramSize);
|
||||||
|
content += QStringLiteral(" -FC%1").arg(ramSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
// JLinkUvProjectOptions
|
// JLinkUvProjectOptions
|
||||||
@@ -138,7 +143,7 @@ public:
|
|||||||
const auto dllRegistry = m_targetOption->appendPropertyGroup("TargetDriverDllRegistry");
|
const auto dllRegistry = m_targetOption->appendPropertyGroup("TargetDriverDllRegistry");
|
||||||
const auto setRegEntry = dllRegistry->appendPropertyGroup("SetRegEntry");
|
const auto setRegEntry = dllRegistry->appendPropertyGroup("SetRegEntry");
|
||||||
setRegEntry->appendProperty("Number", 0);
|
setRegEntry->appendProperty("Number", 0);
|
||||||
const QString key = buildDllRegistryKey(driver);
|
const QString key = UvscServerProvider::buildDllRegistryKey(driver);
|
||||||
setRegEntry->appendProperty("Key", key);
|
setRegEntry->appendProperty("Key", key);
|
||||||
const QString name = buildDllRegistryName(device, provider->m_adapterOpts);
|
const QString name = buildDllRegistryName(device, provider->m_adapterOpts);
|
||||||
setRegEntry->appendProperty("Name", name);
|
setRegEntry->appendProperty("Name", name);
|
||||||
|
@@ -68,12 +68,6 @@ static QString buildAdapterOptions(const StLinkUvscAdapterOptions &opts)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString buildDllRegistryKey(const DriverSelection &driver)
|
|
||||||
{
|
|
||||||
const QFileInfo fi(driver.dll);
|
|
||||||
return fi.baseName();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString buildDllRegistryName(const DeviceSelection &device,
|
static QString buildDllRegistryName(const DeviceSelection &device,
|
||||||
const StLinkUvscAdapterOptions &opts)
|
const StLinkUvscAdapterOptions &opts)
|
||||||
{
|
{
|
||||||
@@ -81,13 +75,11 @@ static QString buildDllRegistryName(const DeviceSelection &device,
|
|||||||
return {};
|
return {};
|
||||||
const DeviceSelection::Algorithm algorithm = device.algorithms.at(device.algorithmIndex);
|
const DeviceSelection::Algorithm algorithm = device.algorithms.at(device.algorithmIndex);
|
||||||
const QFileInfo path(algorithm.path);
|
const QFileInfo path(algorithm.path);
|
||||||
const QString start = algorithm.start.startsWith("0x") ? algorithm.start.mid(2)
|
const QString flashStart = UvscServerProvider::adjustFlashAlgorithmProperty(algorithm.flashStart);
|
||||||
: algorithm.start;
|
const QString flashSize = UvscServerProvider::adjustFlashAlgorithmProperty(algorithm.flashSize);
|
||||||
const QString size = algorithm.size.startsWith("0x") ? algorithm.size.mid(2)
|
|
||||||
: algorithm.size;
|
|
||||||
const QString adaptOpts = buildAdapterOptions(opts);
|
const QString adaptOpts = buildAdapterOptions(opts);
|
||||||
return QStringLiteral(" %6 -FN1 -FF0%1 -FS0%2 -FL0%3 -FP0($$Device:%4$%5)")
|
return QStringLiteral(" %6 -FN1 -FF0%1 -FS0%2 -FL0%3 -FP0($$Device:%4$%5)")
|
||||||
.arg(path.fileName(), start, size, device.name, path.filePath(), adaptOpts);
|
.arg(path.fileName(), flashStart, flashSize, device.name, path.filePath(), adaptOpts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// StLinkUvProjectOptions
|
// StLinkUvProjectOptions
|
||||||
@@ -107,7 +99,7 @@ public:
|
|||||||
const auto dllRegistry = m_targetOption->appendPropertyGroup("TargetDriverDllRegistry");
|
const auto dllRegistry = m_targetOption->appendPropertyGroup("TargetDriverDllRegistry");
|
||||||
const auto setRegEntry = dllRegistry->appendPropertyGroup("SetRegEntry");
|
const auto setRegEntry = dllRegistry->appendPropertyGroup("SetRegEntry");
|
||||||
setRegEntry->appendProperty("Number", 0);
|
setRegEntry->appendProperty("Number", 0);
|
||||||
const QString key = buildDllRegistryKey(driver);
|
const QString key = UvscServerProvider::buildDllRegistryKey(driver);
|
||||||
setRegEntry->appendProperty("Key", key);
|
setRegEntry->appendProperty("Key", key);
|
||||||
const QString name = buildDllRegistryName(device, provider->m_adapterOpts);
|
const QString name = buildDllRegistryName(device, provider->m_adapterOpts);
|
||||||
setRegEntry->appendProperty("Name", name);
|
setRegEntry->appendProperty("Name", name);
|
||||||
|
@@ -66,6 +66,17 @@ constexpr int defaultPortNumber = 5101;
|
|||||||
|
|
||||||
// UvscServerProvider
|
// UvscServerProvider
|
||||||
|
|
||||||
|
QString UvscServerProvider::buildDllRegistryKey(const DriverSelection &driver)
|
||||||
|
{
|
||||||
|
const QFileInfo fi(driver.dll);
|
||||||
|
return fi.baseName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString UvscServerProvider::adjustFlashAlgorithmProperty(const QString &property)
|
||||||
|
{
|
||||||
|
return property.startsWith("0x") ? property.mid(2) : property;
|
||||||
|
}
|
||||||
|
|
||||||
UvscServerProvider::UvscServerProvider(const QString &id)
|
UvscServerProvider::UvscServerProvider(const QString &id)
|
||||||
: IDebugServerProvider(id)
|
: IDebugServerProvider(id)
|
||||||
{
|
{
|
||||||
|
@@ -78,6 +78,9 @@ public:
|
|||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
QString channelString() const final;
|
QString channelString() const final;
|
||||||
|
|
||||||
|
static QString buildDllRegistryKey(const Uv::DriverSelection &driver);
|
||||||
|
static QString adjustFlashAlgorithmProperty(const QString &property);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit UvscServerProvider(const QString &id);
|
explicit UvscServerProvider(const QString &id);
|
||||||
explicit UvscServerProvider(const UvscServerProvider &other);
|
explicit UvscServerProvider(const UvscServerProvider &other);
|
||||||
|
@@ -83,6 +83,24 @@ static QStringList findKeilPackFiles(const QString &path)
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QStringList findNordicSemiconductorPackFiles(const QString &path)
|
||||||
|
{
|
||||||
|
QStringList files;
|
||||||
|
QDirIterator it(path, {"*_DeviceFamilyPack"}, QDir::Dirs);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
const QDir dfpDir(it.next());
|
||||||
|
const QFileInfoList entries = dfpDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot,
|
||||||
|
QDir::Name);
|
||||||
|
if (entries.isEmpty())
|
||||||
|
continue;
|
||||||
|
QDirIterator fit(entries.last().absoluteFilePath(), {"*.pdsc"},
|
||||||
|
QDir::Files | QDir::NoSymLinks);
|
||||||
|
while (fit.hasNext())
|
||||||
|
files.push_back(fit.next());
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
static void fillElementProperty(QXmlStreamReader &in, QString &prop)
|
static void fillElementProperty(QXmlStreamReader &in, QString &prop)
|
||||||
{
|
{
|
||||||
prop = in.readElementText().trimmed();
|
prop = in.readElementText().trimmed();
|
||||||
@@ -115,8 +133,10 @@ static void fillAlgorithms(QXmlStreamReader &in, DeviceSelection::Algorithms &al
|
|||||||
in.skipCurrentElement();
|
in.skipCurrentElement();
|
||||||
DeviceSelection::Algorithm algorithm;
|
DeviceSelection::Algorithm algorithm;
|
||||||
algorithm.path = attrs.value("name").toString();
|
algorithm.path = attrs.value("name").toString();
|
||||||
algorithm.start = attrs.value("start").toString();
|
algorithm.flashStart = attrs.value("start").toString();
|
||||||
algorithm.size = attrs.value("size").toString();
|
algorithm.flashSize = attrs.value("size").toString();
|
||||||
|
algorithm.ramStart = attrs.value("RAMstart").toString();
|
||||||
|
algorithm.ramSize = attrs.value("RAMsize").toString();
|
||||||
algorithms.push_back(algorithm);
|
algorithms.push_back(algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,11 +226,13 @@ void DeviceSelectionModel::fillAllPacks(const FilePath &toolsIniFile)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QStringList allPackFiles;
|
QStringList allPackFiles;
|
||||||
QDirIterator it(packsPath, {"Keil"}, QDir::Dirs | QDir::NoDotAndDotDot);
|
QDirIterator it(packsPath, {"Keil", "NordicSemiconductor"}, QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
const QString path = it.next();
|
const QString path = it.next();
|
||||||
if (path.endsWith("/Keil"))
|
if (path.endsWith("/Keil"))
|
||||||
allPackFiles << findKeilPackFiles(path);
|
allPackFiles << findKeilPackFiles(path);
|
||||||
|
else if (path.endsWith("/NordicSemiconductor"))
|
||||||
|
allPackFiles << findNordicSemiconductorPackFiles(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allPackFiles.isEmpty())
|
if (allPackFiles.isEmpty())
|
||||||
@@ -277,6 +299,8 @@ void DeviceSelectionModel::parseFamily(QXmlStreamReader &in, DeviceSelectionItem
|
|||||||
const QStringRef elementName = in.name();
|
const QStringRef elementName = in.name();
|
||||||
if (elementName == "processor") {
|
if (elementName == "processor") {
|
||||||
fillCpu(in, child->cpu);
|
fillCpu(in, child->cpu);
|
||||||
|
} else if (elementName == "algorithm") {
|
||||||
|
fillAlgorithms(in, child->algorithms);
|
||||||
} else if (elementName == "memory") {
|
} else if (elementName == "memory") {
|
||||||
fillMemories(in, child->memories);
|
fillMemories(in, child->memories);
|
||||||
} else if (elementName == "description") {
|
} else if (elementName == "description") {
|
||||||
@@ -325,6 +349,8 @@ void DeviceSelectionModel::parseDevice(QXmlStreamReader &in, DeviceSelectionItem
|
|||||||
fillCpu(in, child->cpu);
|
fillCpu(in, child->cpu);
|
||||||
} else if (elementName == "debug") {
|
} else if (elementName == "debug") {
|
||||||
fillSvd(in, child->svd);
|
fillSvd(in, child->svd);
|
||||||
|
} else if (elementName == "description") {
|
||||||
|
fillElementProperty(in, child->desc);
|
||||||
} else if (elementName == "memory") {
|
} else if (elementName == "memory") {
|
||||||
fillMemories(in, child->memories);
|
fillMemories(in, child->memories);
|
||||||
} else if (elementName == "algorithm") {
|
} else if (elementName == "algorithm") {
|
||||||
|
@@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDataWidgetMapper>
|
#include <QDataWidgetMapper>
|
||||||
#include <QHBoxLayout>
|
#include <QGridLayout>
|
||||||
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -65,8 +66,10 @@ constexpr char deviceMemorySizeKeyC[] = "BareMetal.UvscServerProvider.DeviceMemo
|
|||||||
// Device ALGORITHM data keys.
|
// Device ALGORITHM data keys.
|
||||||
constexpr char deviceAlgorithmKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithm";
|
constexpr char deviceAlgorithmKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithm";
|
||||||
constexpr char deviceAlgorithmPathKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmPath";
|
constexpr char deviceAlgorithmPathKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmPath";
|
||||||
constexpr char deviceAlgorithmStartKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmStart";
|
constexpr char deviceAlgorithmFlashStartKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmStart";
|
||||||
constexpr char deviceAlgorithmSizeKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmSize";
|
constexpr char deviceAlgorithmFlashSizeKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmSize";
|
||||||
|
constexpr char deviceAlgorithmRamStartKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmRamStart";
|
||||||
|
constexpr char deviceAlgorithmRamSizeKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmRamSize";
|
||||||
constexpr char deviceAlgorithmIndexKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmIndex";
|
constexpr char deviceAlgorithmIndexKeyC[] = "BareMetal.UvscServerProvider.DeviceAlgorithmIndex";
|
||||||
|
|
||||||
// DeviceSelection
|
// DeviceSelection
|
||||||
@@ -110,8 +113,10 @@ QVariantMap DeviceSelection::toMap() const
|
|||||||
for (const DeviceSelection::Algorithm &algorithm : qAsConst(algorithms)) {
|
for (const DeviceSelection::Algorithm &algorithm : qAsConst(algorithms)) {
|
||||||
QVariantMap m;
|
QVariantMap m;
|
||||||
m.insert(deviceAlgorithmPathKeyC, algorithm.path);
|
m.insert(deviceAlgorithmPathKeyC, algorithm.path);
|
||||||
m.insert(deviceAlgorithmStartKeyC, algorithm.start);
|
m.insert(deviceAlgorithmFlashStartKeyC, algorithm.flashStart);
|
||||||
m.insert(deviceAlgorithmSizeKeyC, algorithm.size);
|
m.insert(deviceAlgorithmFlashSizeKeyC, algorithm.flashSize);
|
||||||
|
m.insert(deviceAlgorithmRamStartKeyC, algorithm.ramStart);
|
||||||
|
m.insert(deviceAlgorithmRamSizeKeyC, algorithm.ramSize);
|
||||||
algorithmList.push_back(m);
|
algorithmList.push_back(m);
|
||||||
}
|
}
|
||||||
map.insert(deviceAlgorithmKeyC, algorithmList);
|
map.insert(deviceAlgorithmKeyC, algorithmList);
|
||||||
@@ -159,8 +164,10 @@ void DeviceSelection::fromMap(const QVariantMap &map)
|
|||||||
const auto m = entry.toMap();
|
const auto m = entry.toMap();
|
||||||
DeviceSelection::Algorithm algorithm;
|
DeviceSelection::Algorithm algorithm;
|
||||||
algorithm.path = m.value(deviceAlgorithmPathKeyC).toString();
|
algorithm.path = m.value(deviceAlgorithmPathKeyC).toString();
|
||||||
algorithm.start = m.value(deviceAlgorithmStartKeyC).toString();
|
algorithm.flashStart = m.value(deviceAlgorithmFlashStartKeyC).toString();
|
||||||
algorithm.size = m.value(deviceAlgorithmSizeKeyC).toString();
|
algorithm.flashSize = m.value(deviceAlgorithmFlashSizeKeyC).toString();
|
||||||
|
algorithm.ramStart = m.value(deviceAlgorithmRamStartKeyC).toString();
|
||||||
|
algorithm.ramSize = m.value(deviceAlgorithmRamSizeKeyC).toString();
|
||||||
algorithms.push_back(algorithm);
|
algorithms.push_back(algorithm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +193,9 @@ bool DeviceSelection::Memory::operator==(const Memory &other) const
|
|||||||
|
|
||||||
bool DeviceSelection::Algorithm::operator==(const Algorithm &other) const
|
bool DeviceSelection::Algorithm::operator==(const Algorithm &other) const
|
||||||
{
|
{
|
||||||
return path == other.path && start == other.start && size == other.size;
|
return path == other.path
|
||||||
|
&& flashStart == other.flashStart && flashSize == other.flashSize
|
||||||
|
&& ramStart == other.ramStart && ramSize == other.ramSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceSelection::operator==(const DeviceSelection &other) const
|
bool DeviceSelection::operator==(const DeviceSelection &other) const
|
||||||
@@ -297,7 +306,7 @@ void DeviceSelectionMemoryView::refresh()
|
|||||||
class DeviceSelectionAlgorithmItem final : public TreeItem
|
class DeviceSelectionAlgorithmItem final : public TreeItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Column { PathColumn, StartColumn, SizeColumn };
|
enum Column { PathColumn, FlashStartColumn, FlashSizeColumn, RamStartColumn, RamSizeColumn };
|
||||||
explicit DeviceSelectionAlgorithmItem(int index, DeviceSelection &selection)
|
explicit DeviceSelectionAlgorithmItem(int index, DeviceSelection &selection)
|
||||||
: m_index(index), m_selection(selection)
|
: m_index(index), m_selection(selection)
|
||||||
{}
|
{}
|
||||||
@@ -308,8 +317,10 @@ public:
|
|||||||
const auto &algorithm = m_selection.algorithms.at(m_index);
|
const auto &algorithm = m_selection.algorithms.at(m_index);
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case PathColumn: return algorithm.path;
|
case PathColumn: return algorithm.path;
|
||||||
case StartColumn: return algorithm.start;
|
case FlashStartColumn: return algorithm.flashStart;
|
||||||
case SizeColumn: return algorithm.size;
|
case FlashSizeColumn: return algorithm.flashSize;
|
||||||
|
case RamStartColumn: return algorithm.ramStart;
|
||||||
|
case RamSizeColumn: return algorithm.ramSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
@@ -320,11 +331,17 @@ public:
|
|||||||
if (role == Qt::EditRole) {
|
if (role == Qt::EditRole) {
|
||||||
auto &algorithm = m_selection.algorithms.at(m_index);
|
auto &algorithm = m_selection.algorithms.at(m_index);
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case StartColumn:
|
case FlashStartColumn:
|
||||||
algorithm.start = data.toString();
|
algorithm.flashStart = data.toString();
|
||||||
return true;
|
return true;
|
||||||
case SizeColumn:
|
case FlashSizeColumn:
|
||||||
algorithm.size = data.toString();
|
algorithm.flashSize = data.toString();
|
||||||
|
return true;
|
||||||
|
case RamStartColumn:
|
||||||
|
algorithm.ramStart = data.toString();
|
||||||
|
return true;
|
||||||
|
case RamSizeColumn:
|
||||||
|
algorithm.ramSize = data.toString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,8 +351,10 @@ public:
|
|||||||
Qt::ItemFlags flags(int column) const final
|
Qt::ItemFlags flags(int column) const final
|
||||||
{
|
{
|
||||||
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
if (column == StartColumn || column == SizeColumn)
|
if (column == FlashStartColumn || column == FlashSizeColumn
|
||||||
|
|| column == RamStartColumn || column == RamSizeColumn) {
|
||||||
flags |= Qt::ItemIsEditable;
|
flags |= Qt::ItemIsEditable;
|
||||||
|
}
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +369,7 @@ DeviceSelectionAlgorithmModel::DeviceSelectionAlgorithmModel(DeviceSelection &se
|
|||||||
QObject *parent)
|
QObject *parent)
|
||||||
: TreeModel<TreeItem, DeviceSelectionAlgorithmItem>(parent), m_selection(selection)
|
: TreeModel<TreeItem, DeviceSelectionAlgorithmItem>(parent), m_selection(selection)
|
||||||
{
|
{
|
||||||
setHeader({tr("Name"), tr("Start"), tr("Size")});
|
setHeader({tr("Name"), tr("FLASH Start"), tr("FLASH Size"), tr("RAM Start"), tr("RAM Size")});
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,25 +392,40 @@ DeviceSelectionAlgorithmView::DeviceSelectionAlgorithmView(DeviceSelection &sele
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
const auto model = new DeviceSelectionAlgorithmModel(selection, this);
|
const auto model = new DeviceSelectionAlgorithmModel(selection, this);
|
||||||
const auto layout = new QHBoxLayout;
|
const auto layout = new QGridLayout;
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_comboBox = new QComboBox;
|
m_comboBox = new QComboBox;
|
||||||
m_comboBox->setToolTip(tr("Algorithm path."));
|
m_comboBox->setToolTip(tr("Algorithm path."));
|
||||||
m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
m_comboBox->setModel(model);
|
m_comboBox->setModel(model);
|
||||||
layout->addWidget(m_comboBox);
|
layout->addWidget(m_comboBox, 0, 0, 1, 0);
|
||||||
const auto startEdit = new QLineEdit;
|
// Add FLASH area settings.
|
||||||
startEdit->setToolTip(tr("Start address."));
|
const auto flashLabel = new QLabel(tr("FLASH:"));
|
||||||
layout->addWidget(startEdit);
|
layout->addWidget(flashLabel, 1, 0);
|
||||||
const auto sizeEdit = new QLineEdit;
|
const auto flashStartEdit = new QLineEdit;
|
||||||
sizeEdit->setToolTip(tr("Size."));
|
flashStartEdit->setToolTip(tr("Start address."));
|
||||||
layout->addWidget(sizeEdit);
|
layout->addWidget(flashStartEdit, 1, 1);
|
||||||
|
const auto flashSizeEdit = new QLineEdit;
|
||||||
|
flashSizeEdit->setToolTip(tr("Size."));
|
||||||
|
layout->addWidget(flashSizeEdit, 1, 2);
|
||||||
|
// Add RAM area settings.
|
||||||
|
const auto ramLabel = new QLabel(tr("RAM:"));
|
||||||
|
layout->addWidget(ramLabel, 2, 0);
|
||||||
|
const auto ramStartEdit = new QLineEdit;
|
||||||
|
ramStartEdit->setToolTip(tr("Start address."));
|
||||||
|
layout->addWidget(ramStartEdit, 2, 1);
|
||||||
|
const auto ramSizeEdit = new QLineEdit;
|
||||||
|
ramSizeEdit->setToolTip(tr("Size."));
|
||||||
|
layout->addWidget(ramSizeEdit, 2, 2);
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
const auto mapper = new QDataWidgetMapper(this);
|
const auto mapper = new QDataWidgetMapper(this);
|
||||||
mapper->setModel(model);
|
mapper->setModel(model);
|
||||||
mapper->addMapping(startEdit, DeviceSelectionAlgorithmItem::StartColumn);
|
mapper->addMapping(flashStartEdit, DeviceSelectionAlgorithmItem::FlashStartColumn);
|
||||||
mapper->addMapping(sizeEdit, DeviceSelectionAlgorithmItem::SizeColumn);
|
mapper->addMapping(flashSizeEdit, DeviceSelectionAlgorithmItem::FlashSizeColumn);
|
||||||
|
mapper->addMapping(ramStartEdit, DeviceSelectionAlgorithmItem::RamStartColumn);
|
||||||
|
mapper->addMapping(ramSizeEdit, DeviceSelectionAlgorithmItem::RamSizeColumn);
|
||||||
|
|
||||||
connect(m_comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(m_comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, [mapper, this](int index) {
|
this, [mapper, this](int index) {
|
||||||
@@ -403,8 +437,10 @@ DeviceSelectionAlgorithmView::DeviceSelectionAlgorithmView(DeviceSelection &sele
|
|||||||
emit algorithmChanged(-1);
|
emit algorithmChanged(-1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(startEdit, &QLineEdit::editingFinished, mapper, &QDataWidgetMapper::submit);
|
connect(flashStartEdit, &QLineEdit::editingFinished, mapper, &QDataWidgetMapper::submit);
|
||||||
connect(sizeEdit, &QLineEdit::editingFinished, mapper, &QDataWidgetMapper::submit);
|
connect(flashSizeEdit, &QLineEdit::editingFinished, mapper, &QDataWidgetMapper::submit);
|
||||||
|
connect(ramStartEdit, &QLineEdit::editingFinished, mapper, &QDataWidgetMapper::submit);
|
||||||
|
connect(ramSizeEdit, &QLineEdit::editingFinished, mapper, &QDataWidgetMapper::submit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceSelectionAlgorithmView::setAlgorithm(int index)
|
void DeviceSelectionAlgorithmView::setAlgorithm(int index)
|
||||||
|
@@ -73,8 +73,10 @@ public:
|
|||||||
|
|
||||||
struct Algorithm {
|
struct Algorithm {
|
||||||
QString path;
|
QString path;
|
||||||
QString size;
|
QString flashSize;
|
||||||
QString start;
|
QString flashStart;
|
||||||
|
QString ramSize;
|
||||||
|
QString ramStart;
|
||||||
|
|
||||||
bool operator==(const Algorithm &other) const;
|
bool operator==(const Algorithm &other) const;
|
||||||
};
|
};
|
||||||
|
@@ -84,7 +84,7 @@ DeviceSelectorDetailsPanel::DeviceSelectorDetailsPanel(DeviceSelection &selectio
|
|||||||
m_memoryView = new DeviceSelectionMemoryView(m_selection);
|
m_memoryView = new DeviceSelectionMemoryView(m_selection);
|
||||||
layout->addRow(tr("Memory:"), m_memoryView);
|
layout->addRow(tr("Memory:"), m_memoryView);
|
||||||
m_algorithmView = new DeviceSelectionAlgorithmView(m_selection);
|
m_algorithmView = new DeviceSelectionAlgorithmView(m_selection);
|
||||||
layout->addRow(tr("Flash algorithm"), m_algorithmView);
|
layout->addRow(tr("Flash algorithm:"), m_algorithmView);
|
||||||
m_peripheralDescriptionFileChooser = new Utils::PathChooser(this);
|
m_peripheralDescriptionFileChooser = new Utils::PathChooser(this);
|
||||||
m_peripheralDescriptionFileChooser->setExpectedKind(Utils::PathChooser::File);
|
m_peripheralDescriptionFileChooser->setExpectedKind(Utils::PathChooser::File);
|
||||||
m_peripheralDescriptionFileChooser->setPromptDialogFilter(
|
m_peripheralDescriptionFileChooser->setPromptDialogFilter(
|
||||||
|
Reference in New Issue
Block a user