Ciro Santilli OurBigBook.com $£ Sponsor €¥ 中国独裁统治 China Dictatorship 新疆改造中心、六四事件、法轮功、郝海东、709大抓捕、2015巴拿马文件 邓家贵、低端人口、西藏骚乱
stackoverflow.com/questions/73877965/how-to-compile-c-c-code-into-a-hex-file-for-the-bbc-microbit
Official support is abysmal, very focused on MicroPython and their graphical UI.
The setup impossible to achieve as it requires setting up the Yotta, just like the impossible to setup Compile MicroPython code for Micro Bit locally on Ubuntu 22.04 with your own firmware setup.
So we just use github.com/lancaster-university/microbit-samples + github.com/carlosperate/docker-microbit-toolchain:
docker pull ghcr.io/carlosperate/microbit-toolchain:latest
git clone https://github.com/lancaster-university/microbit-samples
cd microbit-samples
git checkout 285f9acfb54fce2381339164b6fe5c1a7ebd39d5

# Select a sample, 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
cp build/bbc-microbit-classic-gcc/source/microbit-samples-combined.hex "/media/$USER/MICROBIT/"
.hex file size for the hello world was 447 kB, much better than the MicroPython hello world downloaded from the website which was about 1.8 MB!
If you try it again for a second time from a clean tree, it fails with:
warning: github rate limit for anonymous requests exceeded: you must log in
presumably because after Yotta died it started using GitHub as a registry... sad. When will people learn. Apparently we were at 5000 API calls per hour. But if you don't clean the tree, you will be just fine.

Ancestors

  1. Micro Bit
  2. Microprocessor development board
  3. Printed circuit board
  4. Circuit board
  5. Electronic circuit
  6. Electronics
  7. Area of technology
  8. Technology
  9. Ciro Santilli's Homepage