這里有大量的軟件平臺(tái)及工具使得許多microbit計(jì)劃順利的進(jìn)行,這篇文章只是做概略介紹而希望要進(jìn)一步了解可以到不同計(jì)劃的專頁(yè)得到更多的數(shù)據(jù).
Overview
·High Level Programming Languages高階程序語(yǔ)言
oCompiled Languages編譯語(yǔ)言
oInterpreted Langauges直譯語(yǔ)言
·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í)行的及主計(jì)算機(jī)(Host Computer如下圖左邊)上兩類:
一般程序?qū)懞煤笸高^(guò)USB轉(zhuǎn)到micro:bit简珠,整個(gè)流程由兩個(gè)芯片完成膘融,一是KL26Z負(fù)責(zé)程序刷新(code flashing),另一nRF51822則執(zhí)行完成用戶完成的程序岛都。
高階程序語(yǔ)言
Microbit的高階程序語(yǔ)言分成編譯及直譯兩類(但譯者若以實(shí)際的程序執(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.
編譯語(yǔ)言
C/C++, while certainly compiled, is not considered a high-level language
in this context
為了可以確定在線的編譯環(huán)境可支持一百萬(wàn)片microbit的板子立轧,微軟用TypeScript寫(xiě)了瀏覽器版編譯程序帐萎,在這編譯程序上微軟使用了以下的技術(shù) :
·Blocks (at microbit.co.uk)
·TouchDevelop
·CodeKingdoms Javascript (at
microbit.co.uk)
·Blocks and Javascript as part
ofpxt(at pxt.microbit.org)
整個(gè)完整流程說(shuō)明在瀏覽器編譯頁(yè)面In browser compiler,更細(xì)部令人驚艷的細(xì)節(jié)在TouchDevelop in 208 bits.
瀏覽編譯程序不會(huì)編譯整個(gè)程序,只有用戶編寫(xiě)的部分篙顺,其他底層執(zhí)行的部分已經(jīng)預(yù)先用mbed編譯好椎麦,并整合進(jìn)在線編譯程序。當(dāng)用戶編寫(xiě)完他的程序造成,編譯程序便會(huì)編譯并結(jié)合底層軟件缓升,讓用戶下載!
.
直譯語(yǔ)言
在microbit.co.uk正式的編譯程序中棘脐,只有Python是直譯的净当。這是用MicroPython直譯器項(xiàng)目所完成潭苞,細(xì)部數(shù)據(jù)可以MicroPython的連結(jié)中找到。
另外還有Javascript直譯器項(xiàng)目port of the Javascript interpreter Espruino支持microbit!
程序環(huán)境及整合接口
這里有許多程序環(huán)境可讓用戶對(duì)microbit做不同層面的程序設(shè)計(jì).
較普遍的編譯環(huán)境都列在https://microbit.org/code蹦骑,脫機(jī)的編譯環(huán)境有Mu offline Python editor
這里已經(jīng)盡可能將micro bit相關(guān)的編譯環(huán)境列出來(lái),若你有知道,但不在這上面的,請(qǐng)讓我們知道(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
每一個(gè)編譯環(huán)境都會(huì)產(chǎn)生一個(gè).hex的檔案撇簿,這是microbit可以認(rèn)得的格式找蜜。由于主計(jì)算機(jī)會(huì)將Microbit認(rèn)為是USB隨身碟(是由DAPLink模擬出來(lái))诚纸,當(dāng)編譯出來(lái)Hex檔拖拉至microbit旧烧。當(dāng)閃燈結(jié)束夺谁,程序便開(kāi)始執(zhí)行勿负。
另一"刷程序"(flash’ code)是用手機(jī)AP透過(guò)藍(lán)芽傳輸至micro:bit锭硼,更多的信息請(qǐng)參考here溉浙,有關(guān)藍(lán)芽手機(jī)程序更多信息請(qǐng)參考here。
micro:bit底層軟件架構(gòu)
當(dāng)你為microbit寫(xiě)完你的應(yīng)用程序,刷你的程序進(jìn)microbit寺酪。這hex檔除了包含你寫(xiě)的部分也包含了許多底成軟件模塊盒犹,這些軟件模塊在底下一卓嫂、一做介紹:
·the micro:bit Runtime(有時(shí)稱這部分為裝置抽象層)蘑辑,是由Lancaster University用C++寫(xiě)成副砍。裝置抽象層形成不同語(yǔ)言共同使用的部分邦尊,但在不同語(yǔ)言下使用的頻繁度及包裝的緊密度不同又沾。(有興趣的讀者可以用以下列處的鏈接下載語(yǔ)言編譯程序的程序代碼研究,或初步去看各語(yǔ)言的reference作了解)
·ARM mbed這部分提供了mbed對(duì)不同ARM based MCU的周邊有標(biāo)準(zhǔn)的SDK,這也包含了BLE的抽象層及API艳吠,這也代表的microbit的軟件可以執(zhí)行在其他的mbed支持的硬件上
·Nordic nRF51-SDKmbed是建構(gòu)在Nordic nRF51-SDK的上層,由Nordic發(fā)展的組件可以幫助程序人員使用它們的硬件锐涯。
·MicroPython interpreter若你是使用python的程序人員升薯,它是用micro python及mbed開(kāi)發(fā)出來(lái)的,所以microPython是可以使用在許多不同硬件平臺(tái)
中文臺(tái)灣