stabilize stlinkv2.py
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 14 Mar 2013 05:02:23 +0000 (14:02 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 14 Mar 2013 05:02:56 +0000 (14:02 +0900)
tool/stlinkv2.py

index fff6366..5168b07 100755 (executable)
@@ -474,7 +474,11 @@ class stlinkv2(object):
             self.run()
             s = self.get_status()
             if s != 0x0080:
-                raise ValueError("Status of core is not running.", s)
+                #                   DCB_DHCSR    DBGKEY
+                self.write_debug_reg(0xE000EDF0, 0xA05F0000)
+                s = self.get_status()
+                if s != 0x0080:
+                    raise ValueError("Status of core is not running.", s)
         mode = self.stl_mode()
         if mode != 2:
             raise ValueError("Failed to switch debug mode.", mode)