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, as Jason suggested. i just checked the Cortex-A53 Spec and did not find DWT for Cycle Count. I am thinking it's not in ARMv8-A !

    1) What would be the Generic Cycle Count Approach/Strategy  for ARM ?

    2) or what would be the list of Generic Cycle Count Approach depending on the ARM versions ?

    As explained i am looking for an easy Cycle Count Counter i could Read from the code when required in C syntax.

    Regards

Reply
  • Hi, as Jason suggested. i just checked the Cortex-A53 Spec and did not find DWT for Cycle Count. I am thinking it's not in ARMv8-A !

    1) What would be the Generic Cycle Count Approach/Strategy  for ARM ?

    2) or what would be the list of Generic Cycle Count Approach depending on the ARM versions ?

    As explained i am looking for an easy Cycle Count Counter i could Read from the code when required in C syntax.

    Regards

Children