GitHub Want to customise this for your own project folders? Read Now Read Now
Small Bit of Toast is my modified version of the microbit-v2-samples workflow from Lancaster University, keeping the original structure intact while adding one thing that makes life so much easier: predictable automation. Instead of having to shuffle files back and forth from the source folder like a nervous waiter, you just run a single script and get a clean, names hex file returned to you.
At the core of this is the build script. It handles the heavy lifting the same way every time. You work inside your own project folders, run the script, and everything else just happens. No manual copying into source. No surprises when you forgot to move an old .cpp file, and no more generic MICROBIT.hex that gives you no clue which project it belongs to.
The script wipes the slate clean, moves exactly what you're working on into the build context, compiles it, and places the finished hex file right back into your project being freshly delivered like a well-trained bakery.
There are two main ways to use it, depending on how organised you feel.
The preferred approach is through using an entire folder. You work on your projects inside sub directories within the projects folder so you can make use of the CODAL runtime and IntelliSense prompts, and when your inside your working directory just run
../build.sh
This will take everything you have in there, the .cpp or .h files etc., and build it all together. This outputs a hex file that takes the name of the folder so you always know what it is, and it just sits their next to the rest of your project files for easy use.
Its clean, predictable, and ideal for larger projects or juggling different testings.
The second method is by by defining which files you'd like to build so you can just keep your smaller projects together instead of needing a separate folder for only one file projects. To build these you just call.
../build.sh main.cpp
or you can do.
../build.sh main.cpp helpers.cpp helpers.h
If you are working with a smaller amount of files or have certain files that would be reused across different projects. This does exactly what it says, it build only those files and it will return a hex file named after the first file given to it (your main file doesn't need to be called main.cpp).
The whole structure feels a lot quicker than the expected manual method of needing to work in a predefined folder and constantly needing to move your code around to avoid build conflicts, the build file can also be easily customised to allow you to work in whichever folder you like, even the desktop assuming your Linux installation makes use of one, or you use WSL or some other method for building on Windows