How to count execution cycles
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2010-03-18 3:45 AM
Posted on March 18, 2010 at 11:45
How to count execution cycles
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:43 AM
Posted on May 17, 2011 at 13:43
I found a way searching the net. The ARM Cortex has a Cycle counter register. Below is C code to initialize it and read it. Using the Memory View to look at the value of the register at memory location 0xE0001004 let you see the counter updating as you step through the code.
int count = 0; volatile unsigned int *DWT_CYCCNT = (int *)0xE0001004; //address of the register volatile unsigned int *DWT_CONTROL = (int *)0xE0001000; //address of the register volatile unsigned int *SCB_DEMCR = (int *)0xE000EDFC; //address of the register *SCB_DEMCR = *SCB_DEMCR | 0x01000000; *DWT_CYCCNT = 0; // reset the counter *DWT_CONTROL = *DWT_CONTROL | 1 ; // enable the counter ....... ...... count = *DWT_CYCCNT;Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:43 AM
Posted on May 17, 2011 at 13:43
http://forums.arm.com/index.php?showtopic=13949
https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fARM%20CortexM3%20STM32%2fconfigure%20a%20general%20purpose%20TIMx%20%28x%3d2%2c3%2c4%29%20same%20as%20Systick%20on%20STM32F103B&FolderCTID=0x01200200770978C69A...
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
