How to execute functions remotely on micropython

89 Views Asked by At

I am currently experimenting with making a debugging interface to a Micropython implementation running on a NIOS2 processor. It is a very rudimentary way of during it by only sending and receiving register write or read commands to/from the device over ethernet.

However, I've got the bright idea that it could be nice if I, with a decorator, could set a whole function to be executed on the device. By sending the entire source code to the device and then uses exec().

This works just fine. But I ran into the problem with function arguments. If the argument is an already created object how do I get this data to the device? Pickle does not exist in the version of Micropython I'm stuck at using.

I've found that getting the __dict__ information is the way to go. I am though stuck at how to create an object in micropython without running its __init__() method. IE the object must not be initialized twice since it will corrupt itself.

Is this possible to do?

Regards

0

There are 0 best solutions below