Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile.orig 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # Name: Makefile
  2. # Project: hid-mouse example
  3. # Author: Christian Starkjohann
  4. # Creation Date: 2008-04-07
  5. # Tabsize: 4
  6. # Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
  7. # License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
  8. # This Revision: $Id: Makefile 692 2008-11-07 15:07:40Z cs $
  9. DEVICE = atmega168
  10. F_CPU = 16000000 # in Hz
  11. FUSE_L = # see below for fuse values for particular devices
  12. FUSE_H =
  13. #AVRDUDE = avrdude -c usbasp -p $(DEVICE) # edit this line for your programmer
  14. AVRDUDE = avrdude -P COM1 -b 19200 -c arduino -p $(DEVICE)
  15. CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=1
  16. OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
  17. COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE)
  18. ##############################################################################
  19. # Fuse values for particular devices
  20. ##############################################################################
  21. # If your device is not listed here, go to
  22. # http://palmavr.sourceforge.net/cgi-bin/fc.cgi
  23. # and choose options for external crystal clock and no clock divider
  24. #
  25. ################################## ATMega8 ##################################
  26. # ATMega8 FUSE_L (Fuse low byte):
  27. # 0x9f = 1 0 0 1 1 1 1 1
  28. # ^ ^ \ / \--+--/
  29. # | | | +------- CKSEL 3..0 (external >8M crystal)
  30. # | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
  31. # | +------------------ BODEN (BrownOut Detector enabled)
  32. # +-------------------- BODLEVEL (2.7V)
  33. # ATMega8 FUSE_H (Fuse high byte):
  34. # 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
  35. # ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
  36. # | | | | | +-------- BOOTSZ1
  37. # | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
  38. # | | | +-------------- CKOPT (full output swing)
  39. # | | +---------------- SPIEN (allow serial programming)
  40. # | +------------------ WDTON (WDT not always on)
  41. # +-------------------- RSTDISBL (reset pin is enabled)
  42. #
  43. ############################## ATMega48/88/168 ##############################
  44. # ATMega*8 FUSE_L (Fuse low byte):
  45. # 0xdf = 1 1 0 1 1 1 1 1
  46. # ^ ^ \ / \--+--/
  47. # | | | +------- CKSEL 3..0 (external >8M crystal)
  48. # | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
  49. # | +------------------ CKOUT (if 0: Clock output enabled)
  50. # +-------------------- CKDIV8 (if 0: divide by 8)
  51. # ATMega*8 FUSE_H (Fuse high byte):
  52. # 0xde = 1 1 0 1 1 1 1 0
  53. # ^ ^ ^ ^ ^ \-+-/
  54. # | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V)
  55. # | | | | + --------- EESAVE (preserve EEPROM over chip erase)
  56. # | | | +-------------- WDTON (if 0: watchdog always on)
  57. # | | +---------------- SPIEN (allow serial programming)
  58. # | +------------------ DWEN (debug wire enable)
  59. # +-------------------- RSTDISBL (reset pin is enabled)
  60. #
  61. ############################## ATTiny25/45/85 ###############################
  62. # ATMega*5 FUSE_L (Fuse low byte):
  63. # 0xef = 1 1 1 0 1 1 1 1
  64. # ^ ^ \+/ \--+--/
  65. # | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz)
  66. # | | +--------------- SUT 1..0 (BOD enabled, fast rising power)
  67. # | +------------------ CKOUT (clock output on CKOUT pin -> disabled)
  68. # +-------------------- CKDIV8 (divide clock by 8 -> don't divide)
  69. # ATMega*5 FUSE_H (Fuse high byte):
  70. # 0xdd = 1 1 0 1 1 1 0 1
  71. # ^ ^ ^ ^ ^ \-+-/
  72. # | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V)
  73. # | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved)
  74. # | | | +-------------- WDTON (watchdog timer always on -> disable)
  75. # | | +---------------- SPIEN (enable serial programming -> enabled)
  76. # | +------------------ DWEN (debug wire enable)
  77. # +-------------------- RSTDISBL (disable external reset -> enabled)
  78. #
  79. ################################ ATTiny2313 #################################
  80. # ATTiny2313 FUSE_L (Fuse low byte):
  81. # 0xef = 1 1 1 0 1 1 1 1
  82. # ^ ^ \+/ \--+--/
  83. # | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz)
  84. # | | +--------------- SUT 1..0 (BOD enabled, fast rising power)
  85. # | +------------------ CKOUT (clock output on CKOUT pin -> disabled)
  86. # +-------------------- CKDIV8 (divide clock by 8 -> don't divide)
  87. # ATTiny2313 FUSE_H (Fuse high byte):
  88. # 0xdb = 1 1 0 1 1 0 1 1
  89. # ^ ^ ^ ^ \-+-/ ^
  90. # | | | | | +---- RSTDISBL (disable external reset -> enabled)
  91. # | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V)
  92. # | | | +-------------- WDTON (watchdog timer always on -> disable)
  93. # | | +---------------- SPIEN (enable serial programming -> enabled)
  94. # | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved)
  95. # +-------------------- DWEN (debug wire enable)
  96. # symbolic targets:
  97. help:
  98. @echo "This Makefile has no default rule. Use one of the following:"
  99. @echo "make hex ....... to build main.hex"
  100. @echo "make program ... to flash fuses and firmware"
  101. @echo "make fuse ...... to flash the fuses"
  102. @echo "make flash ..... to flash the firmware (use this on metaboard)"
  103. @echo "make clean ..... to delete objects and hex file"
  104. hex: main.hex
  105. program: flash fuse
  106. # rule for programming fuse bits:
  107. fuse:
  108. @[ "$(FUSE_H)" != "" -a "$(FUSE_L)" != "" ] || \
  109. { echo "*** Edit Makefile and choose values for FUSE_L and FUSE_H!"; exit 1; }
  110. $(AVRDUDE) -U hfuse:w:$(FUSE_H):m -U lfuse:w:$(FUSE_L):m
  111. # rule for uploading firmware:
  112. flash: main.hex
  113. $(AVRDUDE) -U flash:w:main.hex:i
  114. # rule for deleting dependent files (those which can be built by Make):
  115. clean:
  116. rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s
  117. # Generic rule for compiling C files:
  118. .c.o:
  119. $(COMPILE) -c $< -o $@
  120. # Generic rule for assembling Assembler source files:
  121. .S.o:
  122. $(COMPILE) -x assembler-with-cpp -c $< -o $@
  123. # "-x assembler-with-cpp" should not be necessary since this is the default
  124. # file type for the .S (with capital S) extension. However, upper case
  125. # characters are not always preserved on Windows. To ensure WinAVR
  126. # compatibility define the file type manually.
  127. # Generic rule for compiling C to assembler, used for debugging only.
  128. .c.s:
  129. $(COMPILE) -S $< -o $@
  130. # file targets:
  131. # Since we don't want to ship the driver multipe times, we copy it into this project:
  132. usbdrv:
  133. cp -r ../usbdrv .
  134. main.elf: usbdrv $(OBJECTS) # usbdrv dependency only needed because we copy it
  135. $(COMPILE) -o main.elf $(OBJECTS)
  136. main.hex: main.elf
  137. rm -f main.hex main.eep.hex
  138. avr-objcopy -j .text -j .data -O ihex main.elf main.hex
  139. avr-size main.hex
  140. # debugging targets:
  141. disasm: main.elf
  142. avr-objdump -d main.elf
  143. cpp:
  144. $(COMPILE) -E main.c