NoteFollowing a national ballot, the union, UCU, that represents staff in the higher education sector has called a strike on three days in late November, and also "action short of a strike" during a period that starts on Wednesday, 23 November. During this period, colleagues are invited to take various actions, including abstaining from voluntary activities. I view the maintenance of Spivey's Corner as an activity I undertake voluntarily and not part of any contract of employment, and I cannot guarantee that it will remain accessible during the period of the dispute. In addition, some materials on the site may pertain to lectures that are cancelled by myself or others as part of the strike, and we are asked not to make them available online. Further details of the reasons for the strike and how it affects teaching in Oxford are on a brief FAQ page.
Setting up a programming environment/Notes
Other pages to be merged into this one:
- digisys:Installing the micro:bit toolchain
- digisys:The micro:bit toolchain on VirtualBox
- compilers:Software setup
- compilers:Installing VirtualBox
- A note about establishing ssh connection to account on ecslab machines, and using that for backup.
All of the software recommended in these notes is free, and easy to find and download.
Linux (with the Raspberry Pi desktop)
If you want to have your own Linux-based programming setup, there are basically two options: get a computer that you can install with Linux, or use a computer you already have – a Mac or a Windows machine – and install a version of Linux inside the virtual environment called VirtualBox.
Get a Linux laptop
Though it seems extravagant, buying a laptop specially to run Linux need not be expensive. If you choose a lightweight Linux distribution such as the Raspberry Pi desktop, then a suitable second-hand laptop can be bought for £150–200. Look for a machine with at least 2GB of RAM and a 60GB hard disk or SSD, if you can still find one that small. It may be that you can find a cast-off machine from a friend that is no longer powerful enough to run recent versions of Windows, but is perfectly fine as a lightweight Linux machine. If you want to buy a second-hand laptop, I won't put any supplier recommendations here, but would be glad to be asked in person.
The Raspberry Pi people produce their own Linux distribution, Raspberry Pi OS (formerly known as Raspbian). It's based on the popular Debian distribution, but compiled to run on the ARM processor of the Raspberry Pi. It comes equipped with a graphical environment (the Raspberry Pi desktop) that's based on LXDE, a lightweight alternative to Gnome, but with a much more polished appearance than LXDE.
The "Raspberry Pi desktop for PC and Mac" is a kind of side project, consisting of Debian for the i386 or x86_64 equipped with the same desktop environment as Raspberry Pi OS. It is a simple and easy-to-use Linux distribution that is well suited to less powerful, older machines. An installation image can be downloaded from
The 32-bit i386 version is perfectly adequate for our purposes, but if a 64-bit edition becomes available (and you have a laptop with a 64-bit processor) then that will work too, and might be slightly faster.
I don't recommend trying to run Linux from a memory stick, except as a demonstration that it is possible.
VirtualBox uses hardware features of recent processors to provide an emulated environment where a 'guest' operating system can run as a single process within a 'host' operating system. Some of the RAM of the host machine becomes dedicated to the guest operating system, and a single large-ish file in the host operating system provides a simulated hard disk drive for the guest. For our purposes, the host might be a PC running Windows or a Mac running Mac OS, and the guest will be a version of Linux. The lightweight nature of the "Raspberry Pi desktop for PC and Mac" makes it ideal as the guest in such a setup, able to run in the modest share of the memory of the host machine that can be lent to the guest.
There is a huge variety of editing and program development environments on offer – and tastes differ, sometimes in a way that is expressed all too passionately. More experienced participants in our courses will already have their own ideas about what tools they like, but for beginners it's good to have an environment that provides simple editing commands, a small selection of clear program building actions, and a clear interface, without complex tools or too great a focus on one programming language. I think that the open source development environment Geany fulfils these requirements very well.
Geany can be installed on Windows and Mac OS as well as Linux, but on Linux it shines particularly well. It does not attempt to integrate too tightly with compilers for various programming languages, but is capable of running any compiler in a sub-process, and usually able to parse the compilers error messages in order to highlight the source lines that contain the errors.
My own programming setup is a bit different from what I've recommended here. I have Debian with Gnome 3 on most of the PCs I use, but I also use Raspberry Pis for some purposes, and I find the Pi desktop quite comfortable, and much tidier than basic LXDE.
I am a long-term user of Emacs, principally because at the time I adopted it, the choice was more or less Emacs or Vi, and Emacs had the feature of allowing a project to be built within the editor, with any error messages parsed afterwards. I had used Vi quite a lot, and never liked the style of interaction that separated command mode from insert mode.
For almost all projects, I stick with Make as a build tool, because it is universal, and adapts well to projects that are written in more than a single language. I use it to manage the processing of collections of TeX documents too.
For version control, I always use Mercurial, just because its set of commands seem to be better designed for human use than the (entirely equivalent) commands offered by Git. When I work with public Git repositories like GitHub, I just use Hggit, which enables Mercurial to be used as a client for Git.
VirtualBox is a virtual machine monitor: it uses the resources provided on a PC or Mac by a host operating system (for example, Windows) to simulate an empty computer, on which another guest operating system (for example, Linux) can be installed. We will use VirtualBox on a Windows machine or Mac to provide a Linux environment that can compile and download programs for the micro:bit. VirtualBox keeps the contents of the guest machine's hard disk in a single file in the host operating system, so virtual machine setups can be shared by copying this file.
If you plug in a micro:bit to a USB port, you should see that it appears as a drive within the virtual machine.
- Document that there is no root password, but there is sudo access for guest
- Disable PCManFM popup on device insertion: under Preferences/Volume Management.
- Allocate CMSIS-DAP USB device to VirtualBox – may need repeating after importing.
- Add udev rule for access to debug device.
Videosetc. directories under
- Customise the toolbar to omit the web browser but show Geany.
Some final hints:
- Use the
VboxSVGAgraphics adapter to avoid some messages at startup.