Simple Raspberry Pi kernel to flash an LED with a preset pattern

After playing with a PiFace extension board on one of my Raspberry Pi computers, and getting it to flash Knight Rider-style patterns [Python v3 code here], I decided to try flashing LEDs from bare metal.  While I am very familiar with Intel x86 assembly language, this was my first forage into the ARM assembly language, and this Raspberry Pi kernel is my first purely home-made kernel.

The source and binary for my kernel may be found in battlesnake/pi-kernel-led-flasher on GitHub.  By default it flashes the following pattern, although the pattern can be changed easily (see the README).

bbbr

As for the ARM architecture and assembly language:  the ability to set condition execution flags on almost any instruction is a lovely idea, which presumably make for better pipeline usage by requiring less conditional branching (although my kernel doesn’t bother enabling branch prediction).  The Intel-like syntax is also a nice touch, since I was initially expecting to be forced into the grotesque AT&T syntax that the Linux world seems to bizarrely like.

Leave a Reply