Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This content was presented (with some edits) May 16th, 2020

Introduction

Welcome to the firmware team! We’re glad to have you.

...

With that out of the way, let’s get started!

What’s firmware?

It’s not software.

It’s not hardware.

...

To understand what firmware is, let’s first examine what software is.

What’s Software?

Software is a set of instructions that you run on a computer. For example, your favourite video game or code editor is software. It’s normally stored on your hard drive, then when you want to execute it, your operating system (Windows or Mac OS or Linux) will grab those instructions, put them into working memory (RAM), and execute those instructions. Once you’re done with the program, they’ll be erased from RAM to make room for other things.

Software vs. Firmware

Firmware is also a set of instructions, but instead of being stored on your hard drive, they’re stored forever in memory that’s wired directly to the electrical components of the computer. As soon as the computer is powered on, it’ll start executing the instructions it has in firmware.

...

In our firmware team, we work mainly on writing code for microcontrollers (like Arduino but we don’t use Arduino) that control or monitor the solar car. This an important aspect of firmware, which is that firmware focuses more on controlling a device’s hardware.

Why does it matter?

Firmware generally has a lot more restrictions than software. Firstly, the processor isn’t very fast and there isn’t much memory available, so our code needs to be simple and not too demanding. We partially get around this restriction by breaking the firmware into small projects and running it on different boards, each responsible for controlling a different part of the car. Breaking it down also helps us work on different parts at the same time.

The purpose of firmware

At the end of the day, in Midnight Sun, the firmware is there to support the hardware, not the other way around. This means we’re not the protagonist!

If you’re a budding software engineer with big dreams of making the world a better place through AI and blockchain or whatever other buzzwords are trending nowadays, this team might not be for you. We keep things simple.

Systems overview

Here’s a diagram of the car’s electrical system:

...

If this scares you, don’t worry! It scares us too. Thankfully, implementing what’s in this diagram is the hardware team’s job, not ours!

Firmware system overview

...

See, we don’t even need to worry about wires. Much cleaner and easier to understand.

...

For the most part, our firmware projects are detailed in Confluence. Boards Each subpage is the home for an electrical board’s documentation, most of which have a sub-page for the firmware.

How we’re working remotely

Even though you write code on a computer, since it’s meant to be run directly on the hardware, it’s not quite the same process when we’re working remotely. Here’s an explanation of how we’re able to do it.

...

First, let’s talk about compiling code.

Compiling code

As you may or may not know, to run C code, first you have to compile it. This means turning the higher level instructions you write as code into simpler instructions for the computer to understand.

...

An important caveat here is that not all computers understand the same instructions. For example, the processor in your laptop understands instructions called x86 (instruction set for Intel processors), while the computer chips we run our firmware on understands instructions called ARM.

Compiling our code

To do things like turn headlights on or off and read voltages from our hardware components on the BMS (battery management system) through code, we use pieces of code that are called libraries. Our firmware projects implement the logic parts we need, like determining when and how often we want an LED to blink and then we use the library to actually talk to the LED to turn it on or off. What this allows us to do is have different versions of the libraries for different types of computers:

...

Also, the hardware is still around, we’re just not close to it anymore. Good thing zoom, discord, and slack all exist! If we want to run our code on real hardware, we just have to call up the hardware member with the board and ask them to run it for us. Yes, this is more inconvenient, but it’s better than showing up a month later without having tested anything at all on hardware.

Writing code

As for actually writing code, it’s important now more than ever that we follow a process for writing code since it’s a little harder for me to peek over your shoulder and ask how you’re doing. Our process for writing firmware is as follows:

...

Notice how much testing we go through! This is really important. In firmware, writing the code is often only half the battle, and there can be many unforeseen delays when you actually start interacting with hardware.

Collaboration

The TL;DR of this is that we use GitHub and JIRA. We’ll be going over the detailed processes for these in later lessons, but otherwise, if you’re familiar with the basics, feel free to skip this section.

...

Again, we’ll be going over how we use these two tools in more depth as part of later lessons.

Conclusion

Thanks for sticking through! In conclusion, here’s what you should come away from reading this with an understanding of:

...

Next in firmware 102, we’ll go into more depth on our firmware system, controller boards, our project structure, testing and validation, and our collaboration platforms. We hope to see you there!

Homework

Your homework before the next lesson is to follow the instructions here: Module 1: Setup

...