diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-04-29 17:21:31 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-04-29 17:21:31 +0800 |
| commit | 0398894a39406ead5921df64892e3a1c82cc25b7 (patch) | |
| tree | 58425972a8ed8c72b268c41ce75a23b4e8e1648f /sleep/Makefile | |
| parent | a9ce750c420813b1e7dab5eb4e0340d107a34b20 (diff) | |
| download | smart-home-0398894a39406ead5921df64892e3a1c82cc25b7.tar.gz | |
Sleep test.
Diffstat (limited to 'sleep/Makefile')
| -rw-r--r-- | sleep/Makefile | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sleep/Makefile b/sleep/Makefile new file mode 100644 index 0000000..c818369 --- /dev/null +++ b/sleep/Makefile @@ -0,0 +1,44 @@ +CC = avr-gcc +MCU = atmega328p +PORT = /dev/cuaU0 +TARGET = sleep + +SRC = main.c uart.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 $(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 *.o *.elf *.hex + |
