這里有大量的軟件平臺及工具使得許多microbit計劃順利的進行,這篇文章只是做概略介紹而希望要進一步了解可以到不同計劃的專頁得到更多的數(shù)據(jù).
Overview
·High Level Programming Languages高階程序語言
oCompiled Languages編譯語言
·Coding environments and IDEs程序環(huán)境及整合接口
·From Coding Environment to micro:bit從程序環(huán)境到microbit
·micro:bit Low Level (C/C++) Software
Stack底層軟件架構(gòu)
在microbit軟件分成在microbit (Target Computer如下圖右邊)上執(zhí)行的及主計算機(Host Computer如下圖左邊)上兩類:
一般程序?qū)懞煤笸高^USB轉(zhuǎn)到micro:bit,整個流程由兩個芯片完成,一是KL26Z負責程序刷新(code flashing),另一nRF51822則執(zhí)行完成用戶完成的程序。
高階程序語言
Microbit的高階程序語言分成編譯及直譯兩類(但譯者若以實際的程序執(zhí)行環(huán)境目前都是"編譯”── 將用戶程序編譯后結(jié)合底層已有bytebode,成為完整執(zhí)行程序),原文便保留
The ‘high level’ programming languages for the
micro:bit break down into two broad categories
·Compiled languages: your
program is compiled to ARM assembler or some other kind of bytecode before
being copied onto the micro:bit.
·Interpreted Languages: both
your script and an interpreter for it are copied onto the micro:bit. Because the
interpreter is on the micro:bit itself, these langauges typically also allow
you to program the micro:bit ‘live’ over USB by typing commands.
編譯語言
C/C++, while certainly compiled, is not considered a high-level language
in this context
為了可以確定在線的編譯環(huán)境可支持一百萬片microbit的板子,微軟用TypeScript寫了瀏覽器版編譯程序,在這編譯程序上微軟使用了以下的技術(shù)?。?/i>
·Blocks (at microbit.co.uk)
·TouchDevelop
·CodeKingdoms Javascript (at
microbit.co.uk)
·Blocks and Javascript as part
ofpxt(at pxt.microbit.org)
整個完整流程說明在瀏覽器編譯頁面In browser compiler,更細部令人驚艷的細節(jié)在TouchDevelop in 208 bits.
瀏覽編譯程序不會編譯整個程序,只有用戶編寫的部分,其他底層執(zhí)行的部分已經(jīng)預(yù)先用mbed編譯好,并整合進在線編譯程序。當用戶編寫完他的程序,編譯程序便會編譯并結(jié)合底層軟件,讓用戶下載!
.
直譯語言
在microbit.co.uk正式的編譯程序中,只有Python是直譯的。這是用MicroPython直譯器項目所完成,細部數(shù)據(jù)可以MicroPython的連結(jié)中找到。
另外還有Javascript直譯器項目port of the Javascript interpreter Espruino支持microbit!
程序環(huán)境及整合接口
這里有許多程序環(huán)境可讓用戶對microbit做不同層面的程序設(shè)計.
較普遍的編譯環(huán)境都列在https://microbit.org/code,脫機的編譯環(huán)境有Mu offline Python editor
這里已經(jīng)盡可能將micro bit相關(guān)的編譯環(huán)境列出來,若你有知道,但不在這上面的,請讓我們知道(Here’s a non-exhaustive list of possible code editors for use with themicro:bit.please add any you know about that are not here,原文中并未指出如何通知,所以在這將原文列出)
·microbit.co.uk editors based
on TouchDevelop backend:
·PXT for micro:bit(successor
to the TouchDevelop-based editors above)
從程序環(huán)境到micro:bit
每一個編譯環(huán)境都會產(chǎn)生一個.hex的檔案,這是microbit可以認得的格式。由于主計算機會將Microbit認為是USB隨身碟(是由DAPLink模擬出來),當編譯出來Hex檔拖拉至microbit。當閃燈結(jié)束,程序便開始執(zhí)行。
另一"刷程序"(flash’ code)是用手機AP透過藍芽傳輸至micro:bit,更多的信息請參考here,有關(guān)藍芽手機程序更多信息請參考here。
micro:bit底層軟件架構(gòu)
當你為microbit寫完你的應(yīng)用程序,刷你的程序進microbit。這hex檔除了包含你寫的部分也包含了許多底成軟件模塊,這些軟件模塊在底下一、一做介紹:
·the micro:bit Runtime(有時稱這部分為裝置抽象層),是由Lancaster University用C++寫成。裝置抽象層形成不同語言共同使用的部分,但在不同語言下使用的頻繁度及包裝的緊密度不同。(有興趣的讀者可以用以下列處的鏈接下載語言編譯程序的程序代碼研究,或初步去看各語言的reference作了解)
·ARM mbed這部分提供了mbed對不同ARM based MCU的周邊有標準的SDK,這也包含了BLE的抽象層及API,這也代表的microbit的軟件可以執(zhí)行在其他的mbed支持的硬件上
·Nordic nRF51-SDKmbed是建構(gòu)在Nordic nRF51-SDK的上層,由Nordic發(fā)展的組件可以幫助程序人員使用它們的硬件。
·MicroPython interpreter若你是使用python的程序人員,它是用micro python及mbed開發(fā)出來的,所以microPython是可以使用在許多不同硬件平臺
中文臺灣