My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. # Marlin Firmware 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. # Marlin 2.0 support and RELOC_WORKAROUND by @marcio-ao
  8. #
  9. # This has been tested with Arduino 0022.
  10. #
  11. # This makefile allows you to build sketches from the command line
  12. # without the Arduino environment (or Java).
  13. #
  14. # Detailed instructions for using the makefile:
  15. #
  16. # 1. Modify the line containing "ARDUINO_INSTALL_DIR" to point to the directory that
  17. # contains the Arduino installation (for example, under Mac OS X, this
  18. # might be /Applications/Arduino.app/Contents/Resources/Java).
  19. #
  20. # 2. Modify the line containing "UPLOAD_PORT" to refer to the filename
  21. # representing the USB or serial connection to your Arduino board
  22. # (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
  23. # changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
  24. #
  25. # 3. Set the line containing "MCU" to match your board's processor.
  26. # Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
  27. # or Diecimila have the atmega168. If you're using a LilyPad Arduino,
  28. # change F_CPU to 8000000. If you are using Gen7 electronics, you
  29. # probably need to use 20000000. Either way, you must regenerate
  30. # the speed lookup table with create_speed_lookuptable.py.
  31. #
  32. # 4. Type "make" and press enter to compile/verify your program.
  33. #
  34. # 5. Type "make upload", reset your Arduino board, and press enter to
  35. # upload your program to the Arduino board.
  36. #
  37. # Note that all settings at the top of this file can be overriden from
  38. # the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
  39. #
  40. # To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
  41. #
  42. # make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
  43. # HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
  44. #
  45. # To compile and upload simply add "upload" to the end of the line...
  46. #
  47. # make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
  48. # HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
  49. #
  50. # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
  51. # start upload manually (using stk500) like so:
  52. #
  53. # avrdude -C /root/arduino/hardware/tools/avr/etc/avrdude.conf -v -p m2560 -c stk500 \
  54. # -U flash:w:applet/Marlin.hex:i -P /dev/ttyUSB0
  55. #
  56. # Or, try disconnecting USB to power down and then reconnecting before running avrdude.
  57. #
  58. # This defines the board to compile for (see boards.h for your board's ID)
  59. HARDWARE_MOTHERBOARD ?= 11
  60. # Arduino source install directory, and version number
  61. # On most linuxes this will be /usr/share/arduino
  62. ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
  63. ARDUINO_VERSION ?= 106
  64. # You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
  65. AVR_TOOLS_PATH ?=
  66. #Programmer configuration
  67. UPLOAD_RATE ?= 57600
  68. AVRDUDE_PROGRAMMER ?= arduino
  69. # on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
  70. UPLOAD_PORT ?= /dev/ttyUSB0
  71. #Directory used to build files in, contains all the build files, from object files to the final hex file
  72. #on linux it is best to put an absolute path like /home/username/tmp .
  73. BUILD_DIR ?= applet
  74. # This defines whether Liquid_TWI2 support will be built
  75. LIQUID_TWI2 ?= 0
  76. # this defines if Wire is needed
  77. WIRE ?= 0
  78. # this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
  79. U8GLIB ?= 1
  80. # this defines whether to include the Trinamic TMC2630Stepper
  81. TMC2630 ?= 1
  82. ############
  83. # Try to automatically determine whether RELOC_WORKAROUND is needed based
  84. # on GCC versions:
  85. # http://www.avrfreaks.net/comment/1789106#comment-1789106
  86. CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ )
  87. CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ )
  88. CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d\ )
  89. CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) )))
  90. ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1)
  91. @echo This version of GCC is likely broken. Enabling relocation workaround.
  92. RELOC_WORKAROUND = 1
  93. endif
  94. ############################################################################
  95. # Below here nothing should be changed...
  96. # Here the Arduino variant is selected by the board type
  97. # HARDWARE_VARIANT = "arduino", "Sanguino", "Gen7", ...
  98. # MCU = "atmega1280", "Mega2560", "atmega2560", "atmega644p", ...
  99. #Gen7
  100. ifeq ($(HARDWARE_MOTHERBOARD),10)
  101. HARDWARE_VARIANT ?= Gen7
  102. MCU ?= atmega644
  103. F_CPU ?= 20000000
  104. else ifeq ($(HARDWARE_MOTHERBOARD),11)
  105. HARDWARE_VARIANT ?= Gen7
  106. MCU ?= atmega644p
  107. F_CPU ?= 20000000
  108. else ifeq ($(HARDWARE_MOTHERBOARD),12)
  109. HARDWARE_VARIANT ?= Gen7
  110. MCU ?= atmega644p
  111. F_CPU ?= 20000000
  112. else ifeq ($(HARDWARE_MOTHERBOARD),13)
  113. HARDWARE_VARIANT ?= Gen7
  114. MCU ?= atmega1284p
  115. F_CPU ?= 20000000
  116. #RAMPS
  117. else ifeq ($(HARDWARE_MOTHERBOARD),3)
  118. HARDWARE_VARIANT ?= arduino
  119. MCU ?= atmega2560
  120. else ifeq ($(HARDWARE_MOTHERBOARD),33)
  121. HARDWARE_VARIANT ?= arduino
  122. MCU ?= atmega2560
  123. else ifeq ($(HARDWARE_MOTHERBOARD),34)
  124. HARDWARE_VARIANT ?= arduino
  125. MCU ?= atmega2560
  126. else ifeq ($(HARDWARE_MOTHERBOARD),35)
  127. HARDWARE_VARIANT ?= arduino
  128. MCU ?= atmega2560
  129. else ifeq ($(HARDWARE_MOTHERBOARD),36)
  130. HARDWARE_VARIANT ?= arduino
  131. MCU ?= atmega2560
  132. else ifeq ($(HARDWARE_MOTHERBOARD),38)
  133. HARDWARE_VARIANT ?= arduino
  134. MCU ?= atmega2560
  135. else ifeq ($(HARDWARE_MOTHERBOARD),43)
  136. HARDWARE_VARIANT ?= arduino
  137. MCU ?= atmega2560
  138. else ifeq ($(HARDWARE_MOTHERBOARD),44)
  139. HARDWARE_VARIANT ?= arduino
  140. MCU ?= atmega2560
  141. else ifeq ($(HARDWARE_MOTHERBOARD),45)
  142. HARDWARE_VARIANT ?= arduino
  143. MCU ?= atmega2560
  144. else ifeq ($(HARDWARE_MOTHERBOARD),46)
  145. HARDWARE_VARIANT ?= arduino
  146. MCU ?= atmega2560
  147. else ifeq ($(HARDWARE_MOTHERBOARD),48)
  148. HARDWARE_VARIANT ?= arduino
  149. MCU ?= atmega2560
  150. #RAMPS equivalents
  151. else ifeq ($(HARDWARE_MOTHERBOARD),143)
  152. HARDWARE_VARIANT ?= arduino
  153. MCU ?= atmega2560
  154. else ifeq ($(HARDWARE_MOTHERBOARD),144)
  155. HARDWARE_VARIANT ?= arduino
  156. MCU ?= atmega2560
  157. else ifeq ($(HARDWARE_MOTHERBOARD),145)
  158. HARDWARE_VARIANT ?= arduino
  159. MCU ?= atmega2560
  160. else ifeq ($(HARDWARE_MOTHERBOARD),146)
  161. HARDWARE_VARIANT ?= arduino
  162. MCU ?= atmega2560
  163. else ifeq ($(HARDWARE_MOTHERBOARD),148)
  164. HARDWARE_VARIANT ?= arduino
  165. MCU ?= atmega2560
  166. else ifeq ($(HARDWARE_MOTHERBOARD),77)
  167. HARDWARE_VARIANT ?= arduino
  168. MCU ?= atmega2560
  169. else ifeq ($(HARDWARE_MOTHERBOARD),78)
  170. HARDWARE_VARIANT ?= arduino
  171. MCU ?= atmega2560
  172. else ifeq ($(HARDWARE_MOTHERBOARD),79)
  173. HARDWARE_VARIANT ?= arduino
  174. MCU ?= atmega2560
  175. else ifeq ($(HARDWARE_MOTHERBOARD),401)
  176. HARDWARE_VARIANT ?= arduino
  177. MCU ?= atmega2560
  178. else ifeq ($(HARDWARE_MOTHERBOARD),402)
  179. HARDWARE_VARIANT ?= arduino
  180. MCU ?= atmega2560
  181. else ifeq ($(HARDWARE_MOTHERBOARD),40)
  182. HARDWARE_VARIANT ?= arduino
  183. MCU ?= atmega2560
  184. else ifeq ($(HARDWARE_MOTHERBOARD),41)
  185. HARDWARE_VARIANT ?= arduino
  186. MCU ?= atmega2560
  187. else ifeq ($(HARDWARE_MOTHERBOARD),47)
  188. HARDWARE_VARIANT ?= arduino
  189. MCU ?= atmega2560
  190. else ifeq ($(HARDWARE_MOTHERBOARD),53)
  191. HARDWARE_VARIANT ?= arduino
  192. MCU ?= atmega2560
  193. else ifeq ($(HARDWARE_MOTHERBOARD),504)
  194. HARDWARE_VARIANT ?= arduino
  195. MCU ?= atmega2560
  196. else ifeq ($(HARDWARE_MOTHERBOARD),37)
  197. HARDWARE_VARIANT ?= arduino
  198. MCU ?= atmega2560
  199. else ifeq ($(HARDWARE_MOTHERBOARD),42)
  200. HARDWARE_VARIANT ?= arduino
  201. MCU ?= atmega2560
  202. else ifeq ($(HARDWARE_MOTHERBOARD),52)
  203. HARDWARE_VARIANT ?= arduino
  204. MCU ?= atmega2560
  205. else ifeq ($(HARDWARE_MOTHERBOARD),49)
  206. HARDWARE_VARIANT ?= arduino
  207. MCU ?= atmega2560
  208. else ifeq ($(HARDWARE_MOTHERBOARD),72)
  209. HARDWARE_VARIANT ?= arduino
  210. MCU ?= atmega2560
  211. else ifeq ($(HARDWARE_MOTHERBOARD),80)
  212. HARDWARE_VARIANT ?= arduino
  213. MCU ?= atmega2560
  214. else ifeq ($(HARDWARE_MOTHERBOARD),503)
  215. HARDWARE_VARIANT ?= arduino
  216. MCU ?= atmega2560
  217. else ifeq ($(HARDWARE_MOTHERBOARD),431)
  218. HARDWARE_VARIANT ?= arduino
  219. MCU ?= atmega2560
  220. else ifeq ($(HARDWARE_MOTHERBOARD),343)
  221. HARDWARE_VARIANT ?= arduino
  222. MCU ?= atmega2560
  223. else ifeq ($(HARDWARE_MOTHERBOARD),243)
  224. HARDWARE_VARIANT ?= arduino
  225. MCU ?= atmega2560
  226. #Other ATmega1280, ATmega2560
  227. else ifeq ($(HARDWARE_MOTHERBOARD),111)
  228. HARDWARE_VARIANT ?= arduino
  229. MCU ?= atmega2560
  230. else ifeq ($(HARDWARE_MOTHERBOARD),112)
  231. HARDWARE_VARIANT ?= arduino
  232. MCU ?= atmega2560
  233. else ifeq ($(HARDWARE_MOTHERBOARD),2)
  234. HARDWARE_VARIANT ?= arduino
  235. MCU ?= atmega2560
  236. else ifeq ($(HARDWARE_MOTHERBOARD),21)
  237. HARDWARE_VARIANT ?= arduino
  238. MCU ?= atmega2560
  239. else ifeq ($(HARDWARE_MOTHERBOARD),200)
  240. HARDWARE_VARIANT ?= arduino
  241. MCU ?= atmega2560
  242. else ifeq ($(HARDWARE_MOTHERBOARD),70)
  243. HARDWARE_VARIANT ?= arduino
  244. MCU ?= atmega2560
  245. else ifeq ($(HARDWARE_MOTHERBOARD),701)
  246. HARDWARE_VARIANT ?= arduino
  247. MCU ?= atmega2560
  248. else ifeq ($(HARDWARE_MOTHERBOARD),703)
  249. HARDWARE_VARIANT ?= arduino
  250. MCU ?= atmega2560
  251. else ifeq ($(HARDWARE_MOTHERBOARD),704)
  252. HARDWARE_VARIANT ?= arduino
  253. MCU ?= atmega2560
  254. else ifeq ($(HARDWARE_MOTHERBOARD),302)
  255. HARDWARE_VARIANT ?= arduino
  256. MCU ?= atmega2560
  257. else ifeq ($(HARDWARE_MOTHERBOARD),303)
  258. HARDWARE_VARIANT ?= arduino
  259. MCU ?= atmega2560
  260. else ifeq ($(HARDWARE_MOTHERBOARD),304)
  261. HARDWARE_VARIANT ?= arduino
  262. MCU ?= atmega2560
  263. else ifeq ($(HARDWARE_MOTHERBOARD),305)
  264. HARDWARE_VARIANT ?= arduino
  265. MCU ?= atmega2560
  266. else ifeq ($(HARDWARE_MOTHERBOARD),21)
  267. HARDWARE_VARIANT ?= arduino
  268. MCU ?= atmega2560
  269. else ifeq ($(HARDWARE_MOTHERBOARD),999)
  270. HARDWARE_VARIANT ?= arduino
  271. MCU ?= atmega2560
  272. else ifeq ($(HARDWARE_MOTHERBOARD),310)
  273. HARDWARE_VARIANT ?= arduino
  274. MCU ?= atmega2560
  275. else ifeq ($(HARDWARE_MOTHERBOARD),321)
  276. HARDWARE_VARIANT ?= arduino
  277. MCU ?= atmega2560
  278. else ifeq ($(HARDWARE_MOTHERBOARD),74)
  279. HARDWARE_VARIANT ?= arduino
  280. MCU ?= atmega2560
  281. else ifeq ($(HARDWARE_MOTHERBOARD),75)
  282. HARDWARE_VARIANT ?= arduino
  283. MCU ?= atmega2560
  284. #Gen6
  285. else ifeq ($(HARDWARE_MOTHERBOARD),5)
  286. HARDWARE_VARIANT ?= Gen6
  287. MCU ?= atmega644p
  288. else ifeq ($(HARDWARE_MOTHERBOARD),51)
  289. HARDWARE_VARIANT ?= Gen6
  290. MCU ?= atmega644p
  291. #Sanguinololu
  292. else ifeq ($(HARDWARE_MOTHERBOARD),6)
  293. HARDWARE_VARIANT ?= Sanguino
  294. MCU ?= atmega644p
  295. else ifeq ($(HARDWARE_MOTHERBOARD),62)
  296. HARDWARE_VARIANT ?= Sanguino
  297. MCU ?= atmega644p
  298. else ifeq ($(HARDWARE_MOTHERBOARD),63)
  299. HARDWARE_VARIANT ?= Sanguino
  300. MCU ?= atmega644p
  301. else ifeq ($(HARDWARE_MOTHERBOARD),64)
  302. HARDWARE_VARIANT ?= Sanguino
  303. MCU ?= atmega1284p
  304. else ifeq ($(HARDWARE_MOTHERBOARD),65)
  305. HARDWARE_VARIANT ?= Sanguino
  306. MCU ?= atmega1284p
  307. else ifeq ($(HARDWARE_MOTHERBOARD),66)
  308. HARDWARE_VARIANT ?= Sanguino
  309. MCU ?= atmega1284p
  310. else ifeq ($(HARDWARE_MOTHERBOARD),69)
  311. HARDWARE_VARIANT ?= Sanguino
  312. MCU ?= atmega1284p
  313. else ifeq ($(HARDWARE_MOTHERBOARD),89)
  314. HARDWARE_VARIANT ?= Sanguino
  315. MCU ?= atmega1284p
  316. else ifeq ($(HARDWARE_MOTHERBOARD),92)
  317. HARDWARE_VARIANT ?= Sanguino
  318. MCU ?= atmega1284p
  319. else ifeq ($(HARDWARE_MOTHERBOARD),505)
  320. HARDWARE_VARIANT ?= Sanguino
  321. MCU ?= atmega1284p
  322. else ifeq ($(HARDWARE_MOTHERBOARD),601)
  323. HARDWARE_VARIANT ?= Sanguino
  324. MCU ?= atmega1284p
  325. #Ultimaker
  326. else ifeq ($(HARDWARE_MOTHERBOARD),7)
  327. HARDWARE_VARIANT ?= arduino
  328. MCU ?= atmega2560
  329. else ifeq ($(HARDWARE_MOTHERBOARD),71)
  330. HARDWARE_VARIANT ?= arduino
  331. MCU ?= atmega1280
  332. #ATmega1281, ATmega2561
  333. else ifeq ($(HARDWARE_MOTHERBOARD),702)
  334. HARDWARE_VARIANT ?= arduino
  335. MCU ?= atmega1281
  336. else ifeq ($(HARDWARE_MOTHERBOARD),25)
  337. HARDWARE_VARIANT ?= arduino
  338. MCU ?= atmega1281
  339. #Teensylu
  340. else ifeq ($(HARDWARE_MOTHERBOARD),8)
  341. HARDWARE_VARIANT ?= Teensy
  342. MCU ?= at90usb1286
  343. else ifeq ($(HARDWARE_MOTHERBOARD),81)
  344. HARDWARE_VARIANT ?= Teensy
  345. MCU ?= at90usb1286
  346. else ifeq ($(HARDWARE_MOTHERBOARD),811)
  347. HARDWARE_VARIANT ?= Teensy
  348. MCU ?= at90usb1286
  349. else ifeq ($(HARDWARE_MOTHERBOARD),82)
  350. HARDWARE_VARIANT ?= Teensy
  351. MCU ?= at90usb646
  352. else ifeq ($(HARDWARE_MOTHERBOARD),83)
  353. HARDWARE_VARIANT ?= Teensy
  354. MCU ?= at90usb1286
  355. else ifeq ($(HARDWARE_MOTHERBOARD),84)
  356. HARDWARE_VARIANT ?= Teensy
  357. MCU ?= at90usb1286
  358. else ifeq ($(HARDWARE_MOTHERBOARD),88)
  359. HARDWARE_VARIANT ?= Teensy
  360. MCU ?= at90usb1286
  361. #Gen3+
  362. else ifeq ($(HARDWARE_MOTHERBOARD),9)
  363. HARDWARE_VARIANT ?= Sanguino
  364. MCU ?= atmega644p
  365. #Gen3 Monolithic Electronics
  366. else ifeq ($(HARDWARE_MOTHERBOARD),22)
  367. HARDWARE_VARIANT ?= Sanguino
  368. MCU ?= atmega644p
  369. #Megatronics
  370. else ifeq ($(HARDWARE_MOTHERBOARD),70)
  371. HARDWARE_VARIANT ?= arduino
  372. MCU ?= atmega2560
  373. #Alpha OMCA board
  374. else ifeq ($(HARDWARE_MOTHERBOARD),90)
  375. HARDWARE_VARIANT ?= SanguinoA
  376. MCU ?= atmega644
  377. #Final OMCA board
  378. else ifeq ($(HARDWARE_MOTHERBOARD),91)
  379. HARDWARE_VARIANT ?= Sanguino
  380. MCU ?= atmega644p
  381. #Sethi 3D_1
  382. else ifeq ($(HARDWARE_MOTHERBOARD),20)
  383. HARDWARE_VARIANT ?= Sanguino
  384. MCU ?= atmega644p
  385. #Rambo
  386. else ifeq ($(HARDWARE_MOTHERBOARD),301)
  387. HARDWARE_VARIANT ?= arduino
  388. MCU ?= atmega2560
  389. #Azteeg
  390. else ifeq ($(HARDWARE_MOTHERBOARD),67)
  391. HARDWARE_VARIANT ?= arduino
  392. MCU ?= atmega2560
  393. else ifeq ($(HARDWARE_MOTHERBOARD),68)
  394. HARDWARE_VARIANT ?= arduino
  395. MCU ?= atmega2560
  396. endif
  397. # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
  398. # if you are setting this to something other than 16MHz
  399. # Set to 16Mhz if not yet set.
  400. F_CPU ?= 16000000
  401. # Arduino contained the main source code for the Arduino
  402. # Libraries, the "hardware variant" are for boards
  403. # that derives from that, and their source are present in
  404. # the main Marlin source directory
  405. TARGET = $(notdir $(CURDIR))
  406. # VPATH tells make to look into these directory for source files,
  407. # there is no need to specify explicit pathnames as long as the
  408. # directory is added here
  409. # The Makefile for previous versions of Marlin used VPATH for all
  410. # source files, but for Marlin 2.0, we use VPATH only for arduino
  411. # library files.
  412. VPATH = .
  413. VPATH += $(BUILD_DIR)
  414. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
  415. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
  416. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
  417. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
  418. ifeq ($(LIQUID_TWI2), 1)
  419. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  420. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  421. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
  422. endif
  423. ifeq ($(WIRE), 1)
  424. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  425. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  426. endif
  427. ifeq ($(NEOPIXEL), 1)
  428. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
  429. endif
  430. ifeq ($(U8GLIB), 1)
  431. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib
  432. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/clib
  433. endif
  434. ifeq ($(TMC2630), 1)
  435. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMC2130Stepper/src
  436. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMC2130Stepper/src/source
  437. endif
  438. ifeq ($(HARDWARE_VARIANT), arduino)
  439. HARDWARE_SUB_VARIANT ?= mega
  440. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
  441. else
  442. ifeq ($(HARDWARE_VARIANT), Sanguino)
  443. VPATH += $(HARDWARE_DIR)/marlin/avr/variants/sanguino
  444. else
  445. HARDWARE_SUB_VARIANT ?= standard
  446. VPATH += $(HARDWARE_DIR)/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
  447. endif
  448. endif
  449. LIB_SRC = wiring.c \
  450. wiring_analog.c wiring_digital.c \
  451. wiring_pulse.c \
  452. wiring_shift.c WInterrupts.c hooks.c
  453. ifeq ($(HARDWARE_VARIANT), Teensy)
  454. LIB_SRC = wiring.c
  455. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
  456. endif
  457. LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp Tone.cpp
  458. ifeq ($(NEOPIXEL), 1)
  459. LIB_CXXSRC += Adafruit_NeoPixel.cpp
  460. endif
  461. ifeq ($(LIQUID_TWI2), 0)
  462. LIB_CXXSRC += LiquidCrystal.cpp
  463. else
  464. LIB_SRC += twi.c
  465. LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp
  466. endif
  467. ifeq ($(WIRE), 1)
  468. LIB_SRC += twi.c
  469. LIB_CXXSRC += Wire.cpp
  470. endif
  471. ifeq ($(U8GLIB), 1)
  472. LIB_CXXSRC += U8glib.cpp
  473. LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_data.c
  474. endif
  475. ifeq ($(TMC2630), 1)
  476. LIB_CXXSRC += TMC2130Stepper.cpp TMC2130Stepper_COOLCONF.cpp TMC2130Stepper_DRV_STATUS.cpp TMC2130Stepper_IHOLD_IRUN.cpp TMC2130Stepper_CHOPCONF.cpp TMC2130Stepper_GCONF.cpp TMC2130Stepper_PWMCONF.cpp SW_SPI.cpp
  477. endif
  478. ifeq ($(RELOC_WORKAROUND), 1)
  479. LD_PREFIX=-nodefaultlibs
  480. LD_SUFFIX=-lm -lgcc -lc -lgcc
  481. endif
  482. #Check for Arduino 1.0.0 or higher and use the correct source files for that version
  483. ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
  484. LIB_CXXSRC += main.cpp
  485. else
  486. LIB_SRC += pins_arduino.c main.c
  487. endif
  488. FORMAT = ihex
  489. # Name of this Makefile (used for "make depend").
  490. MAKEFILE = Makefile
  491. # Debugging format.
  492. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
  493. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
  494. DEBUG = stabs
  495. OPT = s
  496. DEFINES ?=
  497. # Program settings
  498. CC = $(AVR_TOOLS_PATH)avr-gcc
  499. CXX = $(AVR_TOOLS_PATH)avr-g++
  500. OBJCOPY = $(AVR_TOOLS_PATH)avr-objcopy
  501. OBJDUMP = $(AVR_TOOLS_PATH)avr-objdump
  502. AR = $(AVR_TOOLS_PATH)avr-ar
  503. SIZE = $(AVR_TOOLS_PATH)avr-size
  504. NM = $(AVR_TOOLS_PATH)avr-nm
  505. AVRDUDE = avrdude
  506. REMOVE = rm -f
  507. MV = mv -f
  508. # Place -D or -U options here
  509. CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)}
  510. CXXDEFS = $(CDEFS)
  511. ifeq ($(HARDWARE_VARIANT), Teensy)
  512. CDEFS += -DUSB_SERIAL
  513. LIB_SRC += usb.c pins_teensy.c
  514. LIB_CXXSRC += usb_api.cpp
  515. endif
  516. # Add all the source directories as include directories too
  517. CINCS = ${addprefix -I ,${VPATH}}
  518. CXXINCS = ${addprefix -I ,${VPATH}}
  519. # Compiler flag to set the C/CPP Standard level.
  520. CSTANDARD = -std=gnu99
  521. CXXSTANDARD = -std=gnu++11
  522. CDEBUG = -g$(DEBUG)
  523. CWARN = -Wall -Wstrict-prototypes
  524. CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct \
  525. -fshort-enums -w -ffunction-sections -fdata-sections \
  526. -flto \
  527. -DARDUINO=$(ARDUINO_VERSION)
  528. ifneq ($(HARDWARE_MOTHERBOARD),)
  529. CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
  530. endif
  531. #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
  532. CEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics
  533. CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING) $(CSTANDARD)
  534. CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) -Wall $(CEXTRA) $(CTUNING) $(CXXSTANDARD)
  535. #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
  536. LDFLAGS = -lm
  537. # Programming support using avrdude. Settings and variables.
  538. AVRDUDE_PORT = $(UPLOAD_PORT)
  539. AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
  540. ifeq ($(shell uname -s), Linux)
  541. AVRDUDE_CONF = /etc/avrdude/avrdude.conf
  542. else
  543. AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
  544. endif
  545. AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
  546. -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
  547. -b$(UPLOAD_RATE)
  548. # Since Marlin 2.0, the source files may be distributed into several
  549. # different directories, so it is necessary to find them recursively
  550. SRC = $(shell find src -name '*.c' -type f)
  551. CXXSRC = $(shell find src -name '*.cpp' -type f)
  552. # Define all object files.
  553. OBJ = ${patsubst %.c, $(BUILD_DIR)/arduino/%.o, ${LIB_SRC}}
  554. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/arduino/%.o, ${LIB_CXXSRC}}
  555. OBJ += ${patsubst %.S, $(BUILD_DIR)/arduino/%.o, ${LIB_ASRC}}
  556. OBJ += ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
  557. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
  558. # Define all listing files.
  559. LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst)
  560. # Combine all necessary flags and optional flags.
  561. # Add target processor to flags.
  562. ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
  563. ALL_CXXFLAGS = -mmcu=$(MCU) $(CXXFLAGS)
  564. ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS)
  565. # set V=1 (eg, "make V=1") to print the full commands etc.
  566. ifneq ($V,1)
  567. Pecho=@echo
  568. P=@
  569. else
  570. Pecho=@:
  571. P=
  572. endif
  573. # Create required build hierarchy if it does not exist
  574. $(shell mkdir -p $(dir $(OBJ)))
  575. # Default target.
  576. all: sizeafter
  577. build: elf hex
  578. elf: $(BUILD_DIR)/$(TARGET).elf
  579. hex: $(BUILD_DIR)/$(TARGET).hex
  580. eep: $(BUILD_DIR)/$(TARGET).eep
  581. lss: $(BUILD_DIR)/$(TARGET).lss
  582. sym: $(BUILD_DIR)/$(TARGET).sym
  583. # Program the device.
  584. # Do not try to reset an Arduino if it's not one
  585. upload: $(BUILD_DIR)/$(TARGET).hex
  586. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  587. stty hup < $(UPLOAD_PORT); true
  588. endif
  589. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
  590. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  591. stty -hup < $(UPLOAD_PORT); true
  592. endif
  593. # Display size of file.
  594. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
  595. ELFSIZE = $(SIZE) --mcu=$(MCU) -C $(BUILD_DIR)/$(TARGET).elf; \
  596. $(SIZE) $(BUILD_DIR)/$(TARGET).elf
  597. sizebefore:
  598. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
  599. sizeafter: build
  600. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
  601. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  602. COFFCONVERT=$(OBJCOPY) --debugging \
  603. --change-section-address .data-0x800000 \
  604. --change-section-address .bss-0x800000 \
  605. --change-section-address .noinit-0x800000 \
  606. --change-section-address .eeprom-0x810000
  607. coff: $(BUILD_DIR)/$(TARGET).elf
  608. $(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  609. extcoff: $(TARGET).elf
  610. $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  611. .SUFFIXES: .elf .hex .eep .lss .sym
  612. .PRECIOUS: .o
  613. .elf.hex:
  614. $(Pecho) " COPY $@"
  615. $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
  616. .elf.eep:
  617. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  618. --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
  619. # Create extended listing file from ELF output file.
  620. .elf.lss:
  621. $(OBJDUMP) -h -S $< > $@
  622. # Create a symbol table from ELF output file.
  623. .elf.sym:
  624. $(NM) -n $< > $@
  625. # Link: create ELF output file from library.
  626. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
  627. $(Pecho) " CXX $@"
  628. $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -Wl,--gc-sections,--relax -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
  629. # Object files that were found in "src" will be stored in $(BUILD_DIR)
  630. # in directories that mirror the structure of "src"
  631. $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  632. $(Pecho) " CC $<"
  633. $P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
  634. $(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  635. $(Pecho) " CXX $<"
  636. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
  637. # Object files for Arduino libs will be created in $(BUILD_DIR)/arduino
  638. $(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  639. $(Pecho) " CC $<"
  640. $P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
  641. $(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  642. $(Pecho) " CXX $<"
  643. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
  644. # Target: clean project.
  645. clean:
  646. $(Pecho) " RMDIR $(BUILD_DIR)/"
  647. $P rm -rf $(BUILD_DIR)
  648. .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
  649. # Automaticaly include the dependency files created by gcc
  650. -include ${patsubst %.o, %.d, ${OBJ}}