Python on a chip

From emboxit
Revision as of 02:12, 1 November 2012 by 176.92.135.112 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Python on a chip on Arduino Mega

1. Install tools:

A. Cygwin
http://www.cygwin.com/
Remember to select GCC and python packages.
http://cygwin.com/faq.html
B. Install WinAVR:
http://sourceforge.net/projects/winavr/files/
C. Download PyMite 8 http://www.pythononachip.org:... 150px

2. Download our arduino mega port and place under trunk$\src\platform

http://www.cutedigi.com/pub/Arduino/arduinomega.rar

3. Under trunk$, do

make PLATFORM=arduinomega
If it shows pmfeatures.h is missing, please check that you are using the make from WinAVR. Correct the PATH to make sure you are using that make.
The following is the command to check:
     $ make --version
     GNU Make 3.81
     Copyright (C) 2006  Free Software Foundation, Inc.
     This is free software; see the source for copying conditions.
     There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     This program built for i386-pc-mingw32

4. The next step is to program the generated main.hex to the Arduino mega board.

You need STK500, and install AVR studio. Choose Device type ATMEGA1280, and fuse setting is shown as...300px

5. Find a serial port and see what comes out from the serial port of Arduino Mega:300px

The following is main.py, the Python script that got running:

#
# PyMite - A flyweight Python interpreter for 8-bit and larger microcontrollers.
# Copyright 2002 Dean Hall.  All rights reserved.
# PyMite is offered through one of two licenses: commercial or open-source.
# See the LICENSE file at the root of this package for licensing details.
#

#
# This is a sample application that calls functions in the AVR module.
#

"""__NATIVE__
#include <avr/io.h>
"""


print "Hello world."


#
# Initialize the AVR's port A pin direction
#
def init():
    """__NATIVE__
    /* Set port A pins as all outputs */
    DDRA = 0xFF;
    NATIVE_SET_TOS(PM_NONE);

    return PM_RET_OK;
    """
    pass

init()
import avr
avr.portA(0xaa)


print "Expect a NameError (0xEA) after this."
foo()




Python on a chip on LeafLabs Maple [STM32]

Install the tool-chain

  • I have to update the path permanently
  • Build successfully on Ubuntu
600px


Maple


Python on a chip under Ubuntu