Please add a public SSH key to your
profile to be able to clone the repository via the SSH protocol.
Previews are disabled for this project as it contains too many files. Please click on the files to view them.
Makefile
# Project name. Binary file will be name (TARG).hex
TARG = P3DA
# MCU type & frequency
MCU=atmega168
F_CPU=16000000L
# Files in the project
SRCS = main.c
OBJS = $(SRCS:.c=.o)
CC = avr-gcc
OBJCOPY = avr-objcopy
SIZE = avr-size
# Flags for compiler
CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -Wall -g -Os -lm -mcall-prologues -std=c99
LDFLAGS = -mmcu=$(MCU) -Wall -g -Os
all: $(TARG) clean prog
$(TARG): $(OBJS)
$(CC) $(LDFLAGS) -o $@.elf $(OBJS) -lm
$(OBJCOPY) -O ihex -R .eeprom -R .nwram $@.elf $@.hex
$(SIZE) -t $@.hex
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f $(SRCS:.c=.elf) $(TARG).elf $(OBJS)
prog:
avrdude -carduino -P/dev/ttyUSB0 -p$(MCU) -b19200 -D -Uflash:w:$(TARG).hex:i # Arduino Nano ATmega168
# avrdude -carduino -P/dev/ttyUSB0 -p$(MCU) -b57600 -D -Uflash:w:$(TARG).hex:i # Arduino Nano ATmega328