This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data Watch DWT on RPI3 without debuigger

hi,

I am trying to use the Data Watch and Trace  natively on RPI3 without debugger to count Cycle but got a core dump. here the code to compile and run on a RPI3. . My objective is to count cycle to do accurate benchmarking.

I have a core dumped on line *DEMCR = *DEMCR | 0x01000000; 

What is the issue here ?

Thanks for any help. Regards

 #include <stdint.h>

#include <stdio.h>

#include <stdlib.h> volatile uint32_t count = 0;  

// addresses of registers

volatile uint32_t *DWT_CONTROL = (uint32_t *)0xE0001000;

volatile uint32_t *DWT_CYCCNT = (uint32_t *)0xE0001004;

volatile uint32_t *DEMCR = (uint32_t *)0xE000EDFC;

int main () { // enable the use DWT

printf("Init \n");

*DEMCR = *DEMCR | 0x01000000;

printf(" never here ? \n");  

// Reset cycle counter *DWT_CYCCNT = 0; // enable cycle counter

*DWT_CONTROL = *DWT_CONTROL | 1 ;  

// some code here

// number of cycles stored in count variable

count = *DWT_CYCCNT;

printf("count = %d \n",count);

return 0; }  

The output is : Init Segmentation fault (core dumped)  

Parents
  • Hi Jason, thanks for the answer.

    yes, i am using a RPI3 on Ubuntu mate. My app is a C library doing maths intend to run on different platforms (intel and ARM). On Intel, i am using __rdtsc and i was thinking to use DWT for ARM. I tried on a RPI3 thinking it would be the same by error (Thanks Jason to point out)  but i will also need to bench old ARM 7-6 etc.... I am looking for a Cycle count Stat embedded in the library code with the smallest dependencies  so i am not looking for additional tools.  I will look to the similar Cortex-A53 DWT function. Do you know an equivalence DWT on Cortex-A53 ?. Do you think to a more general solution than DWT to count cycle in the ARM world ? Thanks for any advices. Best regards

Reply
  • Hi Jason, thanks for the answer.

    yes, i am using a RPI3 on Ubuntu mate. My app is a C library doing maths intend to run on different platforms (intel and ARM). On Intel, i am using __rdtsc and i was thinking to use DWT for ARM. I tried on a RPI3 thinking it would be the same by error (Thanks Jason to point out)  but i will also need to bench old ARM 7-6 etc.... I am looking for a Cycle count Stat embedded in the library code with the smallest dependencies  so i am not looking for additional tools.  I will look to the similar Cortex-A53 DWT function. Do you know an equivalence DWT on Cortex-A53 ?. Do you think to a more general solution than DWT to count cycle in the ARM world ? Thanks for any advices. Best regards

Children