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

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