LPCtarget/__init__.py
changeset 54 eb068364ccfa
parent 1 4f6d393cb36e
child 56 a4bc15ac7998
equal deleted inserted replaced
53:d92a0c3040a4 54:eb068364ccfa
    13     def _GetBinMD5FileName(self):
    13     def _GetBinMD5FileName(self):
    14         return os.path.join(self.buildpath, "lastbuildPLCbin.md5")
    14         return os.path.join(self.buildpath, "lastbuildPLCbin.md5")
    15 
    15 
    16     def _get_md5_header(self):
    16     def _get_md5_header(self):
    17         """Returns signature header"""
    17         """Returns signature header"""
       
    18         buildpath = self.buildpath.encode(sys.getfilesystemencoding())
    18         size = int(Popen(
    19         size = int(Popen(
    19              ['arm-elf-size','-B',os.path.join(self.buildpath,"ArmPLC_rom.elf")],
    20              ['arm-elf-size','-B',os.path.join(buildpath,"ArmPLC_rom.elf")],
    20              stdout=PIPE).communicate()[0].splitlines()[1].split()[0])
    21              stdout=PIPE).communicate()[0].splitlines()[1].split()[0])
    21         res = "&" + hashlib.md5(open(os.path.join(self.buildpath, "ArmPLC_rom.bin"), "rb").read(size)).hexdigest() + '\n' +\
    22         res = "&" + hashlib.md5(open(os.path.join(buildpath, "ArmPLC_rom.bin"), "rb").read(size)).hexdigest() + '\n' +\
    22               "$" + str(size) + '\n'
    23               "$" + str(size) + '\n'
    23         return res
    24         return res
    24 
    25 
    25     def GetBinaryCode(self):
    26     def GetBinaryCode(self):
    26         """Returns ready to send signed + sized intel formated hex program"""
    27         """Returns ready to send signed + sized intel formated hex program"""