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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  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. # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed)
  285. else ifeq ($(HARDWARE_MOTHERBOARD),1157)
  286. # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed)
  287. else ifeq ($(HARDWARE_MOTHERBOARD),1158)
  288. # Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed)
  289. else ifeq ($(HARDWARE_MOTHERBOARD),1159)
  290. # Longer LK1 PRO / Alfawise U20 Pro (PRO version)
  291. else ifeq ($(HARDWARE_MOTHERBOARD),1160)
  292. # Longer LKx PRO / Alfawise Uxx Pro (PRO version)
  293. else ifeq ($(HARDWARE_MOTHERBOARD),1161)
  294. # Zonestar zrib V5.3 (Chinese RAMPS replica)
  295. else ifeq ($(HARDWARE_MOTHERBOARD),1162)
  296. # Pxmalion Core I3
  297. else ifeq ($(HARDWARE_MOTHERBOARD),1163)
  298. #
  299. # RAMBo and derivatives
  300. #
  301. # Rambo
  302. else ifeq ($(HARDWARE_MOTHERBOARD),1200)
  303. # Mini-Rambo
  304. else ifeq ($(HARDWARE_MOTHERBOARD),1201)
  305. # Mini-Rambo 1.0a
  306. else ifeq ($(HARDWARE_MOTHERBOARD),1202)
  307. # Einsy Rambo
  308. else ifeq ($(HARDWARE_MOTHERBOARD),1203)
  309. # Einsy Retro
  310. else ifeq ($(HARDWARE_MOTHERBOARD),1204)
  311. # abee Scoovo X9H
  312. else ifeq ($(HARDWARE_MOTHERBOARD),1205)
  313. # Rambo ThinkerV2
  314. else ifeq ($(HARDWARE_MOTHERBOARD),1206)
  315. #
  316. # Other ATmega1280, ATmega2560
  317. #
  318. # Cartesio CN Controls V11
  319. else ifeq ($(HARDWARE_MOTHERBOARD),1300)
  320. # Cartesio CN Controls V12
  321. else ifeq ($(HARDWARE_MOTHERBOARD),1301)
  322. # Cartesio CN Controls V15
  323. else ifeq ($(HARDWARE_MOTHERBOARD),1302)
  324. # Cheaptronic v1.0
  325. else ifeq ($(HARDWARE_MOTHERBOARD),1303)
  326. # Cheaptronic v2.0
  327. else ifeq ($(HARDWARE_MOTHERBOARD),1304)
  328. # Makerbot Mightyboard Revision E
  329. else ifeq ($(HARDWARE_MOTHERBOARD),1305)
  330. # Megatronics
  331. else ifeq ($(HARDWARE_MOTHERBOARD),1306)
  332. # Megatronics v2.0
  333. else ifeq ($(HARDWARE_MOTHERBOARD),1307)
  334. # Megatronics v3.0
  335. else ifeq ($(HARDWARE_MOTHERBOARD),1308)
  336. # Megatronics v3.1
  337. else ifeq ($(HARDWARE_MOTHERBOARD),1309)
  338. # Megatronics v3.2
  339. else ifeq ($(HARDWARE_MOTHERBOARD),1310)
  340. # Elefu Ra Board (v3)
  341. else ifeq ($(HARDWARE_MOTHERBOARD),1311)
  342. # Leapfrog
  343. else ifeq ($(HARDWARE_MOTHERBOARD),1312)
  344. # Mega controller
  345. else ifeq ($(HARDWARE_MOTHERBOARD),1313)
  346. # Geeetech GT2560 Rev A
  347. else ifeq ($(HARDWARE_MOTHERBOARD),1314)
  348. # Geeetech GT2560 Rev A+ (with auto level probe)
  349. else ifeq ($(HARDWARE_MOTHERBOARD),1315)
  350. # Geeetech GT2560 Rev B
  351. else ifeq ($(HARDWARE_MOTHERBOARD),1316)
  352. # Geeetech GT2560 Rev B for A10(M/T/D)
  353. else ifeq ($(HARDWARE_MOTHERBOARD),1317)
  354. # Geeetech GT2560 Rev B for A10(M/T/D)
  355. else ifeq ($(HARDWARE_MOTHERBOARD),1318)
  356. # Geeetech GT2560 Rev B for Mecreator2
  357. else ifeq ($(HARDWARE_MOTHERBOARD),1319)
  358. # Geeetech GT2560 Rev B for A20(M/T/D)
  359. else ifeq ($(HARDWARE_MOTHERBOARD),1320)
  360. # Einstart retrofit
  361. else ifeq ($(HARDWARE_MOTHERBOARD),1321)
  362. # Wanhao 0ne+ i3 Mini
  363. else ifeq ($(HARDWARE_MOTHERBOARD),1322)
  364. # Leapfrog Xeed 2015
  365. else ifeq ($(HARDWARE_MOTHERBOARD),1323)
  366. # PICA Shield (original version)
  367. else ifeq ($(HARDWARE_MOTHERBOARD),1324)
  368. # PICA Shield (rev C or later)
  369. else ifeq ($(HARDWARE_MOTHERBOARD),1325)
  370. # Intamsys 4.0 (Funmat HT)
  371. else ifeq ($(HARDWARE_MOTHERBOARD),1326)
  372. # Malyan M180 Mainboard Version 2 (no display function, direct G-code only)
  373. else ifeq ($(HARDWARE_MOTHERBOARD),1327)
  374. # Geeetech GT2560 Rev B for A20(M/T/D)
  375. else ifeq ($(HARDWARE_MOTHERBOARD),1328)
  376. # Mega controller & Protoneer CNC Shield V3.00
  377. else ifeq ($(HARDWARE_MOTHERBOARD),1329)
  378. #
  379. # ATmega1281, ATmega2561
  380. #
  381. # Minitronics v1.0/1.1
  382. else ifeq ($(HARDWARE_MOTHERBOARD),1400)
  383. MCU ?= atmega1281
  384. PROG_MCU ?= m1281
  385. # Silvergate v1.0
  386. else ifeq ($(HARDWARE_MOTHERBOARD),1401)
  387. MCU ?= atmega1281
  388. PROG_MCU ?= m1281
  389. #
  390. # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
  391. #
  392. # Sanguinololu < 1.2
  393. else ifeq ($(HARDWARE_MOTHERBOARD),1500)
  394. HARDWARE_VARIANT ?= Sanguino
  395. MCU ?= atmega644p
  396. PROG_MCU ?= m644p
  397. # Sanguinololu 1.2 and above
  398. else ifeq ($(HARDWARE_MOTHERBOARD),1501)
  399. HARDWARE_VARIANT ?= Sanguino
  400. MCU ?= atmega644p
  401. PROG_MCU ?= m644p
  402. # Melzi
  403. else ifeq ($(HARDWARE_MOTHERBOARD),1502)
  404. HARDWARE_VARIANT ?= Sanguino
  405. MCU ?= atmega644p
  406. PROG_MCU ?= m644p
  407. # Melzi V2.0
  408. else ifeq ($(HARDWARE_MOTHERBOARD),1503)
  409. HARDWARE_VARIANT ?= Sanguino
  410. MCU ?= atmega1284p
  411. PROG_MCU ?= m1284p
  412. # Melzi with ATmega1284 (MaKr3d version)
  413. else ifeq ($(HARDWARE_MOTHERBOARD),1504)
  414. HARDWARE_VARIANT ?= Sanguino
  415. MCU ?= atmega1284p
  416. PROG_MCU ?= m1284p
  417. # Melzi Creality3D board (for CR-10 etc)
  418. else ifeq ($(HARDWARE_MOTHERBOARD),1505)
  419. HARDWARE_VARIANT ?= Sanguino
  420. MCU ?= atmega1284p
  421. PROG_MCU ?= m1284p
  422. # Melzi Malyan M150 board
  423. else ifeq ($(HARDWARE_MOTHERBOARD),1506)
  424. HARDWARE_VARIANT ?= Sanguino
  425. MCU ?= atmega1284p
  426. PROG_MCU ?= m1284p
  427. # Tronxy X5S
  428. else ifeq ($(HARDWARE_MOTHERBOARD),1507)
  429. HARDWARE_VARIANT ?= Sanguino
  430. MCU ?= atmega1284p
  431. PROG_MCU ?= m1284p
  432. # STB V1.1
  433. else ifeq ($(HARDWARE_MOTHERBOARD),1508)
  434. HARDWARE_VARIANT ?= Sanguino
  435. MCU ?= atmega1284p
  436. PROG_MCU ?= m1284p
  437. # Azteeg X1
  438. else ifeq ($(HARDWARE_MOTHERBOARD),1509)
  439. HARDWARE_VARIANT ?= Sanguino
  440. MCU ?= atmega1284p
  441. PROG_MCU ?= m1284p
  442. # Anet 1.0 (Melzi clone)
  443. else ifeq ($(HARDWARE_MOTHERBOARD),1510)
  444. HARDWARE_VARIANT ?= Sanguino
  445. MCU ?= atmega1284p
  446. PROG_MCU ?= m1284p
  447. # ZoneStar ZMIB V2
  448. else ifeq ($(HARDWARE_MOTHERBOARD),1511)
  449. HARDWARE_VARIANT ?= Sanguino
  450. MCU ?= atmega1284p
  451. PROG_MCU ?= m1284p
  452. #
  453. # Other ATmega644P, ATmega644, ATmega1284P
  454. #
  455. # Gen3 Monolithic Electronics
  456. else ifeq ($(HARDWARE_MOTHERBOARD),1600)
  457. HARDWARE_VARIANT ?= Sanguino
  458. MCU ?= atmega644p
  459. PROG_MCU ?= m644p
  460. # Gen3+
  461. else ifeq ($(HARDWARE_MOTHERBOARD),1601)
  462. HARDWARE_VARIANT ?= Sanguino
  463. MCU ?= atmega644p
  464. PROG_MCU ?= m644p
  465. # Gen6
  466. else ifeq ($(HARDWARE_MOTHERBOARD),1602)
  467. HARDWARE_VARIANT ?= Gen6
  468. MCU ?= atmega644p
  469. PROG_MCU ?= m644p
  470. # Gen6 deluxe
  471. else ifeq ($(HARDWARE_MOTHERBOARD),1603)
  472. HARDWARE_VARIANT ?= Gen6
  473. MCU ?= atmega644p
  474. PROG_MCU ?= m644p
  475. # Gen7 custom (Alfons3 Version)
  476. else ifeq ($(HARDWARE_MOTHERBOARD),1604)
  477. HARDWARE_VARIANT ?= Gen7
  478. MCU ?= atmega644
  479. PROG_MCU ?= m644
  480. F_CPU ?= 20000000
  481. # Gen7 v1.1, v1.2
  482. else ifeq ($(HARDWARE_MOTHERBOARD),1605)
  483. HARDWARE_VARIANT ?= Gen7
  484. MCU ?= atmega644p
  485. PROG_MCU ?= m644p
  486. F_CPU ?= 20000000
  487. # Gen7 v1.3
  488. else ifeq ($(HARDWARE_MOTHERBOARD),1606)
  489. HARDWARE_VARIANT ?= Gen7
  490. MCU ?= atmega644p
  491. PROG_MCU ?= m644p
  492. F_CPU ?= 20000000
  493. # Gen7 v1.4
  494. else ifeq ($(HARDWARE_MOTHERBOARD),1607)
  495. HARDWARE_VARIANT ?= Gen7
  496. MCU ?= atmega1284p
  497. PROG_MCU ?= m1284p
  498. F_CPU ?= 20000000
  499. # Alpha OMCA board
  500. else ifeq ($(HARDWARE_MOTHERBOARD),1608)
  501. HARDWARE_VARIANT ?= SanguinoA
  502. MCU ?= atmega644
  503. PROG_MCU ?= m644
  504. # Final OMCA board
  505. else ifeq ($(HARDWARE_MOTHERBOARD),1609)
  506. HARDWARE_VARIANT ?= Sanguino
  507. MCU ?= atmega644p
  508. PROG_MCU ?= m644p
  509. # Sethi 3D_1
  510. else ifeq ($(HARDWARE_MOTHERBOARD),1610)
  511. HARDWARE_VARIANT ?= Sanguino
  512. MCU ?= atmega644p
  513. PROG_MCU ?= m644p
  514. #
  515. # Teensyduino - AT90USB1286, AT90USB1286P
  516. #
  517. # Teensylu
  518. else ifeq ($(HARDWARE_MOTHERBOARD),1700)
  519. HARDWARE_VARIANT ?= Teensy
  520. MCU ?= at90usb1286
  521. PROG_MCU ?= usb1286
  522. # Printrboard (AT90USB1286)
  523. else ifeq ($(HARDWARE_MOTHERBOARD),1701)
  524. HARDWARE_VARIANT ?= Teensy
  525. MCU ?= at90usb1286
  526. PROG_MCU ?= usb1286
  527. # Printrboard Revision F (AT90USB1286)
  528. else ifeq ($(HARDWARE_MOTHERBOARD),1702)
  529. HARDWARE_VARIANT ?= Teensy
  530. MCU ?= at90usb1286
  531. PROG_MCU ?= usb1286
  532. # Brainwave (AT90USB646)
  533. else ifeq ($(HARDWARE_MOTHERBOARD),1703)
  534. HARDWARE_VARIANT ?= Teensy
  535. MCU ?= at90usb646
  536. PROG_MCU ?= usb646
  537. # Brainwave Pro (AT90USB1286)
  538. else ifeq ($(HARDWARE_MOTHERBOARD),1704)
  539. HARDWARE_VARIANT ?= Teensy
  540. MCU ?= at90usb1286
  541. PROG_MCU ?= usb1286
  542. # SAV Mk-I (AT90USB1286)
  543. else ifeq ($(HARDWARE_MOTHERBOARD),1705)
  544. HARDWARE_VARIANT ?= Teensy
  545. MCU ?= at90usb1286
  546. PROG_MCU ?= usb1286
  547. # Teensy++2.0 (AT90USB1286)
  548. else ifeq ($(HARDWARE_MOTHERBOARD),1706)
  549. HARDWARE_VARIANT ?= Teensy
  550. MCU ?= at90usb1286
  551. PROG_MCU ?= usb1286
  552. # 5DPrint D8 Driver Board
  553. else ifeq ($(HARDWARE_MOTHERBOARD),1707)
  554. HARDWARE_VARIANT ?= Teensy
  555. MCU ?= at90usb1286
  556. PROG_MCU ?= usb1286
  557. # UltiMachine Archim1 (with DRV8825 drivers)
  558. else ifeq ($(HARDWARE_MOTHERBOARD),3023)
  559. HARDWARE_VARIANT ?= archim
  560. MCPU = cortex-m3
  561. F_CPU = 84000000
  562. IS_MCU = 0
  563. # UltiMachine Archim2 (with TMC2130 drivers)
  564. else ifeq ($(HARDWARE_MOTHERBOARD),3024)
  565. HARDWARE_VARIANT ?= archim
  566. MCPU = cortex-m3
  567. F_CPU = 84000000
  568. IS_MCU = 0
  569. endif
  570. # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
  571. # if you are setting this to something other than 16MHz
  572. # Do not put the UL suffix, it's done later on.
  573. # Set to 16Mhz if not yet set.
  574. F_CPU ?= 16000000
  575. # Set to microcontroller if IS_MCU not yet set
  576. IS_MCU ?= 1
  577. ifeq ($(IS_MCU),1)
  578. # Set to arduino, ATmega2560 if not yet set.
  579. HARDWARE_VARIANT ?= arduino
  580. MCU ?= atmega2560
  581. PROG_MCU ?= m2560
  582. TOOL_PREFIX = avr
  583. MCU_FLAGS = -mmcu=$(MCU)
  584. SIZE_FLAGS = --mcu=$(MCU) -C
  585. else
  586. TOOL_PREFIX = arm-none-eabi
  587. CPU_FLAGS = -mthumb -mcpu=$(MCPU)
  588. SIZE_FLAGS = -A
  589. endif
  590. # Arduino contained the main source code for the Arduino
  591. # Libraries, the "hardware variant" are for boards
  592. # that derives from that, and their source are present in
  593. # the main Marlin source directory
  594. TARGET = $(notdir $(CURDIR))
  595. # VPATH tells make to look into these directory for source files,
  596. # there is no need to specify explicit pathnames as long as the
  597. # directory is added here
  598. # The Makefile for previous versions of Marlin used VPATH for all
  599. # source files, but for Marlin 2.0, we use VPATH only for arduino
  600. # library files.
  601. VPATH = .
  602. VPATH += $(BUILD_DIR)
  603. VPATH += $(HARDWARE_SRC)
  604. ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
  605. # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
  606. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
  607. # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
  608. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
  609. endif
  610. ifeq ($(IS_MCU),1)
  611. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
  612. # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
  613. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
  614. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial
  615. # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
  616. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
  617. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
  618. endif
  619. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
  620. ifeq ($(LIQUID_TWI2), 1)
  621. WIRE = 1
  622. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
  623. endif
  624. ifeq ($(WIRE), 1)
  625. # Old libraries (avr-core 1.6.21 / Arduino < 1.6.8)
  626. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire
  627. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/utility
  628. # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
  629. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src
  630. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src/utility
  631. endif
  632. ifeq ($(NEOPIXEL), 1)
  633. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
  634. endif
  635. ifeq ($(U8GLIB), 1)
  636. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib
  637. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/csrc
  638. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/cppsrc
  639. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/fntsrc
  640. endif
  641. ifeq ($(TMC), 1)
  642. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src
  643. VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMCStepper/src/source
  644. endif
  645. ifeq ($(HARDWARE_VARIANT), arduino)
  646. HARDWARE_SUB_VARIANT ?= mega
  647. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
  648. else ifeq ($(HARDWARE_VARIANT), Sanguino)
  649. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino
  650. else ifeq ($(HARDWARE_VARIANT), archim)
  651. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/libsam
  652. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/CMSIS/Include/
  653. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/system/CMSIS/Device/ATMEL/
  654. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino
  655. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/avr
  656. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/cores/arduino/USB
  657. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/Wire/src
  658. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/SPI/src
  659. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/libraries/U8glib/src/clib
  660. VPATH += $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim
  661. LDSCRIPT = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/linker_scripts/gcc/flash.ld
  662. LDLIBS = $(ARDUINO_INSTALL_DIR)/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/libsam_sam3x8e_gcc_rel.a
  663. else
  664. HARDWARE_SUB_VARIANT ?= standard
  665. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
  666. endif
  667. LIB_SRC = wiring.c \
  668. wiring_analog.c wiring_digital.c \
  669. wiring_shift.c WInterrupts.c hooks.c
  670. ifeq ($(HARDWARE_VARIANT), archim)
  671. LIB_ASRC += wiring_pulse_asm.S
  672. else
  673. LIB_SRC += wiring_pulse.c
  674. endif
  675. ifeq ($(HARDWARE_VARIANT), Teensy)
  676. LIB_SRC = wiring.c
  677. VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
  678. endif
  679. LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp
  680. ifeq ($(NEOPIXEL), 1)
  681. LIB_CXXSRC += Adafruit_NeoPixel.cpp
  682. endif
  683. ifeq ($(LIQUID_TWI2), 0)
  684. LIB_CXXSRC += LiquidCrystal.cpp
  685. else
  686. LIB_SRC += twi.c
  687. LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp
  688. endif
  689. ifeq ($(WIRE), 1)
  690. LIB_SRC += twi.c
  691. LIB_CXXSRC += Wire.cpp
  692. endif
  693. ifeq ($(TONE), 1)
  694. LIB_CXXSRC += Tone.cpp
  695. endif
  696. ifeq ($(U8GLIB), 1)
  697. LIB_CXXSRC += U8glib.cpp
  698. LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c \
  699. u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c \
  700. u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
  701. endif
  702. ifeq ($(TMC), 1)
  703. LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp \
  704. CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp \
  705. DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp \
  706. SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp \
  707. TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
  708. endif
  709. ifeq ($(RELOC_WORKAROUND), 1)
  710. LD_PREFIX=-nodefaultlibs
  711. LD_SUFFIX=-lm -lgcc -lc -lgcc
  712. endif
  713. #Check for Arduino 1.0.0 or higher and use the correct source files for that version
  714. ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
  715. LIB_CXXSRC += main.cpp
  716. else
  717. LIB_SRC += pins_arduino.c main.c
  718. endif
  719. FORMAT = ihex
  720. # Name of this Makefile (used for "make depend").
  721. MAKEFILE = Makefile
  722. # Debugging format.
  723. # Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
  724. # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
  725. DEBUG = stabs
  726. OPT = s
  727. DEFINES ?=
  728. # Program settings
  729. CC = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-gcc
  730. CXX = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-g++
  731. OBJCOPY = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objcopy
  732. OBJDUMP = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-objdump
  733. AR = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-ar
  734. SIZE = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-size
  735. NM = $(AVR_TOOLS_PATH)$(TOOL_PREFIX)-nm
  736. AVRDUDE = avrdude
  737. REMOVE = rm -f
  738. MV = mv -f
  739. # Place -D or -U options here
  740. CDEFS = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
  741. CXXDEFS = $(CDEFS)
  742. ifeq ($(HARDWARE_VARIANT), Teensy)
  743. CDEFS += -DUSB_SERIAL
  744. LIB_SRC += usb.c pins_teensy.c
  745. LIB_CXXSRC += usb_api.cpp
  746. else ifeq ($(HARDWARE_VARIANT), archim)
  747. CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__
  748. CDEFS += -DUSB_VID=0x27B1 -DUSB_PID=0x0001 -DUSBCON
  749. CDEFS += '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
  750. LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp \
  751. UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp \
  752. PluggableUSB.cpp USBCore.cpp
  753. LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
  754. ifeq ($(U8GLIB), 1)
  755. LIB_SRC += u8g_com_api.c u8g_pb32h1.c
  756. endif
  757. endif
  758. # Add all the source directories as include directories too
  759. CINCS = ${addprefix -I ,${VPATH}}
  760. CXXINCS = ${addprefix -I ,${VPATH}}
  761. # Silence warnings for library code (won't work for .h files, unfortunately)
  762. LIBWARN = -w -Wno-packed-bitfield-compat
  763. # Compiler flag to set the C/CPP Standard level.
  764. CSTANDARD = -std=gnu99
  765. CXXSTANDARD = -std=gnu++11
  766. CDEBUG = -g$(DEBUG)
  767. CWARN = -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -Wno-pragmas -Wunused-parameter
  768. CXXWARN = -Wall -Wno-packed-bitfield-compat -Wno-pragmas -Wunused-parameter
  769. CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
  770. -fshort-enums -ffunction-sections -fdata-sections
  771. ifneq ($(HARDWARE_MOTHERBOARD),)
  772. CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
  773. endif
  774. #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
  775. CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
  776. CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
  777. CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
  778. ASFLAGS := $(CDEFS)
  779. #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
  780. ifeq ($(HARDWARE_VARIANT), archim)
  781. LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
  782. LD_SUFFIX = $(LDLIBS)
  783. LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty
  784. LDFLAGS += -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
  785. else
  786. LD_PREFIX = -Wl,--gc-sections,--relax
  787. LDFLAGS = -lm
  788. CTUNING += -flto
  789. endif
  790. # Programming support using avrdude. Settings and variables.
  791. AVRDUDE_PORT = $(UPLOAD_PORT)
  792. AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
  793. ifeq ($(shell uname -s), Linux)
  794. AVRDUDE_CONF = /etc/avrdude/avrdude.conf
  795. else
  796. AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
  797. endif
  798. AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
  799. -p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
  800. -b$(UPLOAD_RATE)
  801. # Since Marlin 2.0, the source files may be distributed into several
  802. # different directories, so it is necessary to find them recursively
  803. SRC = $(shell find src -name '*.c' -type f)
  804. CXXSRC = $(shell find src -name '*.cpp' -type f)
  805. # Define all object files.
  806. OBJ = ${patsubst %.c, $(BUILD_DIR)/arduino/%.o, ${LIB_SRC}}
  807. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/arduino/%.o, ${LIB_CXXSRC}}
  808. OBJ += ${patsubst %.S, $(BUILD_DIR)/arduino/%.o, ${LIB_ASRC}}
  809. OBJ += ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
  810. OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
  811. # Define all listing files.
  812. LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst)
  813. # Combine all necessary flags and optional flags.
  814. # Add target processor to flags.
  815. ALL_CFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CFLAGS) -I.
  816. ALL_CXXFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(CXXFLAGS)
  817. ALL_ASFLAGS = $(MCU_FLAGS) $(CPU_FLAGS) $(ASFLAGS) -x assembler-with-cpp
  818. # set V=1 (eg, "make V=1") to print the full commands etc.
  819. ifneq ($V,1)
  820. Pecho=@echo
  821. P=@
  822. else
  823. Pecho=@:
  824. P=
  825. endif
  826. # Create required build hierarchy if it does not exist
  827. $(shell mkdir -p $(dir $(OBJ)))
  828. # Default target.
  829. all: sizeafter
  830. build: elf hex bin
  831. elf: $(BUILD_DIR)/$(TARGET).elf
  832. bin: $(BUILD_DIR)/$(TARGET).bin
  833. hex: $(BUILD_DIR)/$(TARGET).hex
  834. eep: $(BUILD_DIR)/$(TARGET).eep
  835. lss: $(BUILD_DIR)/$(TARGET).lss
  836. sym: $(BUILD_DIR)/$(TARGET).sym
  837. # Program the device.
  838. # Do not try to reset an Arduino if it's not one
  839. upload: $(BUILD_DIR)/$(TARGET).hex
  840. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  841. stty hup < $(UPLOAD_PORT); true
  842. endif
  843. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
  844. ifeq (${AVRDUDE_PROGRAMMER}, arduino)
  845. stty -hup < $(UPLOAD_PORT); true
  846. endif
  847. # Display size of file.
  848. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
  849. ELFSIZE = $(SIZE) $(SIZE_FLAGS) $(BUILD_DIR)/$(TARGET).elf; \
  850. $(SIZE) $(BUILD_DIR)/$(TARGET).elf
  851. sizebefore:
  852. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
  853. sizeafter: build
  854. $P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
  855. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  856. COFFCONVERT=$(OBJCOPY) --debugging \
  857. --change-section-address .data-0x800000 \
  858. --change-section-address .bss-0x800000 \
  859. --change-section-address .noinit-0x800000 \
  860. --change-section-address .eeprom-0x810000
  861. coff: $(BUILD_DIR)/$(TARGET).elf
  862. $(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  863. extcoff: $(TARGET).elf
  864. $(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
  865. .SUFFIXES: .elf .hex .eep .lss .sym .bin
  866. .PRECIOUS: .o
  867. .elf.hex:
  868. $(Pecho) " COPY $@"
  869. $P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
  870. .elf.bin:
  871. $(Pecho) " COPY $@"
  872. $P $(OBJCOPY) -O binary -R .eeprom $< $@
  873. .elf.eep:
  874. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  875. --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
  876. # Create extended listing file from ELF output file.
  877. .elf.lss:
  878. $(OBJDUMP) -h -S $< > $@
  879. # Create a symbol table from ELF output file.
  880. .elf.sym:
  881. $(NM) -n $< > $@
  882. # Link: create ELF output file from library.
  883. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
  884. $(Pecho) " CXX $@"
  885. $P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
  886. # Object files that were found in "src" will be stored in $(BUILD_DIR)
  887. # in directories that mirror the structure of "src"
  888. $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  889. $(Pecho) " CC $<"
  890. $P $(CC) -MMD -c $(ALL_CFLAGS) $(CWARN) $< -o $@
  891. $(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  892. $(Pecho) " CXX $<"
  893. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(CXXWARN) $< -o $@
  894. # Object files for Arduino libs will be created in $(BUILD_DIR)/arduino
  895. $(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
  896. $(Pecho) " CC $<"
  897. $P $(CC) -MMD -c $(ALL_CFLAGS) $(LIBWARN) $< -o $@
  898. $(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
  899. $(Pecho) " CXX $<"
  900. $P $(CXX) -MMD -c $(ALL_CXXFLAGS) $(LIBWARN) $< -o $@
  901. $(BUILD_DIR)/arduino/%.o: %.S $(MAKEFILE)
  902. $(Pecho) " CXX $<"
  903. $P $(CXX) -MMD -c $(ALL_ASFLAGS) $< -o $@
  904. # Target: clean project.
  905. clean:
  906. $(Pecho) " RMDIR $(BUILD_DIR)/"
  907. $P rm -rf $(BUILD_DIR)
  908. .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
  909. # Automatically include the dependency files created by gcc
  910. -include ${patsubst %.o, %.d, ${OBJ}}