123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- import QtQuick 2.7
- import QtQuick.Window 2.2
- import gfa.plugins.qml.tivaflash 1.0
- Window {
- visible: true
- width: 640
- 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: "/opt/GfA/tivaflashutil/gfativaflashutil"
- itfName: "/dev/ttyO4"
- xBaudRate: 115200
- slvIdIsNodeAddr: false
- imgFile: "/opt/GfA/tivaflashutil/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;
- }
- }
- }
- }
|