Contiki 和 Python
Contiki and Python
我最近遇到了 Contiki,对于许多很棒的项目来说,它看起来是一个非常有趣的平台。 Contiki 使用 C 来开发它的应用程序。所以我想问的是Python能不能用C来代替?!
没有。 Python 需要一个 运行 时间环境,它不会 运行 在作为 Contiki 目标平台的任何设备上。
然而,有一些 Python-to-C 编译器,但我怀疑如果没有良好的 C 知识来获得正确的接口,你将能够获得任何合理的结果。
正如@morty 指出的那样,Python 需要 运行 时间才能执行。
因此,与在任何操作系统中一样,您需要字节码的本机解释器。
大多数 python 解释器无法安装在 Contiki 可以安装的受限设备上 运行 但是有一个非常好的项目叫做 Python-on-a-chip
http://code.google.com/p/python-on-a-chip/
来自主页
Welcome! Python-on-a-Chip (p14p) is a project to develop a reduced Python virtual machine (codenamed PyMite) that runs a significant subset of the Python language on microcontrollers without an OS. The other parts of p14p are the device drivers, high-level libraries and other tools.
了解 PyMite 能做什么或不能做什么:
Features of the PyMite VM:
- Requires roughly 55 KB program memory
- Initializes in 4KB RAM; print "hello world" needs 5KB; 8KB is the minimum recommended RAM.
- Supports integers, floats, tuples, lists, dicts, functions, modules, classes, generators, decorators and closures
- Supports 25 of 29 keywords and 89 of 112 bytecodes from Python 2.6
- Can run multiple stackless green threads (round-robin)
- Has a mark-sweep garbage collector
- Has a hosted interactive prompt for live coding
- Licensed under the GNU GPL ver. 2
The PyMite VM DOES NOT HAVE:
- A built-in compiler
- Any of Python's libraries (no batteries included)
- A ready-to-go solution for the beginner (you need to know C and how to work with microcontrollers)
基于 PyMite 的一个有趣项目是 https://github.com/tecip-nes/contiki-tres,这是一个基于 IoT 的 WSN 的编程抽象框架。
我最近遇到了 Contiki,对于许多很棒的项目来说,它看起来是一个非常有趣的平台。 Contiki 使用 C 来开发它的应用程序。所以我想问的是Python能不能用C来代替?!
没有。 Python 需要一个 运行 时间环境,它不会 运行 在作为 Contiki 目标平台的任何设备上。 然而,有一些 Python-to-C 编译器,但我怀疑如果没有良好的 C 知识来获得正确的接口,你将能够获得任何合理的结果。
正如@morty 指出的那样,Python 需要 运行 时间才能执行。 因此,与在任何操作系统中一样,您需要字节码的本机解释器。
大多数 python 解释器无法安装在 Contiki 可以安装的受限设备上 运行 但是有一个非常好的项目叫做 Python-on-a-chip http://code.google.com/p/python-on-a-chip/
来自主页
Welcome! Python-on-a-Chip (p14p) is a project to develop a reduced Python virtual machine (codenamed PyMite) that runs a significant subset of the Python language on microcontrollers without an OS. The other parts of p14p are the device drivers, high-level libraries and other tools.
了解 PyMite 能做什么或不能做什么:
Features of the PyMite VM:
- Requires roughly 55 KB program memory
- Initializes in 4KB RAM; print "hello world" needs 5KB; 8KB is the minimum recommended RAM.
- Supports integers, floats, tuples, lists, dicts, functions, modules, classes, generators, decorators and closures
- Supports 25 of 29 keywords and 89 of 112 bytecodes from Python 2.6
- Can run multiple stackless green threads (round-robin)
- Has a mark-sweep garbage collector
- Has a hosted interactive prompt for live coding
- Licensed under the GNU GPL ver. 2
The PyMite VM DOES NOT HAVE:
- A built-in compiler
- Any of Python's libraries (no batteries included)
- A ready-to-go solution for the beginner (you need to know C and how to work with microcontrollers)
基于 PyMite 的一个有趣项目是 https://github.com/tecip-nes/contiki-tres,这是一个基于 IoT 的 WSN 的编程抽象框架。