diff options
author | VG <vg@devys.org> | 2015-01-28 00:03:35 +0100 |
---|---|---|
committer | VG <vg@devys.org> | 2015-01-28 00:03:35 +0100 |
commit | cbb3c9832bbe31d741930d43d3e21a04abeb12f8 (patch) | |
tree | 1338bc0b6786a745d5d920b1aa6b2c0d1e645e5c /Makefile | |
download | servoswitch-cbb3c9832bbe31d741930d43d3e21a04abeb12f8.tar.gz servoswitch-cbb3c9832bbe31d741930d43d3e21a04abeb12f8.tar.bz2 servoswitch-cbb3c9832bbe31d741930d43d3e21a04abeb12f8.zip |
first commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..22606ad --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +# settings for arduino nano v3 +DEVICE = atmega328p +CLOCK = 16000000 +PORT=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9SBZLHD-if00-port0 +#AVRDUDE=avrdude -V -F -p m328p -c arduino -b 115200 -P$(PORT) +#AVRDUDE=avrdude -p $(DEVICE) -c arduino -b 115200 -P $(PORT) +AVRDUDE=avrdude -p $(DEVICE) -c arduino -b 57600 -P $(PORT) + +DEFS = -DF_CPU=$(CLOCK)UL +LIBS = -Wl,--relax,--gc-sections,--print-gc-sections,--entry=main +LIBS = -Wl,--entry=main,--gc-sections,--rela +CFLAGS = -Wall -Werror -pedantic -std=c99 +CFLAGS += -O2 -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -mmcu=$(DEVICE) $(DEFS) +#LDFLAGS = $(LIBS) + +all: main.hex size + +main.hex: main.c + avr-gcc -o main.elf $? $(CFLAGS) $(LDFLAGS) + avr-objcopy -j .text -j .data -O ihex main.elf main.hex + +f: flash +flash: all + $(AVRDUDE) -U flash:w:main.hex:i + +clean: + rm -f *.o *.elf *.hex + +size: + avr-size --mcu=$(DEVICE) -t -A main.elf + avr-size --mcu=$(DEVICE) -C main.elf + avr-nm --size-sort main.elf + + |