Advertisement
Guest User

Untitled

a guest
Aug 8th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 2.35 KB | None | 0 0
  1. # Name: Makefile
  2. # Project: Test3
  3. # Author: JCSilva
  4. # Creation Date: 2016-08-07
  5. # Tabsize: 4
  6. # Copyright:
  7. # License: GNU GPL v2 (see License.txt)
  8. # This Revision: $Id: Makefile,v 1.1 2016/08/04 20:56:04 jcsilva Exp $
  9.  
  10. DEVICE=attiny15
  11. CLOCK=1600000
  12.  
  13. # Programmer
  14. UISP = avrdude -c dragon_isp -p $(DEVICE)
  15. # The two lines above are for "uisp" and the AVR910 serial programmer connected
  16. # to a Keyspan USB to serial converter to a Mac running Mac OS X.
  17. # Choose your favorite programmer and interface.
  18.  
  19. COMPILE = avr-gcc -Wall -Os -I. -mmcu=$(DEVICE) -DF_CPU=$(CLOCK) -DDEBUG_LEVEL=0
  20.  
  21. #include all objects
  22. OBJECTS = main.o
  23.  
  24. # symbolic targets:
  25. all:    main.hex
  26.  
  27. .c.o:
  28.     $(COMPILE) -c $< -o $@
  29.  
  30. .S.o:
  31.     $(COMPILE) -x assembler-with-cpp -Wa,--gstabs -c $< -o $@
  32. # "-x assembler-with-cpp" should not be necessary since this is the default
  33. # file type for the .S (with capital S) extension. However, upper case
  34. # characters are not always preserved on Windows. To ensure WinAVR
  35. # compatibility define the file type manually.
  36.  
  37. .c.s:
  38.     $(COMPILE) -S $< -o $@
  39.  
  40. #This works as follows, writes the flash and verifies, writes the eeprom
  41. # and verifies, writes the fuses and finally, reads the calibration byte
  42. # to file calbyte.hex and the reprograms (only this byte) in the flash
  43. # at the position of change-addresses
  44. flash:  all
  45.     $(UISP) -e -U flash:w:main.hex -U flash:v:main.hex \
  46.     -U eeprom:w:sine.raw -U eeprom:v:sine.raw -U fuse:w:0xd3:m \
  47.     -U calibration:r:calbyte.hex:i
  48.     avr-objcopy --change-addresses=0x3ff calbyte.hex calbyte_s1.hex
  49.     sleep 5
  50.     $(UISP) -D -U flash:w:calbyte_s1.hex:i
  51.  
  52. fuse:
  53.     $(UISP) -U fuse:w:0xd3:m
  54.  
  55. clean:
  56.     rm -f *.hex main.lst main.obj main.cof main.list main.map main.eep main.elf main.bin main.sym *.o
  57.  
  58. # file targets:
  59. main.elf:   $(OBJECTS)
  60.     $(COMPILE) -o main.elf $(OBJECTS)
  61.  
  62. main.hex:   main.elf
  63.     rm -f main.hex main.eep
  64.     avr-objcopy -j .text -j .data -O ihex main.elf main.hex
  65.     avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex main.elf main.eep
  66.     avr-size  -A -x main.elf
  67. # do the checksize script as our last action to allow successful compilation
  68. # on Windows with WinAVR where the Unix commands will fail.
  69.  
  70. disasm: main.elf
  71.     avr-objdump -h -S -d main.elf > main.lst
  72.     cat main.lst
  73.     avr-nm -n main.elf > main.sym
  74.     cat main.sym
  75.     avr-size -A -x main.elf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement