My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Makefile 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  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. # The installed Libraries are in the User folder
  65. ARDUINO_USER_DIR ?= ${HOME}/Arduino
  66. # You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
  67. AVR_TOOLS_PATH ?=
  68. #Programmer configuration
  69. UPLOAD_RATE ?= 57600
  70. AVRDUDE_PROGRAMMER ?= arduino
  71. # on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
  72. UPLOAD_PORT ?= /dev/ttyUSB0
  73. #Directory used to build files in, contains all the build files, from object files to the final hex file
  74. #on linux it is best to put an absolute path like /home/username/tmp .
  75. BUILD_DIR ?= applet
  76. # This defines whether Liquid_TWI2 support will be built
  77. LIQUID_TWI2 ?= 0
  78. # this defines if Wire is needed
  79. WIRE ?= 0
  80. # this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
  81. U8GLIB ?= 1
  82. # this defines whether to include the Trinamic TMCStepper library
  83. TMC ?= 1
  84. ############
  85. # Try to automatically determine whether RELOC_WORKAROUND is needed based
  86. # on GCC versions:
  87. # http://www.avrfreaks.net/comment/1789106#comment-1789106
  88. CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ )
  89. CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ )
  90. CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d\ )
  91. CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) )))
  92. ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1)
  93. @echo This version of GCC is likely broken. Enabling relocation workaround.
  94. RELOC_WORKAROUND = 1
  95. endif
  96. ############################################################################
  97. # Below here nothing should be changed...
  98. # Here the Arduino variant is selected by the board type
  99. # HARDWARE_VARIANT = "arduino", "Sanguino", "Gen7", ...
  100. # MCU = "atmega1280", "Mega2560", "atmega2560", "atmega644p", ...
  101. ifeq ($(HARDWARE_MOTHERBOARD),0)
  102. # No motherboard selected
  103. #
  104. # RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560
  105. #
  106. # MEGA/RAMPS up to 1.2
  107. else ifeq ($(HARDWARE_MOTHERBOARD),3)
  108. # RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
  109. else ifeq ($(HARDWARE_MOTHERBOARD),33)
  110. # RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
  111. else ifeq ($(HARDWARE_MOTHERBOARD),34)
  112. # RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1)
  113. else ifeq ($(HARDWARE_MOTHERBOARD),35)
  114. # RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan)
  115. else ifeq ($(HARDWARE_MOTHERBOARD),36)
  116. # RAMPS 1.3 (Power outputs: Spindle, Controller Fan)
  117. else ifeq ($(HARDWARE_MOTHERBOARD),38)
  118. # RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
  119. else ifeq ($(HARDWARE_MOTHERBOARD),43)
  120. # RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
  121. else ifeq ($(HARDWARE_MOTHERBOARD),44)
  122. # RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
  123. else ifeq ($(HARDWARE_MOTHERBOARD),45)
  124. # RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
  125. else ifeq ($(HARDWARE_MOTHERBOARD),46)
  126. # RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
  127. else ifeq ($(HARDWARE_MOTHERBOARD),48)
  128. # RAMPS Plus 3DYMY (Power outputs: Hotend, Fan, Bed)
  129. else ifeq ($(HARDWARE_MOTHERBOARD),143)
  130. # RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Bed)
  131. else ifeq ($(HARDWARE_MOTHERBOARD),144)
  132. # RAMPS Plus 3DYMY (Power outputs: Hotend, Fan0, Fan1)
  133. else ifeq ($(HARDWARE_MOTHERBOARD),145)
  134. # RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan)
  135. else ifeq ($(HARDWARE_MOTHERBOARD),146)
  136. # RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan)
  137. else ifeq ($(HARDWARE_MOTHERBOARD),148)
  138. #
  139. # RAMPS Derivatives - ATmega1280, ATmega2560
  140. #
  141. # 3Drag Controller
  142. else ifeq ($(HARDWARE_MOTHERBOARD),77)
  143. # Velleman K8200 Controller (derived from 3Drag Controller)
  144. else ifeq ($(HARDWARE_MOTHERBOARD),78)
  145. # Velleman K8400 Controller (derived from 3Drag Controller)
  146. else ifeq ($(HARDWARE_MOTHERBOARD),79)
  147. # 2PrintBeta BAM&DICE with STK drivers
  148. else ifeq ($(HARDWARE_MOTHERBOARD),401)
  149. # 2PrintBeta BAM&DICE Due with STK drivers
  150. else ifeq ($(HARDWARE_MOTHERBOARD),402)
  151. # MKS BASE v1.0
  152. else ifeq ($(HARDWARE_MOTHERBOARD),40)
  153. # MKS v1.5 with Allegro A4982 stepper drivers
  154. else ifeq ($(HARDWARE_MOTHERBOARD),405)
  155. # MKS BASE 1.0 with Heroic HR4982 stepper drivers
  156. else ifeq ($(HARDWARE_MOTHERBOARD),41)
  157. # MKS GEN v1.3 or 1.4
  158. else ifeq ($(HARDWARE_MOTHERBOARD),47)
  159. # MKS GEN L
  160. else ifeq ($(HARDWARE_MOTHERBOARD),53)
  161. # zrib V2.0 control board (Chinese knock off RAMPS replica)
  162. else ifeq ($(HARDWARE_MOTHERBOARD),504)
  163. # Felix 2.0+ Electronics Board (RAMPS like)
  164. else ifeq ($(HARDWARE_MOTHERBOARD),37)
  165. # Invent-A-Part RigidBoard
  166. else ifeq ($(HARDWARE_MOTHERBOARD),42)
  167. # Invent-A-Part RigidBoard V2
  168. else ifeq ($(HARDWARE_MOTHERBOARD),52)
  169. # Sainsmart 2-in-1 board
  170. else ifeq ($(HARDWARE_MOTHERBOARD),49)
  171. # Ultimaker
  172. else ifeq ($(HARDWARE_MOTHERBOARD),7)
  173. # Ultimaker (Older electronics. Pre 1.5.4. This is rare)
  174. else ifeq ($(HARDWARE_MOTHERBOARD),71)
  175. MCU ?= atmega1280
  176. # Azteeg X3
  177. else ifeq ($(HARDWARE_MOTHERBOARD),67)
  178. # Azteeg X3 Pro
  179. else ifeq ($(HARDWARE_MOTHERBOARD),68)
  180. # Ultimainboard 2.x (Uses TEMP_SENSOR 20)
  181. else ifeq ($(HARDWARE_MOTHERBOARD),72)
  182. # Rumba
  183. else ifeq ($(HARDWARE_MOTHERBOARD),80)
  184. # Raise3D Rumba
  185. else ifeq ($(HARDWARE_MOTHERBOARD),333)
  186. # Rapide Lite RL200 Rumba
  187. else ifeq ($(HARDWARE_MOTHERBOARD),801)
  188. # Formbot T-Rex 2 Plus
  189. else ifeq ($(HARDWARE_MOTHERBOARD),95)
  190. # Formbot T-Rex 3
  191. else ifeq ($(HARDWARE_MOTHERBOARD),96)
  192. # Formbot Raptor
  193. else ifeq ($(HARDWARE_MOTHERBOARD),97)
  194. # Formbot Raptor 2
  195. else ifeq ($(HARDWARE_MOTHERBOARD),98)
  196. # bq ZUM Mega 3D
  197. else ifeq ($(HARDWARE_MOTHERBOARD),503)
  198. # MakeBoard Mini v2.1.2 is a control board sold by MicroMake
  199. else ifeq ($(HARDWARE_MOTHERBOARD),431)
  200. # TriGorilla Anycubic version 1.3 based on RAMPS EFB
  201. else ifeq ($(HARDWARE_MOTHERBOARD),343)
  202. # TriGorilla Anycubic version 1.4 based on RAMPS EFB
  203. else ifeq ($(HARDWARE_MOTHERBOARD),443)
  204. # Creality: Ender-4, CR-8
  205. else ifeq ($(HARDWARE_MOTHERBOARD),243)
  206. # Creality: CR10S, CR20, CR-X
  207. else ifeq ($(HARDWARE_MOTHERBOARD),244)
  208. # Fysetc F6
  209. else ifeq ($(HARDWARE_MOTHERBOARD),541)
  210. # Duplicator i3 Plus
  211. else ifeq ($(HARDWARE_MOTHERBOARD),31)
  212. # VORON
  213. else ifeq ($(HARDWARE_MOTHERBOARD),441)
  214. # TRONXY V3 1.0
  215. else ifeq ($(HARDWARE_MOTHERBOARD),442)
  216. # Z-Bolt X Series
  217. else ifeq ($(HARDWARE_MOTHERBOARD),550)
  218. #
  219. # Other ATmega1280, ATmega2560
  220. #
  221. # Cartesio CN Controls V11
  222. else ifeq ($(HARDWARE_MOTHERBOARD),111)
  223. # Cartesio CN Controls V12
  224. else ifeq ($(HARDWARE_MOTHERBOARD),112)
  225. # Cheaptronic v1.0
  226. else ifeq ($(HARDWARE_MOTHERBOARD),2)
  227. # Cheaptronic v2.0
  228. else ifeq ($(HARDWARE_MOTHERBOARD),21)
  229. # Makerbot Mightyboard Revision E
  230. else ifeq ($(HARDWARE_MOTHERBOARD),200)
  231. # Megatronics
  232. else ifeq ($(HARDWARE_MOTHERBOARD),70)
  233. # Megatronics v2.0
  234. else ifeq ($(HARDWARE_MOTHERBOARD),701)
  235. # Megatronics v3.0
  236. else ifeq ($(HARDWARE_MOTHERBOARD),703)
  237. # Megatronics v3.1
  238. else ifeq ($(HARDWARE_MOTHERBOARD),704)
  239. # Rambo
  240. else ifeq ($(HARDWARE_MOTHERBOARD),301)
  241. # Mini-Rambo
  242. else ifeq ($(HARDWARE_MOTHERBOARD),302)
  243. # Mini-Rambo 1.0a
  244. else ifeq ($(HARDWARE_MOTHERBOARD),303)
  245. # Einsy Rambo
  246. else ifeq ($(HARDWARE_MOTHERBOARD),304)
  247. # Einsy Retro
  248. else ifeq ($(HARDWARE_MOTHERBOARD),305)
  249. # Elefu Ra Board (v3)
  250. else ifeq ($(HARDWARE_MOTHERBOARD),21)
  251. # Leapfrog
  252. else ifeq ($(HARDWARE_MOTHERBOARD),999)
  253. # Mega controller
  254. else ifeq ($(HARDWARE_MOTHERBOARD),310)
  255. # abee Scoovo X9H
  256. else ifeq ($(HARDWARE_MOTHERBOARD),321)
  257. # Geeetech GT2560 Rev B for Mecreator2
  258. else ifeq ($(HARDWARE_MOTHERBOARD),73)
  259. # Geeetech GT2560 Rev. A
  260. else ifeq ($(HARDWARE_MOTHERBOARD),74)
  261. # Geeetech GT2560 Rev. A+ (with auto level probe)
  262. else ifeq ($(HARDWARE_MOTHERBOARD),75)
  263. # Geeetech GT2560 Rev B for A10(M/D)
  264. else ifeq ($(HARDWARE_MOTHERBOARD),76)
  265. # Geeetech GT2560 Rev B for A20(M/D)
  266. else ifeq ($(HARDWARE_MOTHERBOARD),86)
  267. # Einstart retrofit
  268. else ifeq ($(HARDWARE_MOTHERBOARD),666)
  269. #
  270. # ATmega1281, ATmega2561
  271. #
  272. else ifeq ($(HARDWARE_MOTHERBOARD),702)
  273. MCU ?= atmega1281
  274. else ifeq ($(HARDWARE_MOTHERBOARD),25)
  275. MCU ?= atmega1281
  276. #
  277. # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
  278. #
  279. # Sanguinololu < 1.2
  280. else ifeq ($(HARDWARE_MOTHERBOARD),6)
  281. HARDWARE_VARIANT ?= Sanguino
  282. MCU ?= atmega644p
  283. # Sanguinololu 1.2 and above
  284. else ifeq ($(HARDWARE_MOTHERBOARD),62)
  285. HARDWARE_VARIANT ?= Sanguino
  286. MCU ?= atmega644p
  287. # Melzi
  288. else ifeq ($(HARDWARE_MOTHERBOARD),63)
  289. HARDWARE_VARIANT ?= Sanguino
  290. MCU ?= atmega644p
  291. # Melzi with ATmega1284 (MaKr3d version)
  292. else ifeq ($(HARDWARE_MOTHERBOARD),66)
  293. HARDWARE_VARIANT ?= Sanguino
  294. MCU ?= atmega1284p
  295. # Melzi Creality3D board (for CR-10 etc)
  296. else ifeq ($(HARDWARE_MOTHERBOARD),89)
  297. HARDWARE_VARIANT ?= Sanguino
  298. MCU ?= atmega1284p
  299. # Melzi Malyan M150 board
  300. else ifeq ($(HARDWARE_MOTHERBOARD),92)
  301. HARDWARE_VARIANT ?= Sanguino
  302. MCU ?= atmega1284p
  303. # Tronxy X5S
  304. else ifeq ($(HARDWARE_MOTHERBOARD),505)
  305. HARDWARE_VARIANT ?= Sanguino
  306. MCU ?= atmega1284p
  307. # STB V1.1
  308. else ifeq ($(HARDWARE_MOTHERBOARD),64)
  309. HARDWARE_VARIANT ?= Sanguino
  310. MCU ?= atmega1284p
  311. # Azteeg X1
  312. else ifeq ($(HARDWARE_MOTHERBOARD),65)
  313. HARDWARE_VARIANT ?= Sanguino
  314. MCU ?= atmega1284p
  315. # Anet 1.0 (Melzi clone)
  316. else ifeq ($(HARDWARE_MOTHERBOARD),69)
  317. HARDWARE_VARIANT ?= Sanguino
  318. MCU ?= atmega1284p
  319. #
  320. # Other ATmega644P, ATmega644, ATmega1284P
  321. #
  322. # Gen3 Monolithic Electronics
  323. else ifeq ($(HARDWARE_MOTHERBOARD),22)
  324. HARDWARE_VARIANT ?= Sanguino
  325. MCU ?= atmega644p
  326. # Gen3+
  327. else ifeq ($(HARDWARE_MOTHERBOARD),9)
  328. HARDWARE_VARIANT ?= Sanguino
  329. MCU ?= atmega644p
  330. # Gen6
  331. else ifeq ($(HARDWARE_MOTHERBOARD),5)
  332. HARDWARE_VARIANT ?= Gen6
  333. MCU ?= atmega644p
  334. # Gen6 deluxe
  335. else ifeq ($(HARDWARE_MOTHERBOARD),51)
  336. HARDWARE_VARIANT ?= Gen6
  337. MCU ?= atmega644p
  338. # Gen7 custom (Alfons3 Version)
  339. else ifeq ($(HARDWARE_MOTHERBOARD),10)
  340. HARDWARE_VARIANT ?= Gen7
  341. MCU ?= atmega644
  342. F_CPU ?= 20000000
  343. # Gen7 v1.1, v1.2
  344. else ifeq ($(HARDWARE_MOTHERBOARD),11)
  345. HARDWARE_VARIANT ?= Gen7
  346. MCU ?= atmega644p
  347. F_CPU ?= 20000000
  348. # Gen7 v1.3
  349. else ifeq ($(HARDWARE_MOTHERBOARD),12)
  350. HARDWARE_VARIANT ?= Gen7
  351. MCU ?= atmega644p
  352. F_CPU ?= 20000000
  353. # Gen7 v1.4
  354. else ifeq ($(HARDWARE_MOTHERBOARD),13)
  355. HARDWARE_VARIANT ?= Gen7
  356. MCU ?= atmega1284p
  357. F_CPU ?= 20000000
  358. # Alpha OMCA board
  359. else ifeq ($(HARDWARE_MOTHERBOARD),90)
  360. HARDWARE_VARIANT ?= SanguinoA
  361. MCU ?= atmega644
  362. # Final OMCA board
  363. else ifeq ($(HARDWARE_MOTHERBOARD),91)
  364. HARDWARE_VARIANT ?= Sanguino
  365. MCU ?= atmega644p
  366. # Sethi 3D_1
  367. else ifeq ($(HARDWARE_MOTHERBOARD),20)
  368. HARDWARE_VARIANT ?= Sanguino
  369. MCU ?= atmega644p
  370. #
  371. # Teensyduino - AT90USB1286, AT90USB1286P
  372. #
  373. # Teensylu
  374. else ifeq ($(HARDWARE_MOTHERBOARD),8)
  375. HARDWARE_VARIANT ?= Teensy
  376. MCU ?= at90usb1286
  377. # Printrboard (AT90USB1286)
  378. else ifeq ($(HARDWARE_MOTHERBOARD),81)
  379. HARDWARE_VARIANT ?= Teensy
  380. MCU ?= at90usb1286
  381. # Printrboard Revision F (AT90USB1286)
  382. else ifeq ($(HARDWARE_MOTHERBOARD),811)
  383. HARDWARE_VARIANT ?= Teensy
  384. MCU ?= at90usb1286
  385. # Brainwave (AT90USB646)
  386. else ifeq ($(HARDWARE_MOTHERBOARD),82)
  387. HARDWARE_VARIANT ?= Teensy
  388. MCU ?= at90usb646
  389. # Brainwave Pro (AT90USB1286)
  390. else ifeq ($(HARDWARE_MOTHERBOARD),83)
  391. HARDWARE_VARIANT ?= Teensy
  392. MCU ?= at90usb1286
  393. # SAV Mk-I (AT90USB1286)
  394. else ifeq ($(HARDWARE_MOTHERBOARD),84)
  395. HARDWARE_VARIANT ?= Teensy
  396. MCU ?= at90usb1286
  397. # Teensy++2.0 (AT90USB1286)
  398. else ifeq ($(HARDWARE_MOTHERBOARD),85)
  399. HARDWARE_VARIANT ?= Teensy
  400. MCU ?= at90usb1286
  401. # 5DPrint D8 Driver Board
  402. else ifeq ($(HARDWARE_MOTHERBOARD),88)
  403. HARDWARE_VARIANT ?= Teensy
  404. MCU ?= at90usb1286
  405. # UltiMachine Archim1 (with DRV8825 drivers)
  406. else ifeq ($(HARDWARE_MOTHERBOARD),1591)
  407. HARDWARE_VARIANT ?= archim
  408. MCPU = cortex-m3
  409. F_CPU = 84000000L
  410. IS_MCU = 0
  411. # UltiMachine Archim2 (with TMC2130 drivers)
  412. else ifeq ($(HARDWARE_MOTHERBOARD),1592)
  413. HARDWARE_VARIANT ?= archim
  414. MCPU = cortex-m3
  415. F_CPU = 84000000L
  416. IS_MCU = 0
  417. endif
  418. # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
  419. # if you are setting this to something other than 16MHz
  420. # Set to 16Mhz if not yet set.
  421. F_CPU ?= 16000000
  422. # Set to microcontroller if IS_MCU not yet set
  423. IS_MCU ?= 1
  424. ifeq ($(IS_MCU),1)
  425. # Set to arduino, ATmega2560 if not yet set.
  426. HARDWARE_VARIANT ?= arduino
  427. MCU ?= atmega2560
  428. TOOL_PREFIX = avr
  429. MCU_FLAGS = -mmcu=$(MCU)
  430. SIZE_FLAGS = --mcu=$(MCU) -C
  431. else
  432. TOOL_PREFIX = arm-none-eabi
  433. CPU_FLAGS = -mthumb -mcpu=$(MCPU)
  434. SIZE_FLAGS = -A
  435. endif
  436. # Arduino contained the main source code for the Arduino
  437. # Libraries, the "hardware variant" are for boards
  438. # that derives from that, and their source are present in
  439. # the main Marlin source directory
  440. TARGET = $(notdir $(CURDIR))
  441. # VPATH tells make to look into these directory for source files,
  442. # there is no need to specify explicit pathnames as long as the
  443. # directory is added here
  444. # The Makefile for previous versions of Marlin used VPATH for all
  445. # source files, but for Marlin 2.0, we use VPATH only for arduino
  446. # library files.
  447. VPATH = .
  448. VPATH += $(BUILD_DIR)
  449. VPATH += $(HARDWARE_SRC)
  450. ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
  451. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
  452. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
  453. endif
  454. ifeq ($(IS_MCU),1)
  455. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
  456. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
  457. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
  458. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
  459. endif
  460. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
  461. ifeq ($(LIQUID_TWI2), 1)
  462. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  463. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  464. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
  465. endif
  466. ifeq ($(WIRE), 1)
  467. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  468. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  469. endif
  470. ifeq ($(NEOPIXEL), 1)
  471. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
  472. endif
  473. ifeq ($(U8GLIB), 1)
  474. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib
  475. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/csrc
  476. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/cppsrc
  477. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/fntsrc
  478. endif
  479. ifeq ($(TMC), 1)
  480. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src
  481. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src/source
  482. endif
  483. ifeq ($(HARDWARE_VARIANT), arduino)
  484. HARDWARE_SUB_VARIANT ?= mega
  485. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
  486. else ifeq ($(HARDWARE_VARIANT), Sanguino)
  487. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino
  488. else ifeq ($(HARDWARE_VARIANT), archim)
  489. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/libsam
  490. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/CMSIS/Include/
  491. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/Device/ATMEL/
  492. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino
  493. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/avr
  494. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB
  495. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src
  496. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src
  497. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/U8glib/src/clib
  498. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim
  499. LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld
  500. LDLIBS = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a
  501. else
  502. HARDWARE_SUB_VARIANT ?= standard
  503. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
  504. endif
  505. LIB_SRC = wiring.c \
  506. wiring_analog.c wiring_digital.c \
  507. wiring_shift.c WInterrupts.c hooks.c
  508. ifeq ($(HARDWARE_VARIANT), archim)
  509. LIB_ASRC += wiring_pulse_asm.S
  510. else
  511. LIB_SRC += wiring_pulse.c
  512. endif
  513. ifeq ($(HARDWARE_VARIANT), Teensy)
  514. LIB_SRC = wiring.c
  515. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
  516. endif
  517. LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp
  518. ifeq ($(NEOPIXEL), 1)
  519. LIB_CXXSRC += Adafruit_NeoPixel.cpp
  520. endif
  521. ifeq ($(LIQUID_TWI2), 0)
  522. LIB_CXXSRC += LiquidCrystal.cpp
  523. else
  524. LIB_SRC += twi.c
  525. LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp
  526. endif
  527. ifeq ($(WIRE), 1)
  528. LIB_SRC += twi.c
  529. LIB_CXXSRC += Wire.cpp
  530. endif
  531. ifeq ($(U8GLIB), 1)
  532. LIB_CXXSRC += U8glib.cpp
  533. 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_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
  534. endif
  535. ifeq ($(TMC), 1)
  536. LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
  537. endif
  538. ifeq ($(RELOC_WORKAROUND), 1)
  539. LD_PREFIX=-nodefaultlibs
  540. LD_SUFFIX=-lm -lgcc -lc -lgcc
  541. endif
  542. #Check for Arduino 1.0.0 or higher and use the correct source files for that version
  543. ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
  544. LIB_CXXSRC += main.cpp
  545. else
  546. LIB_SRC += pins_arduino.c main.c
  547. endif
  548. FORMAT = ihex
  549. # Name of this Makefile (used for "make depend").
  550. MAKEFILE = Makefile
  551. # Debugging format.
  552. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
  553. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
  554. DEBUG = stabs
  555. OPT = s
  556. DEFINES ?=
  557. # Program settings
  558. CC = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-gcc
  559. CXX = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-g++
  560. OBJCOPY = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objcopy
  561. OBJDUMP = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objdump
  562. AR = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-ar
  563. SIZE = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-size
  564. NM = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-nm
  565. AVRDUDE = avrdude
  566. REMOVE = rm -f
  567. MV = mv -f
  568. # Place -D or -U options here
  569. CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
  570. CXXDEFS = $(CDEFS)
  571. ifeq ($(HARDWARE_VARIANT), Teensy)
  572. CDEFS += -DUSB_SERIAL
  573. LIB_SRC += usb.c pins_teensy.c
  574. LIB_CXXSRC += usb_api.cpp
  575. else ifeq ($(HARDWARE_VARIANT), archim)
  576. CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"'
  577. LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp
  578. LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
  579. ifeq ($(U8GLIB), 1)
  580. LIB_SRC += u8g_com_api.c u8g_pb32h1.c
  581. endif
  582. endif
  583. # Add all the source directories as include directories too
  584. CINCS = ${addprefix -I ,${VPATH}}
  585. CXXINCS = ${addprefix -I ,${VPATH}}
  586. # Silence warnings for library code (won't work for .h files, unfortunately)
  587. LIBWARN = -w -Wno-packed-bitfield-compat
  588. # Compiler flag to set the C/CPP Standard level.
  589. CSTANDARD = -std=gnu99
  590. CXXSTANDARD = -std=gnu++11
  591. CDEBUG = -g$(DEBUG)
  592. CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas
  593. CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas
  594. CTUNING = -fsigned-char -funsigned-bitfields -fpack-struct -fno-exceptions \
  595. -fshort-enums -ffunction-sections -fdata-sections
  596. ifneq ($(HARDWARE_MOTHERBOARD),)
  597. CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
  598. endif
  599. #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
  600. CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
  601. CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
  602. CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
  603. ASFLAGS := $(CDEFS)
  604. #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
  605. ifeq ($(HARDWARE_VARIANT), archim)
  606. LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
  607. LD_SUFFIX = $(LDLIBS)
  608. LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
  609. else
  610. LD_PREFIX = -Wl,--gc-sections,--relax
  611. LDFLAGS = -lm
  612. CTUNING += -flto
  613. endif
  614. # Programming support using avrdude. Settings and variables.
  615. AVRDUDE_PORT = $(UPLOAD_PORT)
  616. AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
  617. ifeq ($(shell uname -s), Linux)
  618. AVRDUDE_CONF = /etc/avrdude/avrdude.conf
  619. else
  620. AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
  621. endif
  622. AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
  623. -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
  624. -b$(UPLOAD_RATE)
  625. # Since Marlin 2.0, the source files may be distributed into several
  626. # different directories, so it is necessary to find them recursively
  627. SRC = $(shell find src -name '*.c' -type f)
  628. CXXSRC = $(shell find src -name '*.cpp' -type f)
  629. # Define all object files.
  630. OBJ = ${patsubst %.c, $(BUILD_DIR)/arduino/%.o, ${LIB_SRC}}
  631. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/arduino/%.o, ${LIB_CXXSRC}}
  632. OBJ += ${patsubst %.S, $(BUILD_DIR)/arduino/%.o, ${LIB_ASRC}}
  633. OBJ += ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
  634. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
  635. # Define all listing files.
  636. LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst)
  637. # Combine all necessary flags and optional flags.
  638. # Add target processor to flags.
  639. ALL_CFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CFLAGS) -I.
  640. ALL_CXXFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CXXFLAGS)
  641. ALL_ASFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(ASFLAGS) -x assembler-with-cpp
  642. # set V=1 (eg, "make V=1") to print the full commands etc.
  643. ifneq ($V,1)
  644. Pecho=@echo
  645. P=@
  646. else
  647. Pecho=@:
  648. P=
  649. endif
  650. # Create required build hierarchy if it does not exist
  651. $(shell mkdir -p $(dir $(OBJ)))
  652. # Default target.
  653. all: sizeafter
  654. build: elf hex bin
  655. elf: $(BUILD_DIR)/$(TARGET).elf
  656. bin: $(BUILD_DIR)/$(TARGET).bin
  657. hex: $(BUILD_DIR)/$(TARGET).hex
  658. eep: $(BUILD_DIR)/$(TARGET).eep
  659. lss: $(BUILD_DIR)/$(TARGET).lss
  660. sym: $(BUILD_DIR)/$(TARGET).sym
  661. # Program the device.
  662. # Do not try to reset an Arduino if it's not one
  663. upload: $(BUILD_DIR)/$(TARGET).hex
  664. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  665. stty hup < $(UPLOAD_PORT); true
  666. endif
  667. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
  668. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  669. stty -hup < $(UPLOAD_PORT); true
  670. endif
  671. # Display size of file.
  672. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
  673. ELFSIZE = $(SIZE) $(SIZE_FLAGS) $(BUILD_DIR)/$(TARGET).elf; \
  674. $(SIZE) $(BUILD_DIR)/$(TARGET).elf
  675. sizebefore:
  676. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
  677. sizeafter: build
  678. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
  679. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  680. COFFCONVERT=$(OBJCOPY) --debugging \
  681. --change-section-address .data-0x800000 \
  682. --change-section-address .bss-0x800000 \
  683. --change-section-address .noinit-0x800000 \
  684. --change-section-address .eeprom-0x810000
  685. coff: $(BUILD_DIR)/$(TARGET).elf
  686. $(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  687. extcoff: $(TARGET).elf
  688. $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  689. .SUFFIXES: .elf .hex .eep .lss .sym .bin
  690. .PRECIOUS: .o
  691. .elf.hex:
  692. $(Pecho) " COPY $@"
  693. $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
  694. .elf.bin:
  695. $(Pecho) " COPY $@"
  696. $P $(OBJCOPY) -O binary -R .eeprom $< $@
  697. .elf.eep:
  698. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  699. --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
  700. # Create extended listing file from ELF output file.
  701. .elf.lss:
  702. $(OBJDUMP) -h -S $< > $@
  703. # Create a symbol table from ELF output file.
  704. .elf.sym:
  705. $(NM) -n $< > $@
  706. # Link: create ELF output file from library.
  707. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
  708. $(Pecho) " CXX $@"
  709. $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
  710. # Object files that were found in "src" will be stored in $(BUILD_DIR)
  711. # in directories that mirror the structure of "src"
  712. $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  713. $(Pecho) " CC $<"
  714. $P $(CC) -MMD -c $(ALL_CFLAGS) $(CWARN) $< -o $@
  715. $(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  716. $(Pecho) " CXX $<"
  717. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(CXXWARN) $< -o $@
  718. # Object files for Arduino libs will be created in $(BUILD_DIR)/arduino
  719. $(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  720. $(Pecho) " CC $<"
  721. $P $(CC) -MMD -c $(ALL_CFLAGS) $(LIBWARN) $< -o $@
  722. $(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  723. $(Pecho) " CXX $<"
  724. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(LIBWARN) $< -o $@
  725. $(BUILD_DIR)/arduino/%.o: %.S $(MAKEFILE)
  726. $(Pecho) " CXX $<"
  727. $P $(CXX) -MMD -c $(ALL_ASFLAGS) $< -o $@
  728. # Target: clean project.
  729. clean:
  730. $(Pecho) " RMDIR $(BUILD_DIR)/"
  731. $P rm -rf $(BUILD_DIR)
  732. .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
  733. # Automaticaly include the dependency files created by gcc
  734. -include ${patsubst %.o, %.d, ${OBJ}}