This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Redboot: [xyz]modem via TCP?
On Fri, Feb 09, 2001 at 06:29:10AM -0700, Gary Thomas wrote:
> >> With Redboot, can you do [xyz]modem download via TCP instead of
> >> serial port?
> >
> > I slapped together a Python program that uses "sx" to download
> > an S record file via TCP using xmodem protocol. Small files
> > (less than 2K or so) work fine, but when I get up to about 2K,
> > RedBoot crashes. I can load the large files fine via TFTP and
> > xmodem/serial.
> >
> > Anybody else see anything like this?
>
> I've not tried this. If you want to share [only with me if necessary]
> the Python program, I'll give it a look-see when I get a chance.
Thanks.
Here it is. I didn't try any variations on protocol/frame-size
or anything. Just the defualt x-modem mode. IP addresse and
filename are hard-coded...
========================================================================
import time
import socket
import os
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('192.168.1.21',9000))
print "connected to: ",s.getpeername()," from ",s.getsockname()
r = s.recv(1024)
print "received: ",r
if not r.startswith("RedBoot"):
raise "No answer from RedBoot"
s.send("load -m x\r")
r = s.recv(1024)
print "received: ",r
fd = s.fileno()
os.dup2(fd,0)
os.dup2(fd,1)
os.spawnv(os.P_WAIT,"/usr/bin/sx",("/usr/sbin/sx","-v","dataFile.srec"))
sys.stderr.write("done\n");
s.close()
========================================================================
--
Grant Edwards
grante@visi.com