]> git.sur5r.net Git - openocd/blobdiff - src/target/cortex_m.c
target/cortex_m: restore C_MASKINTS after reset
[openocd] / src / target / cortex_m.c
index f186946722609dd51b55c2743f25e1b9984fbdd4..ca3dbec78dbc61b924d54230c66468b8db3f00c5 100644 (file)
@@ -237,8 +237,11 @@ static int cortex_m_endreset_event(struct target *target)
                        return retval;
        }
 
-       /* clear any interrupt masking */
-       cortex_m_write_debug_halt_mask(target, 0, C_MASKINTS);
+       /* Restore proper interrupt masking setting. */
+       if (cortex_m->isrmasking_mode == CORTEX_M_ISRMASK_ON)
+               cortex_m_write_debug_halt_mask(target, C_MASKINTS, 0);
+       else
+               cortex_m_write_debug_halt_mask(target, 0, C_MASKINTS);
 
        /* Enable features controlled by ITM and DWT blocks, and catch only
         * the vectors we were told to pay attention to.