vsolina / mipyshell

MicroPython based imitation of a POSIX shell that supports line completion, history, basic threading (developed on ESP32 and ESP8266, probably works on other boards)
MIT License
44 stars 3 forks source link

Executing binaries #1

Open sickcodes opened 3 years ago

sickcodes commented 3 years ago

Hey @vsolina @vsolinans!

Amazing, amazing project.

Is there a capability to execute any arbitrary xtensa or i486 binaries?

Possible to add SWAP ram?

Also, do you plan on releasing the Linux ESP32 project? I would do anything to play with that 😅

Love you work

vsolina commented 1 year ago

Glad you like it!

This shell is built on top of MicroPython, if MP can't do it - the shell can't to it either. Running binaries for a different architecture would require some kind of VirtualMachine which is mostly outside of ESP32's capabilities. (there are some toy examples of a VM on ESP32; e.g. the one used to run Linux on ESP32 - like you noticed - but that project was so poorly implemented and so useless that I decided not to release it in the end) In theory running xtensa (native) binaries would be possible in MicroPython - in the form of a native module - either by compiling and linking them into the MicroPython image before flashing it to the controller; OR as an external C module https://docs.micropython.org/en/latest/develop/natmod.html If you create a compiled external module, I don't see why you could not use it within the Shell, should be the same as including a regular .py module. (but I have not tested it) btw. I would love to see a public API for hosted, versioned MicroPython module compiler: I send one or more .c+.h files and get back a cross-compiled external .mpy module

Regarding the SWAP - I don't think MicroPython supports that. If it did support it I assume swapping pages in and out would significantly deteriorate performance. But I guess that will not be a priority any time soon, since external PSRAM is supported and enough for most embedded projects using ESP32.

p.s. sorry for the late response