Hi,
I was one of the Kickstarter backers, and I've been keeping my eye on this project for some time. I have a question about the micropython backend, but first let me explain the context.
I'm in need of a "scripting" language for debugging and testing embedded devices during the development phase. In this circumstance, the device will only ever need to run the scripting code while it is connected to a Linux PC, as everything else will be in C for performance reasons. I'd like to use micropython as this interface, but it's still a bit too heavy for my needs. Is it possible to remove all compiler/language functionality and literally just stream the bytecodes (as compiled on a PC by micropython) to the device? Or burn the compiled bytecodes straight into a flash segment and run them from there? Or an SPI flash or something? I realise this would take some work, but is there fundamentally anything in the internal structure of micropython that would prevent this?
Has anyone tried something like this before? If so, what sort of savings do you see?
Removing the compiler from micropython
Re: Removing the compiler from micropython
Hi,
it would be import to know in which areas you are limited. RAM, ROM?
I am not an expert here, but you might want to check about frozen bytecode which was added recently and helps to free RAM.
Cutting micropython a little bit down can be done, afaik, during compilation with a set of flags. Cutting it even more down, becomes tricky...
it would be import to know in which areas you are limited. RAM, ROM?
I am not an expert here, but you might want to check about frozen bytecode which was added recently and helps to free RAM.
Cutting micropython a little bit down can be done, afaik, during compilation with a set of flags. Cutting it even more down, becomes tricky...
Re: Removing the compiler from micropython
Mostly flash is the problem, 80k is a lot for the low cost ARM chips.
-
- Posts: 363
- Joined: Sun Apr 17, 2016 1:55 pm
Re: Removing the compiler from micropython
penjuin wrote:Hi,
I was one of the Kickstarter backers, and I've been keeping my eye on this project for some time. I have a question about the micropython backend, but first let me explain the context.
I'm in need of a "scripting" language for debugging and testing embedded devices during the development phase. In this circumstance, the device will only ever need to run the scripting code while it is connected to a Linux PC, as everything else will be in C for performance reasons. I'd like to use micropython as this interface, but it's still a bit too heavy for my needs. Is it possible to remove all compiler/language functionality and literally just stream the bytecodes (as compiled on a PC by micropython) to the device? Or burn the compiled bytecodes straight into a flash segment and run them from there? Or an SPI flash or something? I realise this would take some work, but is there fundamentally anything in the internal structure of micropython that would prevent this?
Has anyone tried something like this before? If so, what sort of savings do you see?
If removing mostly language function, it will lost feature of micropython. Your may try Lua, it is smaller.
Re: Removing the compiler from micropython
I'm not really trying to remove language functions, I just want to do the python->bytecode step on a PC, and then the bytecode->instructions step on the microcontroller separately.
Re: Removing the compiler from micropython
MicroPython is more efficient than Lua. In the same binary size, MicroPython offers more features than Lua. And we're committed to maintain the most minimal configuration, unlike Lua. So no, Lua is not smaller.shaoziyang wrote: If removing mostly language function, it will lost feature of micropython. Your may try Lua, it is smaller.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: Removing the compiler from micropython
No. MicroPython is purposedly architectured to make that possible, and that's the direction in which it moves. But yes, actually doing that requires someone who really need that feature (so they make it).penjuin wrote:I realise this would take some work, but is there fundamentally anything in the internal structure of micropython that would prevent this?
Not that I heard of. MicroPython compiler is pretty efficient too, so the talk will be about fitting compiler-less MicroPython in 64K.Has anyone tried something like this before? If so, what sort of savings do you see?
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: Removing the compiler from micropython
Actually, I'm pretty rusty on the codebase myself. Such an option exists, and for a while: https://github.com/micropython/micropyt ... 16195a16ad
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: Removing the compiler from micropython
Hedgehog Lisp also works like that (compiler is on the PC side) if anyone cares. The target-side executable is just 20k or so including garbage collection, AVL trees as dictionaries, etc. Python is a more familiar language though.