CVS: python ihex2titext.py,NONE,1.1

Chris Liechti <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16483/python

Added Files:
	ihex2titext.py 
Log Message:
simple a43->ti-text converter

--- NEW FILE: ihex2titext.py ---
#!/usr/bin/env python
# simple intel hex to TI text converter
# data is read from stdin and output on stdout
# usage: cat file.a43 | ihex2titext >out.txt
#
# (C) 2005 Chris Liechti <[email protected]>
# this is distributed under a free software license, see license.txt
#
# $Id: ihex2titext.py,v 1.1 2005/10/03 20:46:37 cliechti Exp $

#~ from msp430.util import hexdump
from msp430 import memory
import sys

data = memory.Memory()
data.loadIHex(sys.stdin)                    #intel-hex
for segment in data:
    #~ hexdump((segment.startaddress, segment.data))            #print a hex display
    sys.stdout.write("@%04x\n" % segment.startaddress)
    for i in range(0, len(segment.data), 16):
        sys.stdout.write("%s\n" % " ".join(["%02x" % ord(x) for x in segment.data[i:i+16]]))
sys.stdout.write("q\n")



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.