summaryrefslogtreecommitdiffstats
path: root/Dong.Makefile
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-04-09 19:31:30 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-04-09 19:31:30 +0800
commitde096ea780245c8beb748839120e5669fe37d457 (patch)
tree1f8ee90f3a452cfbeb67d18f52fbfbd3cb6d7e21 /Dong.Makefile
parente34917da814c2cdb3710553d479df0aed3979e28 (diff)
downloadavr-nrf24l01-driver-de096ea780245c8beb748839120e5669fe37d457.tar.gz
Rename and fix pdlen read.
Diffstat (limited to 'Dong.Makefile')
-rw-r--r--Dong.Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/Dong.Makefile b/Dong.Makefile
new file mode 100644
index 0000000..4dcb942
--- /dev/null
+++ b/Dong.Makefile
@@ -0,0 +1,44 @@
+CC = avr-gcc
+MCU = atmega328p
+TARGET = dong
+
+SRC = dong.c uart.c nrfm.c
+OBJ = $(SRC:.c=.o)
+
+CFLAGS = -std=gnu99
+CFLAGS += -Os
+CFLAGS += -Wall
+CFLAGS += -mmcu=$(MCU)
+CFLAGS += -DBAUD=115200
+CFLAGS += -DF_CPU=16000000UL
+CFLAGS += -ffunction-sections -fdata-sections
+
+LDFLAGS = -mmcu=$(MCU)
+LDFLAGS += -Wl,--gc-sections
+
+HEX_FLAGS = -O ihex
+HEX_FLAGS += -j .text -j .data
+
+AVRDUDE_FLAGS = -p $(MCU)
+AVRDUDE_FLAGS += -c arduino
+AVRDUDE_FLAGS += -P /dev/cuaU0
+AVRDUDE_FLAGS += -D -U
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+elf: $(OBJ)
+ $(CC) $(LDFLAGS) $(OBJ) -o $(TARGET).elf
+
+hex: elf
+ avr-objcopy $(HEX_FLAGS) $(TARGET).elf $(TARGET).hex
+
+upload: hex
+ avrdude $(AVRDUDE_FLAGS) flash:w:$(TARGET).hex:i
+
+.PHONY: clean
+
+clean:
+ rm *.o *.elf *.hex
+
+