Lolitech@540: import os Lolitech@540: from subprocess import Popen,PIPE greg@425: from .. import toolchain_makefile Lolitech@540: import hashlib greg@425: laurent@489: class LPC_target(toolchain_makefile): greg@425: extension = ".ld" greg@425: DebugEnabled = False edouard@538: edouard@538: def GetBinaryCode(self): Lolitech@540: """Returns ready to send signed + sized intel formated hex program""" edouard@538: try: Lolitech@540: size = int(Popen( Lolitech@540: ['arm-elf-size','-B',os.path.join(self.buildpath,"ArmPLC_rom.elf")], Lolitech@540: stdout=PIPE).communicate()[0].splitlines()[1].split()[0]) Lolitech@540: res = "&" + hashlib.md5(open(os.path.join(self.buildpath, "ArmPLC_rom.bin"), "rb").read(size)).hexdigest() + '\n' +\ Lolitech@540: "$" + str(size) + '\n' +\ Lolitech@540: open(os.path.join(self.buildpath, "ArmPLC_rom.hex"), "r").read() Lolitech@540: return res edouard@538: except Exception, e: edouard@538: return None Lolitech@540: