micro:bit 软件生态系统介绍

micro:bit 软件生态系统介绍

这里有大量的软件平台及工具使得许多microbit 计划顺利的进行,这篇文章只是做概略介绍而希望要进一步了解可以到不同计划的专页得到更多的数据.

Microbit Shop 

Overview

 

在microbit 软件分成在microbit (Target Computer 如下图右边)上执行的及主计算机(Host Computer 如下图左边)上两类 :

一般程序写好后透过USB 转到micro:bit , 整个流程由两个芯片完成,一是 KL26Z负责程序刷新(code flashing) ,另一nRF51822则执行完成用户完成的程序。

 

高阶程序语言

Microbit 的高阶程序语言分成编译及直译两类(但译者若以实际的程序执行环境目前都是"编译” ── 将用户程序编译后结合底层已有bytebode ,成为完整执行程序),原文便保留

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

 

为了可以确定在线的编译环境可支持一百万片microbit 的板子,微软用TypeScript 写了浏览器版编译程序,在这编译程序上微软使用了以下的技术 : 

  • Blocks (at microbit.co.uk)
  • TouchDevelop
  • CodeKingdoms Javascript (at microbit.co.uk)
  • Blocks and Javascript as part of pxt (at pxt.microbit.org)

 

整个完整流程说明在浏览器编译页面 In browser compiler,更细部令人惊艳的细节在 TouchDevelop in 208 bits.

 

浏览编译程序不会编译整个程序,只有用户编写的部分,其他底层执行的部分已经预先用mbed 编译好,并整合进在线编译程序。当用户编写完他的程序,编译程序便会编译并结合底层软件,让用户下载!

.

 

直译语言

在microbit.co.uk 正式的编译程序中,只有 Python 是直译的。这是用MicroPython 直译器项目所完成,细部数据可以 MicroPython的连结中找到。

另外还有Javascript 直译器项目 port of the Javascript interpreter Espruino 支持 microbit!

 

 

程序环境及整合接口

这里有许多程序环境可让用户对microbit做不同层面的程序设计.

较普遍的编译环境都列在https://microbit.org/code,脱机的编译环境有Mu offline Python editor

这里已经尽可能将micro bit 相关的编译环境列出来,若你有知道,但不在这上面的,请让我们知道(Here’s a non-exhaustive list of possible code editors for use with the micro:bit. please add any you know about that are not here,原文中并未指出如何通知,所以在这将原文列出)

 

 

从程序环境到 micro:bit 

每一个编译环境都会产生一个.hex 的档案,这是microbit 可以认得的格式。由于主计算机会将Microbit认为是USB随身碟(是由DAPLink 模拟出来),当编译出来Hex 檔拖拉至microbit。当闪灯结束,程序便开始执行。

另一"刷程序"(flash’ code) 是用手机AP透过蓝芽传输至 micro:bit ,更多的信息请参考 here,有关蓝芽手机程序更多信息请参考 here

 

 

micro:bit底层软件架构

当你为microbit 写完你的应用程序,刷你的程序进microbit 。这hex 档除了包含你写的部分也包含了许多底成软件模块,这些软件模块在底下一、一做介绍:

  • the micro:bit Runtime (有时称这部分为装置抽象层),是由Lancaster University 用C++ 写成。装置抽象层形成不同语言共同使用的部分,但在不同语言下使用的频繁度及包装的紧密度不同。(有兴趣的读者可以用以下列处的链接下载语言编译程序的程序代码研究,或初步去看各语言的reference 作了解)
  • ARM mbed 这部分提供了mbed 对不同ARM based MCU 的周边有标准的SDK ,这也包含了BLE 的抽象层及API ,这也代表的microbit 的软件可以执行在其他的mbed 支持的硬件上
  • Nordic nRF51-SDK mbed 是建构在Nordic nRF51-SDK的上层, 由 Nordic 发展的组件可以帮助程序人员使用它们的硬件。
  • MicroPython interpreter 若你是使用python的程序人员 ,它是用micro python 及mbed 开发出来的,所以microPython 是可以使用在许多不同硬件平台

 

 Micro:bit 中文台湾  中國

posted @ 2017-06-11 19:39  TWmicrobit  阅读(4003)  评论(0编辑  收藏  举报