Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Name: Makefile
- # Project: Test3
- # Author: JCSilva
- # Creation Date: 2016-08-07
- # Tabsize: 4
- # Copyright:
- # License: GNU GPL v2 (see License.txt)
- # This Revision: $Id: Makefile,v 1.1 2016/08/04 20:56:04 jcsilva Exp $
- DEVICE=attiny15
- CLOCK=1600000
- # Programmer
- UISP = avrdude -c dragon_isp -p $(DEVICE)
- # The two lines above are for "uisp" and the AVR910 serial programmer connected
- # to a Keyspan USB to serial converter to a Mac running Mac OS X.
- # Choose your favorite programmer and interface.
- COMPILE = avr-gcc -Wall -Os -I. -mmcu=$(DEVICE) -DF_CPU=$(CLOCK) -DDEBUG_LEVEL=0
- #include all objects
- OBJECTS = main.o
- # symbolic targets:
- all: main.hex
- .c.o:
- $(COMPILE) -c $< -o $@
- .S.o:
- $(COMPILE) -x assembler-with-cpp -Wa,--gstabs -c $< -o $@
- # "-x assembler-with-cpp" should not be necessary since this is the default
- # file type for the .S (with capital S) extension. However, upper case
- # characters are not always preserved on Windows. To ensure WinAVR
- # compatibility define the file type manually.
- .c.s:
- $(COMPILE) -S $< -o $@
- #This works as follows, writes the flash and verifies, writes the eeprom
- # and verifies, writes the fuses and finally, reads the calibration byte
- # to file calbyte.hex and the reprograms (only this byte) in the flash
- # at the position of change-addresses
- flash: all
- $(UISP) -e -U flash:w:main.hex -U flash:v:main.hex \
- -U eeprom:w:sine.raw -U eeprom:v:sine.raw -U fuse:w:0xd3:m \
- -U calibration:r:calbyte.hex:i
- avr-objcopy --change-addresses=0x3ff calbyte.hex calbyte_s1.hex
- sleep 5
- $(UISP) -D -U flash:w:calbyte_s1.hex:i
- fuse:
- $(UISP) -U fuse:w:0xd3:m
- clean:
- rm -f *.hex main.lst main.obj main.cof main.list main.map main.eep main.elf main.bin main.sym *.o
- # file targets:
- main.elf: $(OBJECTS)
- $(COMPILE) -o main.elf $(OBJECTS)
- main.hex: main.elf
- rm -f main.hex main.eep
- avr-objcopy -j .text -j .data -O ihex main.elf main.hex
- avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex main.elf main.eep
- avr-size -A -x main.elf
- # do the checksize script as our last action to allow successful compilation
- # on Windows with WinAVR where the Unix commands will fail.
- disasm: main.elf
- avr-objdump -h -S -d main.elf > main.lst
- cat main.lst
- avr-nm -n main.elf > main.sym
- cat main.sym
- avr-size -A -x main.elf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement