-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (38 loc) · 1.71 KB
/
Makefile
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
ARDUINO := /usr/share/arduino
AVR := /usr/avr
DEVICE := $(shell ls -t /dev/tty* | grep -E 'ACM|USB' | head -1)
paranoid: tone.c
avr-gcc -c -g -Os -Wall -pedantic -ansi -fno-exceptions -ffunction-sections -fdata-sections \
-std=iso9899:1999 \
-Wall -pedantic \
-Wmissing-prototypes \
-pedantic-errors -Wextra -Wall -Waggregate-return -Wcast-align \
-Wcast-qual -Wchar-subscripts -Wcomment -Wconversion \
-Wdisabled-optimization \
-Werror -Wfloat-equal -Wformat -Wformat=2 \
-Wformat-nonliteral -Wformat-security \
-Wformat-y2k \
-Wimport -Winit-self -Winline \
-Winvalid-pch \
-Wunsafe-loop-optimizations -Wlong-long -Wmissing-braces \
-Wmissing-field-initializers -Wmissing-format-attribute \
-Wmissing-include-dirs -Wmissing-noreturn \
-Wpacked -Wpadded -Wparentheses -Wpointer-arith \
-Wredundant-decls -Wreturn-type \
-Wsequence-point -Wshadow -Wsign-compare -Wstack-protector \
-Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default \
-Wswitch-enum -Wtrigraphs -Wuninitialized \
-Wunknown-pragmas -Wunreachable-code -Wunused \
-Wunused-function -Wunused-label -Wunused-parameter \
-Wunused-value -Wunused-variable -Wvariadic-macros \
-Wvolatile-register-var -Wwrite-strings \
-mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 \
tone.c -o tone.c.o
link: paranoid
avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o tone.c.elf tone.c.o
avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 tone.c.elf tone.c.eep
avr-objcopy -O ihex -R .eeprom tone.c.elf tone.c.hex
clean:
rm -f *.elf *.o *.d *.eep *.hex
flash: link
avrdude -vvv -p atmega328p -b 57600 -c arduino -P $(DEVICE) -U flash:w:tone.c.hex