My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037
  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 macOS, 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. Set
  26. # "PROG_MCU" as the AVR part name corresponding to "MCU". You can use the
  27. # following command to get a list of correspondences: `avrdude -c alf -p x`
  28. # Older boards are atmega8 based, newer ones like Arduino Mini, Bluetooth
  29. # or Diecimila have the atmega168. If you're using a LilyPad Arduino,
  30. # change F_CPU to 8000000. If you are using Gen7 electronics, you
  31. # probably need to use 20000000. Either way, you must regenerate
  32. # the speed lookup table with create_speed_lookuptable.py.
  33. #
  34. # 4. Type "make" and press enter to compile/verify your program.
  35. #
  36. # 5. Type "make upload", reset your Arduino board, and press enter to
  37. # upload your program to the Arduino board.
  38. #
  39. # Note that all settings at the top of this file can be overridden from
  40. # the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
  41. #
  42. # To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
  43. #
  44. # make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
  45. # HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino
  46. #
  47. # To compile and upload simply add "upload" to the end of the line...
  48. #
  49. # make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
  50. # HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino upload
  51. #
  52. # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
  53. # start upload manually (using stk500) like so:
  54. #
  55. # avrdude -C /root/arduino/hardware/tools/avr/etc/avrdude.conf -v -p m2560 -c stk500 \
  56. # -U flash:w:applet/Marlin.hex:i -P /dev/ttyUSB0
  57. #
  58. # Or, try disconnecting USB to power down and then reconnecting before running avrdude.
  59. #
  60. # This defines the board to compile for (see boards.h for your board's ID)
  61. HARDWARE_MOTHERBOARD ?= 1020
  62. ifeq ($(OS),Windows_NT)
  63. # Windows
  64. ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
  65. ARDUINO_USER_DIR ?= ${HOME}/Arduino
  66. else
  67. UNAME_S := $(shell uname -s)
  68. ifeq ($(UNAME_S),Linux)
  69. # Linux
  70. ARDUINO_INSTALL_DIR ?= /usr/share/arduino
  71. ARDUINO_USER_DIR ?= ${HOME}/Arduino
  72. endif
  73. ifeq ($(UNAME_S),Darwin)
  74. # Darwin (macOS)
  75. ARDUINO_INSTALL_DIR ?= /Applications/Arduino.app/Contents/Java
  76. ARDUINO_USER_DIR ?= ${HOME}/Documents/Arduino
  77. AVR_TOOLS_PATH ?= /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/
  78. endif
  79. endif
  80. # Arduino source install directory, and version number
  81. # On most linuxes this will be /usr/share/arduino
  82. ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
  83. ARDUINO_VERSION ?= 106
  84. # The installed Libraries are in the User folder
  85. ARDUINO_USER_DIR ?= ${HOME}/Arduino
  86. # You can optionally set a path to the avr-gcc tools.
  87. # Requires a trailing slash. For example, /usr/local/avr-gcc/bin/
  88. AVR_TOOLS_PATH ?=
  89. # Programmer configuration
  90. UPLOAD_RATE ?= 57600
  91. AVRDUDE_PROGRAMMER ?= arduino
  92. # On most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
  93. UPLOAD_PORT ?= /dev/ttyUSB0
  94. # Directory used to build files in, contains all the build files, from object
  95. # files to the final hex file on linux it is best to put an absolute path
  96. # like /home/username/tmp .
  97. BUILD_DIR ?= applet
  98. # This defines whether Liquid_TWI2 support will be built
  99. LIQUID_TWI2 ?= 0
  100. # This defines if Wire is needed
  101. WIRE ?= 0
  102. # This defines if Tone is needed (i.e., SPEAKER is defined in Configuration.h)
  103. # Disabling this (and SPEAKER) saves approximately 350 bytes of memory.
  104. TONE ?= 1
  105. # This defines if U8GLIB is needed (may require RELOC_WORKAROUND)
  106. U8GLIB ?= 0
  107. # This defines whether to include the Trinamic TMCStepper library
  108. TMC ?= 0
  109. # This defines whether to include the AdaFruit NeoPixel library
  110. NEOPIXEL ?= 0
  111. ############
  112. # Try to automatically determine whether RELOC_WORKAROUND is needed based
  113. # on GCC versions:
  114. # https://www.avrfreaks.net/comment/1789106#comment-1789106
  115. CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ )
  116. CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ )
  117. CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d\ )
  118. CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) )))
  119. ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1)
  120. $(warning This GCC version $(CC_VER) is likely broken. Enabling relocation workaround.)
  121. RELOC_WORKAROUND = 1
  122. endif
  123. ############################################################################
  124. # Below here nothing should be changed...
  125. # Here the Arduino variant is selected by the board type
  126. # HARDWARE_VARIANT = "arduino", "Sanguino", "Gen7", ...
  127. # MCU = "atmega1280", "Mega2560", "atmega2560", "atmega644p", ...
  128. ifeq ($(HARDWARE_MOTHERBOARD),0)
  129. # No motherboard selected
  130. #
  131. # RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560
  132. #
  133. # MEGA/RAMPS up to 1.2
  134. else ifeq ($(HARDWARE_MOTHERBOARD),1000)
  135. # RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
  136. else ifeq ($(HARDWARE_MOTHERBOARD),1010)
  137. # RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
  138. else ifeq ($(HARDWARE_MOTHERBOARD),1011)
  139. # RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1)
  140. else ifeq ($(HARDWARE_MOTHERBOARD),1012)
  141. # RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan)
  142. else ifeq ($(HARDWARE_MOTHERBOARD),1013)
  143. # RAMPS 1.3 (Power outputs: Spindle, Controller Fan)
  144. else ifeq ($(HARDWARE_MOTHERBOARD),1014)
  145. # RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
  146. else ifeq ($(HARDWARE_MOTHERBOARD),1020)
  147. # RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
  148. else ifeq ($(HARDWARE_MOTHERBOARD),1021)
  149. # RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
  150. else ifeq ($(HARDWARE_MOTHERBOARD),1022)
  151. # RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
  152. else ifeq ($(HARDWARE_MOTHERBOARD),1023)
  153. # RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
  154. else ifeq ($(HARDWARE_MOTHERBOARD),1024)
  155. # RAMPS Plus 3DYMY (Power outputs: Hotend, Fan, Bed)
  156. else ifeq ($(HARDWARE_MOTHERBOARD),1030)
  157. # RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Bed)
  158. else ifeq ($(HARDWARE_MOTHERBOARD),1031)
  159. # RAMPS Plus 3DYMY (Power outputs: Hotend, Fan0, Fan1)
  160. else ifeq ($(HARDWARE_MOTHERBOARD),1032)
  161. # RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan)
  162. else ifeq ($(HARDWARE_MOTHERBOARD),1033)
  163. # RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan)
  164. else ifeq ($(HARDWARE_MOTHERBOARD),1034)
  165. #
  166. # RAMPS Derivatives - ATmega1280, ATmega2560
  167. #
  168. # 3Drag Controller
  169. else ifeq ($(HARDWARE_MOTHERBOARD),1100)
  170. # Velleman K8200 Controller (derived from 3Drag Controller)
  171. else ifeq ($(HARDWARE_MOTHERBOARD),1101)
  172. # Velleman K8400 Controller (derived from 3Drag Controller)
  173. else ifeq ($(HARDWARE_MOTHERBOARD),1102)
  174. # Velleman K8600 Controller (Vertex Nano)
  175. else ifeq ($(HARDWARE_MOTHERBOARD),1103)
  176. # Velleman K8800 Controller (Vertex Delta)
  177. else ifeq ($(HARDWARE_MOTHERBOARD),1104)
  178. # 2PrintBeta BAM&DICE with STK drivers
  179. else ifeq ($(HARDWARE_MOTHERBOARD),1105)
  180. # 2PrintBeta BAM&DICE Due with STK drivers
  181. else ifeq ($(HARDWARE_MOTHERBOARD),1106)
  182. # MKS BASE v1.0
  183. else ifeq ($(HARDWARE_MOTHERBOARD),1107)
  184. # MKS BASE v1.4 with Allegro A4982 stepper drivers
  185. else ifeq ($(HARDWARE_MOTHERBOARD),1108)
  186. # MKS BASE v1.5 with Allegro A4982 stepper drivers
  187. else ifeq ($(HARDWARE_MOTHERBOARD),1109)
  188. # MKS BASE v1.6 with Allegro A4982 stepper drivers
  189. else ifeq ($(HARDWARE_MOTHERBOARD),1110)
  190. # MKS BASE 1.0 with Heroic HR4982 stepper drivers
  191. else ifeq ($(HARDWARE_MOTHERBOARD),1111)
  192. # MKS GEN v1.3 or 1.4
  193. else ifeq ($(HARDWARE_MOTHERBOARD),1112)
  194. # MKS GEN L
  195. else ifeq ($(HARDWARE_MOTHERBOARD),1113)
  196. # BigTreeTech or BIQU KFB2.0
  197. else ifeq ($(HARDWARE_MOTHERBOARD),1114)
  198. # zrib V2.0 (Chinese RAMPS replica)
  199. else ifeq ($(HARDWARE_MOTHERBOARD),1115)
  200. # zrib V5.2 (Chinese RAMPS replica)
  201. else ifeq ($(HARDWARE_MOTHERBOARD),1116)
  202. # Felix 2.0+ Electronics Board (RAMPS like)
  203. else ifeq ($(HARDWARE_MOTHERBOARD),1117)
  204. # Invent-A-Part RigidBoard
  205. else ifeq ($(HARDWARE_MOTHERBOARD),1118)
  206. # Invent-A-Part RigidBoard V2
  207. else ifeq ($(HARDWARE_MOTHERBOARD),1119)
  208. # Sainsmart 2-in-1 board
  209. else ifeq ($(HARDWARE_MOTHERBOARD),1120)
  210. # Ultimaker
  211. else ifeq ($(HARDWARE_MOTHERBOARD),1121)
  212. # Ultimaker (Older electronics. Pre 1.5.4. This is rare)
  213. else ifeq ($(HARDWARE_MOTHERBOARD),1122)
  214. MCU ?= atmega1280
  215. PROG_MCU ?= m1280
  216. # Azteeg X3
  217. else ifeq ($(HARDWARE_MOTHERBOARD),1123)
  218. # Azteeg X3 Pro
  219. else ifeq ($(HARDWARE_MOTHERBOARD),1124)
  220. # Ultimainboard 2.x (Uses TEMP_SENSOR 20)
  221. else ifeq ($(HARDWARE_MOTHERBOARD),1125)
  222. # Rumba
  223. else ifeq ($(HARDWARE_MOTHERBOARD),1126)
  224. # Raise3D N series Rumba derivative
  225. else ifeq ($(HARDWARE_MOTHERBOARD),1127)
  226. # Rapide Lite 200 (v1, low-cost RUMBA clone with drv)
  227. else ifeq ($(HARDWARE_MOTHERBOARD),1128)
  228. # Formbot T-Rex 2 Plus
  229. else ifeq ($(HARDWARE_MOTHERBOARD),1129)
  230. # Formbot T-Rex 3
  231. else ifeq ($(HARDWARE_MOTHERBOARD),1130)
  232. # Formbot Raptor
  233. else ifeq ($(HARDWARE_MOTHERBOARD),1131)
  234. # Formbot Raptor 2
  235. else ifeq ($(HARDWARE_MOTHERBOARD),1132)
  236. # bq ZUM Mega 3D
  237. else ifeq ($(HARDWARE_MOTHERBOARD),1133)
  238. # MakeBoard Mini v2.1.2 by MicroMake
  239. else ifeq ($(HARDWARE_MOTHERBOARD),1134)
  240. # TriGorilla Anycubic version 1.3-based on RAMPS EFB
  241. else ifeq ($(HARDWARE_MOTHERBOARD),1135)
  242. # ... Ver 1.4
  243. else ifeq ($(HARDWARE_MOTHERBOARD),1136)
  244. # ... Rev 1.1 (new servo pin order)
  245. else ifeq ($(HARDWARE_MOTHERBOARD),1137)
  246. # Creality: Ender-4, CR-8
  247. else ifeq ($(HARDWARE_MOTHERBOARD),1138)
  248. # Creality: CR10S, CR20, CR-X
  249. else ifeq ($(HARDWARE_MOTHERBOARD),1139)
  250. # Dagoma F5
  251. else ifeq ($(HARDWARE_MOTHERBOARD),1140)
  252. # FYSETC F6 1.3
  253. else ifeq ($(HARDWARE_MOTHERBOARD),1141)
  254. # FYSETC F6 1.4
  255. else ifeq ($(HARDWARE_MOTHERBOARD),1142)
  256. # Wanhao Duplicator i3 Plus
  257. else ifeq ($(HARDWARE_MOTHERBOARD),1143)
  258. # VORON Design
  259. else ifeq ($(HARDWARE_MOTHERBOARD),1144)
  260. # Tronxy TRONXY-V3-1.0
  261. else ifeq ($(HARDWARE_MOTHERBOARD),1145)
  262. # Z-Bolt X Series
  263. else ifeq ($(HARDWARE_MOTHERBOARD),1146)
  264. # TT OSCAR
  265. else ifeq ($(HARDWARE_MOTHERBOARD),1147)
  266. # Overlord/Overlord Pro
  267. else ifeq ($(HARDWARE_MOTHERBOARD),1148)
  268. # ADIMLab Gantry v1
  269. else ifeq ($(HARDWARE_MOTHERBOARD),1149)
  270. # ADIMLab Gantry v2
  271. else ifeq ($(HARDWARE_MOTHERBOARD),1150)
  272. # BIQU Tango V1
  273. else ifeq ($(HARDWARE_MOTHERBOARD),1151)
  274. # MKS GEN L V2
  275. else ifeq ($(HARDWARE_MOTHERBOARD),1152)
  276. # MKS GEN L V2.1
  277. else ifeq ($(HARDWARE_MOTHERBOARD),1153)
  278. # Copymaster 3D
  279. else ifeq ($(HARDWARE_MOTHERBOARD),1154)
  280. # Ortur 4
  281. else ifeq ($(HARDWARE_MOTHERBOARD),1155)
  282. # Tenlog D3 Hero IDEX printer
  283. else ifeq ($(HARDWARE_MOTHERBOARD),1156)
  284. # Tenlog D3,5,6 Pro IDEX printers
  285. else ifeq ($(HARDWARE_MOTHERBOARD),1157)
  286. # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed)
  287. else ifeq ($(HARDWARE_MOTHERBOARD),1158)
  288. # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed)
  289. else ifeq ($(HARDWARE_MOTHERBOARD),1159)
  290. # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed)
  291. else ifeq ($(HARDWARE_MOTHERBOARD),1160)
  292. # Longer LK1 PRO / Alfawise U20 Pro (PRO version)
  293. else ifeq ($(HARDWARE_MOTHERBOARD),1161)
  294. # Longer LKx PRO / Alfawise Uxx Pro (PRO version)
  295. else ifeq ($(HARDWARE_MOTHERBOARD),1162)
  296. # Zonestar zrib V5.3 (Chinese RAMPS replica)
  297. else ifeq ($(HARDWARE_MOTHERBOARD),1163)
  298. # Pxmalion Core I3
  299. else ifeq ($(HARDWARE_MOTHERBOARD),1164)
  300. #
  301. # RAMBo and derivatives
  302. #
  303. # Rambo
  304. else ifeq ($(HARDWARE_MOTHERBOARD),1200)
  305. # Mini-Rambo
  306. else ifeq ($(HARDWARE_MOTHERBOARD),1201)
  307. # Mini-Rambo 1.0a
  308. else ifeq ($(HARDWARE_MOTHERBOARD),1202)
  309. # Einsy Rambo
  310. else ifeq ($(HARDWARE_MOTHERBOARD),1203)
  311. # Einsy Retro
  312. else ifeq ($(HARDWARE_MOTHERBOARD),1204)
  313. # abee Scoovo X9H
  314. else ifeq ($(HARDWARE_MOTHERBOARD),1205)
  315. # Rambo ThinkerV2
  316. else ifeq ($(HARDWARE_MOTHERBOARD),1206)
  317. #
  318. # Other ATmega1280, ATmega2560
  319. #
  320. # Cartesio CN Controls V11
  321. else ifeq ($(HARDWARE_MOTHERBOARD),1300)
  322. # Cartesio CN Controls V12
  323. else ifeq ($(HARDWARE_MOTHERBOARD),1301)
  324. # Cartesio CN Controls V15
  325. else ifeq ($(HARDWARE_MOTHERBOARD),1302)
  326. # Cheaptronic v1.0
  327. else ifeq ($(HARDWARE_MOTHERBOARD),1303)
  328. # Cheaptronic v2.0
  329. else ifeq ($(HARDWARE_MOTHERBOARD),1304)
  330. # Makerbot Mightyboard Revision E
  331. else ifeq ($(HARDWARE_MOTHERBOARD),1305)
  332. # Megatronics
  333. else ifeq ($(HARDWARE_MOTHERBOARD),1306)
  334. # Megatronics v2.0
  335. else ifeq ($(HARDWARE_MOTHERBOARD),1307)
  336. # Megatronics v3.0
  337. else ifeq ($(HARDWARE_MOTHERBOARD),1308)
  338. # Megatronics v3.1
  339. else ifeq ($(HARDWARE_MOTHERBOARD),1309)
  340. # Megatronics v3.2
  341. else ifeq ($(HARDWARE_MOTHERBOARD),1310)
  342. # Elefu Ra Board (v3)
  343. else ifeq ($(HARDWARE_MOTHERBOARD),1311)
  344. # Leapfrog
  345. else ifeq ($(HARDWARE_MOTHERBOARD),1312)
  346. # Mega controller
  347. else ifeq ($(HARDWARE_MOTHERBOARD),1313)
  348. # Geeetech GT2560 Rev A
  349. else ifeq ($(HARDWARE_MOTHERBOARD),1314)
  350. # Geeetech GT2560 Rev A+ (with auto level probe)
  351. else ifeq ($(HARDWARE_MOTHERBOARD),1315)
  352. # Geeetech GT2560 Rev B
  353. else ifeq ($(HARDWARE_MOTHERBOARD),1316)
  354. # Geeetech GT2560 Rev B for A10(M/T/D)
  355. else ifeq ($(HARDWARE_MOTHERBOARD),1317)
  356. # Geeetech GT2560 Rev B for A10(M/T/D)
  357. else ifeq ($(HARDWARE_MOTHERBOARD),1318)
  358. # Geeetech GT2560 Rev B for Mecreator2
  359. else ifeq ($(HARDWARE_MOTHERBOARD),1319)
  360. # Geeetech GT2560 Rev B for A20(M/T/D)
  361. else ifeq ($(HARDWARE_MOTHERBOARD),1320)
  362. # Einstart retrofit
  363. else ifeq ($(HARDWARE_MOTHERBOARD),1321)
  364. # Wanhao 0ne+ i3 Mini
  365. else ifeq ($(HARDWARE_MOTHERBOARD),1322)
  366. # Leapfrog Xeed 2015
  367. else ifeq ($(HARDWARE_MOTHERBOARD),1323)
  368. # PICA Shield (original version)
  369. else ifeq ($(HARDWARE_MOTHERBOARD),1324)
  370. # PICA Shield (rev C or later)
  371. else ifeq ($(HARDWARE_MOTHERBOARD),1325)
  372. # Intamsys 4.0 (Funmat HT)
  373. else ifeq ($(HARDWARE_MOTHERBOARD),1326)
  374. # Malyan M180 Mainboard Version 2 (no display function, direct G-code only)
  375. else ifeq ($(HARDWARE_MOTHERBOARD),1327)
  376. # Geeetech GT2560 Rev B for A20(M/T/D)
  377. else ifeq ($(HARDWARE_MOTHERBOARD),1328)
  378. # Mega controller & Protoneer CNC Shield V3.00
  379. else ifeq ($(HARDWARE_MOTHERBOARD),1329)
  380. #
  381. # ATmega1281, ATmega2561
  382. #
  383. # Minitronics v1.0/1.1
  384. else ifeq ($(HARDWARE_MOTHERBOARD),1400)
  385. MCU ?= atmega1281
  386. PROG_MCU ?= m1281
  387. # Silvergate v1.0
  388. else ifeq ($(HARDWARE_MOTHERBOARD),1401)
  389. MCU ?= atmega1281
  390. PROG_MCU ?= m1281
  391. #
  392. # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
  393. #
  394. # Sanguinololu < 1.2
  395. else ifeq ($(HARDWARE_MOTHERBOARD),1500)
  396. HARDWARE_VARIANT ?= Sanguino
  397. MCU ?= atmega644p
  398. PROG_MCU ?= m644p
  399. # Sanguinololu 1.2 and above
  400. else ifeq ($(HARDWARE_MOTHERBOARD),1501)
  401. HARDWARE_VARIANT ?= Sanguino
  402. MCU ?= atmega644p
  403. PROG_MCU ?= m644p
  404. # Melzi
  405. else ifeq ($(HARDWARE_MOTHERBOARD),1502)
  406. HARDWARE_VARIANT ?= Sanguino
  407. MCU ?= atmega644p
  408. PROG_MCU ?= m644p
  409. # Melzi V2.0
  410. else ifeq ($(HARDWARE_MOTHERBOARD),1503)
  411. HARDWARE_VARIANT ?= Sanguino
  412. MCU ?= atmega1284p
  413. PROG_MCU ?= m1284p
  414. # Melzi with ATmega1284 (MaKr3d version)
  415. else ifeq ($(HARDWARE_MOTHERBOARD),1504)
  416. HARDWARE_VARIANT ?= Sanguino
  417. MCU ?= atmega1284p
  418. PROG_MCU ?= m1284p
  419. # Melzi Creality3D board (for CR-10 etc)
  420. else ifeq ($(HARDWARE_MOTHERBOARD),1505)
  421. HARDWARE_VARIANT ?= Sanguino
  422. MCU ?= atmega1284p
  423. PROG_MCU ?= m1284p
  424. # Melzi Malyan M150 board
  425. else ifeq ($(HARDWARE_MOTHERBOARD),1506)
  426. HARDWARE_VARIANT ?= Sanguino
  427. MCU ?= atmega1284p
  428. PROG_MCU ?= m1284p
  429. # Tronxy X5S
  430. else ifeq ($(HARDWARE_MOTHERBOARD),1507)
  431. HARDWARE_VARIANT ?= Sanguino
  432. MCU ?= atmega1284p
  433. PROG_MCU ?= m1284p
  434. # STB V1.1
  435. else ifeq ($(HARDWARE_MOTHERBOARD),1508)
  436. HARDWARE_VARIANT ?= Sanguino
  437. MCU ?= atmega1284p
  438. PROG_MCU ?= m1284p
  439. # Azteeg X1
  440. else ifeq ($(HARDWARE_MOTHERBOARD),1509)
  441. HARDWARE_VARIANT ?= Sanguino
  442. MCU ?= atmega1284p
  443. PROG_MCU ?= m1284p
  444. # Anet 1.0 (Melzi clone)
  445. else ifeq ($(HARDWARE_MOTHERBOARD),1510)
  446. HARDWARE_VARIANT ?= Sanguino
  447. MCU ?= atmega1284p
  448. PROG_MCU ?= m1284p
  449. # ZoneStar ZMIB V2
  450. else ifeq ($(HARDWARE_MOTHERBOARD),1511)
  451. HARDWARE_VARIANT ?= Sanguino
  452. MCU ?= atmega1284p
  453. PROG_MCU ?= m1284p
  454. #
  455. # Other ATmega644P, ATmega644, ATmega1284P
  456. #
  457. # Gen3 Monolithic Electronics
  458. else ifeq ($(HARDWARE_MOTHERBOARD),1600)
  459. HARDWARE_VARIANT ?= Sanguino
  460. MCU ?= atmega644p
  461. PROG_MCU ?= m644p
  462. # Gen3+
  463. else ifeq ($(HARDWARE_MOTHERBOARD),1601)
  464. HARDWARE_VARIANT ?= Sanguino
  465. MCU ?= atmega644p
  466. PROG_MCU ?= m644p
  467. # Gen6
  468. else ifeq ($(HARDWARE_MOTHERBOARD),1602)
  469. HARDWARE_VARIANT ?= Gen6
  470. MCU ?= atmega644p
  471. PROG_MCU ?= m644p
  472. # Gen6 deluxe
  473. else ifeq ($(HARDWARE_MOTHERBOARD),1603)
  474. HARDWARE_VARIANT ?= Gen6
  475. MCU ?= atmega644p
  476. PROG_MCU ?= m644p
  477. # Gen7 custom (Alfons3 Version)
  478. else ifeq ($(HARDWARE_MOTHERBOARD),1604)
  479. HARDWARE_VARIANT ?= Gen7
  480. MCU ?= atmega644
  481. PROG_MCU ?= m644
  482. F_CPU ?= 20000000
  483. # Gen7 v1.1, v1.2
  484. else ifeq ($(HARDWARE_MOTHERBOARD),1605)
  485. HARDWARE_VARIANT ?= Gen7
  486. MCU ?= atmega644p
  487. PROG_MCU ?= m644p
  488. F_CPU ?= 20000000
  489. # Gen7 v1.3
  490. else ifeq ($(HARDWARE_MOTHERBOARD),1606)
  491. HARDWARE_VARIANT ?= Gen7
  492. MCU ?= atmega644p
  493. PROG_MCU ?= m644p
  494. F_CPU ?= 20000000
  495. # Gen7 v1.4
  496. else ifeq ($(HARDWARE_MOTHERBOARD),1607)
  497. HARDWARE_VARIANT ?= Gen7
  498. MCU ?= atmega1284p
  499. PROG_MCU ?= m1284p
  500. F_CPU ?= 20000000
  501. # Alpha OMCA board
  502. else ifeq ($(HARDWARE_MOTHERBOARD),1608)
  503. HARDWARE_VARIANT ?= SanguinoA
  504. MCU ?= atmega644
  505. PROG_MCU ?= m644
  506. # Final OMCA board
  507. else ifeq ($(HARDWARE_MOTHERBOARD),1609)
  508. HARDWARE_VARIANT ?= Sanguino
  509. MCU ?= atmega644p
  510. PROG_MCU ?= m644p
  511. # Sethi 3D_1
  512. else ifeq ($(HARDWARE_MOTHERBOARD),1610)
  513. HARDWARE_VARIANT ?= Sanguino
  514. MCU ?= atmega644p
  515. PROG_MCU ?= m644p
  516. #
  517. # Teensyduino - AT90USB1286, AT90USB1286P
  518. #
  519. # Teensylu
  520. else ifeq ($(HARDWARE_MOTHERBOARD),1700)
  521. HARDWARE_VARIANT ?= Teensy
  522. MCU ?= at90usb1286
  523. PROG_MCU ?= usb1286
  524. # Printrboard (AT90USB1286)
  525. else ifeq ($(HARDWARE_MOTHERBOARD),1701)
  526. HARDWARE_VARIANT ?= Teensy
  527. MCU ?= at90usb1286
  528. PROG_MCU ?= usb1286
  529. # Printrboard Revision F (AT90USB1286)
  530. else ifeq ($(HARDWARE_MOTHERBOARD),1702)
  531. HARDWARE_VARIANT ?= Teensy
  532. MCU ?= at90usb1286
  533. PROG_MCU ?= usb1286
  534. # Brainwave (AT90USB646)
  535. else ifeq ($(HARDWARE_MOTHERBOARD),1703)
  536. HARDWARE_VARIANT ?= Teensy
  537. MCU ?= at90usb646
  538. PROG_MCU ?= usb646
  539. # Brainwave Pro (AT90USB1286)
  540. else ifeq ($(HARDWARE_MOTHERBOARD),1704)
  541. HARDWARE_VARIANT ?= Teensy
  542. MCU ?= at90usb1286
  543. PROG_MCU ?= usb1286
  544. # SAV Mk-I (AT90USB1286)
  545. else ifeq ($(HARDWARE_MOTHERBOARD),1705)
  546. HARDWARE_VARIANT ?= Teensy
  547. MCU ?= at90usb1286
  548. PROG_MCU ?= usb1286
  549. # Teensy++2.0 (AT90USB1286)
  550. else ifeq ($(HARDWARE_MOTHERBOARD),1706)
  551. HARDWARE_VARIANT ?= Teensy
  552. MCU ?= at90usb1286
  553. PROG_MCU ?= usb1286
  554. # 5DPrint D8 Driver Board
  555. else ifeq ($(HARDWARE_MOTHERBOARD),1707)
  556. HARDWARE_VARIANT ?= Teensy
  557. MCU ?= at90usb1286
  558. PROG_MCU ?= usb1286
  559. # UltiMachine Archim1 (with DRV8825 drivers)
  560. else ifeq ($(HARDWARE_MOTHERBOARD),3023)
  561. HARDWARE_VARIANT ?= archim
  562. MCPU = cortex-m3
  563. F_CPU = 84000000
  564. IS_MCU = 0
  565. # UltiMachine Archim2 (with TMC2130 drivers)
  566. else ifeq ($(HARDWARE_MOTHERBOARD),3024)
  567. HARDWARE_VARIANT ?= archim
  568. MCPU = cortex-m3
  569. F_CPU = 84000000
  570. IS_MCU = 0
  571. endif
  572. # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
  573. # if you are setting this to something other than 16MHz
  574. # Do not put the UL suffix, it's done later on.
  575. # Set to 16Mhz if not yet set.
  576. F_CPU ?= 16000000
  577. # Set to microcontroller if IS_MCU not yet set
  578. IS_MCU ?= 1
  579. ifeq ($(IS_MCU),1)
  580. # Set to arduino, ATmega2560 if not yet set.
  581. HARDWARE_VARIANT ?= arduino
  582. MCU ?= atmega2560
  583. PROG_MCU ?= m2560
  584. TOOL_PREFIX = avr
  585. MCU_FLAGS = -mmcu=$(MCU)
  586. SIZE_FLAGS = --mcu=$(MCU) -C
  587. else
  588. TOOL_PREFIX = arm-none-eabi
  589. CPU_FLAGS = -mthumb -mcpu=$(MCPU)
  590. SIZE_FLAGS = -A
  591. endif
  592. # Arduino contained the main source code for the Arduino
  593. # Libraries, the "hardware variant" are for boards
  594. # that derives from that, and their source are present in
  595. # the main Marlin source directory
  596. TARGET = $(notdir $(CURDIR))
  597. # VPATH tells make to look into these directory for source files,
  598. # there is no need to specify explicit pathnames as long as the
  599. # directory is added here
  600. # The Makefile for previous versions of Marlin used VPATH for all
  601. # source files, but for Marlin 2.0, we use VPATH only for arduino
  602. # library files.
  603. VPATH = .
  604. VPATH += $(BUILD_DIR)
  605. VPATH += $(HARDWARE_SRC)
  606. ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
  607. # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
  608. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
  609. # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
  610. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
  611. endif
  612. ifeq ($(IS_MCU),1)
  613. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
  614. # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
  615. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
  616. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial
  617. # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
  618. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
  619. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
  620. endif
  621. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
  622. ifeq ($(LIQUID_TWI2), 1)
  623. WIRE = 1
  624. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
  625. endif
  626. ifeq ($(WIRE), 1)
  627. # Old libraries (avr-core 1.6.21 / Arduino < 1.6.8)
  628. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire
  629. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/utility
  630. # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
  631. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src
  632. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src/utility
  633. endif
  634. ifeq ($(NEOPIXEL), 1)
  635. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
  636. endif
  637. ifeq ($(U8GLIB), 1)
  638. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib
  639. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/csrc
  640. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/cppsrc
  641. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/fntsrc
  642. endif
  643. ifeq ($(TMC), 1)
  644. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src
  645. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src/source
  646. endif
  647. ifeq ($(HARDWARE_VARIANT), arduino)
  648. HARDWARE_SUB_VARIANT ?= mega
  649. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
  650. else ifeq ($(HARDWARE_VARIANT), Sanguino)
  651. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino
  652. else ifeq ($(HARDWARE_VARIANT), archim)
  653. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/libsam
  654. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/CMSIS/Include/
  655. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/Device/ATMEL/
  656. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino
  657. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/avr
  658. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB
  659. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src
  660. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src
  661. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/U8glib/src/clib
  662. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim
  663. LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld
  664. LDLIBS = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a
  665. else
  666. HARDWARE_SUB_VARIANT ?= standard
  667. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
  668. endif
  669. LIB_SRC = wiring.c \
  670. wiring_analog.c wiring_digital.c \
  671. wiring_shift.c WInterrupts.c hooks.c
  672. ifeq ($(HARDWARE_VARIANT), archim)
  673. LIB_ASRC += wiring_pulse_asm.S
  674. else
  675. LIB_SRC += wiring_pulse.c
  676. endif
  677. ifeq ($(HARDWARE_VARIANT), Teensy)
  678. LIB_SRC = wiring.c
  679. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
  680. endif
  681. LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp
  682. ifeq ($(NEOPIXEL), 1)
  683. LIB_CXXSRC += Adafruit_NeoPixel.cpp
  684. endif
  685. ifeq ($(LIQUID_TWI2), 0)
  686. LIB_CXXSRC += LiquidCrystal.cpp
  687. else
  688. LIB_SRC += twi.c
  689. LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp
  690. endif
  691. ifeq ($(WIRE), 1)
  692. LIB_SRC += twi.c
  693. LIB_CXXSRC += Wire.cpp
  694. endif
  695. ifeq ($(TONE), 1)
  696. LIB_CXXSRC += Tone.cpp
  697. endif
  698. ifeq ($(U8GLIB), 1)
  699. LIB_CXXSRC += U8glib.cpp
  700. LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c \
  701. u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c \
  702. u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
  703. endif
  704. ifeq ($(TMC), 1)
  705. LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp \
  706. CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp \
  707. DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp \
  708. SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp \
  709. TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
  710. endif
  711. ifeq ($(RELOC_WORKAROUND), 1)
  712. LD_PREFIX=-nodefaultlibs
  713. LD_SUFFIX=-lm -lgcc -lc -lgcc
  714. endif
  715. #Check for Arduino 1.0.0 or higher and use the correct source files for that version
  716. ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
  717. LIB_CXXSRC += main.cpp
  718. else
  719. LIB_SRC += pins_arduino.c main.c
  720. endif
  721. FORMAT = ihex
  722. # Name of this Makefile (used for "make depend").
  723. MAKEFILE = Makefile
  724. # Debugging format.
  725. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
  726. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
  727. DEBUG = stabs
  728. OPT = s
  729. DEFINES ?=
  730. # Program settings
  731. CC = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-gcc
  732. CXX = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-g++
  733. OBJCOPY = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objcopy
  734. OBJDUMP = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objdump
  735. AR = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-ar
  736. SIZE = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-size
  737. NM = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-nm
  738. AVRDUDE = avrdude
  739. REMOVE = rm -f
  740. MV = mv -f
  741. # Place -D or -U options here
  742. CDEFS = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
  743. CXXDEFS = $(CDEFS)
  744. ifeq ($(HARDWARE_VARIANT), Teensy)
  745. CDEFS += -DUSB_SERIAL
  746. LIB_SRC += usb.c pins_teensy.c
  747. LIB_CXXSRC += usb_api.cpp
  748. else ifeq ($(HARDWARE_VARIANT), archim)
  749. CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__
  750. CDEFS += -DUSB_VID=0x27B1 -DUSB_PID=0x0001 -DUSBCON
  751. CDEFS += '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
  752. LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp \
  753. UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp \
  754. PluggableUSB.cpp USBCore.cpp
  755. LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
  756. ifeq ($(U8GLIB), 1)
  757. LIB_SRC += u8g_com_api.c u8g_pb32h1.c
  758. endif
  759. endif
  760. # Add all the source directories as include directories too
  761. CINCS = ${addprefix -I ,${VPATH}}
  762. CXXINCS = ${addprefix -I ,${VPATH}}
  763. # Silence warnings for library code (won't work for .h files, unfortunately)
  764. LIBWARN = -w -Wno-packed-bitfield-compat
  765. # Compiler flag to set the C/CPP Standard level.
  766. CSTANDARD = -std=gnu99
  767. CXXSTANDARD = -std=gnu++11
  768. CDEBUG = -g$(DEBUG)
  769. CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas -Wunused-parameter
  770. CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas -Wunused-parameter
  771. CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
  772. -fshort-enums -ffunction-sections -fdata-sections
  773. ifneq ($(HARDWARE_MOTHERBOARD),)
  774. CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
  775. endif
  776. #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
  777. CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
  778. CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
  779. CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
  780. ASFLAGS := $(CDEFS)
  781. #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
  782. ifeq ($(HARDWARE_VARIANT), archim)
  783. LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
  784. LD_SUFFIX = $(LDLIBS)
  785. LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty
  786. LDFLAGS += -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
  787. else
  788. LD_PREFIX = -Wl,--gc-sections,--relax
  789. LDFLAGS = -lm
  790. CTUNING += -flto
  791. endif
  792. # Programming support using avrdude. Settings and variables.
  793. AVRDUDE_PORT = $(UPLOAD_PORT)
  794. AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
  795. ifeq ($(shell uname -s), Linux)
  796. AVRDUDE_CONF = /etc/avrdude/avrdude.conf
  797. else
  798. AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
  799. endif
  800. AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
  801. -p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
  802. -b$(UPLOAD_RATE)
  803. # Since Marlin 2.0, the source files may be distributed into several
  804. # different directories, so it is necessary to find them recursively
  805. SRC = $(shell find src -name '*.c' -type f)
  806. CXXSRC = $(shell find src -name '*.cpp' -type f)
  807. # Define all object files.
  808. OBJ = ${patsubst %.c, $(BUILD_DIR)/arduino/%.o, ${LIB_SRC}}
  809. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/arduino/%.o, ${LIB_CXXSRC}}
  810. OBJ += ${patsubst %.S, $(BUILD_DIR)/arduino/%.o, ${LIB_ASRC}}
  811. OBJ += ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
  812. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
  813. # Define all listing files.
  814. LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst)
  815. # Combine all necessary flags and optional flags.
  816. # Add target processor to flags.
  817. ALL_CFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CFLAGS) -I.
  818. ALL_CXXFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CXXFLAGS)
  819. ALL_ASFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(ASFLAGS) -x assembler-with-cpp
  820. # set V=1 (eg, "make V=1") to print the full commands etc.
  821. ifneq ($V,1)
  822. Pecho=@echo
  823. P=@
  824. else
  825. Pecho=@:
  826. P=
  827. endif
  828. # Create required build hierarchy if it does not exist
  829. $(shell mkdir -p $(dir $(OBJ)))
  830. # Default target.
  831. all: sizeafter
  832. build: elf hex bin
  833. elf: $(BUILD_DIR)/$(TARGET).elf
  834. bin: $(BUILD_DIR)/$(TARGET).bin
  835. hex: $(BUILD_DIR)/$(TARGET).hex
  836. eep: $(BUILD_DIR)/$(TARGET).eep
  837. lss: $(BUILD_DIR)/$(TARGET).lss
  838. sym: $(BUILD_DIR)/$(TARGET).sym
  839. # Program the device.
  840. # Do not try to reset an Arduino if it's not one
  841. upload: $(BUILD_DIR)/$(TARGET).hex
  842. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  843. stty hup < $(UPLOAD_PORT); true
  844. endif
  845. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
  846. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  847. stty -hup < $(UPLOAD_PORT); true
  848. endif
  849. # Display size of file.
  850. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
  851. ELFSIZE = $(SIZE) $(SIZE_FLAGS) $(BUILD_DIR)/$(TARGET).elf; \
  852. $(SIZE) $(BUILD_DIR)/$(TARGET).elf
  853. sizebefore:
  854. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
  855. sizeafter: build
  856. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
  857. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  858. COFFCONVERT=$(OBJCOPY) --debugging \
  859. --change-section-address .data-0x800000 \
  860. --change-section-address .bss-0x800000 \
  861. --change-section-address .noinit-0x800000 \
  862. --change-section-address .eeprom-0x810000
  863. coff: $(BUILD_DIR)/$(TARGET).elf
  864. $(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  865. extcoff: $(TARGET).elf
  866. $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  867. .SUFFIXES: .elf .hex .eep .lss .sym .bin
  868. .PRECIOUS: .o
  869. .elf.hex:
  870. $(Pecho) " COPY $@"
  871. $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
  872. .elf.bin:
  873. $(Pecho) " COPY $@"
  874. $P $(OBJCOPY) -O binary -R .eeprom $< $@
  875. .elf.eep:
  876. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  877. --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
  878. # Create extended listing file from ELF output file.
  879. .elf.lss:
  880. $(OBJDUMP) -h -S $< > $@
  881. # Create a symbol table from ELF output file.
  882. .elf.sym:
  883. $(NM) -n $< > $@
  884. # Link: create ELF output file from library.
  885. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
  886. $(Pecho) " CXX $@"
  887. $P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
  888. # Object files that were found in "src" will be stored in $(BUILD_DIR)
  889. # in directories that mirror the structure of "src"
  890. $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  891. $(Pecho) " CC $<"
  892. $P $(CC) -MMD -c $(ALL_CFLAGS) $(CWARN) $< -o $@
  893. $(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  894. $(Pecho) " CXX $<"
  895. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(CXXWARN) $< -o $@
  896. # Object files for Arduino libs will be created in $(BUILD_DIR)/arduino
  897. $(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  898. $(Pecho) " CC $<"
  899. $P $(CC) -MMD -c $(ALL_CFLAGS) $(LIBWARN) $< -o $@
  900. $(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  901. $(Pecho) " CXX $<"
  902. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(LIBWARN) $< -o $@
  903. $(BUILD_DIR)/arduino/%.o: %.S $(MAKEFILE)
  904. $(Pecho) " CXX $<"
  905. $P $(CXX) -MMD -c $(ALL_ASFLAGS) $< -o $@
  906. # Target: clean project.
  907. clean:
  908. $(Pecho) " RMDIR $(BUILD_DIR)/"
  909. $P rm -rf $(BUILD_DIR)
  910. .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
  911. # Automatically include the dependency files created by gcc
  912. -include ${patsubst %.o, %.d, ${OBJ}}