[BangPypers] converting python to assembly..

Vishal vsapre80 at gmail.com
Fri Jun 1 08:59:38 CEST 2012


On Fri, Jun 1, 2012 at 11:32 AM, Anand Balachandran Pillai <
abpillai at gmail.com> wrote:

> On Thu, May 31, 2012 at 11:40 AM, Vishal <vsapre80 at gmail.com> wrote:
>
> > Hello,
> >
> > Does anybody know of any effort that can covert a relatively static
> version
> > of python code into assembly for use with microcontrollers ?
> >
>
> Just wondering what is the need for this ? If you are coding in Python
> in the first place do you really want to go down all the way to assembly
> code output ? In that case I think you should start off with C rather
> than Python.
>
> >> Very good question. Here's the situation. In one of our products, we
create the control app in Python, but then need to control physical
outputs/inputs of analog and digital nature. We need to use a
microcontroller board for this. The microcontroller still needs lot of
software, an RTOS, and number of tasks (serial, ADC, PWM etc etc). All this
software needs to be written in the  preferred dialect of C and using the
preferred compiler of the vendor (MPLAB for Microchip's PIC controllers
etc). It would be great if we could simply write in Python and then have
this converted to the preferred microcontroller's assembly either as direct
binary files or creating a C file with the assembly code inside asm() calls
and then passing this C file to the MPLAB compiler.

Life can go on even without this hack...but this hack would make life
easier and more productive.

>
> >
> > CorePy did it but not for microcontrollers
> > P14p (or PyMite) actually creates a python interpreter in C and puts it
> > inside the microcontroller, and its GPL.
> > PyPy as you know is not yet for microcontrollers and only creates
> assembly
> > when the JIT kicks in.
> > Cython/Pyrex would convert python with type specifications into extension
> > module...but it will not fit into microcontrollers.
> >
> > I am looking for something more "simple", i.e. instead of writing C and
> > compiling it to machine instructions...write python (restricted set..may
> > be) and convert it to machine instructions.
> >
> > Any pointers will be of big help..
> >
>
> I see some projects like pyastra (circa 2006) and pyasm on Google but
> nothing
> which is maintained and has kept up.
>
> >> PyAstra is not maintained and in its current form only caters to the
lower end of the PIC spectrum (PIC12, PIC16 i.e. 8 bit ones). What we would
be using is PIC24 or dsPIC33 (16 bit processors with "lots"of RAM...30K RAM
and 256K ROM :D) .

>
>
> >
> > Thanks and best regards,
> > Vishal Sapre
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
>
> --
> Regards,
>
> --Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
Thanks and best regards,
Vishal Sapre

---
"Life is 10% how you make it, and 90% how you take it"
"बहुजन हिताय, बहुजन सुखाय (Benefit for most people, Happiness for most
people.)"
---
Please DONT print this email, unless you really need to.
Save Energy & Paper. Save the Earth.


More information about the BangPypers mailing list