MicroPython:针对微控制器的Python

https://img-my.csdn.net/uploads/201505/18/1431886342_8770.jpg

剑桥大学数学科学中心的Damien P. George在研究各种深奥数学、物理问题之余,还搞了一个MicroPython项目,将Python移植到ARM Cortex M微处理器上,并开发了电路板。2013年曾经在KickStarter上成功筹得近10万英镑。2014年成功完成项目,发货。

同时,这个项目也在GitHub上开源,至今已有1800+星,60位贡献者。

George曾在2014年PyCon UK上介绍MicroPython,所用硬件平台叫pyboard,规格是:

  • STM32F405RG: 192k RAM, 1M ROM, 168MHz, Cortex M4F.
  • USB micro connector for device (and host).
  • Micro SD card.
  • 3-axis accelerometer (MMA7660).
  • Real-time clock, 4 LEDs, 2 switches.
  • 30 GPIO: symmetric pin layout, plus extra pins.
  • Internal file system. ”/flash” and ”/sd”.

由于存储太小,CPython都太大,只能自行开发Python实现,采取了很多优化措施:

  • Interned strings, most already in ROM.
  • Small integers stuffed in a pointer.
  • Optimised method calls (thanks PyPy!).
  • Range object is optimised (if possible).
  • Python stack frames live on the C stack.
  • ROM absolutely everything that can be ROMed!
  • Garbage collection only (no reference counts).
  • Exceptions implemented with custom setjmp/longjmp.

优化后,比原生的Python 2和Python 3都快了几个数量级:https://news.ycombinator.com/item?id=7841642

MicroPython的生态系统现在也开始起来了,就在本月前几天,荷兰埃因霍温的一个团队WiPy刚刚在KickStarter上成功众筹到75000多英镑,他们的项目是基于MicroPython软件的另一款硬件:超低功耗的物联网WiFi硬件。

SparkFun上也有WiFi模块ESP8266

HN上的两次讨论:

-https://news.ycombinator.com/item?id=9558969 -https://news.ycombinator.com/item?id=7840566

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值