Guest User

atmega324a-makefile

a guest
May 10th, 2021
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.36 KB | None | 0 0
  1. # Name: Makefile
  2. # Author: <insert your name here>
  3. # Copyright: <insert your copyright message here>
  4. # License: <insert your license reference here>
  5.  
  6. # DEVICE ....... The AVR device you compile for
  7. # CLOCK ........ Target AVR clock rate in Hertz
  8. # OBJECTS ...... The object files created from your source files. This list is
  9. #                usually the same as the list of source files with suffix ".o".
  10. # PROGRAMMER ... Options to avrdude which define the hardware you use for
  11. #                uploading to the AVR and the interface where this hardware
  12. #                is connected.
  13. # FUSES ........ Parameters for avrdude to flash the fuses appropriately.
  14.  
  15. DEVICE     = atmega324a
  16. AVRDUDEDEV = atmega328p
  17. CLOCK      = 8000000
  18. PORT       = /dev/cu.usbmodem002042642
  19. PROGRAMMER = -c stk500v2 -P $(PORT)
  20. OBJECTS    = project.o game.o buttons.o display.o ledmatrix.o serialio.o spi.o terminalio.o timer0.o
  21. FUSES      = -U lfuse:w:0xE6:m -U hfuse:w:0xd1:m -U efuse:w:0xff:m
  22.  
  23.  
  24. ######################################################################
  25. ######################################################################
  26.  
  27. # Tune the lines below only if you know what you are doing:
  28.  
  29. AVRDUDE = avrdude $(PROGRAMMER) -p $(AVRDUDEDEV)
  30. COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)
  31.  
  32. # symbolic targets:
  33. all:    main.hex
  34.  
  35. .c.o:
  36.     $(COMPILE) -c $< -o $@
  37.  
  38. .S.o:
  39.     $(COMPILE) -x assembler-with-cpp -c $< -o $@
  40. # "-x assembler-with-cpp" should not be necessary since this is the default
  41. # file type for the .S (with capital S) extension. However, upper case
  42. # characters are not always preserved on Windows. To ensure WinAVR
  43. # compatibility define the file type manually.
  44.  
  45. .c.s:
  46.     $(COMPILE) -S $< -o $@
  47.  
  48. flash:  all
  49.     $(AVRDUDE) -U flash:w:main.hex:i -F
  50.  
  51. fuse:
  52.     $(AVRDUDE) $(FUSES)
  53.  
  54. install: flash fuse
  55.  
  56. # if you use a bootloader, change the command below appropriately:
  57. load: all
  58.     bootloadHID main.hex
  59.  
  60. clean:
  61.     rm -f main.hex main.elf $(OBJECTS)
  62.  
  63. # file targets:
  64. main.elf: $(OBJECTS)
  65.     $(COMPILE) -o main.elf $(OBJECTS)
  66.  
  67. main.hex: main.elf
  68.     rm -f main.hex
  69.     avr-objcopy -j .text -j .data -O ihex main.elf main.hex
  70. # If you have an EEPROM section, you must also create a hex file for the
  71. # EEPROM and add it to the "flash" target.
  72.  
  73. # Targets for code debugging and analysis:
  74. disasm: main.elf
  75.     avr-objdump -d main.elf
  76.  
  77. cpp:
  78.     $(COMPILE) -E main.c
  79.  
Advertisement
Add Comment
Please, Sign In to add comment