Browse Source

Fix and improve Makefile / CMake (#19640)

Samantaz Fox 4 years ago
parent
commit
b8700e0aa8
2 changed files with 133 additions and 42 deletions
  1. 129
    38
      Marlin/Makefile
  2. 4
    4
      buildroot/share/cmake/CMakeLists.txt

+ 129
- 38
Marlin/Makefile View File

22
 #     (e.g. UPLOAD_PORT = /dev/tty.USB0).  If the exact name of this file
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*).
23
 #     changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
24
 #
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
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
27
 #     or Diecimila have the atmega168.  If you're using a LilyPad Arduino,
29
 #     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
30
 #     change F_CPU to 8000000. If you are using Gen7 electronics, you
29
 #     probably need to use 20000000. Either way, you must regenerate
31
 #     probably need to use 20000000. Either way, you must regenerate
34
 #  5. Type "make upload", reset your Arduino board, and press enter to
36
 #  5. Type "make upload", reset your Arduino board, and press enter to
35
 #     upload your program to the Arduino board.
37
 #     upload your program to the Arduino board.
36
 #
38
 #
37
-# Note that all settings at the top of this file can be overriden from
39
+# Note that all settings at the top of this file can be overridden from
38
 # the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
40
 # the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
39
 #
41
 #
40
 # To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
42
 # To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
41
 #
43
 #
42
 #   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
44
 #   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
43
-#   HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
45
+#   HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino
44
 #
46
 #
45
 # To compile and upload simply add "upload" to the end of the line...
47
 # To compile and upload simply add "upload" to the end of the line...
46
 #
48
 #
47
 #   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
49
 #   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
48
-#   HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
50
+#   HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino upload
49
 #
51
 #
50
 # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
52
 # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
51
 # start upload manually (using stk500) like so:
53
 # start upload manually (using stk500) like so:
57
 #
59
 #
58
 
60
 
59
 # This defines the board to compile for (see boards.h for your board's ID)
61
 # This defines the board to compile for (see boards.h for your board's ID)
60
-HARDWARE_MOTHERBOARD ?= 11
62
+HARDWARE_MOTHERBOARD ?= 1020
63
+
64
+ifeq ($(OS),Windows_NT)
65
+  # Windows
66
+  ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
67
+  ARDUINO_USER_DIR ?= ${HOME}/Arduino
68
+else
69
+  UNAME_S := $(shell uname -s)
70
+  ifeq ($(UNAME_S),Linux)
71
+    # Linux
72
+    ARDUINO_INSTALL_DIR ?= /usr/share/arduino
73
+    ARDUINO_USER_DIR ?= ${HOME}/Arduino
74
+  endif
75
+  ifeq ($(UNAME_S),Darwin)
76
+    # Darwin (macOS)
77
+    ARDUINO_INSTALL_DIR ?= /Applications/Arduino.app/Contents/Java
78
+    ARDUINO_USER_DIR ?= ${HOME}/Documents/Arduino
79
+    AVR_TOOLS_PATH ?= /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/
80
+  endif
81
+endif
61
 
82
 
62
 # Arduino source install directory, and version number
83
 # Arduino source install directory, and version number
63
 # On most linuxes this will be /usr/share/arduino
84
 # On most linuxes this will be /usr/share/arduino
67
 # The installed Libraries are in the User folder
88
 # The installed Libraries are in the User folder
68
 ARDUINO_USER_DIR ?= ${HOME}/Arduino
89
 ARDUINO_USER_DIR ?= ${HOME}/Arduino
69
 
90
 
70
-# You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
91
+# You can optionally set a path to the avr-gcc tools.
92
+# Requires a trailing slash. For example, /usr/local/avr-gcc/bin/
71
 AVR_TOOLS_PATH ?=
93
 AVR_TOOLS_PATH ?=
72
 
94
 
73
-#Programmer configuration
95
+# Programmer configuration
74
 UPLOAD_RATE        ?= 57600
96
 UPLOAD_RATE        ?= 57600
75
 AVRDUDE_PROGRAMMER ?= arduino
97
 AVRDUDE_PROGRAMMER ?= arduino
76
-# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
98
+# On most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
77
 UPLOAD_PORT        ?= /dev/ttyUSB0
99
 UPLOAD_PORT        ?= /dev/ttyUSB0
78
 
100
 
79
-#Directory used to build files in, contains all the build files, from object files to the final hex file
80
-#on linux it is best to put an absolute path like /home/username/tmp .
101
+# Directory used to build files in, contains all the build files, from object
102
+# files to the final hex file on linux it is best to put an absolute path
103
+# like /home/username/tmp .
81
 BUILD_DIR          ?= applet
104
 BUILD_DIR          ?= applet
82
 
105
 
83
 # This defines whether Liquid_TWI2 support will be built
106
 # This defines whether Liquid_TWI2 support will be built
84
 LIQUID_TWI2        ?= 0
107
 LIQUID_TWI2        ?= 0
85
 
108
 
86
-# this defines if Wire is needed
109
+# This defines if Wire is needed
87
 WIRE               ?= 0
110
 WIRE               ?= 0
88
 
111
 
89
-# this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
90
-U8GLIB             ?= 1
112
+# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h)
113
+# Disabling this (and SPEAKER) saves approximatively 350 bytes of memory.
114
+TONE               ?= 1
115
+
116
+# This defines if U8GLIB is needed (may require RELOC_WORKAROUND)
117
+U8GLIB             ?= 0
91
 
118
 
92
-# this defines whether to include the Trinamic TMCStepper library
93
-TMC                ?= 1
119
+# This defines whether to include the Trinamic TMCStepper library
120
+TMC                ?= 0
94
 
121
 
95
-# this defines whether to include the AdaFruit NeoPixel library
122
+# This defines whether to include the AdaFruit NeoPixel library
96
 NEOPIXEL           ?= 0
123
 NEOPIXEL           ?= 0
97
 
124
 
98
 ############
125
 ############
208
 else ifeq ($(HARDWARE_MOTHERBOARD),1120)
235
 else ifeq ($(HARDWARE_MOTHERBOARD),1120)
209
 # Ultimaker (Older electronics. Pre 1.5.4. This is rare)
236
 # Ultimaker (Older electronics. Pre 1.5.4. This is rare)
210
 else ifeq ($(HARDWARE_MOTHERBOARD),1121)
237
 else ifeq ($(HARDWARE_MOTHERBOARD),1121)
211
-  MCU ?= atmega1280
238
+  MCU              ?= atmega1280
239
+  PROG_MCU         ?= m1280
212
 
240
 
213
 # Azteeg X3
241
 # Azteeg X3
214
 else ifeq ($(HARDWARE_MOTHERBOARD),1122)
242
 else ifeq ($(HARDWARE_MOTHERBOARD),1122)
350
 # Minitronics v1.0/1.1
378
 # Minitronics v1.0/1.1
351
 else ifeq ($(HARDWARE_MOTHERBOARD),1400)
379
 else ifeq ($(HARDWARE_MOTHERBOARD),1400)
352
   MCU              ?= atmega1281
380
   MCU              ?= atmega1281
381
+  PROG_MCU         ?= m1281
353
 # Silvergate v1.0
382
 # Silvergate v1.0
354
 else ifeq ($(HARDWARE_MOTHERBOARD),1401)
383
 else ifeq ($(HARDWARE_MOTHERBOARD),1401)
355
   MCU              ?= atmega1281
384
   MCU              ?= atmega1281
385
+  PROG_MCU         ?= m1281
356
 
386
 
357
 #
387
 #
358
 # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
388
 # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
362
 else ifeq ($(HARDWARE_MOTHERBOARD),1500)
392
 else ifeq ($(HARDWARE_MOTHERBOARD),1500)
363
   HARDWARE_VARIANT ?= Sanguino
393
   HARDWARE_VARIANT ?= Sanguino
364
   MCU              ?= atmega644p
394
   MCU              ?= atmega644p
395
+  PROG_MCU         ?= m644p
365
 # Sanguinololu 1.2 and above
396
 # Sanguinololu 1.2 and above
366
 else ifeq ($(HARDWARE_MOTHERBOARD),1501)
397
 else ifeq ($(HARDWARE_MOTHERBOARD),1501)
367
   HARDWARE_VARIANT ?= Sanguino
398
   HARDWARE_VARIANT ?= Sanguino
368
   MCU              ?= atmega644p
399
   MCU              ?= atmega644p
400
+  PROG_MCU         ?= m644p
369
 # Melzi
401
 # Melzi
370
 else ifeq ($(HARDWARE_MOTHERBOARD),1502)
402
 else ifeq ($(HARDWARE_MOTHERBOARD),1502)
371
   HARDWARE_VARIANT ?= Sanguino
403
   HARDWARE_VARIANT ?= Sanguino
372
   MCU              ?= atmega644p
404
   MCU              ?= atmega644p
405
+  PROG_MCU         ?= m644p
373
 # Melzi V2.0
406
 # Melzi V2.0
374
 else ifeq ($(HARDWARE_MOTHERBOARD),1503)
407
 else ifeq ($(HARDWARE_MOTHERBOARD),1503)
375
   HARDWARE_VARIANT ?= Sanguino
408
   HARDWARE_VARIANT ?= Sanguino
376
   MCU              ?= atmega1284p
409
   MCU              ?= atmega1284p
410
+  PROG_MCU         ?= m1284p
377
 # Melzi with ATmega1284 (MaKr3d version)
411
 # Melzi with ATmega1284 (MaKr3d version)
378
 else ifeq ($(HARDWARE_MOTHERBOARD),1504)
412
 else ifeq ($(HARDWARE_MOTHERBOARD),1504)
379
   HARDWARE_VARIANT ?= Sanguino
413
   HARDWARE_VARIANT ?= Sanguino
380
   MCU              ?= atmega1284p
414
   MCU              ?= atmega1284p
415
+  PROG_MCU         ?= m1284p
381
 # Melzi Creality3D board (for CR-10 etc)
416
 # Melzi Creality3D board (for CR-10 etc)
382
 else ifeq ($(HARDWARE_MOTHERBOARD),1505)
417
 else ifeq ($(HARDWARE_MOTHERBOARD),1505)
383
   HARDWARE_VARIANT ?= Sanguino
418
   HARDWARE_VARIANT ?= Sanguino
384
   MCU              ?= atmega1284p
419
   MCU              ?= atmega1284p
420
+  PROG_MCU         ?= m1284p
385
 # Melzi Malyan M150 board
421
 # Melzi Malyan M150 board
386
 else ifeq ($(HARDWARE_MOTHERBOARD),1506)
422
 else ifeq ($(HARDWARE_MOTHERBOARD),1506)
387
   HARDWARE_VARIANT ?= Sanguino
423
   HARDWARE_VARIANT ?= Sanguino
388
   MCU              ?= atmega1284p
424
   MCU              ?= atmega1284p
425
+  PROG_MCU         ?= m1284p
389
 # Tronxy X5S
426
 # Tronxy X5S
390
 else ifeq ($(HARDWARE_MOTHERBOARD),1507)
427
 else ifeq ($(HARDWARE_MOTHERBOARD),1507)
391
   HARDWARE_VARIANT ?= Sanguino
428
   HARDWARE_VARIANT ?= Sanguino
392
   MCU              ?= atmega1284p
429
   MCU              ?= atmega1284p
430
+  PROG_MCU         ?= m1284p
393
 # STB V1.1
431
 # STB V1.1
394
 else ifeq ($(HARDWARE_MOTHERBOARD),1508)
432
 else ifeq ($(HARDWARE_MOTHERBOARD),1508)
395
   HARDWARE_VARIANT ?= Sanguino
433
   HARDWARE_VARIANT ?= Sanguino
396
   MCU              ?= atmega1284p
434
   MCU              ?= atmega1284p
435
+  PROG_MCU         ?= m1284p
397
 # Azteeg X1
436
 # Azteeg X1
398
 else ifeq ($(HARDWARE_MOTHERBOARD),1509)
437
 else ifeq ($(HARDWARE_MOTHERBOARD),1509)
399
   HARDWARE_VARIANT ?= Sanguino
438
   HARDWARE_VARIANT ?= Sanguino
400
   MCU              ?= atmega1284p
439
   MCU              ?= atmega1284p
440
+  PROG_MCU         ?= m1284p
401
 # Anet 1.0 (Melzi clone)
441
 # Anet 1.0 (Melzi clone)
402
 else ifeq ($(HARDWARE_MOTHERBOARD),1510)
442
 else ifeq ($(HARDWARE_MOTHERBOARD),1510)
403
   HARDWARE_VARIANT ?= Sanguino
443
   HARDWARE_VARIANT ?= Sanguino
404
   MCU              ?= atmega1284p
444
   MCU              ?= atmega1284p
445
+  PROG_MCU         ?= m1284p
405
 
446
 
406
 #
447
 #
407
 # Other ATmega644P, ATmega644, ATmega1284P
448
 # Other ATmega644P, ATmega644, ATmega1284P
411
 else ifeq ($(HARDWARE_MOTHERBOARD),1600)
452
 else ifeq ($(HARDWARE_MOTHERBOARD),1600)
412
   HARDWARE_VARIANT ?= Sanguino
453
   HARDWARE_VARIANT ?= Sanguino
413
   MCU              ?= atmega644p
454
   MCU              ?= atmega644p
455
+  PROG_MCU         ?= m644p
414
 # Gen3+
456
 # Gen3+
415
 else ifeq ($(HARDWARE_MOTHERBOARD),1601)
457
 else ifeq ($(HARDWARE_MOTHERBOARD),1601)
416
   HARDWARE_VARIANT ?= Sanguino
458
   HARDWARE_VARIANT ?= Sanguino
417
   MCU              ?= atmega644p
459
   MCU              ?= atmega644p
460
+  PROG_MCU         ?= m644p
418
 # Gen6
461
 # Gen6
419
 else ifeq ($(HARDWARE_MOTHERBOARD),1602)
462
 else ifeq ($(HARDWARE_MOTHERBOARD),1602)
420
   HARDWARE_VARIANT ?= Gen6
463
   HARDWARE_VARIANT ?= Gen6
421
   MCU              ?= atmega644p
464
   MCU              ?= atmega644p
465
+  PROG_MCU         ?= m644p
422
 # Gen6 deluxe
466
 # Gen6 deluxe
423
 else ifeq ($(HARDWARE_MOTHERBOARD),1603)
467
 else ifeq ($(HARDWARE_MOTHERBOARD),1603)
424
   HARDWARE_VARIANT ?= Gen6
468
   HARDWARE_VARIANT ?= Gen6
425
   MCU              ?= atmega644p
469
   MCU              ?= atmega644p
470
+  PROG_MCU         ?= m644p
426
 # Gen7 custom (Alfons3 Version)
471
 # Gen7 custom (Alfons3 Version)
427
 else ifeq ($(HARDWARE_MOTHERBOARD),1604)
472
 else ifeq ($(HARDWARE_MOTHERBOARD),1604)
428
   HARDWARE_VARIANT ?= Gen7
473
   HARDWARE_VARIANT ?= Gen7
429
   MCU              ?= atmega644
474
   MCU              ?= atmega644
475
+  PROG_MCU         ?= m644
430
   F_CPU            ?= 20000000
476
   F_CPU            ?= 20000000
431
 # Gen7 v1.1, v1.2
477
 # Gen7 v1.1, v1.2
432
 else ifeq ($(HARDWARE_MOTHERBOARD),1605)
478
 else ifeq ($(HARDWARE_MOTHERBOARD),1605)
433
   HARDWARE_VARIANT ?= Gen7
479
   HARDWARE_VARIANT ?= Gen7
434
   MCU              ?= atmega644p
480
   MCU              ?= atmega644p
481
+  PROG_MCU         ?= m644p
435
   F_CPU            ?= 20000000
482
   F_CPU            ?= 20000000
436
 # Gen7 v1.3
483
 # Gen7 v1.3
437
 else ifeq ($(HARDWARE_MOTHERBOARD),1606)
484
 else ifeq ($(HARDWARE_MOTHERBOARD),1606)
438
   HARDWARE_VARIANT ?= Gen7
485
   HARDWARE_VARIANT ?= Gen7
439
   MCU              ?= atmega644p
486
   MCU              ?= atmega644p
487
+  PROG_MCU         ?= m644p
440
   F_CPU            ?= 20000000
488
   F_CPU            ?= 20000000
441
 # Gen7 v1.4
489
 # Gen7 v1.4
442
 else ifeq ($(HARDWARE_MOTHERBOARD),1607)
490
 else ifeq ($(HARDWARE_MOTHERBOARD),1607)
443
   HARDWARE_VARIANT ?= Gen7
491
   HARDWARE_VARIANT ?= Gen7
444
   MCU              ?= atmega1284p
492
   MCU              ?= atmega1284p
493
+  PROG_MCU         ?= m1284p
445
   F_CPU            ?= 20000000
494
   F_CPU            ?= 20000000
446
 # Alpha OMCA board
495
 # Alpha OMCA board
447
 else ifeq ($(HARDWARE_MOTHERBOARD),1608)
496
 else ifeq ($(HARDWARE_MOTHERBOARD),1608)
448
   HARDWARE_VARIANT ?= SanguinoA
497
   HARDWARE_VARIANT ?= SanguinoA
449
   MCU              ?= atmega644
498
   MCU              ?= atmega644
499
+  PROG_MCU         ?= m644
450
 # Final OMCA board
500
 # Final OMCA board
451
 else ifeq ($(HARDWARE_MOTHERBOARD),1609)
501
 else ifeq ($(HARDWARE_MOTHERBOARD),1609)
452
   HARDWARE_VARIANT ?= Sanguino
502
   HARDWARE_VARIANT ?= Sanguino
453
   MCU              ?= atmega644p
503
   MCU              ?= atmega644p
504
+  PROG_MCU         ?= m644p
454
 # Sethi 3D_1
505
 # Sethi 3D_1
455
 else ifeq ($(HARDWARE_MOTHERBOARD),1610)
506
 else ifeq ($(HARDWARE_MOTHERBOARD),1610)
456
   HARDWARE_VARIANT ?= Sanguino
507
   HARDWARE_VARIANT ?= Sanguino
457
   MCU              ?= atmega644p
508
   MCU              ?= atmega644p
509
+  PROG_MCU         ?= m644p
458
 
510
 
459
 #
511
 #
460
 # Teensyduino - AT90USB1286, AT90USB1286P
512
 # Teensyduino - AT90USB1286, AT90USB1286P
464
 else ifeq ($(HARDWARE_MOTHERBOARD),1700)
516
 else ifeq ($(HARDWARE_MOTHERBOARD),1700)
465
   HARDWARE_VARIANT ?= Teensy
517
   HARDWARE_VARIANT ?= Teensy
466
   MCU              ?= at90usb1286
518
   MCU              ?= at90usb1286
519
+  PROG_MCU         ?= usb1286
467
 # Printrboard (AT90USB1286)
520
 # Printrboard (AT90USB1286)
468
 else ifeq ($(HARDWARE_MOTHERBOARD),1701)
521
 else ifeq ($(HARDWARE_MOTHERBOARD),1701)
469
   HARDWARE_VARIANT ?= Teensy
522
   HARDWARE_VARIANT ?= Teensy
470
   MCU              ?= at90usb1286
523
   MCU              ?= at90usb1286
524
+  PROG_MCU         ?= usb1286
471
 # Printrboard Revision F (AT90USB1286)
525
 # Printrboard Revision F (AT90USB1286)
472
 else ifeq ($(HARDWARE_MOTHERBOARD),1702)
526
 else ifeq ($(HARDWARE_MOTHERBOARD),1702)
473
   HARDWARE_VARIANT ?= Teensy
527
   HARDWARE_VARIANT ?= Teensy
474
   MCU              ?= at90usb1286
528
   MCU              ?= at90usb1286
529
+  PROG_MCU         ?= usb1286
475
 # Brainwave (AT90USB646)
530
 # Brainwave (AT90USB646)
476
 else ifeq ($(HARDWARE_MOTHERBOARD),1703)
531
 else ifeq ($(HARDWARE_MOTHERBOARD),1703)
477
   HARDWARE_VARIANT ?= Teensy
532
   HARDWARE_VARIANT ?= Teensy
478
   MCU              ?= at90usb646
533
   MCU              ?= at90usb646
534
+  PROG_MCU         ?= usb646
479
 # Brainwave Pro (AT90USB1286)
535
 # Brainwave Pro (AT90USB1286)
480
 else ifeq ($(HARDWARE_MOTHERBOARD),1704)
536
 else ifeq ($(HARDWARE_MOTHERBOARD),1704)
481
   HARDWARE_VARIANT ?= Teensy
537
   HARDWARE_VARIANT ?= Teensy
482
   MCU              ?= at90usb1286
538
   MCU              ?= at90usb1286
539
+  PROG_MCU         ?= usb1286
483
 # SAV Mk-I (AT90USB1286)
540
 # SAV Mk-I (AT90USB1286)
484
 else ifeq ($(HARDWARE_MOTHERBOARD),1705)
541
 else ifeq ($(HARDWARE_MOTHERBOARD),1705)
485
   HARDWARE_VARIANT ?= Teensy
542
   HARDWARE_VARIANT ?= Teensy
486
   MCU              ?= at90usb1286
543
   MCU              ?= at90usb1286
544
+  PROG_MCU         ?= usb1286
487
 # Teensy++2.0 (AT90USB1286)
545
 # Teensy++2.0 (AT90USB1286)
488
 else ifeq ($(HARDWARE_MOTHERBOARD),1706)
546
 else ifeq ($(HARDWARE_MOTHERBOARD),1706)
489
   HARDWARE_VARIANT ?= Teensy
547
   HARDWARE_VARIANT ?= Teensy
490
   MCU              ?= at90usb1286
548
   MCU              ?= at90usb1286
549
+  PROG_MCU         ?= usb1286
491
 # 5DPrint D8 Driver Board
550
 # 5DPrint D8 Driver Board
492
 else ifeq ($(HARDWARE_MOTHERBOARD),1707)
551
 else ifeq ($(HARDWARE_MOTHERBOARD),1707)
493
   HARDWARE_VARIANT ?= Teensy
552
   HARDWARE_VARIANT ?= Teensy
494
   MCU              ?= at90usb1286
553
   MCU              ?= at90usb1286
554
+  PROG_MCU         ?= usb1286
495
 
555
 
496
 # UltiMachine Archim1 (with DRV8825 drivers)
556
 # UltiMachine Archim1 (with DRV8825 drivers)
497
 else ifeq ($(HARDWARE_MOTHERBOARD),3023)
557
 else ifeq ($(HARDWARE_MOTHERBOARD),3023)
498
   HARDWARE_VARIANT ?= archim
558
   HARDWARE_VARIANT ?= archim
499
   MCPU              = cortex-m3
559
   MCPU              = cortex-m3
500
-  F_CPU             = 84000000L
560
+  F_CPU             = 84000000
501
   IS_MCU            = 0
561
   IS_MCU            = 0
502
 # UltiMachine Archim2 (with TMC2130 drivers)
562
 # UltiMachine Archim2 (with TMC2130 drivers)
503
 else ifeq ($(HARDWARE_MOTHERBOARD),3024)
563
 else ifeq ($(HARDWARE_MOTHERBOARD),3024)
504
   HARDWARE_VARIANT ?= archim
564
   HARDWARE_VARIANT ?= archim
505
   MCPU              = cortex-m3
565
   MCPU              = cortex-m3
506
-  F_CPU             = 84000000L
566
+  F_CPU             = 84000000
507
   IS_MCU            = 0
567
   IS_MCU            = 0
508
 endif
568
 endif
509
 
569
 
510
 # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
570
 # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
511
 # if you are setting this to something other than 16MHz
571
 # if you are setting this to something other than 16MHz
572
+# Do not put the UL suffix, it's done later on.
512
 # Set to 16Mhz if not yet set.
573
 # Set to 16Mhz if not yet set.
513
 F_CPU ?= 16000000
574
 F_CPU ?= 16000000
514
 
575
 
518
 ifeq ($(IS_MCU),1)
579
 ifeq ($(IS_MCU),1)
519
   # Set to arduino, ATmega2560 if not yet set.
580
   # Set to arduino, ATmega2560 if not yet set.
520
   HARDWARE_VARIANT ?= arduino
581
   HARDWARE_VARIANT ?= arduino
521
-  MCU ?= atmega2560
582
+  MCU              ?= atmega2560
583
+  PROG_MCU         ?= m2560
522
 
584
 
523
   TOOL_PREFIX = avr
585
   TOOL_PREFIX = avr
524
   MCU_FLAGS   = -mmcu=$(MCU)
586
   MCU_FLAGS   = -mmcu=$(MCU)
549
 VPATH += $(HARDWARE_SRC)
611
 VPATH += $(HARDWARE_SRC)
550
 
612
 
551
 ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
613
 ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
552
-VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
553
-VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
614
+  # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
615
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
616
+  # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
617
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
554
 endif
618
 endif
555
 
619
 
556
 ifeq ($(IS_MCU),1)
620
 ifeq ($(IS_MCU),1)
557
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
621
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
558
 
622
 
623
+  # Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
559
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
624
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
625
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial
626
+  # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
560
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
627
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
561
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
628
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
562
 endif
629
 endif
563
 
630
 
564
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
631
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
632
+
565
 ifeq ($(LIQUID_TWI2), 1)
633
 ifeq ($(LIQUID_TWI2), 1)
566
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
567
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
568
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
634
+  WIRE   = 1
635
+  VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
569
 endif
636
 endif
570
 ifeq ($(WIRE), 1)
637
 ifeq ($(WIRE), 1)
571
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
572
-VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
638
+  # Old libraries (avr-core 1.6.21 / Arduino < 1.6.8)
639
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire
640
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/utility
641
+  # New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
642
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src
643
+  VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src/utility
573
 endif
644
 endif
574
 ifeq ($(NEOPIXEL), 1)
645
 ifeq ($(NEOPIXEL), 1)
575
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
646
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
641
   LIB_CXXSRC += Wire.cpp
712
   LIB_CXXSRC += Wire.cpp
642
 endif
713
 endif
643
 
714
 
715
+ifeq ($(TONE), 1)
716
+  LIB_CXXSRC += Tone.cpp
717
+endif
718
+
644
 ifeq ($(U8GLIB), 1)
719
 ifeq ($(U8GLIB), 1)
645
   LIB_CXXSRC += U8glib.cpp
720
   LIB_CXXSRC += U8glib.cpp
646
-  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
721
+  LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c \
722
+    u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c \
723
+    u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
647
 endif
724
 endif
648
 
725
 
649
 ifeq ($(TMC), 1)
726
 ifeq ($(TMC), 1)
650
-  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
727
+  LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp \
728
+    CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp \
729
+    DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp \
730
+    SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp \
731
+    TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
651
 endif
732
 endif
652
 
733
 
653
 ifeq ($(RELOC_WORKAROUND), 1)
734
 ifeq ($(RELOC_WORKAROUND), 1)
689
 MV = mv -f
770
 MV = mv -f
690
 
771
 
691
 # Place -D or -U options here
772
 # Place -D or -U options here
692
-CDEFS    = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
773
+CDEFS    = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
693
 CXXDEFS  = $(CDEFS)
774
 CXXDEFS  = $(CDEFS)
694
 
775
 
695
 ifeq ($(HARDWARE_VARIANT), Teensy)
776
 ifeq ($(HARDWARE_VARIANT), Teensy)
696
-  CDEFS  += -DUSB_SERIAL
777
+  CDEFS      += -DUSB_SERIAL
697
   LIB_SRC    += usb.c pins_teensy.c
778
   LIB_SRC    += usb.c pins_teensy.c
698
   LIB_CXXSRC += usb_api.cpp
779
   LIB_CXXSRC += usb_api.cpp
699
 
780
 
700
 else ifeq ($(HARDWARE_VARIANT), archim)
781
 else ifeq ($(HARDWARE_VARIANT), archim)
701
-  CDEFS      += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
702
-  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
782
+  CDEFS      += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__
783
+  CDEFS      += -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON
784
+  CDEFS      += '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
785
+
786
+  LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp \
787
+    UARTClass.cpp  USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp \
788
+    PluggableUSB.cpp USBCore.cpp
789
+
703
   LIB_SRC    += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
790
   LIB_SRC    += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
704
 
791
 
705
   ifeq ($(U8GLIB), 1)
792
   ifeq ($(U8GLIB), 1)
725
 ifneq ($(HARDWARE_MOTHERBOARD),)
812
 ifneq ($(HARDWARE_MOTHERBOARD),)
726
   CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
813
   CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
727
 endif
814
 endif
815
+
728
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
816
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
729
 CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
817
 CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
730
 CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA)   $(CTUNING) $(CSTANDARD)
818
 CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA)   $(CTUNING) $(CSTANDARD)
731
 CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
819
 CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
732
 ASFLAGS :=          $(CDEFS)
820
 ASFLAGS :=          $(CDEFS)
733
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
821
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
822
+
734
 ifeq ($(HARDWARE_VARIANT), archim)
823
 ifeq ($(HARDWARE_VARIANT), archim)
735
   LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
824
   LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
736
   LD_SUFFIX = $(LDLIBS)
825
   LD_SUFFIX = $(LDLIBS)
737
-  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
826
+
827
+  LDFLAGS   = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty
828
+  LDFLAGS  += -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
738
 else
829
 else
739
   LD_PREFIX = -Wl,--gc-sections,--relax
830
   LD_PREFIX = -Wl,--gc-sections,--relax
740
   LDFLAGS   = -lm
831
   LDFLAGS   = -lm
750
   AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
841
   AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
751
 endif
842
 endif
752
 AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
843
 AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
753
-  -p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
844
+  -p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
754
   -b$(UPLOAD_RATE)
845
   -b$(UPLOAD_RATE)
755
 
846
 
756
 # Since Marlin 2.0, the source files may be distributed into several
847
 # Since Marlin 2.0, the source files may be distributed into several
851
 
942
 
852
 .elf.eep:
943
 .elf.eep:
853
 	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
944
 	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
854
-    --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
945
+	  --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
855
 
946
 
856
 # Create extended listing file from ELF output file.
947
 # Create extended listing file from ELF output file.
857
 .elf.lss:
948
 .elf.lss:
865
 
956
 
866
 $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
957
 $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
867
 	$(Pecho) "  CXX   $@"
958
 	$(Pecho) "  CXX   $@"
868
-	$P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
959
+	$P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
869
 
960
 
870
 # Object files that were found in "src" will be stored in $(BUILD_DIR)
961
 # Object files that were found in "src" will be stored in $(BUILD_DIR)
871
 # in directories that mirror the structure of "src"
962
 # in directories that mirror the structure of "src"

+ 4
- 4
buildroot/share/cmake/CMakeLists.txt View File

47
 #  cmake .. -DARDUINO_SDK_PATH="/path/to/arduino-1.x.x"              #
47
 #  cmake .. -DARDUINO_SDK_PATH="/path/to/arduino-1.x.x"              #
48
 #====================================================================#
48
 #====================================================================#
49
 #set(ARDUINO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}/arduino-1.6.8)
49
 #set(ARDUINO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}/arduino-1.6.8)
50
-#set(ARDUINO_SDK_PATH /home/tom/git/BigBox-Dual-Marlin/ArduinoAddons/Arduino_1.6.x)
51
-#set(ARDUINO_SDK_PATH  /home/tom/test/arduino-1.6.11)
50
+#set(ARDUINO_SDK_PATH /Applications/Arduino.app/Contents/Java)
51
+#set(ARDUINO_SDK_PATH $HOME/ArduinoAddons/Arduino_1.6.x)
52
 #====================================================================#
52
 #====================================================================#
53
 #  Set included cmake files                                          #
53
 #  Set included cmake files                                          #
54
 #====================================================================#
54
 #====================================================================#
96
 #  Include Marlin.ino to compile libs not included in *.cpp files    #
96
 #  Include Marlin.ino to compile libs not included in *.cpp files    #
97
 #====================================================================#
97
 #====================================================================#
98
 
98
 
99
-file(GLOB SOURCES "../../../src/*.cpp")
100
-set(${PROJECT_NAME}_SRCS "${SOURCES};../../../src/Marlin.ino")
99
+file(GLOB_RECURSE SOURCES "../../../Marlin/*.cpp")
100
+set(${PROJECT_NAME}_SRCS "${SOURCES};../../../Marlin/Marlin.ino")
101
 
101
 
102
 #====================================================================#
102
 #====================================================================#
103
 #  Define the port for uploading code to the Arduino                 #
103
 #  Define the port for uploading code to the Arduino                 #

Loading…
Cancel
Save