Browse Source

Merge pull request #1499 from Guozhanxin/new

to be able debug trace bit  before use DWT.
Bernard Xiong 7 years ago
parent
commit
f0895aa491
1 changed files with 3 additions and 0 deletions
  1. 3 0
      components/drivers/cputime/cputime_cortexm.c

+ 3 - 0
components/drivers/cputime/cputime_cortexm.c

@@ -54,6 +54,9 @@ int cortexm_cputime_init(void)
     /* check support bit */
     if ((DWT->CTRL & (1UL << DWT_CTRL_NOCYCCNT_Pos)) == 0) 
     {
+        /* enable trace*/
+        CoreDebug->DEMCR |= (1UL << CoreDebug_DEMCR_TRCENA_Pos);
+        
         /* whether cycle counter not enabled */
         if ((DWT->CTRL & (1UL << DWT_CTRL_CYCCNTENA_Pos)) == 0) 
         {