forked from qt-creator/qt-creator
Debugger: Handle missing {lsb|msb} tags in SVD file
The SVD file format describes the possible presence of tags `<lsb></lsb>` and `<msb></msb>` to describe the bit fields of the register data: * https://www.keil.com/pack/doc/CMSIS/SVD/html/schema_1_2_gr.html So, we need also implement parsing for such tags from the SVD files. Task-number: QTCREATORBUG-24414 Change-Id: I968cdfb4c86bfed0aac212c3f3a4376c8ee93ffe Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -59,6 +59,8 @@ constexpr char kDisplayName[] = "displayName";
|
||||
constexpr char kField[] = "field";
|
||||
constexpr char kFields[] = "fields";
|
||||
constexpr char kGroupName[] = "groupName";
|
||||
constexpr char kLsb[] = "lsb";
|
||||
constexpr char kMsb[] = "msb";
|
||||
constexpr char kName[] = "name";
|
||||
constexpr char kPeripheral[] = "peripheral";
|
||||
constexpr char kPeripherals[] = "peripherals";
|
||||
@@ -566,6 +568,8 @@ PeripheralRegisterHandler::PeripheralRegisterHandler(DebuggerEngine *engine)
|
||||
static void handleField(QXmlStreamReader &in, PeripheralRegister ®)
|
||||
{
|
||||
PeripheralRegisterField fld;
|
||||
Utils::optional<int> from;
|
||||
Utils::optional<int> to;
|
||||
while (in.readNextStartElement()) {
|
||||
const auto elementName = in.name();
|
||||
if (elementName == QLatin1String(kName)) {
|
||||
@@ -593,11 +597,20 @@ static void handleField(QXmlStreamReader &in, PeripheralRegister ®)
|
||||
fld.bitOffset = int(decodeNumeric(in.readElementText()));
|
||||
} else if (elementName == QLatin1String(kBitWidth)) {
|
||||
fld.bitWidth = int(decodeNumeric(in.readElementText()));
|
||||
} else if (elementName == QLatin1String(kLsb)) {
|
||||
from = int(decodeNumeric(in.readElementText()));
|
||||
} else if (elementName == QLatin1String(kMsb)) {
|
||||
to = int(decodeNumeric(in.readElementText()));
|
||||
} else {
|
||||
in.skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (from && to) {
|
||||
fld.bitOffset = *from;
|
||||
fld.bitWidth = *to - *from + 1;
|
||||
}
|
||||
|
||||
// Inherit the field access from the register access if the filed
|
||||
// has not the access rights description.
|
||||
if (fld.access == PeripheralRegisterAccess::Unknown)
|
||||
|
Reference in New Issue
Block a user