As a student in CS 107e: Computer Systems from the Ground Up, I implemented various aspects of a computer system on a Raspberry Pi.
The code was all written in bare metal C with no operating system. The aspects that I directly worked on were:
- A Larson Scanner, purely in ARM assembly!
- A clock, and a complete GPIO interfaced with the appropriate RasPi registers to enable digital reads/writes.
- A string library (
strcmp, strlcat, printf, etc).
- A memory allocation library (
malloc, free, realloc, etc).
- A PS/2 keyboard library and console with simple commands like
poke, peek, echo, etc.
- A graphics library with text and shape (rectangles, anti-aliased lines, anti-aliased triangles, etc) drawing functionality.
- An interrupt handling library, to make the PS/2 keyboard more responsive when combined with costly graphics operations.
By the end of the quarter, I had created a terminal. After plugging in an HDMI monitor and PS/2 keyboard to the Raspberry Pi,
I could type on the keyboard, see the characters show up on the monitor, and execute simple commands, like changing the values in a GPIO register to turn on an LED.
Additionally, my version of the console terminal had a "history" capability where you could click the up and down arrow keys to access recent commands.
Though I cannot publish code publicly for honor code reasons, I am happy to discuss the class and projects -- see the Contact tab above.
As part of the course, I worked on an open ended final project called Air Snare, which is a drum kit you can play without drums. The hardware was two "drum sticks" (pencils)
with LSM6DS33 IMUs and push buttons, the Raspberry Pi, and an HDMI monitor for sound output. One stick played a kick drum or snare drum (selected with the push button), and the other
played a hi-hat or crash symbol. From a software standpoint, the project involved:
- Development of I2C driver for two LSM6DS33 IMUs to read raw data.
- Filtering and gesture extraction from the IMU data.
- Audio sequencing to queue sounds to be played based on the detected gestures.
- Delivery of audio samples to the Raspberry Pi GPU to output over HDMI to the attached screen.
All of this was implemented in bare-metal C with no operating system and no
stdlib. However, I made use of the libraries I had written (mentioned above).
The code can be found at
this GitHub repository, and some images and a video demo are below.