micropython微控制器_MicroPython:针对微控制器的Python
劍橋大學數學科學中心的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
總結
以上是生活随笔為你收集整理的micropython微控制器_MicroPython:针对微控制器的Python的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python怎么将if和try一起用_P
- 下一篇: 2020知到python语言应用答案_2