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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  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. # Formbot T-Rex 2 Plus
  187. else ifeq ($(HARDWARE_MOTHERBOARD),95)
  188. # Formbot T-Rex 3
  189. else ifeq ($(HARDWARE_MOTHERBOARD),96)
  190. # Formbot Raptor
  191. else ifeq ($(HARDWARE_MOTHERBOARD),97)
  192. # Formbot Raptor 2
  193. else ifeq ($(HARDWARE_MOTHERBOARD),98)
  194. # bq ZUM Mega 3D
  195. else ifeq ($(HARDWARE_MOTHERBOARD),503)
  196. # MakeBoard Mini v2.1.2 is a control board sold by MicroMake
  197. else ifeq ($(HARDWARE_MOTHERBOARD),431)
  198. # TriGorilla Anycubic version 1.3 based on RAMPS EFB
  199. else ifeq ($(HARDWARE_MOTHERBOARD),343)
  200. # TriGorilla Anycubic version 1.4 based on RAMPS EFB
  201. else ifeq ($(HARDWARE_MOTHERBOARD),443)
  202. # Creality: Ender-4, CR-8
  203. else ifeq ($(HARDWARE_MOTHERBOARD),243)
  204. # Creality: CR10S, CR20, CR-X
  205. else ifeq ($(HARDWARE_MOTHERBOARD),244)
  206. # Fysetc F6
  207. else ifeq ($(HARDWARE_MOTHERBOARD),541)
  208. # Duplicator i3 Plus
  209. else ifeq ($(HARDWARE_MOTHERBOARD),31)
  210. # VORON
  211. else ifeq ($(HARDWARE_MOTHERBOARD),441)
  212. #
  213. # Other ATmega1280, ATmega2560
  214. #
  215. # Cartesio CN Controls V11
  216. else ifeq ($(HARDWARE_MOTHERBOARD),111)
  217. # Cartesio CN Controls V12
  218. else ifeq ($(HARDWARE_MOTHERBOARD),112)
  219. # Cheaptronic v1.0
  220. else ifeq ($(HARDWARE_MOTHERBOARD),2)
  221. # Cheaptronic v2.0
  222. else ifeq ($(HARDWARE_MOTHERBOARD),21)
  223. # Makerbot Mightyboard Revision E
  224. else ifeq ($(HARDWARE_MOTHERBOARD),200)
  225. # Megatronics
  226. else ifeq ($(HARDWARE_MOTHERBOARD),70)
  227. # Megatronics v2.0
  228. else ifeq ($(HARDWARE_MOTHERBOARD),701)
  229. # Megatronics v3.0
  230. else ifeq ($(HARDWARE_MOTHERBOARD),703)
  231. # Megatronics v3.1
  232. else ifeq ($(HARDWARE_MOTHERBOARD),704)
  233. # Rambo
  234. else ifeq ($(HARDWARE_MOTHERBOARD),301)
  235. # Mini-Rambo
  236. else ifeq ($(HARDWARE_MOTHERBOARD),302)
  237. # Mini-Rambo 1.0a
  238. else ifeq ($(HARDWARE_MOTHERBOARD),303)
  239. # Einsy Rambo
  240. else ifeq ($(HARDWARE_MOTHERBOARD),304)
  241. # Einsy Retro
  242. else ifeq ($(HARDWARE_MOTHERBOARD),305)
  243. # Elefu Ra Board (v3)
  244. else ifeq ($(HARDWARE_MOTHERBOARD),21)
  245. # Leapfrog
  246. else ifeq ($(HARDWARE_MOTHERBOARD),999)
  247. # Mega controller
  248. else ifeq ($(HARDWARE_MOTHERBOARD),310)
  249. # abee Scoovo X9H
  250. else ifeq ($(HARDWARE_MOTHERBOARD),321)
  251. # Geeetech GT2560 Rev. A
  252. else ifeq ($(HARDWARE_MOTHERBOARD),74)
  253. # Geeetech GT2560 Rev. A+ (with auto level probe)
  254. else ifeq ($(HARDWARE_MOTHERBOARD),75)
  255. #
  256. # ATmega1281, ATmega2561
  257. #
  258. else ifeq ($(HARDWARE_MOTHERBOARD),702)
  259. MCU ?= atmega1281
  260. else ifeq ($(HARDWARE_MOTHERBOARD),25)
  261. MCU ?= atmega1281
  262. #
  263. # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
  264. #
  265. # Sanguinololu < 1.2
  266. else ifeq ($(HARDWARE_MOTHERBOARD),6)
  267. HARDWARE_VARIANT ?= Sanguino
  268. MCU ?= atmega644p
  269. # Sanguinololu 1.2 and above
  270. else ifeq ($(HARDWARE_MOTHERBOARD),62)
  271. HARDWARE_VARIANT ?= Sanguino
  272. MCU ?= atmega644p
  273. # Melzi
  274. else ifeq ($(HARDWARE_MOTHERBOARD),63)
  275. HARDWARE_VARIANT ?= Sanguino
  276. MCU ?= atmega644p
  277. # Melzi with ATmega1284 (MaKr3d version)
  278. else ifeq ($(HARDWARE_MOTHERBOARD),66)
  279. HARDWARE_VARIANT ?= Sanguino
  280. MCU ?= atmega1284p
  281. # Melzi Creality3D board (for CR-10 etc)
  282. else ifeq ($(HARDWARE_MOTHERBOARD),89)
  283. HARDWARE_VARIANT ?= Sanguino
  284. MCU ?= atmega1284p
  285. # Melzi Malyan M150 board
  286. else ifeq ($(HARDWARE_MOTHERBOARD),92)
  287. HARDWARE_VARIANT ?= Sanguino
  288. MCU ?= atmega1284p
  289. # Tronxy X5S
  290. else ifeq ($(HARDWARE_MOTHERBOARD),505)
  291. HARDWARE_VARIANT ?= Sanguino
  292. MCU ?= atmega1284p
  293. # STB V1.1
  294. else ifeq ($(HARDWARE_MOTHERBOARD),64)
  295. HARDWARE_VARIANT ?= Sanguino
  296. MCU ?= atmega1284p
  297. # Azteeg X1
  298. else ifeq ($(HARDWARE_MOTHERBOARD),65)
  299. HARDWARE_VARIANT ?= Sanguino
  300. MCU ?= atmega1284p
  301. # Anet 1.0 (Melzi clone)
  302. else ifeq ($(HARDWARE_MOTHERBOARD),69)
  303. HARDWARE_VARIANT ?= Sanguino
  304. MCU ?= atmega1284p
  305. #
  306. # Other ATmega644P, ATmega644, ATmega1284P
  307. #
  308. # Gen3 Monolithic Electronics
  309. else ifeq ($(HARDWARE_MOTHERBOARD),22)
  310. HARDWARE_VARIANT ?= Sanguino
  311. MCU ?= atmega644p
  312. # Gen3+
  313. else ifeq ($(HARDWARE_MOTHERBOARD),9)
  314. HARDWARE_VARIANT ?= Sanguino
  315. MCU ?= atmega644p
  316. # Gen6
  317. else ifeq ($(HARDWARE_MOTHERBOARD),5)
  318. HARDWARE_VARIANT ?= Gen6
  319. MCU ?= atmega644p
  320. # Gen6 deluxe
  321. else ifeq ($(HARDWARE_MOTHERBOARD),51)
  322. HARDWARE_VARIANT ?= Gen6
  323. MCU ?= atmega644p
  324. # Gen7 custom (Alfons3 Version)
  325. else ifeq ($(HARDWARE_MOTHERBOARD),10)
  326. HARDWARE_VARIANT ?= Gen7
  327. MCU ?= atmega644
  328. F_CPU ?= 20000000
  329. # Gen7 v1.1, v1.2
  330. else ifeq ($(HARDWARE_MOTHERBOARD),11)
  331. HARDWARE_VARIANT ?= Gen7
  332. MCU ?= atmega644p
  333. F_CPU ?= 20000000
  334. # Gen7 v1.3
  335. else ifeq ($(HARDWARE_MOTHERBOARD),12)
  336. HARDWARE_VARIANT ?= Gen7
  337. MCU ?= atmega644p
  338. F_CPU ?= 20000000
  339. # Gen7 v1.4
  340. else ifeq ($(HARDWARE_MOTHERBOARD),13)
  341. HARDWARE_VARIANT ?= Gen7
  342. MCU ?= atmega1284p
  343. F_CPU ?= 20000000
  344. # Alpha OMCA board
  345. else ifeq ($(HARDWARE_MOTHERBOARD),90)
  346. HARDWARE_VARIANT ?= SanguinoA
  347. MCU ?= atmega644
  348. # Final OMCA board
  349. else ifeq ($(HARDWARE_MOTHERBOARD),91)
  350. HARDWARE_VARIANT ?= Sanguino
  351. MCU ?= atmega644p
  352. # Sethi 3D_1
  353. else ifeq ($(HARDWARE_MOTHERBOARD),20)
  354. HARDWARE_VARIANT ?= Sanguino
  355. MCU ?= atmega644p
  356. #
  357. # Teensyduino - AT90USB1286, AT90USB1286P
  358. #
  359. # Teensylu
  360. else ifeq ($(HARDWARE_MOTHERBOARD),8)
  361. HARDWARE_VARIANT ?= Teensy
  362. MCU ?= at90usb1286
  363. # Printrboard (AT90USB1286)
  364. else ifeq ($(HARDWARE_MOTHERBOARD),81)
  365. HARDWARE_VARIANT ?= Teensy
  366. MCU ?= at90usb1286
  367. # Printrboard Revision F (AT90USB1286)
  368. else ifeq ($(HARDWARE_MOTHERBOARD),811)
  369. HARDWARE_VARIANT ?= Teensy
  370. MCU ?= at90usb1286
  371. # Brainwave (AT90USB646)
  372. else ifeq ($(HARDWARE_MOTHERBOARD),82)
  373. HARDWARE_VARIANT ?= Teensy
  374. MCU ?= at90usb646
  375. # Brainwave Pro (AT90USB1286)
  376. else ifeq ($(HARDWARE_MOTHERBOARD),83)
  377. HARDWARE_VARIANT ?= Teensy
  378. MCU ?= at90usb1286
  379. # SAV Mk-I (AT90USB1286)
  380. else ifeq ($(HARDWARE_MOTHERBOARD),84)
  381. HARDWARE_VARIANT ?= Teensy
  382. MCU ?= at90usb1286
  383. # Teensy++2.0 (AT90USB1286)
  384. else ifeq ($(HARDWARE_MOTHERBOARD),85)
  385. HARDWARE_VARIANT ?= Teensy
  386. MCU ?= at90usb1286
  387. # 5DPrint D8 Driver Board
  388. else ifeq ($(HARDWARE_MOTHERBOARD),88)
  389. HARDWARE_VARIANT ?= Teensy
  390. MCU ?= at90usb1286
  391. # UltiMachine Archim1 (with DRV8825 drivers)
  392. else ifeq ($(HARDWARE_MOTHERBOARD),1591)
  393. HARDWARE_VARIANT ?= archim
  394. MCPU = cortex-m3
  395. F_CPU = 84000000L
  396. IS_MCU = 0
  397. # UltiMachine Archim2 (with TMC2130 drivers)
  398. else ifeq ($(HARDWARE_MOTHERBOARD),1592)
  399. HARDWARE_VARIANT ?= archim
  400. MCPU = cortex-m3
  401. F_CPU = 84000000L
  402. IS_MCU = 0
  403. endif
  404. # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
  405. # if you are setting this to something other than 16MHz
  406. # Set to 16Mhz if not yet set.
  407. F_CPU ?= 16000000
  408. # Set to microcontroller if IS_MCU not yet set
  409. IS_MCU ?= 1
  410. ifeq ($(IS_MCU),1)
  411. # Set to arduino, ATmega2560 if not yet set.
  412. HARDWARE_VARIANT ?= arduino
  413. MCU ?= atmega2560
  414. TOOL_PREFIX = avr
  415. MCU_FLAGS = -mmcu=$(MCU)
  416. SIZE_FLAGS = --mcu=$(MCU) -C
  417. else
  418. TOOL_PREFIX = arm-none-eabi
  419. CPU_FLAGS = -mthumb -mcpu=$(MCPU)
  420. SIZE_FLAGS = -A
  421. endif
  422. # Arduino contained the main source code for the Arduino
  423. # Libraries, the "hardware variant" are for boards
  424. # that derives from that, and their source are present in
  425. # the main Marlin source directory
  426. TARGET = $(notdir $(CURDIR))
  427. # VPATH tells make to look into these directory for source files,
  428. # there is no need to specify explicit pathnames as long as the
  429. # directory is added here
  430. # The Makefile for previous versions of Marlin used VPATH for all
  431. # source files, but for Marlin 2.0, we use VPATH only for arduino
  432. # library files.
  433. VPATH = .
  434. VPATH += $(BUILD_DIR)
  435. VPATH += $(HARDWARE_SRC)
  436. ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
  437. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
  438. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
  439. endif
  440. ifeq ($(IS_MCU),1)
  441. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
  442. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
  443. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
  444. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
  445. endif
  446. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
  447. ifeq ($(LIQUID_TWI2), 1)
  448. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  449. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  450. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
  451. endif
  452. ifeq ($(WIRE), 1)
  453. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
  454. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
  455. endif
  456. ifeq ($(NEOPIXEL), 1)
  457. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
  458. endif
  459. ifeq ($(U8GLIB), 1)
  460. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib
  461. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/csrc
  462. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/cppsrc
  463. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/fntsrc
  464. endif
  465. ifeq ($(TMC), 1)
  466. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src
  467. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src/source
  468. endif
  469. ifeq ($(HARDWARE_VARIANT), arduino)
  470. HARDWARE_SUB_VARIANT ?= mega
  471. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
  472. else ifeq ($(HARDWARE_VARIANT), Sanguino)
  473. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino
  474. else ifeq ($(HARDWARE_VARIANT), archim)
  475. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/libsam
  476. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/CMSIS/Include/
  477. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/Device/ATMEL/
  478. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino
  479. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/avr
  480. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB
  481. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src
  482. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src
  483. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/U8glib/src/clib
  484. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim
  485. LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld
  486. LDLIBS = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a
  487. else
  488. HARDWARE_SUB_VARIANT ?= standard
  489. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
  490. endif
  491. LIB_SRC = wiring.c \
  492. wiring_analog.c wiring_digital.c \
  493. wiring_shift.c WInterrupts.c hooks.c
  494. ifeq ($(HARDWARE_VARIANT), archim)
  495. LIB_ASRC += wiring_pulse_asm.S
  496. else
  497. LIB_SRC += wiring_pulse.c
  498. endif
  499. ifeq ($(HARDWARE_VARIANT), Teensy)
  500. LIB_SRC = wiring.c
  501. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
  502. endif
  503. LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp
  504. ifeq ($(NEOPIXEL), 1)
  505. LIB_CXXSRC += Adafruit_NeoPixel.cpp
  506. endif
  507. ifeq ($(LIQUID_TWI2), 0)
  508. LIB_CXXSRC += LiquidCrystal.cpp
  509. else
  510. LIB_SRC += twi.c
  511. LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp
  512. endif
  513. ifeq ($(WIRE), 1)
  514. LIB_SRC += twi.c
  515. LIB_CXXSRC += Wire.cpp
  516. endif
  517. ifeq ($(U8GLIB), 1)
  518. LIB_CXXSRC += U8glib.cpp
  519. 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
  520. endif
  521. ifeq ($(TMC), 1)
  522. 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
  523. endif
  524. ifeq ($(RELOC_WORKAROUND), 1)
  525. LD_PREFIX=-nodefaultlibs
  526. LD_SUFFIX=-lm -lgcc -lc -lgcc
  527. endif
  528. #Check for Arduino 1.0.0 or higher and use the correct source files for that version
  529. ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
  530. LIB_CXXSRC += main.cpp
  531. else
  532. LIB_SRC += pins_arduino.c main.c
  533. endif
  534. FORMAT = ihex
  535. # Name of this Makefile (used for "make depend").
  536. MAKEFILE = Makefile
  537. # Debugging format.
  538. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
  539. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
  540. DEBUG = stabs
  541. OPT = s
  542. DEFINES ?=
  543. # Program settings
  544. CC = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-gcc
  545. CXX = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-g++
  546. OBJCOPY = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objcopy
  547. OBJDUMP = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objdump
  548. AR = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-ar
  549. SIZE = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-size
  550. NM = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-nm
  551. AVRDUDE = avrdude
  552. REMOVE = rm -f
  553. MV = mv -f
  554. # Place -D or -U options here
  555. CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
  556. CXXDEFS = $(CDEFS)
  557. ifeq ($(HARDWARE_VARIANT), Teensy)
  558. CDEFS += -DUSB_SERIAL
  559. LIB_SRC += usb.c pins_teensy.c
  560. LIB_CXXSRC += usb_api.cpp
  561. else ifeq ($(HARDWARE_VARIANT), archim)
  562. CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"'
  563. 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
  564. LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
  565. ifeq ($(U8GLIB), 1)
  566. LIB_SRC += u8g_com_api.c u8g_pb32h1.c
  567. endif
  568. endif
  569. # Add all the source directories as include directories too
  570. CINCS = ${addprefix -I ,${VPATH}}
  571. CXXINCS = ${addprefix -I ,${VPATH}}
  572. # Silence warnings for library code (won't work for .h files, unfortunately)
  573. LIBWARN = -w -Wno-packed-bitfield-compat
  574. # Compiler flag to set the C/CPP Standard level.
  575. CSTANDARD = -std=gnu99
  576. CXXSTANDARD = -std=gnu++11
  577. CDEBUG = -g$(DEBUG)
  578. CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas
  579. CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas
  580. CTUNING = -fsigned-char -funsigned-bitfields -fpack-struct -fno-exceptions \
  581. -fshort-enums -ffunction-sections -fdata-sections
  582. ifneq ($(HARDWARE_MOTHERBOARD),)
  583. CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
  584. endif
  585. #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
  586. CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
  587. CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
  588. CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
  589. ASFLAGS := $(CDEFS)
  590. #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
  591. ifeq ($(HARDWARE_VARIANT), archim)
  592. LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
  593. LD_SUFFIX = $(LDLIBS)
  594. LDFLAGS = -lm -gcc -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
  595. else
  596. LD_PREFIX = -Wl,--gc-sections,--relax
  597. LDFLAGS = -lm
  598. CTUNING += -flto
  599. endif
  600. # Programming support using avrdude. Settings and variables.
  601. AVRDUDE_PORT = $(UPLOAD_PORT)
  602. AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
  603. ifeq ($(shell uname -s), Linux)
  604. AVRDUDE_CONF = /etc/avrdude/avrdude.conf
  605. else
  606. AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
  607. endif
  608. AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
  609. -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
  610. -b$(UPLOAD_RATE)
  611. # Since Marlin 2.0, the source files may be distributed into several
  612. # different directories, so it is necessary to find them recursively
  613. SRC = $(shell find src -name '*.c' -type f)
  614. CXXSRC = $(shell find src -name '*.cpp' -type f)
  615. # Define all object files.
  616. OBJ = ${patsubst %.c, $(BUILD_DIR)/arduino/%.o, ${LIB_SRC}}
  617. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/arduino/%.o, ${LIB_CXXSRC}}
  618. OBJ += ${patsubst %.S, $(BUILD_DIR)/arduino/%.o, ${LIB_ASRC}}
  619. OBJ += ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
  620. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
  621. # Define all listing files.
  622. LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst)
  623. # Combine all necessary flags and optional flags.
  624. # Add target processor to flags.
  625. ALL_CFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CFLAGS) -I.
  626. ALL_CXXFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CXXFLAGS)
  627. ALL_ASFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(ASFLAGS) -x assembler-with-cpp
  628. # set V=1 (eg, "make V=1") to print the full commands etc.
  629. ifneq ($V,1)
  630. Pecho=@echo
  631. P=@
  632. else
  633. Pecho=@:
  634. P=
  635. endif
  636. # Create required build hierarchy if it does not exist
  637. $(shell mkdir -p $(dir $(OBJ)))
  638. # Default target.
  639. all: sizeafter
  640. build: elf hex bin
  641. elf: $(BUILD_DIR)/$(TARGET).elf
  642. bin: $(BUILD_DIR)/$(TARGET).bin
  643. hex: $(BUILD_DIR)/$(TARGET).hex
  644. eep: $(BUILD_DIR)/$(TARGET).eep
  645. lss: $(BUILD_DIR)/$(TARGET).lss
  646. sym: $(BUILD_DIR)/$(TARGET).sym
  647. # Program the device.
  648. # Do not try to reset an Arduino if it's not one
  649. upload: $(BUILD_DIR)/$(TARGET).hex
  650. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  651. stty hup < $(UPLOAD_PORT); true
  652. endif
  653. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
  654. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  655. stty -hup < $(UPLOAD_PORT); true
  656. endif
  657. # Display size of file.
  658. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
  659. ELFSIZE = $(SIZE) $(SIZE_FLAGS) $(BUILD_DIR)/$(TARGET).elf; \
  660. $(SIZE) $(BUILD_DIR)/$(TARGET).elf
  661. sizebefore:
  662. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
  663. sizeafter: build
  664. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
  665. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  666. COFFCONVERT=$(OBJCOPY) --debugging \
  667. --change-section-address .data-0x800000 \
  668. --change-section-address .bss-0x800000 \
  669. --change-section-address .noinit-0x800000 \
  670. --change-section-address .eeprom-0x810000
  671. coff: $(BUILD_DIR)/$(TARGET).elf
  672. $(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  673. extcoff: $(TARGET).elf
  674. $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  675. .SUFFIXES: .elf .hex .eep .lss .sym .bin
  676. .PRECIOUS: .o
  677. .elf.hex:
  678. $(Pecho) " COPY $@"
  679. $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
  680. .elf.bin:
  681. $(Pecho) " COPY $@"
  682. $P $(OBJCOPY) -O binary -R .eeprom $< $@
  683. .elf.eep:
  684. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  685. --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
  686. # Create extended listing file from ELF output file.
  687. .elf.lss:
  688. $(OBJDUMP) -h -S $< > $@
  689. # Create a symbol table from ELF output file.
  690. .elf.sym:
  691. $(NM) -n $< > $@
  692. # Link: create ELF output file from library.
  693. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
  694. $(Pecho) " CXX $@"
  695. $P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
  696. # Object files that were found in "src" will be stored in $(BUILD_DIR)
  697. # in directories that mirror the structure of "src"
  698. $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  699. $(Pecho) " CC $<"
  700. $P $(CC) -MMD -c $(ALL_CFLAGS) $(CWARN) $< -o $@
  701. $(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  702. $(Pecho) " CXX $<"
  703. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(CXXWARN) $< -o $@
  704. # Object files for Arduino libs will be created in $(BUILD_DIR)/arduino
  705. $(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  706. $(Pecho) " CC $<"
  707. $P $(CC) -MMD -c $(ALL_CFLAGS) $(LIBWARN) $< -o $@
  708. $(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  709. $(Pecho) " CXX $<"
  710. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(LIBWARN) $< -o $@
  711. $(BUILD_DIR)/arduino/%.o: %.S $(MAKEFILE)
  712. $(Pecho) " CXX $<"
  713. $P $(CXX) -MMD -c $(ALL_ASFLAGS) $< -o $@
  714. # Target: clean project.
  715. clean:
  716. $(Pecho) " RMDIR $(BUILD_DIR)/"
  717. $P rm -rf $(BUILD_DIR)
  718. .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
  719. # Automaticaly include the dependency files created by gcc
  720. -include ${patsubst %.o, %.d, ${OBJ}}