Adventures of Writing an OS Kernel from Scratch on a Cortex M3 Board

This term I’m currently taking SE350 (formerly known as ECE354) a.k.a. Operating Systems a.k.a. one of the heaviest workload courses in my program. For this course, we have a cumulative lab with 4 deliverables. At the end of this term, we’ll have a fully working OS kernel for the Keil MCB1700 Cortex-M3 Board with the following features:

For this lab, I’ll be working with my classmates Fasih A., Josh K., and John Z. With any luck, we should be able to get a decent amount of sleep and not kill each other by the end of this term. Because we have to write a 30-ish page report at the end documenting all of our work and what we’ve learned, I thought it would be a good idea to start a journal about our (mis)adventures starting from the beginning.

The adventure begins…

posts/2014/os/os-wow.jpg
OS WOW

Part 2

For part two, we have to implement message passing, keyboard interrupts, and timer interrupts. In part one, we simply used busy waiting for printf that waited until the THR (Transmission Holding Register) is empty before writing the next character to the uart (Universal Asynchronous Receiver/Transmitter). For part two, we need an interrupt routine that handles THRE interrupts (Transmission Holding Register Empty interrupts). After getting a THRE interrupt, our interrupt process then needs to get the next message in its pending messages queue, store it in a buffer, free the message’s memory, and write the next chacacter in our buffer to the THR.

As for the timer interrupts, we just need to increment an internal counter everytime we get an interrupt and deliver any delayed messages that have expired. Finally, we also need to implement a digital clock on the terminal that updates every second. Overall, it doesn’t look too bad and we have about a month before it’s due. Unfortunately, we also have at least 3 midterms (depending on our electives) and 3 major assignments between part one and part two.

Part 3

posts/2014/os/os-wow-lcd-display.jpg
OS WOW on the LCD Display

Part 4