2011-11-14 20:23:01 +01:00
|
|
|
PRG = 16ch_pwm
|
|
|
|
OBJ = main.o
|
2012-01-07 19:57:34 +01:00
|
|
|
MCU_TARGET = atmega32
|
2011-11-14 20:23:01 +01:00
|
|
|
OPTIMIZE = -O2
|
|
|
|
|
|
|
|
DEFS =
|
|
|
|
LIBS =
|
|
|
|
|
|
|
|
# You should not have to change anything below here.
|
|
|
|
|
|
|
|
CC = avr-gcc
|
|
|
|
|
|
|
|
# Override is only needed by avr-lib build system.
|
|
|
|
|
|
|
|
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
|
|
|
|
override LDFLAGS = -Wl,-Map,$(PRG).map
|
|
|
|
|
|
|
|
OBJCOPY = avr-objcopy
|
|
|
|
OBJDUMP = avr-objdump
|
|
|
|
SIZE = avr-size
|
|
|
|
|
|
|
|
all: $(PRG).elf lst text
|
|
|
|
$(SIZE) -x -A $(PRG).elf
|
|
|
|
|
|
|
|
$(PRG).elf: $(OBJ)
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf *.o *.lst *.map $(PRG).elf *.hex *.bin
|
|
|
|
|
|
|
|
lst: $(PRG).lst
|
|
|
|
|
|
|
|
%.lst: %.elf
|
|
|
|
$(OBJDUMP) -h -S $< > $@
|
|
|
|
|
|
|
|
# Rules for building the .text rom images
|
|
|
|
|
|
|
|
text: hex bin
|
|
|
|
|
|
|
|
hex: $(PRG).hex
|
|
|
|
bin: $(PRG).bin
|
|
|
|
|
|
|
|
%.hex: %.elf
|
|
|
|
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
|
|
|
|
|
|
|
%.bin: %.elf
|
|
|
|
$(OBJCOPY) -j .text -j .data -O binary $< $@
|
|
|
|
|
|
|
|
install: text
|
|
|
|
# uisp -dprog=stk200 --erase --upload if=$(PRG).hex --verify
|
|
|
|
# avrdude -p m16 -c butterfly -b 19200 -P /dev/ttyUSB0 -U flash:w:$(PRG).hex
|
2012-01-07 19:57:34 +01:00
|
|
|
# avrdude -p m16 -c dragon_isp -P usb -U flash:w:$(PRG).hex
|
|
|
|
avrdude -p m32 -c dragon_isp -P usb -U flash:w:$(PRG).hex
|