targets/LPC/__init__.py
changeset 691 bb340874f09e
parent 648 73295e742da2
child 717 1c23952dbde1
--- a/targets/LPC/__init__.py	Thu Feb 16 15:13:05 2012 +0100
+++ b/targets/LPC/__init__.py	Thu Feb 16 22:52:28 2012 +0100
@@ -40,6 +40,16 @@
             except IOError, e:
                 return None
 
+    def ResetBinaryCodeMD5(self, mode):
+        if mode == "BOOTLOADER":
+            self.binmd5key = None
+            try:
+                os.remove(self._GetBinMD5FileName())
+            except Exception, e:
+                pass
+        else:
+            return toolchain_makefile.ResetBinaryCodeMD5(self)
+
     def GetBinaryCodeMD5(self, mode):
         if mode == "BOOTLOADER":
             return self._get_cached_md5_header()
@@ -48,16 +58,17 @@
 
     def build(self):
         res = toolchain_makefile.build(self)
-        self.binmd5key = self._get_md5_header()
-        f = open(self._GetBinMD5FileName(), "w")
-        f.write(self.binmd5key)
-        f.close()
-        try:
-            self.PluginsRootInstance.logger.write(
-                _("Binary is %s bytes long\n")%
-                    str(os.path.getsize(
-                        os.path.join(self.buildpath, "ArmPLC_rom.bin"))))
-        except Exception, e:
-            pass 
+        if res:
+            self.binmd5key = self._get_md5_header()
+            f = open(self._GetBinMD5FileName(), "w")
+            f.write(self.binmd5key)
+            f.close()
+            try:
+                self.PluginsRootInstance.logger.write(
+                    _("Binary is %s bytes long\n")%
+                        str(os.path.getsize(
+                            os.path.join(self.buildpath, "ArmPLC_rom.bin"))))
+            except Exception, e:
+                pass
         return res