From 08f14d81c73f42947b069324a2c05f5c2dceac28 Mon Sep 17 00:00:00 2001 From: Leon Krieg Date: Sat, 24 Aug 2024 01:04:40 +0200 Subject: [PATCH] Initial commit --- Makefile | 34 ++++++++++++++++++++++++++++++++++ bin/.gitignore | 2 ++ src/main.c | 6 ++++++ 3 files changed, 42 insertions(+) create mode 100644 Makefile create mode 100644 bin/.gitignore create mode 100644 src/main.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2be064a --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +.DELETE_ON_ERROR: +.SUFFIXES: + +# Makefile +# Written by Leon Krieg + +ARCH := m32 +FREQ := 1600000UL +MCU := atmega32a +ASP := usbasp +GCC := avr-gcc +AVD := avrdude +RMF := rm -f +BINDIR := bin +ELFILE := $(BINDIR)/out.elf +TARGET := $(BINDIR)/core.hex +CFLAGS := -Os -std=c99 -Wall -Wextra -Werror +CPPFLAGS := -DF_CPU=$(FREQ) + +.PHONY: all +all: flash + +.PHONY: flash +flash: $(TARGET) + $(AVD) -c $(ASP) -p $(ARCH) -U flash:w:$(TARGET) + +$(TARGET): src/main.c + $(GCC) -o $(ELFILE) $(CFLAGS) $(CPPFLAGS) $^ -mmcu=$(MCU) + avr-objcopy -j .text -j .data -O ihex $(ELFILE) $@ + avr-size --format=avr --mcu=$(MCU) $@ + +clean: + $(RMF) $(TARGET) + $(RMF) $(ELFILE) diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..258b76a --- /dev/null +++ b/src/main.c @@ -0,0 +1,6 @@ +#define UNUSED(s) (void)(s) + +int main(void) +{ + return 0; +}