Skip to content
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

Add option for providing an external implementation of clock functions #516

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

erlingrj
Copy link
Collaborator

@erlingrj erlingrj commented Feb 6, 2025

This PR adds support for letting the user provide their own implementation of functions found in clock.c. This enables locking the physical time the runtime sees, to a simulator.

#else // defined(LF_EXTERNAL_CLOCK_PLUGIN)
// The following empty "dummy" function is here to avoid an "Empty translation unit" compiler
// warning if the user has defined LF_EXTERNAL_CLOCK_PLUGIN to provide their own implementation.
void __clock_dummy_function(void) {}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are using Werror=pedantic which throws an error on empty translation units. This dummy definition avoids that problem.

@erlingrj erlingrj requested a review from edwardalee February 6, 2025 09:13
@erlingrj erlingrj added the feature New feature label Feb 6, 2025
Copy link
Contributor

@edwardalee edwardalee left a comment

Choose a reason for hiding this comment

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

It would be nice to add specific instructions for how to make use of this. E.g., "Add X to your target properties, put Y into your cmake include file, then provide your own foo.c file and link it in as follows..." These could go into a comment in clock.c.

@erlingrj erlingrj enabled auto-merge February 7, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants