assembly / compile

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
macgman2000
Posts: 1
Joined: Wed Feb 27, 2019 6:27 pm

assembly / compile

Post by macgman2000 » Wed Feb 27, 2019 6:31 pm

Hello,

I am new to Micropython. Is there a way to bypass the interpreter and generate complied machine code?

I want to run the micropython script to develop and test my logic coding, but also want to regain the speed by running un-interpreted machine code. Maybe this isn't possible, but thought I would ask...

Thanks,
Nick

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: assembly / compile

Post by Roberthh » Wed Feb 27, 2019 7:58 pm

No, not in general. On Pyboard you can use decorators to generate faster code (viper), which is translated into machine code) or even use assembly code, at least a subset of that. See also this section of the documentation: http://docs.micropython.org/en/latest/r ... ython.html
http://docs.micropython.org/en/latest/p ... mbler.html
http://docs.micropython.org/en/latest/r ... 2_mov.html
That allows you to mix python code to handle complicated data structures and use machine code for speed.

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: assembly / compile

Post by jickster » Thu Feb 28, 2019 3:23 am

Roberthh wrote:No, not in general. On Pyboard you can use decorators to generate faster code (viper), which is translated into machine code) or even use assembly code, at least a subset of that. See also this section of the documentation: http://docs.micropython.org/en/latest/r ... ython.html
http://docs.micropython.org/en/latest/p ... mbler.html
http://docs.micropython.org/en/latest/r ... 2_mov.html
That allows you to mix python code to handle complicated data structures and use machine code for speed.

I don’t understand why the cross compiler - mpy-cross.exe - is still not able to generate machine code


Sent from my iPhone using Tapatalk Pro

Post Reply