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

Restarting (Ctrl+D) does not reset module's variables #274

Open
josuah opened this issue Oct 18, 2023 · 0 comments
Open

Restarting (Ctrl+D) does not reset module's variables #274

josuah opened this issue Oct 18, 2023 · 0 comments

Comments

@josuah
Copy link
Member

josuah commented Oct 18, 2023

All the custom C code of the modules would need to reset the variables to zero.

This is done by C at startup, but when rebooting MicroPython, the global variables contained within the modules might have invalid code.

For instance, callbacks might be pointing at invalid memory, or worse: working code that is not referred by malloc and might be overwritten at any time.

One possible solution is to use MicroPython __init__, a single struct globals for all global variables, and inside __init__, memset the struct globals to 0 (or default values).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

1 participant