#NEWLINE# def setupDWT( self ) : #NEWLINE# #INDENT# '\n        Reads the number of hardware watchpoints available on the core\n        and makes sure that they are all disabled and ready for future\n        use\n        ' #NEWLINE# demcr = self . readMemory ( CortexM . DEMCR ) #NEWLINE# demcr = ( demcr | CortexM . DEMCR_TRCENA ) #NEWLINE# self . writeMemory ( CortexM . DEMCR , demcr ) #NEWLINE# dwt_ctrl = self . readMemory ( CortexM . DWT_CTRL ) #NEWLINE# watchpoint_count = ( ( dwt_ctrl >> 28 ) & 15 ) #NEWLINE# logging . info ( '%d hardware watchpoints' , watchpoint_count ) #NEWLINE# for i in range ( watchpoint_count ) : #NEWLINE# #INDENT# self . watchpoints . append ( Watchpoint ( ( CortexM . DWT_COMP_BASE + ( CortexM . DWT_COMP_BLOCK_SIZE * i ) ) ) ) #NEWLINE# self . writeMemory ( ( ( CortexM . DWT_COMP_BASE + ( CortexM . DWT_COMP_BLOCK_SIZE * i ) ) + CortexM . DWT_FUNCTION_OFFSET ) , 0 ) #NEWLINE# #UNINDENT# self . dwt_configured = True