equal
deleted
inserted
replaced
|
1 import os |
|
2 from subprocess import Popen,PIPE |
1 from .. import toolchain_makefile |
3 from .. import toolchain_makefile |
|
4 import hashlib |
2 |
5 |
3 class LPC_target(toolchain_makefile): |
6 class LPC_target(toolchain_makefile): |
4 extension = ".ld" |
7 extension = ".ld" |
5 DebugEnabled = False |
8 DebugEnabled = False |
6 |
9 |
7 def GetBinaryCode(self): |
10 def GetBinaryCode(self): |
|
11 """Returns ready to send signed + sized intel formated hex program""" |
8 try: |
12 try: |
9 return open(os.path.join(self.buildpath, "ArmPLC_rom.bin"), "rb").read() |
13 size = int(Popen( |
|
14 ['arm-elf-size','-B',os.path.join(self.buildpath,"ArmPLC_rom.elf")], |
|
15 stdout=PIPE).communicate()[0].splitlines()[1].split()[0]) |
|
16 res = "&" + hashlib.md5(open(os.path.join(self.buildpath, "ArmPLC_rom.bin"), "rb").read(size)).hexdigest() + '\n' +\ |
|
17 "$" + str(size) + '\n' +\ |
|
18 open(os.path.join(self.buildpath, "ArmPLC_rom.hex"), "r").read() |
|
19 return res |
10 except Exception, e: |
20 except Exception, e: |
11 return None |
21 return None |
|
22 |