comparison Makefile @ 312:ef64a178092f

- Some basic ADC code - Turn on -mcall-prologues - Put strings in program space, saves RAM
author Matt Johnston <matt@ucc.asn.au>
date Mon, 14 May 2012 00:22:57 +0800
parents 0a64532c1de1
children 52cb08a01171
comparison
equal deleted inserted replaced
311:fc96a51bdce6 312:ef64a178092f
15 # add settings like this to your ~/.avrduderc file: 15 # add settings like this to your ~/.avrduderc file:
16 # default_programmer = "stk500v2" 16 # default_programmer = "stk500v2"
17 # default_serial = "avrdoper" 17 # default_serial = "avrdoper"
18 # FUSES ........ Parameters for avrdude to flash the fuses appropriately. 18 # FUSES ........ Parameters for avrdude to flash the fuses appropriately.
19 19
20 DEVICE = atmega328 20 DEVICE = atmega168
21 CLOCK = 1000000 21 CLOCK = 1000000
22 PROGRAMMER = #-c stk500v2 -P avrdoper 22 PROGRAMMER = #-c stk500v2 -P avrdoper
23 OBJECTS = main.o ff.o mmc.o onewire.o 23 OBJECTS = main.o ff.o mmc.o onewire.o
24 LIBS = -lm
24 FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m 25 FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m
25 26
26 # ATMega8 fuse bits used above (fuse bits for other devices are different!): 27 # ATMega8 fuse bits used above (fuse bits for other devices are different!):
27 # Example for 8 MHz internal oscillator 28 # Example for 8 MHz internal oscillator
28 # Fuse high byte: 29 # Fuse high byte:
47 48
48 49
49 # Tune the lines below only if you know what you are doing: 50 # Tune the lines below only if you know what you are doing:
50 51
51 AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) 52 AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
52 COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 53 COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -g -std=c99 -mcall-prologues
53 54
54 # symbolic targets: 55 # symbolic targets:
55 all: main.hex 56 all: main.hex
56 57
57 .c.o: 58 .c.o:
83 clean: 84 clean:
84 rm -f main.hex main.elf $(OBJECTS) 85 rm -f main.hex main.elf $(OBJECTS)
85 86
86 # file targets: 87 # file targets:
87 main.elf: $(OBJECTS) 88 main.elf: $(OBJECTS)
88 $(COMPILE) -o main.elf $(OBJECTS) 89 $(COMPILE) -o main.elf $(OBJECTS) $(LIBS)
89 90
90 main.hex: main.elf 91 main.hex: main.elf
91 rm -f main.hex 92 rm -f main.hex
92 avr-objcopy -j .text -j .data -O ihex main.elf main.hex 93 avr-objcopy -j .text -j .data -O ihex main.elf main.hex
93 avr-size --format=avr --mcu=$(DEVICE) main.elf 94 avr-size --format=avr --mcu=$(DEVICE) main.elf