TrapdoorSmoke
Posts: 81
Joined: Thu Nov 19, 2015 10:28 pm
Location: Scotland

Micro:bit Questions

Fri Jun 24, 2016 8:33 pm

I have some questions about BBC Micro:bit.
I couldn't find the answers anywhere.

A. Is the compiler for the device open source?

B. I know the Bord exempts .hex files is this compiled machine binary code or interpreted.

C. Can I compile c and c++ for the device.

Heater
Posts: 15950
Joined: Tue Jul 17, 2012 3:02 pm

Re: Micro:bit Questions

Sat Jun 25, 2016 2:03 am

No idea.

This is the wrong forum, this is the Raspberry Pi site.

I would hope that Micro:bit uses an ATMEL chip and can be programmed in C/C++ using the opensource avr-gcc compiler. Like the Arduino.

If not, bin it.
Memory in C++ is a leaky abstraction .

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: Micro:bit Questions

Sat Jun 25, 2016 7:49 am

Head over to developer.mbed.org - the micro:bit is an mbed enabled ARM Cortex M0 device. You'll have access to the online c/c++ compiler (Keil backend), or export your project to gcc etc target for offline compiling.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Micro:bit Questions

Sat Jun 25, 2016 10:11 am

TrapdoorSmoke wrote:I have some questions about BBC Micro:bit.
I couldn't find the answers anywhere.

B. I know the Bord exempts .hex files is this compiled machine binary code or interpreted.
See the last paragraph at https://www.microbit.co.uk/help:
The hex file contains the ARM machine instructions of your compiled script, along with the original script text. This means that: (1) the hex file can be copied onto your BBC micro:bit to run it; (2) the hex file also can be loaded back into the web app for further editing of the script. So, the hex file is a great way to share you script (via email or file sharing services). To load a hex file into the web app, you can either: (1) drag-and-drop the hex file onto the web app; (2) click on the “Import Code” icon in the web app.
PS: I think this question is way out of scope for a forum run by the Raspberry Pi Foundation in support of the Raspberry Pi.

User avatar
DougieLawson
Posts: 39126
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Micro:bit Questions

Sat Jun 25, 2016 11:50 am

TrapdoorSmoke wrote: A. Is the compiler for the device open source?
http://codewith.mu/ gives you microPython. You have to compile it from source https://github.com/ntoll/mu or install it with sudo apt-get install mu.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
carlosperate
Posts: 3
Joined: Sun Jan 17, 2016 1:01 pm
Location: Cambridge, UK
Contact: Website

Re: Micro:bit Questions

Sat Jun 25, 2016 3:20 pm

A. Is the compiler for the device open source?
Yes, the compiler used is gcc for ARM. But the easiest solution would be to use the mbed toolchain, which is based on yotta, so you would need to get all of that installed as well.
B. I know the Bord exempts .hex files is this compiled machine binary code or interpreted.
The hex file is machine code that gets loaded directly into the microbit flash. Some people might think that MicroPython is interpreted, but that's not quite the case (if you want to know more, you can check out this presentation), nevertheless the micropython output produces a hex file that includes the runtime with your python script attached.
C. Can I compile c and c++ for the device.
Yes, you will need more than just the compiler though, unless you are planning to reimplement all low level stuff. Basically it uses mbed (which uses the nordic libraries for this platform) and a "device abstraction layer" (DAL), more info at http://lancaster-university.github.io/microbit-docs/

Return to “Off topic discussion”