summaryrefslogtreecommitdiffstats
path: root/lock/Server.Makefile
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-05-17 10:57:12 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-05-17 10:57:12 +0800
commit4f80330bae049dec0e69433a0e87c5427553febe (patch)
tree178a939a1b700434dc13bb064be4f275c06cc639 /lock/Server.Makefile
parentd02d12832a302ce811c60daa43d02856de777135 (diff)
downloadsmart-home-4f80330bae049dec0e69433a0e87c5427553febe.tar.gz
Rename files and use -f flag in rm.
Diffstat (limited to 'lock/Server.Makefile')
-rw-r--r--lock/Server.Makefile46
1 files changed, 46 insertions, 0 deletions
diff --git a/lock/Server.Makefile b/lock/Server.Makefile
new file mode 100644
index 0000000..154bf21
--- /dev/null
+++ b/lock/Server.Makefile
@@ -0,0 +1,46 @@
+CC = avr-gcc
+MCU = atmega328p
+PORT = /dev/cuaU0
+TARGET = server
+
+SRC = bend.c uart.c nrfm.c util.c
+OBJ = $(SRC:.c=.o)
+
+CFLAGS = -std=gnu99
+CFLAGS += -Os
+CFLAGS += -Wall
+CFLAGS += -mmcu=$(MCU)
+CFLAGS += -DBAUD=115200
+CFLAGS += -DDEBUG=1
+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 $(PORT)
+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 -f *.o *.elf *.hex
+
+