Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Kermit is a serial communication app like minicom and it has its own script language, and I used it for some automatic upload on embedded devices. However, it is quite limited and/or buggy, so I finally switched to using python and pyserial.<br> Whenever you deal with texte mode, like AT command set or speaking to a shell over a serial line, it is really powerful.</p> <p>If I need to do binary transfer using some standard protocol, I usually use command line tools in non interactive mode, and spawn them from my python script.</p> <p>Here is some part of the tools I built : waiting for some input, sending data through xmodem, sending a command to u-boot and starting a transfer using the kermit protocol. I use it for automatic flashing and testing of embedded devices.</p> <pre><code>class Parser : def __init__(self, sport_name): self.currentMsg = '' if sport_name : self.ser = serial.Serial(sport_name, 115200) def WaitFor(self, s, timeOut=None): self.ser.timeout = timeOut self.currentMsg = '' while self.currentMsg.endswith(s) != True : # should add a try catch here c=self.ser.read() if c != '' : self.currentMsg += c sys.stdout.write(c) else : print 'timeout waiting for ' + s return False return True def XmodemSend(self,fname): if not self.WaitFor('C', 1) : print 'RomBOOT did not launch xmodem transfer' return self.ser.flushInput() self.ser.close() call(["xmodem","-d",self.ser.port,"-T",fname]) self.ser.open() def UbootLoad(self, fname): self.ser.write('loadb 0x20000000\n') if not self.WaitFor('bps...',1) : print 'loadb command failed' sys.exit() self.ser.flushInput() self.ser.close() retcode=call(['kermit','-y','kermit_init','-s',fname]) if retcode != 0 : print 'error sending' + fname sys.exit() self.ser.open() self.UbootCmd('echo\n') </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload