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; } } } }