My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. # Arduino 0011 Makefile
  2. # Arduino adaptation by mellis, eighthave, oli.keller
  3. #
  4. # This makefile allows you to build sketches from the command line
  5. # without the Arduino environment (or Java).
  6. #
  7. # Detailed instructions for using the makefile:
  8. #
  9. # 1. Copy this file into the folder with your sketch. There should be a
  10. # file with the same name as the folder and with the extension .pde
  11. # (e.g. foo.pde in the foo/ folder).
  12. #
  13. # 2. Modify the line containg "INSTALL_DIR" to point to the directory that
  14. # contains the Arduino installation (for example, under Mac OS X, this
  15. # might be /Applications/arduino-0012).
  16. #
  17. # 3. Modify the line containing "PORT" to refer to the filename
  18. # representing the USB or serial connection to your Arduino board
  19. # (e.g. PORT = /dev/tty.USB0). If the exact name of this file
  20. # changes, you can use * as a wildcard (e.g. PORT = /dev/tty.usb*).
  21. #
  22. # 4. Set the line containing "MCU" to match your board's processor.
  23. # Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
  24. # or Diecimila have the atmega168. If you're using a LilyPad Arduino,
  25. # change F_CPU to 8000000.
  26. #
  27. # 5. At the command line, change to the directory containing your
  28. # program's file and the makefile.
  29. #
  30. # 6. Type "make" and press enter to compile/verify your program.
  31. #
  32. # 7. Type "make upload", reset your Arduino board, and press enter to
  33. # upload your program to the Arduino board.
  34. #
  35. # $Id$
  36. TARGET = $(notdir $(CURDIR))
  37. INSTALL_DIR = /Users/dmellis/Source/arduino/trunk/build/macosx/build/work
  38. PORT = /dev/tty.usb*
  39. UPLOAD_RATE = 19200
  40. AVRDUDE_PROGRAMMER = stk500v1
  41. MCU = atmega168
  42. F_CPU = 16000000
  43. ############################################################################
  44. # Below here nothing should be changed...
  45. ARDUINO = $(INSTALL_DIR)/hardware/cores/arduino
  46. AVR_TOOLS_PATH = $(INSTALL_DIR)/hardware/tools/avr/bin
  47. SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
  48. $(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
  49. $(ARDUINO)/wiring_pulse.c $(ARDUINO)/wiring_serial.c \
  50. $(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
  51. CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WMath.cpp
  52. FORMAT = ihex
  53. # Name of this Makefile (used for "make depend").
  54. MAKEFILE = Makefile
  55. # Debugging format.
  56. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
  57. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
  58. DEBUG = stabs
  59. OPT = s
  60. # Place -D or -U options here
  61. CDEFS = -DF_CPU=$(F_CPU)
  62. CXXDEFS = -DF_CPU=$(F_CPU)
  63. # Place -I options here
  64. CINCS = -I$(ARDUINO)
  65. CXXINCS = -I$(ARDUINO)
  66. # Compiler flag to set the C Standard level.
  67. # c89 - "ANSI" C
  68. # gnu89 - c89 plus GCC extensions
  69. # c99 - ISO C99 standard (not yet fully implemented)
  70. # gnu99 - c99 plus GCC extensions
  71. CSTANDARD = -std=gnu99
  72. CDEBUG = -g$(DEBUG)
  73. CWARN = -Wall -Wstrict-prototypes
  74. CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
  75. #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
  76. CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA)
  77. CXXFLAGS = $(CDEFS) $(CINCS) -O$(OPT)
  78. #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
  79. LDFLAGS = -lm
  80. # Programming support using avrdude. Settings and variables.
  81. AVRDUDE_PORT = $(PORT)
  82. AVRDUDE_WRITE_FLASH = -U flash:w:applet/$(TARGET).hex
  83. AVRDUDE_FLAGS = -V -F -C $(INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf \
  84. -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
  85. -b $(UPLOAD_RATE)
  86. # Program settings
  87. CC = $(AVR_TOOLS_PATH)/avr-gcc
  88. CXX = $(AVR_TOOLS_PATH)/avr-g++
  89. OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy
  90. OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump
  91. AR = $(AVR_TOOLS_PATH)/avr-ar
  92. SIZE = $(AVR_TOOLS_PATH)/avr-size
  93. NM = $(AVR_TOOLS_PATH)/avr-nm
  94. AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
  95. REMOVE = rm -f
  96. MV = mv -f
  97. # Define all object files.
  98. OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
  99. # Define all listing files.
  100. LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
  101. # Combine all necessary flags and optional flags.
  102. # Add target processor to flags.
  103. ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
  104. ALL_CXXFLAGS = -mmcu=$(MCU) -I. $(CXXFLAGS)
  105. ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
  106. # Default target.
  107. all: applet_files build sizeafter
  108. build: elf hex
  109. applet_files: $(TARGET).pde
  110. # Here is the "preprocessing".
  111. # It creates a .cpp file based with the same name as the .pde file.
  112. # On top of the new .cpp file comes the WProgram.h header.
  113. # At the end there is a generic main() function attached.
  114. # Then the .cpp file will be compiled. Errors during compile will
  115. # refer to this new, automatically generated, file.
  116. # Not the original .pde file you actually edit...
  117. test -d applet || mkdir applet
  118. echo '#include "WProgram.h"' > applet/$(TARGET).cpp
  119. cat $(TARGET).pde >> applet/$(TARGET).cpp
  120. cat $(ARDUINO)/main.cxx >> applet/$(TARGET).cpp
  121. elf: applet/$(TARGET).elf
  122. hex: applet/$(TARGET).hex
  123. eep: applet/$(TARGET).eep
  124. lss: applet/$(TARGET).lss
  125. sym: applet/$(TARGET).sym
  126. # Program the device.
  127. upload: applet/$(TARGET).hex
  128. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
  129. # Display size of file.
  130. HEXSIZE = $(SIZE) --target=$(FORMAT) applet/$(TARGET).hex
  131. ELFSIZE = $(SIZE) applet/$(TARGET).elf
  132. sizebefore:
  133. @if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
  134. sizeafter:
  135. @if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(HEXSIZE); echo; fi
  136. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  137. COFFCONVERT=$(OBJCOPY) --debugging \
  138. --change-section-address .data-0x800000 \
  139. --change-section-address .bss-0x800000 \
  140. --change-section-address .noinit-0x800000 \
  141. --change-section-address .eeprom-0x810000
  142. coff: applet/$(TARGET).elf
  143. $(COFFCONVERT) -O coff-avr applet/$(TARGET).elf $(TARGET).cof
  144. extcoff: $(TARGET).elf
  145. $(COFFCONVERT) -O coff-ext-avr applet/$(TARGET).elf $(TARGET).cof
  146. .SUFFIXES: .elf .hex .eep .lss .sym
  147. .elf.hex:
  148. $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
  149. .elf.eep:
  150. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  151. --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
  152. # Create extended listing file from ELF output file.
  153. .elf.lss:
  154. $(OBJDUMP) -h -S $< > $@
  155. # Create a symbol table from ELF output file.
  156. .elf.sym:
  157. $(NM) -n $< > $@
  158. # Link: create ELF output file from library.
  159. applet/$(TARGET).elf: $(TARGET).pde applet/core.a
  160. $(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
  161. applet/core.a: $(OBJ)
  162. @for i in $(OBJ); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done
  163. # Compile: create object files from C++ source files.
  164. .cpp.o:
  165. $(CXX) -c $(ALL_CXXFLAGS) $< -o $@
  166. # Compile: create object files from C source files.
  167. .c.o:
  168. $(CC) -c $(ALL_CFLAGS) $< -o $@
  169. # Compile: create assembler files from C source files.
  170. .c.s:
  171. $(CC) -S $(ALL_CFLAGS) $< -o $@
  172. # Assemble: create object files from assembler source files.
  173. .S.o:
  174. $(CC) -c $(ALL_ASFLAGS) $< -o $@
  175. # Target: clean project.
  176. clean:
  177. $(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
  178. applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/core.a \
  179. $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
  180. depend:
  181. if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \
  182. then \
  183. sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \
  184. $(MAKEFILE).$$$$ && \
  185. $(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \
  186. fi
  187. echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \
  188. >> $(MAKEFILE); \
  189. $(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE)
  190. .PHONY: all build elf hex eep lss sym program coff extcoff clean depend applet_files sizebefore sizeafter