Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

support for cortex-m4 DWT registers available? #58

Open
echowwww opened this issue Jun 15, 2018 · 2 comments
Open

support for cortex-m4 DWT registers available? #58

echowwww opened this issue Jun 15, 2018 · 2 comments
Assignees

Comments

@echowwww
Copy link

Description

When i tried to use DWT registers to count execution cycles, the result was always 0. So i wonder whether the gnu-mcu-eclipse supports DWT register for cortex m4?

Steps to Reproduce

  1. enable and initiate DWT
  2. runs lines of instructions
  3. get cycle from DWT_CYCCNT

Expected behaviour: [What you expected to happen]
any value greater than 0
Actual behaviour: [What actually happened]
0

Versions

  • QEMU v2.8.0-3
  • Eclipse Oxygen.2

Btw, if DWT is really not implemented yet, how should i count the cycle?
Thanks for any advice and help!

@ilg-ul
Copy link
Contributor

ilg-ul commented Jun 15, 2018

Counting cycles is somehow tricky on an emulator like QEMU, since the original code is translated into native code. I don't know if it is supported.

I'll check next time I'll update to the latest version, and, if available, I'll try to make the count available.

@ilg-ul
Copy link
Contributor

ilg-ul commented Feb 26, 2019

DWT (Data Watchpoint and Trace Unit) is present on M3/M4 at 0xE0001000–0xE0001FFF.

The DWT->CYCCNT is at 0xE0001004.

DWT->CTRL is at 0xE0001000.
[0] | CYCCNTENA | Enable the CYCCNT counter. If not enabled, the counter does not count and no event is generated for PS sampling or CYCCNTENA. In normal use, the debugger must initialize the CYCCNT counter to 0.


I checked the current code, and there is no easy way to get the cycles count.

I'll leave this open and I'll revisit it after updating to the latest sources.

@ilg-ul ilg-ul self-assigned this Feb 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants