8000 Add CPU cycle counter accessors by earlephilhower · Pull Request #226 · earlephilhower/arduino-pico · GitHub
[go: up one dir, main page]

Skip to content

Add CPU cycle counter accessors #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 29, 2021
Merged

Add CPU cycle counter accessors #226

merged 8 commits into from
Jun 29, 2021

Conversation

earlephilhower
Copy link
Owner

Use the 24-bit SYSTICK peripheral, wrapped in logic to extend it to a
full 32 or 64bits. W/o the wrapper, SYSTICK will wrap around in ~100ms.

Adds rp2040.getCycleCount() and rp2040.getCycleCount64()

Clean up the libpico build process as crt0.S from the pico-sdk should
be directly used.

Use the 24-bit SYSTICK peripheral, wrapped in logic to extend it to a
full 32 or 64bits.  W/o the wrapper, SYSTICK will wrap around in ~100ms.

Adds rp2040.getCycleCount() and rp2040.getCycleCount64()

Clean up the libpico build process as crt0.S from the pico-sdk should
be directly used.
@earlephilhower earlephilhower merged commit 03e740a into master Jun 29, 2021
@earlephilhower earlephilhower deleted the cyclecount branch June 29, 2021 03:53
@Andy2No
Copy link
Contributor
Andy2No commented Jun 29, 2021

That could be useful. What data types do they return?

What's the approximate loop/repeat time for each one?

Also, is there a way to get the current CPU clock frequency or cycle time, to use to convert the return value to a number of microseconds? Not essential, but it would be nice to be able to write code that still gave correct time periods, based on that, without needing to assume the CPU clock speed, since it can be changed.

schkovich pushed a commit to schkovich/arduino-pico that referenced this pull request May 24, 2025
earlephilhower#226)

* Add some extra defines to customise behaviour of STDIO_USB_RESET modes

* Tweaks to STDIO_USB_RESET defines
schkovich pushed a commit to schkovich/arduino-pico that referenced this pull request May 24, 2025
earlephilhower#226)

* Add some extra defines to customise behaviour of STDIO_USB_RESET modes

* Tweaks to STDIO_USB_RESET defines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0