Capturing Native/Compiled Code

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
delta9
Posts: 2
Joined: Tue May 20, 2014 6:01 am

Capturing Native/Compiled Code

Post by delta9 » Tue May 20, 2014 6:14 am

I've compiled microPython on my Linux box, and can run simple Python programs, often seeing a handy speedup to my runtimes. (I think this is freakin' amazing and awesome.) I can use the command-line switches on the interactive interpreter to emit bytecode vs. native code, and can observe the impact on performance. (Again: great!) What I cannot do, however, is capture the '.pyc' bytecode or the native code. I've used 'strace' to determine that the executable does not access/write to any files after reading my input, so it's all occuring in memory. A cursory check of the source reveals that the '-X compile-only' runtime option merely skips running the (in-memory) generated code, but does not do anything to preserve the compiled result (search 'compile-only' and 'compile_only' in 'unix/main.c' to see what I mean).

So, the question is this: how can I retain the compiled result (specifically, the native code) in an executable format? Must even that 'native' code be run through the interpreter (presumably because it lacks some boilerplate bits)?

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Capturing Native/Compiled Code

Post by pfalcon » Tue May 20, 2014 2:36 pm

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/

delta9
Posts: 2
Joined: Tue May 20, 2014 6:01 am

Re: Capturing Native/Compiled Code

Post by delta9 » Tue May 20, 2014 3:47 pm

Oh – easy peasy. ;)

Reading through that discussion, it's clear that I should stick to my dayjob. I fairly well follow the gist of it, but it looks like I'm of no help in this area. Thanks for your contribution to the project!

Post Reply