Menu

Excute external flashtool inside the workerscript

Anonymous
2020-07-23
2020-07-24
  • Anonymous

    Anonymous - 2020-07-23

    Hello all,

    i use a workerscript to define basic setting of a microcontroller.
    This is done via listening to u-boot messages and sending the necessary commands.
    In case of a corrupt flash it is necessary to activate via jumper the recovery-mode,
    and start via the GUI a external flashtool (imx_uart).
    Is it possible to execute inside a workerscript a external executable ?
    If yes, is it possble to do a disconnect so that the connected slot
    "scriptInf.dataReceivedSignal.connect(dataReceivedSlot)" releases
    the serial-port.

    Best regards,
    Mathias

     
  • Stefan Zieker

    Stefan Zieker - 2020-07-23

    Hi Mathias,

    you can call scriptInf.disconnect to disconnect the main interface. If you want to reconnect to the serial port you can call scriptInf.connectSerialPort.
    To create an external process you can call scriptThread.createProcessAsynchronous or scriptThread.createProcess.
    For more details you should have a look in the manual (ScriptComunicator has several other functions for processes and the main interface).

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2020-07-23
  • Anonymous

    Anonymous - 2020-07-23

    Hello Stefan,

    many thanks for your fast help and for the fantastic ScriptCommunicator.
    With you help i was able to automate the flashing, yet without any checks.
    The snippet is attached.
    The dialog for starting the flashing is modal this makes it difficult to watch
    log-files, is there a possibilty like UI_Dialog.setModal(false) ?

    Best regards,
    Mathias

     
  • Stefan Zieker

    Stefan Zieker - 2020-07-24

    Hello Mathias,

    I have created a UI file for you and modified your script (attachment). I hope this helps.

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2020-07-24
  • Anonymous

    Anonymous - 2020-07-24

    Hello Stefan,

    your flash.zip works, attached a screenshot after the 100% progress.
    Thousand thanks for your help. I will add a dataReceivedSignal-slot which
    collects all incoming data into a global array so that timerSlot() can check for the correct
    response from the microcontroller. Is this the way to do or can the timerSlot() -function
    wait for a incoming message ? ( In Reflection-Basic there was a function WaitForString() ).

    Best regards and many thanks,
    Mathias

     
  • Stefan Zieker

    Stefan Zieker - 2020-07-24

    Hi Mathias,

    you can do it both ways. Collect and check the data in a dataReceivedSignal slot or collect the data in a dataReceivedSignal slot and check the data in the timer slot. I think following code snippet could be usefull for you:

    var g_receivedData = Array();
    function dataReceivedSlot(data)
    {
        g_receivedData = g_receivedData.concat(data);   
        if(conv.byteArrayToString(g_receivedData).indexOf("Ready") != -1)
        {//Ready received
    
            //Delete the received data.
            g_receivedData = Array();
    
        //Do something.
            }
        }
    

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2020-07-24

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.