Skip to content

benchmark: fix build error on Cortex-M0 #76

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

Conversation

gilles-peskine-arm
Copy link
Contributor

The timing code uses the DWT cycle counter which is an M3/M4 feature.
For the sake of M0, use the mbed microsecond timer if DWT is not available.

This commit addresses #74

The timing code uses the DWT cycle counter which is an M3/M4 feature.
For the sake of M0, use the mbed microsecond timer if DWT is not available.
@MarceloSalazar
Copy link

Please submit PR to mbed-os-workshop-17q2 branch (so we can use it this week).

@@ -179,6 +179,8 @@
mbedtls_printf( "FAILED: -0x%04x\r\n", -ret );
#endif

#if defined(CoreDebug_DEMCR_TRCENA_Msk) && defined(DWT_CTRL_CYCCNTENA_Msk)
/* DWT cycle counter is available (Cortex-M3, Cortex-M4) */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use different ways of measuring time. Using the same implementation will let us compare results across different platforms/MCUs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code always prints kB/s. I only changed the additional printing of cycles/byte, which aren't meaningful across platforms. The only fully portable alternative is not to have a cycle count at all, AFAICT. So this is the best I know how to do at the moment, but I'm open to suggestions.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we remove the usage of the cycle counter and use only one way of measuring time (which is supported across platforms).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#79 removes the cycle counter altogether.

A return statement was missing in a benchmarking function.
@gilles-peskine-arm
Copy link
Contributor Author

Rebased against workshop branch: PR #77

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