Writing a Blinky Program
Initial Downloads
For most projects I suggest you hand-type code that is in a code block in these articles. However for files that are not super important to the lesson, I will provide downloads. So for example, in this lesson, you will be writing a main
program which means that the Makefile, startup code, callbacks, and interrupts do not pertain to you just yet, and hand-typing them will not be super useful/a worthwhile use of your time. So the provided initial code is here:
Goal
A common practice whenever one wants to program with something new is to write a very simple "proof-of-concept" program. If you are learning a new language perhaps you want to write a program that prints "Hello, World!" to stdout
, or if you are learning a new library you want to do something to that effect utilizing some basic feature of that library (such as sending a network packet over Ethernet from one computer to another saying a message like "Hello, World!"). In the case of an embedded system, the standard beginner program of choice is to write a "Blinky" program, that is, a program that turns an LED on the board on and off at a certain rate.
One thing to think about is why printing something like "Hello, World!" is not a good first program for an embedded device environment.
Structure of an Embedded Program
Embedded programs follow the same abstract structure as programming for any system: set up your resources, then enter the main execution.