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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. # Sprinter Arduino Project Makefile
  2. #
  3. # Makefile Based on:
  4. # Arduino 0011 Makefile
  5. # Arduino adaptation by mellis, eighthave, oli.keller
  6. # Marlin adaption by Daid
  7. #
  8. # This has been tested with Arduino 0022.
  9. #
  10. # This makefile allows you to build sketches from the command line
  11. # without the Arduino environment (or Java).
  12. #
  13. # Detailed instructions for using the makefile:
  14. #
  15. # 1. Modify the line containing "ARDUINO_INSTALL_DIR" to point to the directory that
  16. # contains the Arduino installation (for example, under Mac OS X, this
  17. # might be /Applications/Arduino.app/Contents/Resources/Java).
  18. #
  19. # 2. Modify the line containing "UPLOAD_PORT" to refer to the filename
  20. # representing the USB or serial connection to your Arduino board
  21. # (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
  22. # changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
  23. #
  24. # 3. Set the line containing "MCU" to match your board's processor.
  25. # Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
  26. # or Diecimila have the atmega168. If you're using a LilyPad Arduino,
  27. # change F_CPU to 8000000. If you are using Gen7 electronics, you
  28. # probably need to use 20000000. Either way, you must regenerate
  29. # the speed lookup table with create_speed_lookuptable.py.
  30. #
  31. # 4. Type "make" and press enter to compile/verify your program.
  32. #
  33. # 5. Type "make upload", reset your Arduino board, and press enter to
  34. # upload your program to the Arduino board.
  35. #
  36. # Note that all settings are set with ?=, this means you can override them
  37. # from the commandline with "make HARDWARE_MOTHERBOARD=71" for example
  38. # This defined the board you are compiling for (see boards.h for the options)
  39. HARDWARE_MOTHERBOARD ?= 11
  40. # Arduino source install directory, and version number
  41. # On most linuxes this will be /usr/share/arduino
  42. ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
  43. ARDUINO_VERSION ?= 106
  44. # You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
  45. AVR_TOOLS_PATH ?=
  46. #Programmer configuration
  47. UPLOAD_RATE ?= 57600
  48. AVRDUDE_PROGRAMMER ?= arduino
  49. # on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
  50. UPLOAD_PORT ?= /dev/ttyUSB0
  51. #Directory used to build files in, contains all the build files, from object files to the final hex file
  52. #on linux it is best to put an absolute path like /home/username/tmp .
  53. BUILD_DIR ?= applet
  54. # This defines whether Liquid_TWI2 support will be built
  55. LIQUID_TWI2 ?= 0
  56. # this defines if Wire is needed
  57. WIRE ?= 0
  58. ############################################################################
  59. # Below here nothing should be changed...
  60. # Here the Arduino variant is selected by the board type
  61. # HARDWARE_VARIANT = "arduino", "Sanguino", "Gen7", ...
  62. # MCU = "atmega1280", "Mega2560", "atmega2560", "atmega644p", ...
  63. #Gen7
  64. ifeq ($(HARDWARE_MOTHERBOARD),10)
  65. HARDWARE_VARIANT ?= Gen7
  66. MCU ?= atmega644
  67. F_CPU ?= 20000000
  68. else ifeq ($(HARDWARE_MOTHERBOARD),11)
  69. HARDWARE_VARIANT ?= Gen7
  70. MCU ?= atmega644p
  71. F_CPU ?= 20000000
  72. else ifeq ($(HARDWARE_MOTHERBOARD),12)
  73. HARDWARE_VARIANT ?= Gen7
  74. MCU ?= atmega644p
  75. F_CPU ?= 20000000
  76. else ifeq ($(HARDWARE_MOTHERBOARD),13)
  77. HARDWARE_VARIANT ?= Gen7
  78. MCU ?= atmega1284p
  79. F_CPU ?= 20000000
  80. #RAMPS
  81. else ifeq ($(HARDWARE_MOTHERBOARD),3)
  82. HARDWARE_VARIANT ?= arduino
  83. MCU ?= atmega2560
  84. else ifeq ($(HARDWARE_MOTHERBOARD),33)
  85. HARDWARE_VARIANT ?= arduino
  86. MCU ?= atmega2560
  87. else ifeq ($(HARDWARE_MOTHERBOARD),34)
  88. HARDWARE_VARIANT ?= arduino
  89. MCU ?= atmega2560
  90. else ifeq ($(HARDWARE_MOTHERBOARD),35)
  91. HARDWARE_VARIANT ?= arduino
  92. MCU ?= atmega2560
  93. else ifeq ($(HARDWARE_MOTHERBOARD),36)
  94. HARDWARE_VARIANT ?= arduino
  95. MCU ?= atmega2560
  96. else ifeq ($(HARDWARE_MOTHERBOARD),38)
  97. HARDWARE_VARIANT ?= arduino
  98. MCU ?= atmega2560
  99. else ifeq ($(HARDWARE_MOTHERBOARD),43)
  100. HARDWARE_VARIANT ?= arduino
  101. MCU ?= atmega2560
  102. else ifeq ($(HARDWARE_MOTHERBOARD),44)
  103. HARDWARE_VARIANT ?= arduino
  104. MCU ?= atmega2560
  105. else ifeq ($(HARDWARE_MOTHERBOARD),45)
  106. HARDWARE_VARIANT ?= arduino
  107. MCU ?= atmega2560
  108. else ifeq ($(HARDWARE_MOTHERBOARD),46)
  109. HARDWARE_VARIANT ?= arduino
  110. MCU ?= atmega2560
  111. else ifeq ($(HARDWARE_MOTHERBOARD),48)
  112. HARDWARE_VARIANT ?= arduino
  113. MCU ?= atmega2560
  114. #Gen6
  115. else ifeq ($(HARDWARE_MOTHERBOARD),5)
  116. HARDWARE_VARIANT ?= Gen6
  117. MCU ?= atmega644p
  118. else ifeq ($(HARDWARE_MOTHERBOARD),51)
  119. HARDWARE_VARIANT ?= Gen6
  120. MCU ?= atmega644p
  121. #Sanguinololu
  122. else ifeq ($(HARDWARE_MOTHERBOARD),6)
  123. HARDWARE_VARIANT ?= Sanguino
  124. MCU ?= atmega644p
  125. else ifeq ($(HARDWARE_MOTHERBOARD),62)
  126. HARDWARE_VARIANT ?= Sanguino
  127. MCU ?= atmega644p
  128. else ifeq ($(HARDWARE_MOTHERBOARD),63)
  129. HARDWARE_VARIANT ?= Sanguino
  130. MCU ?= atmega644p
  131. else ifeq ($(HARDWARE_MOTHERBOARD),65)
  132. HARDWARE_VARIANT ?= Sanguino
  133. MCU ?= atmega1284p
  134. else ifeq ($(HARDWARE_MOTHERBOARD),66)
  135. HARDWARE_VARIANT ?= Sanguino
  136. MCU ?= atmega1284p
  137. else ifeq ($(HARDWARE_MOTHERBOARD),69)
  138. HARDWARE_VARIANT ?= Sanguino
  139. MCU ?= atmega1284p
  140. #Ultimaker
  141. else ifeq ($(HARDWARE_MOTHERBOARD),7)
  142. HARDWARE_VARIANT ?= arduino
  143. MCU ?= atmega2560
  144. else ifeq ($(HARDWARE_MOTHERBOARD),71)
  145. HARDWARE_VARIANT ?= arduino
  146. MCU ?= atmega1280
  147. #Teensylu
  148. else ifeq ($(HARDWARE_MOTHERBOARD),8)
  149. HARDWARE_VARIANT ?= Teensy
  150. MCU ?= at90usb1286
  151. else ifeq ($(HARDWARE_MOTHERBOARD),81)
  152. HARDWARE_VARIANT ?= Teensy
  153. MCU ?= at90usb1286
  154. else ifeq ($(HARDWARE_MOTHERBOARD),811)
  155. HARDWARE_VARIANT ?= Teensy
  156. MCU ?= at90usb1286
  157. else ifeq ($(HARDWARE_MOTHERBOARD),82)
  158. HARDWARE_VARIANT ?= Teensy
  159. MCU ?= at90usb646
  160. else ifeq ($(HARDWARE_MOTHERBOARD),83)
  161. HARDWARE_VARIANT ?= Teensy
  162. MCU ?= at90usb1286
  163. else ifeq ($(HARDWARE_MOTHERBOARD),84)
  164. HARDWARE_VARIANT ?= Teensy
  165. MCU ?= at90usb1286
  166. #Gen3+
  167. else ifeq ($(HARDWARE_MOTHERBOARD),9)
  168. HARDWARE_VARIANT ?= Sanguino
  169. MCU ?= atmega644p
  170. #Gen3 Monolithic Electronics
  171. else ifeq ($(HARDWARE_MOTHERBOARD),22)
  172. HARDWARE_VARIANT ?= Sanguino
  173. MCU ?= atmega644p
  174. #Megatronics
  175. else ifeq ($(HARDWARE_MOTHERBOARD),70)
  176. HARDWARE_VARIANT ?= arduino
  177. MCU ?= atmega2560
  178. #Alpha OMCA board
  179. else ifeq ($(HARDWARE_MOTHERBOARD),90)
  180. HARDWARE_VARIANT ?= SanguinoA
  181. MCU ?= atmega644
  182. #Final OMCA board
  183. else ifeq ($(HARDWARE_MOTHERBOARD),91)
  184. HARDWARE_VARIANT ?= Sanguino
  185. MCU ?= atmega644p
  186. #Rambo
  187. else ifeq ($(HARDWARE_MOTHERBOARD),301)
  188. HARDWARE_VARIANT ?= arduino
  189. MCU ?= atmega2560
  190. # Azteeg
  191. else ifeq ($(HARDWARE_MOTHERBOARD),67)
  192. HARDWARE_VARIANT ?= arduino
  193. MCU ?= atmega2560
  194. else ifeq ($(HARDWARE_MOTHERBOARD),68)
  195. HARDWARE_VARIANT ?= arduino
  196. MCU ?= atmega2560
  197. endif
  198. # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
  199. # if you are setting this to something other than 16MHz
  200. # Set to 16Mhz if not yet set.
  201. F_CPU ?= 16000000
  202. # Arduino contained the main source code for the Arduino
  203. # Libraries, the "hardware variant" are for boards
  204. # that derives from that, and their source are present in
  205. # the main Marlin source directory
  206. ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Sanguino))
  207. HARDWARE_DIR = $(ARDUINO_INSTALL_DIR)/hardware
  208. else
  209. ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
  210. HARDWARE_DIR = ../ArduinoAddons/Arduino_1.x.x
  211. else
  212. HARDWARE_DIR = ../ArduinoAddons/Arduino_0.xx
  213. endif
  214. endif
  215. HARDWARE_SRC = $(HARDWARE_DIR)/marlin/avr/cores/arduino
  216. TARGET = $(notdir $(CURDIR))
  217. # VPATH tells make to look into these directory for source files,
  218. # there is no need to specify explicit pathnames as long as the
  219. # directory is added here
  220. VPATH = .
  221. VPATH += $(BUILD_DIR)
  222. VPATH += $(HARDWARE_SRC)
  223. ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
  224. VPATH += $(HARDWARE_DIR)/marlin/avr/libraries/LiquidCrystal/src
  225. VPATH += $(HARDWARE_DIR)/marlin/avr/libraries/SPI
  226. ifeq ($(LIQUID_TWI2), 1)
  227. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  228. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  229. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
  230. endif
  231. ifeq ($(WIRE), 1)
  232. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  233. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  234. endif
  235. else
  236. VPATH += $(HARDWARE_DIR)/libraries/LiquidCrystal
  237. VPATH += $(HARDWARE_DIR)/libraries/SPI
  238. ifeq ($(LIQUID_TWI2), 1)
  239. VPATH += $(HARDWARE_DIR)/libraries/Wire
  240. VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
  241. VPATH += $(HARDWARE_DIR)/libraries/LiquidTWI2
  242. endif
  243. ifeq ($(WIRE), 1)
  244. VPATH += $(HARDWARE_DIR)/libraries/Wire
  245. VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
  246. endif
  247. endif
  248. ifeq ($(HARDWARE_VARIANT), arduino)
  249. HARDWARE_SUB_VARIANT ?= mega
  250. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/variants/$(HARDWARE_SUB_VARIANT)
  251. else
  252. ifeq ($(HARDWARE_VARIANT), Sanguino)
  253. VPATH += $(HARDWARE_DIR)/marlin/avr/variants/sanguino
  254. else
  255. HARDWARE_SUB_VARIANT ?= standard
  256. VPATH += $(HARDWARE_DIR)/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
  257. endif
  258. endif
  259. SRC = wiring.c \
  260. wiring_analog.c wiring_digital.c \
  261. wiring_pulse.c \
  262. wiring_shift.c WInterrupts.c hooks.c
  263. ifeq ($(HARDWARE_VARIANT), Teensy)
  264. SRC = wiring.c
  265. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
  266. endif
  267. CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp \
  268. MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp \
  269. SdFile.cpp SdVolume.cpp planner.cpp stepper.cpp \
  270. temperature.cpp cardreader.cpp configuration_store.cpp \
  271. watchdog.cpp SPI.cpp servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
  272. dac_mcp4728.cpp vector_3.cpp qr_solve.cpp buzzer.cpp
  273. ifeq ($(LIQUID_TWI2), 0)
  274. CXXSRC += LiquidCrystal.cpp
  275. else
  276. SRC += twi.c
  277. CXXSRC += Wire.cpp LiquidTWI2.cpp
  278. endif
  279. ifeq ($(WIRE), 1)
  280. SRC += twi.c
  281. CXXSRC += Wire.cpp
  282. endif
  283. #Check for Arduino 1.0.0 or higher and use the correct source files for that version
  284. ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
  285. CXXSRC += main.cpp
  286. else
  287. SRC += pins_arduino.c main.c
  288. endif
  289. FORMAT = ihex
  290. # Name of this Makefile (used for "make depend").
  291. MAKEFILE = Makefile
  292. # Debugging format.
  293. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
  294. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
  295. DEBUG = stabs
  296. OPT = s
  297. DEFINES ?=
  298. # Program settings
  299. CC = $(AVR_TOOLS_PATH)avr-gcc
  300. CXX = $(AVR_TOOLS_PATH)avr-g++
  301. OBJCOPY = $(AVR_TOOLS_PATH)avr-objcopy
  302. OBJDUMP = $(AVR_TOOLS_PATH)avr-objdump
  303. AR = $(AVR_TOOLS_PATH)avr-ar
  304. SIZE = $(AVR_TOOLS_PATH)avr-size
  305. NM = $(AVR_TOOLS_PATH)avr-nm
  306. AVRDUDE = avrdude
  307. REMOVE = rm -f
  308. MV = mv -f
  309. # Place -D or -U options here
  310. CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)}
  311. CXXDEFS = $(CDEFS)
  312. ifeq ($(HARDWARE_VARIANT), Teensy)
  313. CDEFS += -DUSB_SERIAL
  314. SRC += usb.c pins_teensy.c
  315. CXXSRC += usb_api.cpp
  316. endif
  317. # Add all the source directories as include directories too
  318. CINCS = ${addprefix -I ,${VPATH}}
  319. CXXINCS = ${addprefix -I ,${VPATH}}
  320. # Compiler flag to set the C Standard level.
  321. # c89 - "ANSI" C
  322. # gnu89 - c89 plus GCC extensions
  323. # c99 - ISO C99 standard (not yet fully implemented)
  324. # gnu99 - c99 plus GCC extensions
  325. #CSTANDARD = -std=gnu99
  326. CDEBUG = -g$(DEBUG)
  327. CWARN = -Wall -Wstrict-prototypes
  328. CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct \
  329. -fshort-enums -w -ffunction-sections -fdata-sections \
  330. -DARDUINO=$(ARDUINO_VERSION)
  331. ifneq ($(HARDWARE_MOTHERBOARD),)
  332. CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
  333. endif
  334. #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
  335. CEXTRA = -fno-use-cxa-atexit
  336. CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING)
  337. CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) -Wall $(CEXTRA) $(CTUNING)
  338. #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
  339. LDFLAGS = -lm
  340. # Programming support using avrdude. Settings and variables.
  341. AVRDUDE_PORT = $(UPLOAD_PORT)
  342. AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
  343. ifeq ($(shell uname -s), Linux)
  344. AVRDUDE_CONF = /etc/avrdude/avrdude.conf
  345. else
  346. AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
  347. endif
  348. AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
  349. -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
  350. -b$(UPLOAD_RATE)
  351. # Define all object files.
  352. OBJ = ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
  353. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
  354. OBJ += ${patsubst %.S, $(BUILD_DIR)/%.o, ${ASRC}}
  355. # Define all listing files.
  356. LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
  357. # Combine all necessary flags and optional flags.
  358. # Add target processor to flags.
  359. ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
  360. ALL_CXXFLAGS = -mmcu=$(MCU) $(CXXFLAGS)
  361. ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS)
  362. # set V=1 (eg, "make V=1") to print the full commands etc.
  363. ifneq ($V,1)
  364. Pecho=@echo
  365. P=@
  366. else
  367. Pecho=@:
  368. P=
  369. endif
  370. # Default target.
  371. all: sizeafter
  372. build: $(BUILD_DIR) elf hex
  373. # Creates the object directory
  374. $(BUILD_DIR):
  375. $P mkdir -p $(BUILD_DIR)
  376. elf: $(BUILD_DIR)/$(TARGET).elf
  377. hex: $(BUILD_DIR)/$(TARGET).hex
  378. eep: $(BUILD_DIR)/$(TARGET).eep
  379. lss: $(BUILD_DIR)/$(TARGET).lss
  380. sym: $(BUILD_DIR)/$(TARGET).sym
  381. # Program the device.
  382. # Do not try to reset an Arduino if it's not one
  383. upload: $(BUILD_DIR)/$(TARGET).hex
  384. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  385. stty hup < $(UPLOAD_PORT); true
  386. endif
  387. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
  388. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  389. stty -hup < $(UPLOAD_PORT); true
  390. endif
  391. # Display size of file.
  392. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
  393. ELFSIZE = $(SIZE) --mcu=$(MCU) -C $(BUILD_DIR)/$(TARGET).elf; \
  394. $(SIZE) $(BUILD_DIR)/$(TARGET).elf
  395. sizebefore:
  396. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
  397. sizeafter: build
  398. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
  399. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  400. COFFCONVERT=$(OBJCOPY) --debugging \
  401. --change-section-address .data-0x800000 \
  402. --change-section-address .bss-0x800000 \
  403. --change-section-address .noinit-0x800000 \
  404. --change-section-address .eeprom-0x810000
  405. coff: $(BUILD_DIR)/$(TARGET).elf
  406. $(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  407. extcoff: $(TARGET).elf
  408. $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  409. .SUFFIXES: .elf .hex .eep .lss .sym
  410. .PRECIOUS: .o
  411. .elf.hex:
  412. $(Pecho) " COPY $@"
  413. $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
  414. .elf.eep:
  415. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  416. --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
  417. # Create extended listing file from ELF output file.
  418. .elf.lss:
  419. $(OBJDUMP) -h -S $< > $@
  420. # Create a symbol table from ELF output file.
  421. .elf.sym:
  422. $(NM) -n $< > $@
  423. # Link: create ELF output file from library.
  424. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
  425. $(Pecho) " CXX $@"
  426. $P $(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ -L. $(OBJ) $(LDFLAGS)
  427. $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  428. $(Pecho) " CC $<"
  429. $P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
  430. $(BUILD_DIR)/%.o: $(BUILD_DIR)/%.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  431. $(Pecho) " CXX $<"
  432. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
  433. $(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  434. $(Pecho) " CXX $<"
  435. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
  436. # Target: clean project.
  437. clean:
  438. $(Pecho) " RM $(BUILD_DIR)/*"
  439. $P $(REMOVE) $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep $(BUILD_DIR)/$(TARGET).cof $(BUILD_DIR)/$(TARGET).elf \
  440. $(BUILD_DIR)/$(TARGET).map $(BUILD_DIR)/$(TARGET).sym $(BUILD_DIR)/$(TARGET).lss $(BUILD_DIR)/$(TARGET).cpp \
  441. $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
  442. $(Pecho) " RMDIR $(BUILD_DIR)/"
  443. $P rm -rf $(BUILD_DIR)
  444. .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
  445. # Automaticaly include the dependency files created by gcc
  446. -include ${wildcard $(BUILD_DIR)/*.d}