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

MicroPython module for interfacing with other Microkit components #153

Open
JE-Archer opened this issue Feb 26, 2025 · 0 comments
Open

MicroPython module for interfacing with other Microkit components #153

JE-Archer opened this issue Feb 26, 2025 · 0 comments

Comments

@JE-Archer
Copy link
Contributor

When deploying the MicroPython component in a system, there is currently no way to actually interface with another component on the system purely by writing Python code. By interfacing with another component we mean:

  • reading from and writing to shared memory regions;
  • notifying and being notified;
  • calling PPCs;
  • handling PPCs (?).

Instead, a user needs to write a C module for MicroPython and then call that module from Python. It would probably be useful to define a small module which provides an interface to other components which the MicroPython has a channel to. The module could consist of:

  • a method for notifying another component;
  • an asynchronous flag object which allows awaiting a notification from another component;
  • a method for executing a PPC;
  • an object providing a view of a shared memory region.

With the above a user would be able to use the MicroPython component to interface with another component writing only Python without any C.

The information required for these methods to work (information about shared memory regions, channel IDs) could be provided in the MicroPython resource object. Then, from Python code, the user could use the module to enumerate the channels available to it and call the above methods on a channel object to interface with it. Some pseudocode:

import lionsos

channels = lionsos.channels()
for ch in channel:
    ch.regions[0] = "Hello"
    ch.notify()
    await ch.notification()
    print(ch.regions[1])
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

No branches or pull requests

1 participant