Writing an Embedded OS

Diving into bare-metal microcontroller programming

Part 0: Introduction

Last year, I found myself with a good excuse to dive into writing some embedded software. Like many people, I'd started out with an Arduino, using their Wiring programming environment. After some long evenings cozying up to Atmel datasheets, I felt comfortable abandoning the Arduino IDE and writing everything... [Read More]

Part 1: The ST Micro Nucleo STM32F411 Board

Before we look at any code, it will be useful to get a little more familiar with the hardware. This is a Nucleo STM32F411 development board from ST Microelectronics, and its purpose is to make it easy to develop using the STM32F411RET6 microcontroller.... [Read More]

Part 2: The Toolchain

The process of building firmware isn't too different to building a native executable. We'll use gcc and ld to compile and link C sources, but it will be a cross-compiler that outputs ARM code instead of code for our host platform (usually x86 or x86-64). We'll also use GCC's assembler... [Read More]

Part 3: A First Look at Code

Let's take a look at the source code. Clone the following Git repository: git@github.com:embedded-guide/zeptos.git and check out the tag part3: git clone git@github.com:embedded-guide/zeptos.git cd zeptos git checkout part3 This is a tiny test project that we'll use to get our toolchain working. The first file... [Read More]

Part 4: Clocks

Before we get into the really interesting stuff, we need to cover an important, but somewhat tedious topic: clocks. All the activity within the MCU is coordinated by clocks. We're not talking about wallclock time here (we'll refer to that as the real-time clock, or RTC), but a simple signal... [Read More]

Part 5: GPIO Driver

This is an upcoming part.

Part 6: UART Driver

This is an upcoming part.

Part 7: Task Switching

This is an upcoming part.

Part 8: Blocking

This is an upcoming part.

Part 9: Message Passing

This is an upcoming part.