Browse Source

Aus den Flashutils herausgelöst und eigenes Repo erstellt

Rind 3 năm trước cách đây
commit
29ff09d3a3
14 tập tin đã thay đổi với 2462 bổ sung0 xóa
  1. 15 0
      .gitignore
  2. 12 0
      demo/.gitignore
  3. 20 0
      demo/demo.pro
  4. 20 0
      demo/main.cpp
  5. 433 0
      demo/main.qml
  6. 5 0
      demo/qml.qrc
  7. 65 0
      gfativaflashplugin.pro
  8. 235 0
      plugins.qmltypes
  9. 4 0
      qmldir
  10. 1258 0
      src/gfativaflash.cpp
  11. 306 0
      src/gfativaflash.h
  12. 11 0
      src/gfativaflash_plugin.cpp
  13. 25 0
      src/gfativaflash_plugin.h
  14. 53 0
      src/tagnames.h

+ 15 - 0
.gitignore

@@ -0,0 +1,15 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+
+Debug/
+Profile/
+Release/
+install.sh
+pdump.sh
+*.pro.user
+*.bak
+*.sh

+ 12 - 0
demo/.gitignore

@@ -0,0 +1,12 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+
+Debug/
+Profile/
+Release/
+*.pro.user
+*.bak

+ 20 - 0
demo/demo.pro

@@ -0,0 +1,20 @@
+QT += quick
+CONFIG += c++11
+
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib/gfa
+QMAKE_RPATHDIR += /usr/lib/gfa
+
+SOURCES += \
+        main.cpp
+
+RESOURCES += qml.qrc
+
+target.path = /opt/GfA/demo/tivaflashplugindemo
+INSTALLS += target

+ 20 - 0
demo/main.cpp

@@ -0,0 +1,20 @@
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
+    QGuiApplication app(argc, argv);
+
+    QQmlApplicationEngine engine;
+    const QUrl url(QStringLiteral("qrc:/main.qml"));
+    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
+                     &app, [url](QObject *obj, const QUrl &objUrl) {
+        if (!obj && url == objUrl)
+            QCoreApplication::exit(-1);
+    }, Qt::QueuedConnection);
+    engine.load(url);
+
+    return app.exec();
+}

+ 433 - 0
demo/main.qml

@@ -0,0 +1,433 @@
+import QtQuick 2.7
+import QtQuick.Window 2.2
+import gfa.plugins.qml.tivaflash 1.0
+
+Window {
+    visible: true
+    width: 800
+    height: 480
+
+    property int statNr: 1
+    property int mbAddr: 100
+
+    Rectangle {
+        anchors.fill: parent
+        gradient: Gradient {
+            GradientStop { position: 0.0; color: "gray" }
+            GradientStop { position: 0.5; color: "black" }
+            GradientStop { position: 1.0; color: "dimgray" }
+        }
+    }
+
+    Text {
+        id: headline
+        x: 250
+        y: 5
+        color: "white"
+        font.pixelSize: 24
+        text: qsTr("GfA Tiva Flash Utility")
+    }
+
+    Rectangle {
+        id: line
+        x: 5
+        y: 40
+        width: 790
+        height: 2
+        color: "white"
+    }
+
+    Rectangle
+    {
+        x: 5
+        y: 75
+        width: 50
+        height: 40
+        color: "darkred"
+
+        Text {
+            text: statNr
+            anchors.centerIn: parent
+            color: "white"
+        }
+    }
+
+    Rectangle
+    {
+        x: 60
+        y: 75
+        width: 120
+        height: 20
+        color: "darkred"
+
+	    Text {
+	        id: materialEepromText
+            anchors.centerIn: parent
+	        color: "white"
+	        font.pixelSize: 14
+	        text: idTivaFlash.materialEeprom[statNr]
+	    }
+	}
+
+    Rectangle
+    {
+        x: 60
+        y: 95
+        width: 120
+        height: 20
+        color: "darkred"
+
+	    Text {
+	        id: serialEepromText
+            anchors.centerIn: parent
+	        color: "white"
+	        font.pixelSize: 14
+	        text: idTivaFlash.serialEeprom[statNr]
+	    }
+	}
+
+    Rectangle
+    {
+        x: 185
+        y: 75
+        width: 40
+        height: 40
+        color: "darkblue"
+        visible: idTivaFlash.imgUploadStatus.uploadInProgress
+
+	    Text {
+	        id: idUploadPercent
+            anchors.centerIn: parent
+	        color: "white"
+	        font.pixelSize: 14
+            text: idTivaFlash.imgUploadStatus.percentSent
+	    }
+	}
+
+    Rectangle
+    {
+        x: 230
+        y: 75
+        width: 120
+        height: 20
+        color: "darkblue"
+
+	    Text {
+            anchors.centerIn: parent
+	        color: "white"
+	        font.pixelSize: 14
+	        text: idTivaFlash.imgSizeApp[statNr]
+	    }
+	}
+
+    Rectangle
+    {
+        x: 230
+        y: 95
+        width: 120
+        height: 20
+        color: "darkblue"
+
+	    Text {
+            anchors.centerIn: parent
+	        color: "white"
+	        font.pixelSize: 14
+	        text: idTivaFlash.imgCRC32App[statNr].toString(16)
+	    }
+	}
+
+    Rectangle
+    {
+        x: 355
+        y: 75
+        width: 120
+        height: 20
+        color: "darkblue"
+
+	    Text {
+            anchors.centerIn: parent
+	        color: "white"
+	        font.pixelSize: 14
+	        text: idTivaFlash.imgMaterialApp[statNr]
+	    }
+	}
+
+    Rectangle
+    {
+        x: 355
+        y: 95
+        width: 120
+        height: 20
+        color: "darkblue"
+
+	    Text {
+            anchors.centerIn: parent
+	        color: "white"
+	        font.pixelSize: 14
+	        text: idTivaFlash.imgBuildApp[statNr]
+	    }
+	}
+
+    Rectangle
+    {
+        x: 500
+        y: 75
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "uploadImgFile"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+                idTivaFlash.uploadImgFile(statNr, mbAddr);
+            }
+        }
+    }
+
+    Rectangle
+    {
+        x: 500
+        y: 125
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "startBootloader"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+	            idTivaFlash.startBootloader(statNr);
+			}
+        }
+    }
+
+    Rectangle
+    {
+        x: 500
+        y: 175
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "resetBootloader"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+	            idTivaFlash.resetBootloader(statNr);
+			}
+        }
+    }
+
+    Rectangle
+    {
+        x: 500
+        y: 225
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "pingTarget"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+                idTivaFlash.pingTarget(statNr);
+            }
+        }
+    }
+
+    Rectangle
+    {
+        x: 500
+        y: 275
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "getTargetImgInfo"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+	            idTivaFlash.getTargetImgInfo(statNr);
+			}
+        }
+    }
+
+    Rectangle
+    {
+        x: 500
+        y: 325
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "validateImgFile"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+	            idTivaFlash.validateImgFile(statNr);
+			}
+        }
+    }
+
+    Rectangle
+    {
+        x: 500
+        y: 375
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "getMatSer"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+	            idTivaFlash.getMatSer(statNr);
+//	            idTivaFlash.getFileImgInfo();
+//	            idTivaFlash.reviveBootloader(statNr);
+			}
+        }
+    }
+
+    Rectangle
+    {
+        x: 500
+        y: 425
+        width: 200
+        height: 40
+        color: idTivaFlash.executing ? "red" : "green"
+
+        Text {
+            text: "clearImgInfo"
+            anchors.centerIn: parent
+            color: "white"
+        }
+        MouseArea
+        {
+            anchors.fill: parent
+            enabled: !idTivaFlash.executing
+            onClicked:
+            {
+                idExecOut.text = "";
+//        		idUploadPercent.text = "";
+	            idTivaFlash.clearImgInfo(statNr);
+			}
+        }
+    }
+
+    Text {
+         id: idExecOut
+         x: 5
+         y: 150
+         width: 495
+         height: 300
+         color: "white"
+         font.pixelSize: 14
+     }
+
+    TivaFlash {
+        id: idTivaFlash
+        tivaFlashUtilPath: "gfativaflashutil"
+//        itfName: "/dev/ttyO4" // Sitara
+        itfName: "/dev/ttyS0"
+        xBaudRate: 115200
+        slvIdIsNodeAddr: false
+        imgFile: "/opt/GfA/bin/OLS-1V1_0009_crc.bin"
+        verbosity: 2
+
+        onProcessStarted:	// arguments: slv (number, Slave ID)
+        {
+            console.info("Process started");
+        }
+
+        onProcessFinished:	// arguments: slv (number, Slave ID), exitcode (number Exit code), normalExit (bool, Normal exit or crash)
+        {
+            console.info("Process finished - exitcode: " + (normalExit ? exitcode : "crashed!"));
+        }
+
+        onProcessOutput:	// arguments: slv (number, Slave ID), ctx (number, 1=error, 2=info, 3=status), msg (string, Message)
+        {
+            idExecOut.text += msg + "\n";
+        }
+
+        onImgUploadProgress:	// arguments: stat (object ImgUploadStatus)
+        {
+        	switch(stat.ctx)
+        	{
+        	case ImgUploadStatus.EraseFlashStart:
+//        		idUploadPercent.text = "";
+        		break;
+            case ImgUploadStatus.EraseFlashEnd:
+                break;
+            case ImgUploadStatus.ImgUploadStart:
+//        		idUploadPercent.text = "0";
+                break;
+            case ImgUploadStatus.ImgUploadBlock:
+//                idUploadPercent.text = stat.percentSent;
+                break;
+            case ImgUploadStatus.ImgUploadSuccess:
+//        		idUploadPercent.text = "Ok";
+                break;
+            case ImgUploadStatus.ImgUploadError:
+//        		idUploadPercent.text = "Err";
+                break;
+            }
+        }
+	}
+}

+ 5 - 0
demo/qml.qrc

@@ -0,0 +1,5 @@
+<RCC>
+    <qresource prefix="/">
+        <file>main.qml</file>
+    </qresource>
+</RCC>

+ 65 - 0
gfativaflashplugin.pro

@@ -0,0 +1,65 @@
+TEMPLATE = lib
+TARGET = gfativaflashplugin
+QT += sql qml
+CONFIG += qt plugin c++11
+
+##############################################################
+
+TARGET = $$qtLibraryTarget($$TARGET)
+uri = gfa.plugins.qml.tivaflash
+
+##############################################################
+
+QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib/gfa
+QMAKE_RPATHLINKDIR += /usr/lib/gfa
+QMAKE_RPATHDIR += /usr/lib/gfa
+
+##############################################################
+
+CONFIG(debug, debug|release) {
+    QMAKE_CXXFLAGS -= -Os
+    QMAKE_CFLAGS -= -Os
+    QMAKE_CXXFLAGS += -D_DEBUG
+    QMAKE_CFLAGS += -D_DEBUG
+    QMAKE_LIBS += -lgfamininetd
+}
+
+CONFIG(release, debug|release) {
+    QMAKE_LIBS += -lgfamininet
+}
+
+##############################################################
+
+SOURCES += \
+    src/gfativaflash.cpp \
+    src/gfativaflash_plugin.cpp
+
+HEADERS += \
+    src/gfativaflash.h \
+    src/gfativaflash_plugin.h
+
+##############################################################
+
+qmlPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
+
+##############################################################
+
+linux-g++ {
+	QMAKE_POST_LINK += @test -d $(INSTALL_ROOT)$$qmlPath || mkdir -p $(INSTALL_ROOT)$$qmlPath
+	QMAKE_POST_LINK += $$escape_expand(\\n\\t)$(COPY_FILE) $$OUT_PWD/$(TARGET) $(INSTALL_ROOT)$$qmlPath/
+	QMAKE_POST_LINK += $$escape_expand(\\n\\t)$(COPY_FILE) $$_PRO_FILE_PWD_/qmldir $(INSTALL_ROOT)$$qmlPath/
+	QMAKE_POST_LINK += $$escape_expand(\\n\\t)qmlplugindump -nonrelocatable $$uri 1.0 > $$qmlPath/plugins.qmltypes
+	QMAKE_POST_LINK += $$escape_expand(\\n\\t)$(COPY_FILE) $(INSTALL_ROOT)$$qmlPath/plugins.qmltypes $$_PRO_FILE_PWD_/
+}
+
+##############################################################
+
+linux-buildroot-g++ {
+	qmlDir.files = $$_PRO_FILE_PWD_/qmldir
+	qmlDir.path = $$qmlPath
+	target.path = $$qmlPath
+	copy_qmltyes.path = $$qmlPath
+	copy_qmltyes.files = $$_PRO_FILE_PWD_/plugins.qmltypes
+	INSTALLS += target qmlDir copy_qmltyes
+	DISTFILES += qmlDir copy_qmltyes
+}

+ 235 - 0
plugins.qmltypes

@@ -0,0 +1,235 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable gfa.plugins.qml.tivaflash 1.0'
+
+Module {
+    dependencies: ["QtQuick 2.7"]
+    Component {
+        name: "ImgUploadStatus"
+        prototype: "QObject"
+        exports: ["gfa.plugins.qml.tivaflash/ImgUploadStatus 1.0"]
+        isCreatable: false
+        exportMetaObjectRevisions: [0]
+        Enum {
+            name: "StatusCtx"
+            values: {
+                "EraseFlashStart": 0,
+                "EraseFlashEnd": 1,
+                "ImgUploadStart": 2,
+                "ImgUploadBlock": 3,
+                "ImgUploadSuccess": 4,
+                "ImgUploadError": 5
+            }
+        }
+        Property { name: "ctx"; type: "int"; isReadonly: true }
+        Property { name: "errorCode"; type: "int"; isReadonly: true }
+        Property { name: "cntFlashPages"; type: "int"; isReadonly: true }
+        Property { name: "cbBlock"; type: "int"; isReadonly: true }
+        Property { name: "blockNr"; type: "int"; isReadonly: true }
+        Property { name: "cbTotal"; type: "int"; isReadonly: true }
+        Property { name: "cbSent"; type: "int"; isReadonly: true }
+        Property { name: "percentSent"; type: "int"; isReadonly: true }
+        Property { name: "uploadInProgress"; type: "bool"; isReadonly: true }
+        Signal {
+            name: "ctxChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "errorCodeChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "cntFlashPagesChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "cbBlockChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "blockNrChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "cbTotalChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "cbSentChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "percentSentChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "uploadInProgressChanged"
+            Parameter { name: "val"; type: "bool" }
+        }
+    }
+    Component {
+        name: "TivaFlash"
+        prototype: "QObject"
+        exports: ["gfa.plugins.qml.tivaflash/TivaFlash 1.0"]
+        exportMetaObjectRevisions: [0]
+        Property { name: "tivaFlashUtilPath"; type: "string" }
+        Property { name: "itfName"; type: "string" }
+        Property { name: "slvIdIsNodeAddr"; type: "bool" }
+        Property { name: "verbosity"; type: "int" }
+        Property { name: "imgFile"; type: "string" }
+        Property { name: "executing"; type: "bool"; isReadonly: true }
+        Property { name: "xBaudRate"; type: "int" }
+        Property { name: "appAddress"; type: "int" }
+        Property { name: "blockSize"; type: "int" }
+        Property { name: "pageEraseTime"; type: "int" }
+        Property { name: "mbCtrlRegister"; type: "int" }
+        Property { name: "forceAllParities"; type: "bool" }
+        Property { name: "imgUploadStatus"; type: "ImgUploadStatus"; isReadonly: true; isPointer: true }
+        Property { name: "materialEeprom"; type: "QStringList"; isReadonly: true }
+        Property { name: "serialEeprom"; type: "QStringList"; isReadonly: true }
+        Property { name: "imgMaterialBoot"; type: "QStringList"; isReadonly: true }
+        Property { name: "imgBuildBoot"; type: "QStringList"; isReadonly: true }
+        Property { name: "imgSizeBoot"; type: "QList<int>"; isReadonly: true }
+        Property { name: "imgCRC32Boot"; type: "QList<double>"; isReadonly: true }
+        Property { name: "imgMaterialApp"; type: "QStringList"; isReadonly: true }
+        Property { name: "imgBuildApp"; type: "QStringList"; isReadonly: true }
+        Property { name: "imgSizeApp"; type: "QList<int>"; isReadonly: true }
+        Property { name: "imgCRC32App"; type: "QList<double>"; isReadonly: true }
+        Property { name: "imgMaterialFile"; type: "string"; isReadonly: true }
+        Property { name: "imgBuildFile"; type: "string"; isReadonly: true }
+        Property { name: "imgSizeFile"; type: "int"; isReadonly: true }
+        Property { name: "imgCRC32File"; type: "double"; isReadonly: true }
+        Signal {
+            name: "materialFileChanged"
+            Parameter { name: "val"; type: "string" }
+        }
+        Signal {
+            name: "imgBuildFileChanged"
+            Parameter { name: "val"; type: "string" }
+        }
+        Signal {
+            name: "imgSizeFileChanged"
+            Parameter { name: "val"; type: "int" }
+        }
+        Signal {
+            name: "imgCRC32FileChanged"
+            Parameter { name: "val"; type: "double" }
+        }
+        Signal {
+            name: "executingChanged"
+            Parameter { name: "val"; type: "bool" }
+        }
+        Signal {
+            name: "processStarted"
+            Parameter { name: "slv"; type: "int" }
+        }
+        Signal {
+            name: "processFinished"
+            Parameter { name: "slv"; type: "int" }
+            Parameter { name: "exitcode"; type: "int" }
+            Parameter { name: "normalExit"; type: "bool" }
+        }
+        Signal {
+            name: "processOutput"
+            Parameter { name: "slv"; type: "int" }
+            Parameter { name: "ctx"; type: "int" }
+            Parameter { name: "msg"; type: "string" }
+        }
+        Signal {
+            name: "imgUploadProgress"
+            Parameter { name: "stat"; type: "ImgUploadStatus"; isPointer: true }
+        }
+        Method {
+            name: "getMatSer"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+            Parameter { name: "nMbID"; type: "int" }
+        }
+        Method {
+            name: "getMatSer"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method {
+            name: "getTargetImgInfo"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+            Parameter { name: "nMbID"; type: "int" }
+        }
+        Method {
+            name: "getTargetImgInfo"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method { name: "getFileImgInfo"; type: "bool" }
+        Method {
+            name: "pingTarget"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+            Parameter { name: "nMbID"; type: "int" }
+        }
+        Method {
+            name: "pingTarget"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method {
+            name: "startBootloader"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+            Parameter { name: "nMbID"; type: "int" }
+        }
+        Method {
+            name: "startBootloader"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method {
+            name: "resetBootloader"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+            Parameter { name: "nMbID"; type: "int" }
+        }
+        Method {
+            name: "resetBootloader"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method {
+            name: "validateImgFile"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+            Parameter { name: "nMbID"; type: "int" }
+        }
+        Method {
+            name: "validateImgFile"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method {
+            name: "uploadImgFile"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+            Parameter { name: "nMbID"; type: "int" }
+        }
+        Method {
+            name: "uploadImgFile"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method {
+            name: "reviveBootloader"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+        Method {
+            name: "clearImgInfo"
+            type: "bool"
+            Parameter { name: "nSlvID"; type: "int" }
+        }
+    }
+}

+ 4 - 0
qmldir

@@ -0,0 +1,4 @@
+module gfa.plugins.qml.tivaflash
+plugin gfativaflashplugin
+classname TivaFlash
+typeinfo plugins.qmltypes

+ 1258 - 0
src/gfativaflash.cpp

@@ -0,0 +1,1258 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <string>
+#include <regex>
+#include "gfativaflash.h"
+
+#define _TEST_VERBOSITY(v, n)					(((v) == -1) && ((n) <= 2)) || (((v) >= 0) && ((v) >= (n)))
+
+/////////////////////////////////////////////////////////////////////////////
+
+TivaFlash::TivaFlash(QObject *pParent) :	QObject(pParent),
+											m_nExitCode(0),
+											m_slvIdIsNodeAddr(false),
+											m_verbosity(-1),
+											m_bExecuting(false),
+											m_xBaudRate(0),
+											m_curSlvID(0),
+											m_appAddress(0),
+											m_blockSize(0),
+											m_pageEraseTime(0),
+											m_mbCtrlRegister(0),
+											m_forceAllParities(false),
+											m_imgSizeFile(0),
+											m_imgCRC32File(0.0),
+											m_imgUpldProg(this),
+											m_qProcess(this)
+{
+	setObjectName("TivaFlash");
+
+	for(int i = 0; i < _MAX_SLAVE_COUNT; i++)
+	{
+		m_materialEeprom.append("");
+		m_serialEeprom.append("");
+
+		m_imgSizeBoot.append(0);
+		m_imgCRC32Boot.append(0.0);
+		m_imgMaterialBoot.append("");
+		m_imgBuildBoot.append("");
+
+		m_imgSizeApp.append(0);
+		m_imgCRC32App.append(0.0);
+		m_imgMaterialApp.append("");
+		m_imgBuildApp.append("");
+	}
+
+	connect(&m_qProcess, SIGNAL(started()), SLOT(onProcessStarted()));
+	connect(&m_qProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(onProcessFinished(int, QProcess::ExitStatus)));
+	connect(&m_qProcess, SIGNAL(readyReadStandardOutput()), SLOT(onProcessReadyReadStandardOutput()));
+	connect(&m_qProcess, SIGNAL(stateChanged(QProcess::ProcessState)), SLOT(onProcessStateChanged(QProcess::ProcessState)));
+
+	m_qProcess.setProcessChannelMode(QProcess::MergedChannels);
+}
+
+TivaFlash::~TivaFlash(void)
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::onProcessStarted(void)
+{
+	setExecuting(true);
+	emit processStarted(m_curSlvID);
+}
+
+void TivaFlash::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+	setExecuting(false);
+	emit processFinished(m_curSlvID, exitCode, exitStatus == QProcess::ExitStatus::NormalExit);
+}
+
+void TivaFlash::onProcessReadyReadStandardOutput(void)
+{
+	char szLine[256];
+
+	while(m_qProcess.readLine(szLine, sizeof(szLine)) > 0)
+	{
+		onCmdOutput(m_curSlvID, szLine);
+	}
+}
+
+void TivaFlash::onProcessStateChanged(QProcess::ProcessState newState)
+{
+	setExecuting(newState != QProcess::ProcessState::NotRunning);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::getSlavIDs(int nSlvID, int nMbID, QStringList &rargs) const
+{
+	std::string ret;
+
+	if(m_slvIdIsNodeAddr)
+		rargs << QString::asprintf("--node-addr=%d", nSlvID);
+	else
+		rargs << QString::asprintf("--stat-num=%d", nSlvID);
+
+	if(_IS_VALID_MB_ID(nMbID))
+	{
+		rargs << QString::asprintf("--mb-slave-id=%d", nMbID);
+
+		if(m_mbCtrlRegister > 0)
+			rargs << QString::asprintf("--mb-bl-ctrl-reg=%d", m_mbCtrlRegister);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::getXBaud(QStringList &rargs) const
+{
+	if(m_xBaudRate > 0)
+	{
+		rargs << QString::asprintf("--x-baud-rate=%d", m_xBaudRate);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::getAppAddr(QStringList &rargs) const
+{
+	if(m_appAddress > 0)
+	{
+		rargs << QString::asprintf("--app-addr=0x%X", m_appAddress);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::getBlockSize(QStringList &rargs) const
+{
+	if(m_blockSize > 0)
+	{
+		rargs << QString::asprintf("--block-size=%d", m_blockSize);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::getPageEraseTime(QStringList &rargs) const
+{
+	if(m_pageEraseTime > 0)
+	{
+		rargs << QString::asprintf("--page-erase-time=%d", m_pageEraseTime);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::getForceAllParities(QStringList &rargs) const
+{
+	if(m_forceAllParities)
+	{
+		rargs << QString::asprintf("--force-all-par");
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+int TivaFlash::parseTaggedString(const char *pszIn, std::string &sOut) const
+{
+	static const std::string strRegEx = "<([0-9]+)>(.+)<\\/\\1>";
+	static std::regex reg(strRegEx, std::regex_constants::ECMAScript | std::regex_constants::optimize);
+	std::cmatch res;
+
+	if(pszIn && *pszIn)
+	{
+		try
+		{
+			if(regex_search(pszIn, res, reg))
+			{
+				size_t nSize = res.size();
+
+				if(nSize == 3)
+				{
+					std::string strTagName = res[1].str();
+					sOut = res[2].str();
+					return atoi(strTagName.c_str());
+				}
+			}
+		}
+		catch(...)
+		{
+		}
+	}
+
+	return -1;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+int TivaFlash::parseTaggedValues(const char *pszIn, int &rnVal1, int &rnVal2) const
+{
+	static const std::string strRegEx = "([0-9]+)\\|([0-9]+)";
+	static std::regex reg(strRegEx, std::regex_constants::ECMAScript | std::regex_constants::optimize);
+	std::cmatch res;
+
+	if(pszIn && *pszIn)
+	{
+		try
+		{
+			if(regex_search(pszIn, res, reg))
+			{
+				size_t nSize = res.size();
+
+				if(nSize == 3)
+				{
+					rnVal1 = atoi(res[1].str().c_str());
+					rnVal2 = atoi(res[2].str().c_str());
+					return nSize - 1;
+				}
+			}
+		}
+		catch(...)
+		{
+		}
+	}
+
+	return -1;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void TivaFlash::onCmdOutput(int nSlvID, const char *pszOut)
+{
+	std::string s;
+	int nTag = parseTaggedString(pszOut, s);
+	int nVal1, nVal2;
+
+	if(nTag >= 0)
+	{
+		QString qs = QString::fromStdString(s);
+
+		switch(nTag)
+		{
+		/////////////////////////////////////////////////////////////////////
+
+		case PLUGIN_TAG_EXIT_CODE:
+			m_nExitCode = qs.toInt();
+			break;
+
+		/////////////////////////////////////////////////////////////////////
+
+		case PLUGIN_TAG_STATUS:
+			if(_TEST_VERBOSITY(m_verbosity, PLUGIN_TAG_STATUS))
+				emit processOutput(nSlvID, nTag, qs);
+			break;
+		case PLUGIN_TAG_INFO:
+			if(_TEST_VERBOSITY(m_verbosity, PLUGIN_TAG_INFO))
+				emit processOutput(nSlvID, nTag, qs);
+			break;
+		case PLUGIN_TAG_ERROR:
+			if(_TEST_VERBOSITY(m_verbosity, PLUGIN_TAG_ERROR))
+				emit processOutput(nSlvID, nTag, qs);
+			break;
+
+		/////////////////////////////////////////////////////////////////////
+
+		case PLUGIN_TAG_IMG_MATERIAL_EEPROM:
+			setMaterialEeprom(nSlvID, qs);
+			break;
+		case PLUGIN_TAG_IMG_SERIAL_EEPROM:
+			setSerialEeprom(nSlvID, qs);
+			break;
+
+		/////////////////////////////////////////////////////////////////////
+
+		case PLUGIN_TAG_IMG_LENGTH_BOOT:
+			setImgSizeBoot(nSlvID, qs.toUInt());
+			break;
+		case PLUGIN_TAG_IMG_CRC32_BOOT:
+			setImgCRC32Boot(nSlvID, qs.toDouble());
+			break;
+		case PLUGIN_TAG_IMG_BUILD_BOOT:
+			setImgBuildBoot(nSlvID, qs);
+			break;
+		case PLUGIN_TAG_IMG_MATERIAL_BOOT:
+			setImgMaterialBoot(nSlvID, qs);
+			break;
+
+		/////////////////////////////////////////////////////////////////////
+
+		case PLUGIN_TAG_IMG_LENGTH_APP:
+			setImgSizeApp(nSlvID, qs.toUInt());
+			break;
+		case PLUGIN_TAG_IMG_CRC32_APP:
+			setImgCRC32App(nSlvID, qs.toDouble());
+			break;
+		case PLUGIN_TAG_IMG_MATERIAL_APP:
+			setImgBuildApp(nSlvID, qs);
+			break;
+		case PLUGIN_TAG_IMG_BUILD_APP:
+			setImgMaterialApp(nSlvID, qs);
+			break;
+
+		/////////////////////////////////////////////////////////////////////
+
+		case PLUGIN_TAG_IMG_LENGTH_FILE:
+			setImgSizeFile(qs.toUInt());
+			break;
+		case PLUGIN_TAG_IMG_CRC32_FILE:
+			setImgCRC32File(qs.toDouble());
+			break;
+		case PLUGIN_TAG_IMG_MATERIAL_FILE:
+			setImgMaterialFile(qs);
+			break;
+		case PLUGIN_TAG_IMG_BUILD_FILE:
+			setImgBuildFile(qs);
+			break;
+
+		/////////////////////////////////////////////////////////////////////
+
+		case PLUGIN_TAG_UPLOAD_START_ERASE_FLASH:
+			m_imgUpldProg.clear();
+			m_imgUpldProg.setCtx(ImgUploadStatus::EraseFlashStart);
+			if(parseTaggedValues(s.c_str(), nVal1, nVal2) == 2)
+			{
+				m_imgUpldProg.setUploadInProgress(true);
+				m_imgUpldProg.setCntFlashPages(nVal1);
+				m_imgUpldProg.setCbTotal(nVal2);
+				emit imgUploadProgress(&m_imgUpldProg);
+			}
+			break;
+		case PLUGIN_TAG_UPLOAD_END_ERASE_FLASH:
+			m_imgUpldProg.setCtx(ImgUploadStatus::EraseFlashEnd);
+			emit imgUploadProgress(&m_imgUpldProg);
+			break;
+		case PLUGIN_TAG_UPLOAD_BLOCKS_START:
+			m_imgUpldProg.setCtx(ImgUploadStatus::ImgUploadStart);
+			m_imgUpldProg.setCbBlock(qs.toInt());
+			emit imgUploadProgress(&m_imgUpldProg);
+			break;
+		case PLUGIN_TAG_UPLOAD_BLOCK:
+			m_imgUpldProg.setCtx(ImgUploadStatus::ImgUploadBlock);
+			if(parseTaggedValues(s.c_str(), nVal1, nVal2) == 2)
+			{
+				int nCbTotal = m_imgUpldProg.cbTotal();
+				int nCbSent = nVal1;
+				m_imgUpldProg.setCbSent(nCbSent);
+				if(nCbTotal)
+					m_imgUpldProg.setPercentSent(nCbSent * 100 / nCbTotal);
+				m_imgUpldProg.SetBlockNr(nVal2);
+				emit imgUploadProgress(&m_imgUpldProg);
+			}
+			break;
+		case PLUGIN_TAG_UPLOAD_BLOCKS_END:
+			m_imgUpldProg.setCtx(ImgUploadStatus::ImgUploadSuccess);
+			m_imgUpldProg.setErrorCode(0);
+			m_imgUpldProg.setUploadInProgress(false);
+			emit imgUploadProgress(&m_imgUpldProg);
+			break;
+		case PLUGIN_TAG_UPLOAD_ERROR:
+			m_imgUpldProg.setCtx(ImgUploadStatus::ImgUploadError);
+			m_imgUpldProg.setErrorCode(qs.toInt());
+			m_imgUpldProg.setUploadInProgress(false);
+			emit imgUploadProgress(&m_imgUpldProg);
+			break;
+		}
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// command methods
+// getMatSer
+
+bool TivaFlash::getMatSer(int nSlvID, int nMbID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+
+	setMaterialEeprom(nSlvID, "");
+	setSerialEeprom(nSlvID, "");
+
+	QStringList args;
+	args << "--show-mat-ser";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, nMbID, args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// getTargetImgInfo
+
+bool TivaFlash::getTargetImgInfo(int nSlvID, int nMbID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+
+	setImgSizeBoot(nSlvID, 0);
+	setImgCRC32Boot(nSlvID, 0.0);
+	setImgMaterialBoot(nSlvID, "");
+	setImgBuildBoot(nSlvID, "");
+
+	setImgSizeApp(nSlvID, 0);
+	setImgCRC32App(nSlvID, 0.0);
+	setImgMaterialApp(nSlvID, "");
+	setImgBuildApp(nSlvID, "");
+
+	QStringList args;
+	args << "--show-dev-img-info";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, nMbID, args);
+	getXBaud(args);
+	getAppAddr(args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// getFileImgInfo
+
+bool TivaFlash::getFileImgInfo(void)
+{
+	if(m_bExecuting)
+		return false;
+	m_curSlvID = 0;
+
+	setImgSizeFile(0);
+	setImgCRC32File(0.0);
+	setImgMaterialFile("");
+	setImgBuildFile("");
+
+	QStringList args;
+	args << "--show-file-img-info";
+	args << "--plugin-mode";
+	args << QString::fromStdString(m_imgFile);
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// pingTarget
+
+bool TivaFlash::pingTarget(int nSlvID, int nMbID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+
+	QStringList args;
+	args << "--ping-target";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, nMbID, args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// startBootloader
+
+bool TivaFlash::startBootloader(int nSlvID, int nMbID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+
+	QStringList args;
+	args << "--start-boot";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, nMbID, args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// resetBootloader
+
+bool TivaFlash::resetBootloader(int nSlvID, int nMbID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+
+	QStringList args;
+	args << "--reset-boot";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, nMbID, args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// validateImgFile
+
+bool TivaFlash::validateImgFile(int nSlvID, int nMbID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+
+	QStringList args;
+	args << "--validate-img";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, nMbID, args);
+	getAppAddr(args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	args << QString::fromStdString(m_imgFile);
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// uploadImgFile
+
+bool TivaFlash::uploadImgFile(int nSlvID, int nMbID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+	m_imgUpldProg.clear();
+
+	QStringList args;
+	args << "--upload-img";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, nMbID, args);
+	getXBaud(args);
+	getAppAddr(args);
+	getBlockSize(args);
+	getPageEraseTime(args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	args << QString::fromStdString(m_imgFile);
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// reviveBootloader
+
+bool TivaFlash::reviveBootloader(int nSlvID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+	m_curSlvID = nSlvID;
+
+	QStringList args;
+	args << "--revive-boot";
+	args << QString::asprintf("--itf-name=%s", m_itfName.c_str());
+	getSlavIDs(nSlvID, 0, args);
+	getForceAllParities(args);
+	args << "--plugin-mode";
+	m_qProcess.start(QString::fromStdString(m_tivaFlashUtilPath), args, QIODevice::ReadOnly);
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// clearImgInfo
+
+bool TivaFlash::clearImgInfo(int nSlvID)
+{
+	if(m_bExecuting)
+		return false;
+	if(!_IS_VALID_SLV_ID(nSlvID))
+		return false;
+
+	setImgSizeFile(0);
+	setImgCRC32File(0);
+	setImgMaterialFile(0);
+	setImgBuildFile(0);
+
+	if(nSlvID > 0)
+	{
+		setMaterialEeprom(nSlvID, "");
+		setSerialEeprom(nSlvID, "");
+
+		setImgSizeBoot(nSlvID, 0);
+		setImgCRC32Boot(nSlvID, 0);
+		setImgMaterialBoot(nSlvID, "");
+		setImgBuildBoot(nSlvID, "");
+
+		setImgSizeApp(nSlvID, 0);
+		setImgCRC32App(nSlvID, 0);
+		setImgMaterialApp(nSlvID, "");
+		setImgBuildApp(nSlvID, "");
+	}
+	else
+	{
+		for(int i = 0; i < _MAX_SLAVE_COUNT; ++i)
+		{
+			setMaterialEeprom(i, "");
+			setSerialEeprom(i, "");
+
+			setImgSizeBoot(i, 0);
+			setImgCRC32Boot(i, 0);
+			setImgMaterialBoot(i, "");
+			setImgBuildBoot(i, "");
+
+			setImgSizeApp(i, 0);
+			setImgCRC32App(i, 0);
+			setImgMaterialApp(i, "");
+			setImgBuildApp(i, "");
+		}
+	}
+
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// properties
+// tivaFlashUtilPath
+
+QString TivaFlash::tivaFlashUtilPath(void) const
+{
+	return QString::fromStdString(m_tivaFlashUtilPath);
+}
+
+void TivaFlash::setTivaFlashUtilPath(const QString &val)
+{
+	m_tivaFlashUtilPath = val.toStdString();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// itfName
+
+QString TivaFlash::itfName(void) const
+{
+	return QString::fromStdString(m_itfName);
+}
+
+void TivaFlash::setItfName(const QString &val)
+{
+	m_itfName = val.toStdString();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// slvIdIsNodeAddr
+
+bool TivaFlash::slvIdIsNodeAddr(void) const
+{
+	return m_slvIdIsNodeAddr;
+}
+
+void TivaFlash::setSlvIdIsNodeAddr(bool val)
+{
+	if(m_slvIdIsNodeAddr != val)
+	{
+		m_slvIdIsNodeAddr = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// verbosity
+
+int TivaFlash::verbosity(void) const
+{
+	return m_verbosity;
+}
+
+void TivaFlash::setVerbosity(int val)
+{
+	if(val < 0)
+		val = 0;
+	else if(val > 3)
+		val = 3;
+
+	if(m_verbosity != val)
+	{
+		m_verbosity = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgFile
+
+QString TivaFlash::imgFile(void) const
+{
+	return QString::fromStdString(m_imgFile);
+}
+
+void TivaFlash::setImgFile(const QString &val)
+{
+	m_imgFile = val.toStdString();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// executing
+
+bool TivaFlash::executing(void) const
+{
+	return m_bExecuting;
+}
+
+void TivaFlash::setExecuting(bool val)
+{
+	if(m_bExecuting != val)
+	{
+		m_bExecuting = val;
+		emit executingChanged(m_bExecuting);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// xBaudRate
+
+int TivaFlash::xBaudRate(void) const
+{
+	return m_xBaudRate;
+}
+
+void TivaFlash::setXBaudRate(int val)
+{
+	if(m_xBaudRate != val)
+	{
+		m_xBaudRate = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// appAddress
+
+int TivaFlash::appAddress(void) const
+{
+	return m_appAddress;
+}
+
+void TivaFlash::setAppAddress(int val)
+{
+	if(m_appAddress != val)
+	{
+		m_appAddress = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// blockSize
+
+int TivaFlash::blockSize(void) const
+{
+	return m_blockSize;
+}
+
+void TivaFlash::setBlockSize(int val)
+{
+	if(m_blockSize != val)
+	{
+		m_blockSize = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// pageEraseTime
+
+int TivaFlash::pageEraseTime(void) const
+{
+	return m_pageEraseTime;
+}
+
+void TivaFlash::setPageEraseTime(int val)
+{
+	if(m_pageEraseTime != val)
+	{
+		m_pageEraseTime = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// mbCtrlRegister
+
+int TivaFlash::mbCtrlRegister(void) const
+{
+	return m_mbCtrlRegister;
+}
+
+void TivaFlash::setMbCtrlRegister(int val)
+{
+	if(m_mbCtrlRegister != val)
+	{
+		m_mbCtrlRegister = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// forceAllParities
+
+bool TivaFlash::forceAllParities(void) const
+{
+	return m_forceAllParities;
+}
+
+void TivaFlash::setForceAllParities(bool val)
+{
+	if(m_forceAllParities != val)
+	{
+		m_forceAllParities = val;
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgUploadStatus
+
+ImgUploadStatus* TivaFlash::imgUploadStatus(void)
+{
+	return &m_imgUpldProg;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// materialEeprom
+
+const QStringList& TivaFlash::materialEeprom(void) const
+{
+	return m_materialEeprom;
+}
+
+void TivaFlash::setMaterialEeprom(int nSlvID, const QString &val)
+{
+	if(m_materialEeprom[nSlvID] != val)
+	{
+		m_materialEeprom[nSlvID] = val;
+		emit materialEepromChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// serialEeprom
+
+const QStringList& TivaFlash::serialEeprom(void) const
+{
+	return m_serialEeprom;
+}
+
+void TivaFlash::setSerialEeprom(int nSlvID, const QString &val)
+{
+	if(m_serialEeprom[nSlvID] != val)
+	{
+		m_serialEeprom[nSlvID] = val;
+		emit serialEepromChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// imgSizeBoot
+
+const QList<int>& TivaFlash::imgSizeBoot(void) const
+{
+	return m_imgSizeBoot;
+}
+
+void TivaFlash::setImgSizeBoot(int nSlvID, int val)
+{
+	if(m_imgSizeBoot[nSlvID] != val)
+	{
+		m_imgSizeBoot[nSlvID] = val;
+		emit imgSizeBootChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgCRC32Boot
+
+const QList<double>& TivaFlash::imgCRC32Boot(void) const
+{
+	return m_imgCRC32Boot;
+}
+
+void TivaFlash::setImgCRC32Boot(int nSlvID, double val)
+{
+	if(m_imgCRC32Boot[nSlvID] != val)
+	{
+		m_imgCRC32Boot[nSlvID] = val;
+		emit imgCRC32BootChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgMaterialBoot
+
+const QStringList& TivaFlash::imgMaterialBoot(void) const
+{
+	return m_imgMaterialBoot;
+}
+
+void TivaFlash::setImgMaterialBoot(int nSlvID, const QString &val)
+{
+	if(m_imgMaterialBoot[nSlvID] != val)
+	{
+		m_imgMaterialBoot[nSlvID] = val;
+		emit imgMaterialBootChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgBuildBoot
+
+const QStringList& TivaFlash::imgBuildBoot(void) const
+{
+	return m_imgBuildBoot;
+}
+
+void TivaFlash::setImgBuildBoot(int nSlvID, const QString &val)
+{
+	if(m_imgBuildBoot[nSlvID] != val)
+	{
+		m_imgBuildBoot[nSlvID] = val;
+		emit imgBuildBootChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// imgSizeApp
+
+const QList<int>& TivaFlash::imgSizeApp(void) const
+{
+	return m_imgSizeApp;
+}
+
+void TivaFlash::setImgSizeApp(int nSlvID, int val)
+{
+	if(m_imgSizeApp[nSlvID] != val)
+	{
+		m_imgSizeApp[nSlvID] = val;
+		emit imgSizeAppChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgCRC32App
+
+const QList<double>& TivaFlash::imgCRC32App(void) const
+{
+	return m_imgCRC32App;
+}
+
+void TivaFlash::setImgCRC32App(int nSlvID, double val)
+{
+	if(m_imgCRC32App[nSlvID] != val)
+	{
+		m_imgCRC32App[nSlvID] = val;
+		emit imgCRC32AppChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgMaterialApp
+
+const QStringList& TivaFlash::imgMaterialApp(void) const
+{
+	return m_imgMaterialApp;
+}
+
+void TivaFlash::setImgMaterialApp(int nSlvID, const QString &val)
+{
+	if(m_imgMaterialApp[nSlvID] != val)
+	{
+		m_imgMaterialApp[nSlvID] = val;
+		emit imgMaterialAppChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgBuildApp
+
+const QStringList& TivaFlash::imgBuildApp(void) const
+{
+	return m_imgBuildApp;
+}
+
+void TivaFlash::setImgBuildApp(int nSlvID, const QString &val)
+{
+	if(m_imgBuildApp[nSlvID] != val)
+	{
+		m_imgBuildApp[nSlvID] = val;
+		emit imgBuildAppChanged();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// imgSizeFile
+
+int TivaFlash::imgSizeFile(void) const
+{
+	return m_imgSizeFile;
+}
+
+void TivaFlash::setImgSizeFile(int val)
+{
+	if(m_imgSizeFile != val)
+	{
+		m_imgSizeFile = val;
+		emit imgSizeFileChanged(m_imgSizeFile);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgCRC32File
+
+double TivaFlash::imgCRC32File(void) const
+{
+	return m_imgCRC32File;
+}
+
+void TivaFlash::setImgCRC32File(double val)
+{
+	if(m_imgCRC32File != val)
+	{
+		m_imgCRC32File = val;
+		emit imgCRC32FileChanged(m_imgCRC32File);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgMaterialFile
+
+const QString& TivaFlash::imgMaterialFile(void) const
+{
+	return m_imgMaterialFile;
+}
+
+void TivaFlash::setImgMaterialFile(const QString &val)
+{
+	if(m_imgMaterialFile != val)
+	{
+		m_imgMaterialFile = val;
+		emit materialFileChanged(m_imgMaterialFile);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// imgBuildFile
+
+const QString& TivaFlash::imgBuildFile(void) const
+{
+	return m_imgBuildFile;
+}
+
+void TivaFlash::setImgBuildFile(const QString &val)
+{
+	if(m_imgBuildFile != val)
+	{
+		m_imgBuildFile = val;
+		emit imgBuildFileChanged(m_imgBuildFile);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+ImgUploadStatus::ImgUploadStatus(QObject *pParent) :	QObject(pParent)
+{
+	setObjectName("ImgUploadStatus");
+	clear();
+}
+
+ImgUploadStatus::~ImgUploadStatus(void)
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void ImgUploadStatus::clear(void)
+{
+	m_nCtx = 0;
+	m_nErrorCode = 0;
+	m_nCbBlock = 0;
+	m_nBlockNr = 0;
+	m_nCbTotal = 0;
+	m_nCbSent = 0;
+	m_nPercentSent = 0;
+	m_nCntFlashPages = 0;
+	m_bUploadInProgress = false;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// properties
+// ctx
+
+int ImgUploadStatus::ctx(void) const
+{
+	return m_nCtx;
+}
+
+void ImgUploadStatus::setCtx(int val)
+{
+	if(m_nCtx != val)
+	{
+		m_nCtx = val;
+		emit ctxChanged(m_nCtx);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// errorCode
+
+int ImgUploadStatus::errorCode(void) const
+{
+	return m_nErrorCode;
+}
+
+void ImgUploadStatus::setErrorCode(int val)
+{
+	if(m_nErrorCode != val)
+	{
+		m_nErrorCode = val;
+		emit errorCodeChanged(m_nErrorCode);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// cbBlock
+
+int ImgUploadStatus::cbBlock(void) const
+{
+	return m_nCbBlock;
+}
+
+void ImgUploadStatus::setCbBlock(int val)
+{
+	if(m_nCbBlock != val)
+	{
+		m_nCbBlock = val;
+		emit cbBlockChanged(m_nCbBlock);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// blockNr
+
+int ImgUploadStatus::blockNr(void) const
+{
+	return m_nBlockNr;
+}
+
+void ImgUploadStatus::SetBlockNr(int val)
+{
+	if(m_nBlockNr != val)
+	{
+		m_nBlockNr = val;
+		emit blockNrChanged(m_nBlockNr);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// cbTotal
+
+int ImgUploadStatus::cbTotal(void) const
+{
+	return m_nCbTotal;
+}
+
+void ImgUploadStatus::setCbTotal(int val)
+{
+	if(m_nCbTotal != val)
+	{
+		m_nCbTotal = val;
+		emit cbTotalChanged(m_nCbTotal);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// cbSent
+
+int ImgUploadStatus::cbSent(void) const
+{
+	return m_nCbSent;
+}
+
+void ImgUploadStatus::setCbSent(int val)
+{
+	if(m_nCbSent != val)
+	{
+		m_nCbSent = val;
+		emit cbSentChanged(m_nCbSent);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// percentSent
+
+int ImgUploadStatus::percentSent(void) const
+{
+	return m_nPercentSent;
+}
+
+void ImgUploadStatus::setPercentSent(int val)
+{
+	if(m_nPercentSent != val)
+	{
+		m_nPercentSent = val;
+		emit percentSentChanged(m_nPercentSent);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// cntFlashPages
+
+int ImgUploadStatus::cntFlashPages(void) const
+{
+	return m_nCntFlashPages;
+}
+
+void ImgUploadStatus::setCntFlashPages(int val)
+{
+	if(m_nCntFlashPages != val)
+	{
+		m_nCntFlashPages = val;
+		emit cntFlashPagesChanged(m_nCntFlashPages);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// uploadInProgress
+
+bool ImgUploadStatus::uploadInProgress(void) const
+{
+	return m_bUploadInProgress;
+}
+
+void ImgUploadStatus::setUploadInProgress(bool val)
+{
+	if(m_bUploadInProgress != val)
+	{
+		m_bUploadInProgress = val;
+		emit uploadInProgressChanged(m_bUploadInProgress);
+	}
+}

+ 306 - 0
src/gfativaflash.h

@@ -0,0 +1,306 @@
+// gfativaflash.h :
+//
+
+#if !defined(AGD_GFATIVAFLASH_H__49F09E25_28B7_4178_B4B6_6DAFF98ABECD__INCLUDED_)
+#define AGD_GFATIVAFLASH_H__49F09E25_28B7_4178_B4B6_6DAFF98ABECD__INCLUDED_
+
+#include <string>
+#include <QObject>
+#include <QList>
+#include <QStringList>
+#include <QProcess>
+#include "tagnames.h"
+
+#ifdef __cplusplus
+
+/////////////////////////////////////////////////////////////////////////////
+// gfativaflash.h - Declarations:
+
+#define _MAX_SLAVE_COUNT								256
+#define _MB_BROADCAST_ADDRESS							0
+#define _MB_MAX_SLAVE_ID								247
+#define _IS_VALID_SLV_ID(id)							(((id) >= 0) && ((id) < _MAX_SLAVE_COUNT))
+#define _IS_VALID_MB_ID(id)								(((id) != _MB_BROADCAST_ADDRESS) && ((id) <= _MB_MAX_SLAVE_ID))
+
+/////////////////////////////////////////////////////////////////////////////
+
+class ImgUploadStatus : public QObject
+{
+    Q_OBJECT
+	Q_PROPERTY(int ctx READ ctx NOTIFY ctxChanged)
+	Q_PROPERTY(int errorCode READ errorCode NOTIFY errorCodeChanged)
+	Q_PROPERTY(int cntFlashPages READ cntFlashPages NOTIFY cntFlashPagesChanged)
+	Q_PROPERTY(int cbBlock READ cbBlock NOTIFY cbBlockChanged)
+	Q_PROPERTY(int blockNr READ blockNr NOTIFY blockNrChanged)
+	Q_PROPERTY(int cbTotal READ cbTotal NOTIFY cbTotalChanged)
+	Q_PROPERTY(int cbSent READ cbSent NOTIFY cbSentChanged)
+	Q_PROPERTY(int percentSent READ percentSent NOTIFY percentSentChanged)
+	Q_PROPERTY(bool uploadInProgress READ uploadInProgress NOTIFY uploadInProgressChanged)
+
+public:
+	enum StatusCtx
+	{
+		EraseFlashStart,
+		EraseFlashEnd,
+		ImgUploadStart,
+		ImgUploadBlock,
+		ImgUploadSuccess,
+		ImgUploadError
+	};
+
+	Q_ENUMS(StatusCtx);
+
+public:
+    explicit ImgUploadStatus(QObject *pParent = NULL);
+    virtual ~ImgUploadStatus(void);
+
+    void clear(void);
+
+signals:
+	void ctxChanged(int val);
+	void errorCodeChanged(int val);
+	void cntFlashPagesChanged(int val);
+	void cbBlockChanged(int val);
+	void blockNrChanged(int val);
+	void cbTotalChanged(int val);
+	void cbSentChanged(int val);
+	void percentSentChanged(int val);
+	void uploadInProgressChanged(bool val);
+
+public:
+	int ctx(void) const;
+	void setCtx(int val);
+
+	int errorCode(void) const;
+	void setErrorCode(int val);
+
+	int cbBlock(void) const;
+	void setCbBlock(int val);
+
+	int blockNr(void) const;
+	void SetBlockNr(int val);
+
+	int cbTotal(void) const;
+	void setCbTotal(int val);
+
+	int cbSent(void) const;
+	void setCbSent(int val);
+
+	int percentSent(void) const;
+	void setPercentSent(int val);
+
+	int cntFlashPages(void) const;
+	void setCntFlashPages(int val);
+
+	bool uploadInProgress(void) const;
+	void setUploadInProgress(bool val);
+
+private:
+	int m_nCtx;
+	int m_nErrorCode;
+	int m_nCbBlock;
+	int m_nBlockNr;
+	int m_nCbTotal;
+	int m_nCbSent;
+	int m_nPercentSent;
+	int m_nCntFlashPages;
+	bool m_bUploadInProgress;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+class TivaFlash : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(QString tivaFlashUtilPath READ tivaFlashUtilPath WRITE setTivaFlashUtilPath)
+    Q_PROPERTY(QString itfName READ itfName WRITE setItfName)
+	Q_PROPERTY(bool slvIdIsNodeAddr READ slvIdIsNodeAddr WRITE setSlvIdIsNodeAddr)
+	Q_PROPERTY(int verbosity READ verbosity WRITE setVerbosity)
+    Q_PROPERTY(QString imgFile READ imgFile WRITE setImgFile)
+    Q_PROPERTY(bool executing READ executing NOTIFY executingChanged)
+	Q_PROPERTY(int xBaudRate READ xBaudRate WRITE setXBaudRate)
+	Q_PROPERTY(int appAddress READ appAddress WRITE setAppAddress)
+	Q_PROPERTY(int blockSize READ blockSize WRITE setBlockSize)
+	Q_PROPERTY(int pageEraseTime READ pageEraseTime WRITE setPageEraseTime)
+	Q_PROPERTY(int mbCtrlRegister READ mbCtrlRegister WRITE setMbCtrlRegister)
+    Q_PROPERTY(bool forceAllParities READ forceAllParities WRITE setForceAllParities)
+
+    Q_PROPERTY(ImgUploadStatus* imgUploadStatus READ imgUploadStatus CONSTANT)
+
+    Q_PROPERTY(QStringList materialEeprom READ materialEeprom NOTIFY materialEepromChanged)
+    Q_PROPERTY(QStringList serialEeprom READ serialEeprom NOTIFY serialEepromChanged)
+
+	Q_PROPERTY(QStringList imgMaterialBoot READ imgMaterialBoot NOTIFY imgMaterialBootChanged)
+	Q_PROPERTY(QStringList imgBuildBoot READ imgBuildBoot NOTIFY imgBuildBootChanged)
+    Q_PROPERTY(QList<int> imgSizeBoot READ imgSizeBoot NOTIFY imgSizeBootChanged)
+	Q_PROPERTY(QList<double> imgCRC32Boot READ imgCRC32Boot NOTIFY imgCRC32BootChanged)
+
+	Q_PROPERTY(QStringList imgMaterialApp READ imgMaterialApp NOTIFY imgMaterialAppChanged)
+	Q_PROPERTY(QStringList imgBuildApp READ imgBuildApp NOTIFY imgBuildAppChanged)
+    Q_PROPERTY(QList<int> imgSizeApp READ imgSizeApp NOTIFY imgSizeAppChanged)
+	Q_PROPERTY(QList<double> imgCRC32App READ imgCRC32App NOTIFY imgCRC32AppChanged)
+
+    Q_PROPERTY(QString imgMaterialFile READ imgMaterialFile NOTIFY materialFileChanged)
+	Q_PROPERTY(QString imgBuildFile READ imgBuildFile NOTIFY imgBuildFileChanged)
+	Q_PROPERTY(int imgSizeFile READ imgSizeFile NOTIFY imgSizeFileChanged)
+	Q_PROPERTY(double imgCRC32File READ imgCRC32File NOTIFY imgCRC32FileChanged)
+
+public:
+    explicit TivaFlash(QObject *pParent = NULL);
+    virtual ~TivaFlash(void);
+
+public:
+	Q_INVOKABLE bool getMatSer(int nSlvID, int nMbID = 0);
+	Q_INVOKABLE bool getTargetImgInfo(int nSlvID, int nMbID = 0);
+	Q_INVOKABLE bool getFileImgInfo(void);
+	Q_INVOKABLE bool pingTarget(int nSlvID, int nMbID = 0);
+	Q_INVOKABLE bool startBootloader(int nSlvID, int nMbID = 0);
+	Q_INVOKABLE bool resetBootloader(int nSlvID, int nMbID = 0);
+	Q_INVOKABLE bool validateImgFile(int nSlvID, int nMbID = 0);
+	Q_INVOKABLE bool uploadImgFile(int nSlvID, int nMbID = 0);
+	Q_INVOKABLE bool reviveBootloader(int nSlvID);
+	Q_INVOKABLE bool clearImgInfo(int nSlvID);
+
+signals:
+	void materialEepromChanged(void) const;
+	void serialEepromChanged(void) const;
+
+	void imgSizeBootChanged(void) const;
+	void imgCRC32BootChanged(void) const;
+	void imgMaterialBootChanged(void) const;
+	void imgBuildBootChanged(void) const;
+
+	void imgSizeAppChanged(void) const;
+	void imgCRC32AppChanged(void) const;
+	void imgMaterialAppChanged(void) const;
+	void imgBuildAppChanged(void) const;
+
+	void materialFileChanged(const QString &val) const;
+	void imgBuildFileChanged(const QString &val) const;
+	void imgSizeFileChanged(int val) const;
+	void imgCRC32FileChanged(double val) const;
+
+	void executingChanged(bool val) const;
+	void processStarted(int slv) const;
+	void processFinished(int slv, int exitcode, bool normalExit) const;
+	void processOutput(int slv, int ctx, QString msg) const;
+	void imgUploadProgress(ImgUploadStatus *stat);
+
+private:
+	QString tivaFlashUtilPath(void) const;
+	void setTivaFlashUtilPath(const QString &val);
+	QString itfName(void) const;
+	void setItfName(const QString &val);
+	bool slvIdIsNodeAddr(void) const;
+	void setSlvIdIsNodeAddr(bool val);
+	int verbosity(void) const;
+	void setVerbosity(int val);
+	QString imgFile(void) const;
+	void setImgFile(const QString &val);
+	bool executing(void) const;
+	void setExecuting(bool val);
+	int xBaudRate(void) const;
+	void setXBaudRate(int val);
+	int appAddress(void) const;
+	void setAppAddress(int val);
+	int blockSize(void) const;
+	void setBlockSize(int val);
+	int pageEraseTime(void) const;
+	void setPageEraseTime(int val);
+	int mbCtrlRegister(void) const;
+	void setMbCtrlRegister(int val);
+	bool forceAllParities(void) const;
+	void setForceAllParities(bool val);
+	
+	ImgUploadStatus* imgUploadStatus(void);
+
+	const QStringList& materialEeprom(void) const;
+	void setMaterialEeprom(int nSlvID, const QString &val);
+	const QStringList& serialEeprom(void) const;
+	void setSerialEeprom(int nSlvID, const QString &val);
+
+	const QList<int>& imgSizeBoot(void) const;
+	void setImgSizeBoot(int nSlvID, int val);
+	const QList<double>& imgCRC32Boot(void) const;
+	void setImgCRC32Boot(int nSlvID, double val);
+	const QStringList& imgMaterialBoot(void) const;
+	void setImgMaterialBoot(int nSlvID, const QString &val);
+	const QStringList& imgBuildBoot(void) const;
+	void setImgBuildBoot(int nSlvID, const QString &val);
+
+	const QList<int>& imgSizeApp(void) const;
+	void setImgSizeApp(int nSlvID, int val);
+	const QList<double>& imgCRC32App(void) const;
+	void setImgCRC32App(int nSlvID, double val);
+	const QStringList& imgMaterialApp(void) const;
+	void setImgMaterialApp(int nSlvID, const QString &val);
+	const QStringList& imgBuildApp(void) const;
+	void setImgBuildApp(int nSlvID, const QString &val);
+
+	int imgSizeFile(void) const;
+	void setImgSizeFile(int val);
+	double imgCRC32File(void) const;
+	void setImgCRC32File(double val);
+	const QString& imgMaterialFile(void) const;
+	void setImgMaterialFile(const QString &val);
+	const QString& imgBuildFile(void) const;
+	void setImgBuildFile(const QString &val);
+
+private:
+	void onCmdOutput(int nSlvID, const char *pszOut);
+	void getSlavIDs(int nSlvID, int nMbID, QStringList &rargs) const;
+	void getXBaud(QStringList &rargs) const;
+	void getAppAddr(QStringList &rargs) const;
+	void getBlockSize(QStringList &rargs) const;
+	void getPageEraseTime(QStringList &rargs) const;
+	void getForceAllParities(QStringList &rargs) const;
+	int parseTaggedString(const char *pszIn, std::string &sOut) const;
+	int parseTaggedValues(const char *pszIn, int &rnVal1, int &rnVal2) const;
+
+private slots:
+	void onProcessStarted(void);
+	void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
+	void onProcessReadyReadStandardOutput(void);
+	void onProcessStateChanged(QProcess::ProcessState newState);
+
+private:
+	int m_nExitCode;
+	std::string m_tivaFlashUtilPath;
+	std::string m_itfName;
+	bool m_slvIdIsNodeAddr;
+	int m_verbosity;
+	bool m_bExecuting;
+	int m_xBaudRate;
+	int m_curSlvID;
+	int m_appAddress;
+	int m_blockSize;
+	int m_pageEraseTime;
+	int m_mbCtrlRegister;
+	bool m_forceAllParities;
+	std::string m_imgFile;
+
+	QStringList m_materialEeprom;
+	QStringList m_serialEeprom;
+
+	QList<int> m_imgSizeBoot;
+	QList<double> m_imgCRC32Boot;
+	QStringList m_imgMaterialBoot;
+	QStringList m_imgBuildBoot;
+
+	QList<int> m_imgSizeApp;
+	QList<double> m_imgCRC32App;
+	QStringList m_imgMaterialApp;
+	QStringList m_imgBuildApp;
+
+	int m_imgSizeFile;
+	double m_imgCRC32File;
+	QString m_imgMaterialFile;
+	QString m_imgBuildFile;
+
+	ImgUploadStatus m_imgUpldProg;
+	QProcess m_qProcess;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+#endif	//	__cplusplus
+#endif	//	!defined(AGD_GFATIVAFLASH_H__49F09E25_28B7_4178_B4B6_6DAFF98ABECD__INCLUDED_)

+ 11 - 0
src/gfativaflash_plugin.cpp

@@ -0,0 +1,11 @@
+#include "gfativaflash_plugin.h"
+#include "gfativaflash.h"
+#include <qqml.h>
+
+void TivaFlashPlugin::registerTypes(const char *uri)
+{
+    // gfa.plugins.qml.tivaflash
+    qmlRegisterType<TivaFlash>(uri, 1, 0, "TivaFlash");
+    qmlRegisterUncreatableType<ImgUploadStatus>(uri, 1, 0, "ImgUploadStatus", "ImgUploadStatus is not creatable");
+}
+

+ 25 - 0
src/gfativaflash_plugin.h

@@ -0,0 +1,25 @@
+// gfativaflash_plugin.h :
+//
+
+#if !defined(AGD_GFATIVAFLASH_PLUGIN_H__C0A6A381_7F81_4454_A36E_DF5BC5C2CF47__INCLUDED_)
+#define AGD_GFATIVAFLASH_PLUGIN_H__C0A6A381_7F81_4454_A36E_DF5BC5C2CF47__INCLUDED_
+
+#include <QQmlExtensionPlugin>
+
+#ifdef __cplusplus
+
+/////////////////////////////////////////////////////////////////////////////
+// gfativaflash_plugin.h - Declarations:
+
+class TivaFlashPlugin : public QQmlExtensionPlugin
+{
+    Q_OBJECT
+    Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+    void registerTypes(const char *uri);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+#endif	//	__cplusplus
+#endif	//	!defined(AGD_GFATIVAFLASH_PLUGIN_H__C0A6A381_7F81_4454_A36E_DF5BC5C2CF47__INCLUDED_)

+ 53 - 0
src/tagnames.h

@@ -0,0 +1,53 @@
+// tagnames.h :
+//
+
+#if !defined(AGD_TAGNAMES_H__0DFDE1D3_67CC_4E5A_8148_E26AD8E5FA1F__INCLUDED_)
+#define AGD_TAGNAMES_H__0DFDE1D3_67CC_4E5A_8148_E26AD8E5FA1F__INCLUDED_
+
+#ifdef __cplusplus
+extern "C" {
+#endif	//	__cplusplus
+
+/////////////////////////////////////////////////////////////////////////////
+// tagnames.h - Declarations:
+
+typedef enum _PLUGIN_TAG_NUMBERS
+{
+	PLUGIN_TAG_EXIT_CODE,
+
+	PLUGIN_TAG_ERROR,
+	PLUGIN_TAG_INFO,
+	PLUGIN_TAG_STATUS,
+
+	PLUGIN_TAG_IMG_MATERIAL_EEPROM,
+	PLUGIN_TAG_IMG_SERIAL_EEPROM,
+
+	PLUGIN_TAG_IMG_LENGTH_BOOT,
+	PLUGIN_TAG_IMG_CRC32_BOOT,
+	PLUGIN_TAG_IMG_MATERIAL_BOOT,
+	PLUGIN_TAG_IMG_BUILD_BOOT,
+
+	PLUGIN_TAG_IMG_LENGTH_APP,
+	PLUGIN_TAG_IMG_CRC32_APP,
+	PLUGIN_TAG_IMG_MATERIAL_APP,
+	PLUGIN_TAG_IMG_BUILD_APP,
+
+	PLUGIN_TAG_IMG_LENGTH_FILE,
+	PLUGIN_TAG_IMG_CRC32_FILE,
+	PLUGIN_TAG_IMG_MATERIAL_FILE,
+	PLUGIN_TAG_IMG_BUILD_FILE,
+
+	PLUGIN_TAG_UPLOAD_START_ERASE_FLASH,
+	PLUGIN_TAG_UPLOAD_END_ERASE_FLASH,
+	PLUGIN_TAG_UPLOAD_BLOCKS_START,
+	PLUGIN_TAG_UPLOAD_BLOCK,
+	PLUGIN_TAG_UPLOAD_BLOCKS_END,
+	PLUGIN_TAG_UPLOAD_ERROR
+
+}PLUGIN_TAG_NUMBERS;
+
+/////////////////////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+}
+#endif	//	__cplusplus
+#endif	//	!defined(AGD_TAGNAMES_H__0DFDE1D3_67CC_4E5A_8148_E26AD8E5FA1F__INCLUDED_)