The basics of hello world
Running hello world or Blinky on a microcontroller involves more than just a print statement. The traditional hello world program in C may look as follows:
#include <stdio.h>int main() { printf("Hello Cortex-M world!\n"); }
If I compile this program and run it on any of my laptop computers, it will print the following message:
$ gcc -o hello hello.c $ ./hello Hello Cortex-M world!
Developers are not typically interested in the details of running a C program on a computer running Windows, Linux, or macOS. It’s clear that the printf
function is defined in a C header file, stdio.h
, and there is a C library that provides the code. Most developers generally understand that a new process is created, the program is loaded into memory, and the C language defines the standard output file (stdio
) to be the terminal and writes the message. The operating system will take care of the details to run the program...