Site: | pymite.python-hosting.com |
---|---|
Author: | Dean Hall |
. . . lets Python* run in a BILLION new places.
PyMite is a flyweight Python interpreter written from scratch to execute on 8-bit and larger microcontrollers with resources as limited as 64 KB of program memory (flash) and 4 KB of RAM.
Usually, Makefile is more complicated than the ...
Porting layer (plat.c):
- plat_init(): init i/o [periodic callback]
- plat_memGetByte(): get byte from mem(s)
- plat_getByte(): get byte from i/o
- plat_putByte(): send byte out i/o
- plat_getMsTicks(): get ms since boot
- plat_reportError(): print traceback
ipm> import sys; sys.heap() (4968, 8192) ipm> map(range, range(5)) [[], [0], [0, 1], [0, 1, 2], [0, 1, 2, 3]] ipm> [chr(x+0x30) for x in range(20) if x%3!=0] ['1','2','4','5','7','8',':',';','=','>','@','A','C'] ipm> l=range(3); import list; list.append(l,"foo") ipm> d = {}; d['foo'] = l; d['bar'] = chr ipm> d {'bar':'<obj type 0x08 @ 0x0000b500>', 'foo':[0, 1, 2, 'foo']}
def id(o): """__NATIVE__ PmReturn_t retval; pPmObj_t pr = C_NULL; if (NATIVE_GET_NUM_ARGS() != 1) { PM_RAISE(retval, PM_RET_EX_TYPE); return retval; } retval = int_new((int)NATIVE_GET_LOCAL(0), &pr); NATIVE_SET_TOS(pr); return retval; """ pass
ipm> import mbed ipm> mbed.lcd_print("PyMite r07 on\nMbed-002 14366")
Open Spaces:
- Embedded Systems: Sat 1140 DFW.B
- PyMite: Sun 1035 DFW.B
Try it out:
svn co http://svn.pymite.python-hosting.com/trunk cd trunk; make ipm
Planning PyMite 10: +classes +exceptions +more gravy