Say you have a simple bit of code:
#include <avr/io.h>
#include <util/delay.h>
#define LED_BUILTIN _BV(PORTB5)
int main(void)
{
DDRB |= LED_BUILTIN;
while (1)
{
PORTB |= LED_BUILTIN; // turn on led
_delay_ms(1000); // delay 1s
PORTB &= ~LED_BUILTIN; // turn off led
_delay_ms(1000); // delay 1s
}
}
You have a Makefile that compiles that into an object (.o
) file like this:
avr-gcc -mmcu=atmega328p -DF_CPU=16000000 -Os -c blink.c
If you were to forget to set the device type when compiling your .c
file into an object file (.o
), you would get a warning: