-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (33 loc) · 1.2 KB
/
Makefile
File metadata and controls
43 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Two first steps of WinAVR cross-compiler toolchain are used here, and to put
# the file in the flash we use Micronucleus
CC = avr-gcc
OBJCOPY = avr-objcopy
DUDE = micronucleus
# Configuration for the attiny85, which is the main part of the Wattuino Nanite 85
CFLAGS = -Wall -Os -Iusbdrv -std=gnu99 -mmcu=attiny85
OBJFLAGS = -j .text -j .data -O ihex
DUDEFLAGS = --run
# The list of object files for the firmware
OBJECTS = usbdrv/usbdrv.o usbdrv/oddebug.o usbdrv/usbdrvasm.o main.o
# Building the firmware for attiny85
all: main.hex $(CMDLINE)
# By using command "make flash" the firmware is uploaded to Nanite
flash: main.hex
$(DUDE) $(DUDEFLAGS) $<
# Removing the files existing after compilation
clean:
$(RM) *.o *.hex *.elf usbdrv/*.o
# From .elf file to .hex
%.hex: %.elf
$(OBJCOPY) $(OBJFLAGS) $< $@
# Making main.elf file from object files
main.elf: $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $@
# Recompiling .o files after changing the config
$(OBJECTS): usbdrv/usbconfig.h
# Making object .o files from .c files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Making object .o files from assembler .S files
%.o: %.S
$(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@