C Development on a Micro:bit

I wanted to have a fiddle writing code for the BBC Micro:bit in C, where I’d have access to the full potential of the device, most importantly the Bluetooth functionality.

Creating your own programs offline requires a non-trivial setup, regardless of your operating system.  Mostly for my own benefit, here are the URLs and simplified steps required to get up and running:

Yotta

I followed the instructions on https://lancaster-university.github.io/microbit-docs/offline-toolchains/.  What follows are my notes on what I had to do to make it work, over and above the instructions (adn what

Yotta is based on Python 2.  As I generally only code Python 3 this wasn’t a problem as there is a download of Yotta with all dependencies, available from http://yottadocs.mbed.com/#installing.

This will create some environment variables: YOTTA_INSTALL_LOCATION and YOTTA_PATH, the latter is added to the system path when you use the batch file run_yotta.bat, which is added to the desktop.

Grab SRecord from http://srecord.sourceforge.net/, this won’t get added to the path automatically, you have to do it manually.

Finally, you need GNU ARM Embedded Toolchain, from here: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads.

Before you start running stuff though, you’ll need a user created on http://developer.mbed.org.  This is because when you run yotta for the first time, it’ll want you to authenticate with this site before downloading some dependencies.

Finally, you can run “Run Yotta” and follow the rest of the instructions on https://lancaster-university.github.io/microbit-docs/offline-toolchains/.

This means cloning the repo:

git clone https://github.com/lancaster-university/microbit-samples

cd microbit-samples

then run:

yt target bbc-microbit-classic-gcc

and

yt build

And finally, copy the compiled .hex file to the shared drive on the Micro:bit:

copy build\bbc-microbit-classic-gcc\source\microbit-samples-combined.hex e:

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.