0

I tried setting up the toolchain on Ubuntu 22.04 host to run the examples from https://github.com/lancaster-university/microbit-samples/ but I'm just unable to setup Yotta, I keep getting different dependency issues. What are the exact steps needed?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985

2 Answers2

2

After trying to setup the toolchain for a while, I finally decided to Google for a Docker image with the toolchain, and found https://github.com/carlosperate/docker-microbit-toolchain at this commit from Carlos Atencio, a Micro:Bit foundation employee, and that just absolutely worked:

# Get the Docker image.
docker pull ghcr.io/carlosperate/microbit-toolchain:latest

# Get examples.
git clone https://github.com/lancaster-university/microbit-samples
cd microbit-samples
git checkout 285f9acfb54fce2381339164b6fe5c1a7ebd39d5

# Select a sample. It builds one at a time. The default one is the hello world.
cp source/examples/hello-world/* source

# Build and flash.
docker run -v $(pwd):/home --rm ghcr.io/carlosperate/microbit-toolchain:latest yotta build

# Flash.
cp build/bbc-microbit-classic-gcc/source/microbit-samples-combined.hex "/media/$USER/MICROBIT/"

And you can then flash the example you want to run with:

cp build/counter.hex "/media/$USER/MICROBIT/"

The source code for the hello world from https://github.com/lancaster-university/microbit-samples/blob/285f9acfb54fce2381339164b6fe5c1a7ebd39d5/source/examples/hello-world/main.cpp is:

#include "MicroBit.h"

MicroBit uBit;

int main()
{
    uBit.init();
    uBit.display.scroll("HELLO WORLD! :)");
    release_fiber();
}

Atencios' Docker setup explains how get yotta working if you still want that: https://github.com/carlosperate/docker-microbit-toolchain/blob/master/Dockerfile , the key is likely using his magically crafted requirements.txt, likely kept back from the day when things really worked, to avoid the infinitely many dependency issues of yotta. He's on Ubuntu 20.04.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
2

It's great that you've found a work around to compile C for the micro:bit. To answer your original question, here's what worked for me to install yotta on Debian 11.5. I have Python v3.9.2 installed.

sudo aptitude install python-setuptools cmake build-essential ninja-build python-dev libffi-dev libssl-dev

pip3 install yotta --user
Oppy
  • 2,662
  • 16
  • 22