瀏覽代碼

Fix and improve Makefile / CMake (#19640)

Samantaz Fox 4 年之前
父節點
當前提交
b8700e0aa8
共有 2 個檔案被更改,包括 133 行新增42 行删除
  1. 129
    38
      Marlin/Makefile
  2. 4
    4
      buildroot/share/cmake/CMakeLists.txt

+ 129
- 38
Marlin/Makefile 查看文件

@@ -22,8 +22,10 @@
22 22
 #     (e.g. UPLOAD_PORT = /dev/tty.USB0).  If the exact name of this file
23 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 29
 #     or Diecimila have the atmega168.  If you're using a LilyPad Arduino,
28 30
 #     change F_CPU to 8000000. If you are using Gen7 electronics, you
29 31
 #     probably need to use 20000000. Either way, you must regenerate
@@ -34,18 +36,18 @@
34 36
 #  5. Type "make upload", reset your Arduino board, and press enter to
35 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 40
 # the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
39 41
 #
40 42
 # To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
41 43
 #
42 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 47
 # To compile and upload simply add "upload" to the end of the line...
46 48
 #
47 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 52
 # If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
51 53
 # start upload manually (using stk500) like so:
@@ -57,7 +59,26 @@
57 59
 #
58 60
 
59 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 83
 # Arduino source install directory, and version number
63 84
 # On most linuxes this will be /usr/share/arduino
@@ -67,32 +88,38 @@ ARDUINO_VERSION      ?= 106
67 88
 # The installed Libraries are in the User folder
68 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 93
 AVR_TOOLS_PATH ?=
72 94
 
73
-#Programmer configuration
95
+# Programmer configuration
74 96
 UPLOAD_RATE        ?= 57600
75 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 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 104
 BUILD_DIR          ?= applet
82 105
 
83 106
 # This defines whether Liquid_TWI2 support will be built
84 107
 LIQUID_TWI2        ?= 0
85 108
 
86
-# this defines if Wire is needed
109
+# This defines if Wire is needed
87 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 123
 NEOPIXEL           ?= 0
97 124
 
98 125
 ############
@@ -208,7 +235,8 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1119)
208 235
 else ifeq ($(HARDWARE_MOTHERBOARD),1120)
209 236
 # Ultimaker (Older electronics. Pre 1.5.4. This is rare)
210 237
 else ifeq ($(HARDWARE_MOTHERBOARD),1121)
211
-  MCU ?= atmega1280
238
+  MCU              ?= atmega1280
239
+  PROG_MCU         ?= m1280
212 240
 
213 241
 # Azteeg X3
214 242
 else ifeq ($(HARDWARE_MOTHERBOARD),1122)
@@ -350,9 +378,11 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1320)
350 378
 # Minitronics v1.0/1.1
351 379
 else ifeq ($(HARDWARE_MOTHERBOARD),1400)
352 380
   MCU              ?= atmega1281
381
+  PROG_MCU         ?= m1281
353 382
 # Silvergate v1.0
354 383
 else ifeq ($(HARDWARE_MOTHERBOARD),1401)
355 384
   MCU              ?= atmega1281
385
+  PROG_MCU         ?= m1281
356 386
 
357 387
 #
358 388
 # Sanguinololu and Derivatives - ATmega644P, ATmega1284P
@@ -362,46 +392,57 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1401)
362 392
 else ifeq ($(HARDWARE_MOTHERBOARD),1500)
363 393
   HARDWARE_VARIANT ?= Sanguino
364 394
   MCU              ?= atmega644p
395
+  PROG_MCU         ?= m644p
365 396
 # Sanguinololu 1.2 and above
366 397
 else ifeq ($(HARDWARE_MOTHERBOARD),1501)
367 398
   HARDWARE_VARIANT ?= Sanguino
368 399
   MCU              ?= atmega644p
400
+  PROG_MCU         ?= m644p
369 401
 # Melzi
370 402
 else ifeq ($(HARDWARE_MOTHERBOARD),1502)
371 403
   HARDWARE_VARIANT ?= Sanguino
372 404
   MCU              ?= atmega644p
405
+  PROG_MCU         ?= m644p
373 406
 # Melzi V2.0
374 407
 else ifeq ($(HARDWARE_MOTHERBOARD),1503)
375 408
   HARDWARE_VARIANT ?= Sanguino
376 409
   MCU              ?= atmega1284p
410
+  PROG_MCU         ?= m1284p
377 411
 # Melzi with ATmega1284 (MaKr3d version)
378 412
 else ifeq ($(HARDWARE_MOTHERBOARD),1504)
379 413
   HARDWARE_VARIANT ?= Sanguino
380 414
   MCU              ?= atmega1284p
415
+  PROG_MCU         ?= m1284p
381 416
 # Melzi Creality3D board (for CR-10 etc)
382 417
 else ifeq ($(HARDWARE_MOTHERBOARD),1505)
383 418
   HARDWARE_VARIANT ?= Sanguino
384 419
   MCU              ?= atmega1284p
420
+  PROG_MCU         ?= m1284p
385 421
 # Melzi Malyan M150 board
386 422
 else ifeq ($(HARDWARE_MOTHERBOARD),1506)
387 423
   HARDWARE_VARIANT ?= Sanguino
388 424
   MCU              ?= atmega1284p
425
+  PROG_MCU         ?= m1284p
389 426
 # Tronxy X5S
390 427
 else ifeq ($(HARDWARE_MOTHERBOARD),1507)
391 428
   HARDWARE_VARIANT ?= Sanguino
392 429
   MCU              ?= atmega1284p
430
+  PROG_MCU         ?= m1284p
393 431
 # STB V1.1
394 432
 else ifeq ($(HARDWARE_MOTHERBOARD),1508)
395 433
   HARDWARE_VARIANT ?= Sanguino
396 434
   MCU              ?= atmega1284p
435
+  PROG_MCU         ?= m1284p
397 436
 # Azteeg X1
398 437
 else ifeq ($(HARDWARE_MOTHERBOARD),1509)
399 438
   HARDWARE_VARIANT ?= Sanguino
400 439
   MCU              ?= atmega1284p
440
+  PROG_MCU         ?= m1284p
401 441
 # Anet 1.0 (Melzi clone)
402 442
 else ifeq ($(HARDWARE_MOTHERBOARD),1510)
403 443
   HARDWARE_VARIANT ?= Sanguino
404 444
   MCU              ?= atmega1284p
445
+  PROG_MCU         ?= m1284p
405 446
 
406 447
 #
407 448
 # Other ATmega644P, ATmega644, ATmega1284P
@@ -411,50 +452,61 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1510)
411 452
 else ifeq ($(HARDWARE_MOTHERBOARD),1600)
412 453
   HARDWARE_VARIANT ?= Sanguino
413 454
   MCU              ?= atmega644p
455
+  PROG_MCU         ?= m644p
414 456
 # Gen3+
415 457
 else ifeq ($(HARDWARE_MOTHERBOARD),1601)
416 458
   HARDWARE_VARIANT ?= Sanguino
417 459
   MCU              ?= atmega644p
460
+  PROG_MCU         ?= m644p
418 461
 # Gen6
419 462
 else ifeq ($(HARDWARE_MOTHERBOARD),1602)
420 463
   HARDWARE_VARIANT ?= Gen6
421 464
   MCU              ?= atmega644p
465
+  PROG_MCU         ?= m644p
422 466
 # Gen6 deluxe
423 467
 else ifeq ($(HARDWARE_MOTHERBOARD),1603)
424 468
   HARDWARE_VARIANT ?= Gen6
425 469
   MCU              ?= atmega644p
470
+  PROG_MCU         ?= m644p
426 471
 # Gen7 custom (Alfons3 Version)
427 472
 else ifeq ($(HARDWARE_MOTHERBOARD),1604)
428 473
   HARDWARE_VARIANT ?= Gen7
429 474
   MCU              ?= atmega644
475
+  PROG_MCU         ?= m644
430 476
   F_CPU            ?= 20000000
431 477
 # Gen7 v1.1, v1.2
432 478
 else ifeq ($(HARDWARE_MOTHERBOARD),1605)
433 479
   HARDWARE_VARIANT ?= Gen7
434 480
   MCU              ?= atmega644p
481
+  PROG_MCU         ?= m644p
435 482
   F_CPU            ?= 20000000
436 483
 # Gen7 v1.3
437 484
 else ifeq ($(HARDWARE_MOTHERBOARD),1606)
438 485
   HARDWARE_VARIANT ?= Gen7
439 486
   MCU              ?= atmega644p
487
+  PROG_MCU         ?= m644p
440 488
   F_CPU            ?= 20000000
441 489
 # Gen7 v1.4
442 490
 else ifeq ($(HARDWARE_MOTHERBOARD),1607)
443 491
   HARDWARE_VARIANT ?= Gen7
444 492
   MCU              ?= atmega1284p
493
+  PROG_MCU         ?= m1284p
445 494
   F_CPU            ?= 20000000
446 495
 # Alpha OMCA board
447 496
 else ifeq ($(HARDWARE_MOTHERBOARD),1608)
448 497
   HARDWARE_VARIANT ?= SanguinoA
449 498
   MCU              ?= atmega644
499
+  PROG_MCU         ?= m644
450 500
 # Final OMCA board
451 501
 else ifeq ($(HARDWARE_MOTHERBOARD),1609)
452 502
   HARDWARE_VARIANT ?= Sanguino
453 503
   MCU              ?= atmega644p
504
+  PROG_MCU         ?= m644p
454 505
 # Sethi 3D_1
455 506
 else ifeq ($(HARDWARE_MOTHERBOARD),1610)
456 507
   HARDWARE_VARIANT ?= Sanguino
457 508
   MCU              ?= atmega644p
509
+  PROG_MCU         ?= m644p
458 510
 
459 511
 #
460 512
 # Teensyduino - AT90USB1286, AT90USB1286P
@@ -464,51 +516,60 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1610)
464 516
 else ifeq ($(HARDWARE_MOTHERBOARD),1700)
465 517
   HARDWARE_VARIANT ?= Teensy
466 518
   MCU              ?= at90usb1286
519
+  PROG_MCU         ?= usb1286
467 520
 # Printrboard (AT90USB1286)
468 521
 else ifeq ($(HARDWARE_MOTHERBOARD),1701)
469 522
   HARDWARE_VARIANT ?= Teensy
470 523
   MCU              ?= at90usb1286
524
+  PROG_MCU         ?= usb1286
471 525
 # Printrboard Revision F (AT90USB1286)
472 526
 else ifeq ($(HARDWARE_MOTHERBOARD),1702)
473 527
   HARDWARE_VARIANT ?= Teensy
474 528
   MCU              ?= at90usb1286
529
+  PROG_MCU         ?= usb1286
475 530
 # Brainwave (AT90USB646)
476 531
 else ifeq ($(HARDWARE_MOTHERBOARD),1703)
477 532
   HARDWARE_VARIANT ?= Teensy
478 533
   MCU              ?= at90usb646
534
+  PROG_MCU         ?= usb646
479 535
 # Brainwave Pro (AT90USB1286)
480 536
 else ifeq ($(HARDWARE_MOTHERBOARD),1704)
481 537
   HARDWARE_VARIANT ?= Teensy
482 538
   MCU              ?= at90usb1286
539
+  PROG_MCU         ?= usb1286
483 540
 # SAV Mk-I (AT90USB1286)
484 541
 else ifeq ($(HARDWARE_MOTHERBOARD),1705)
485 542
   HARDWARE_VARIANT ?= Teensy
486 543
   MCU              ?= at90usb1286
544
+  PROG_MCU         ?= usb1286
487 545
 # Teensy++2.0 (AT90USB1286)
488 546
 else ifeq ($(HARDWARE_MOTHERBOARD),1706)
489 547
   HARDWARE_VARIANT ?= Teensy
490 548
   MCU              ?= at90usb1286
549
+  PROG_MCU         ?= usb1286
491 550
 # 5DPrint D8 Driver Board
492 551
 else ifeq ($(HARDWARE_MOTHERBOARD),1707)
493 552
   HARDWARE_VARIANT ?= Teensy
494 553
   MCU              ?= at90usb1286
554
+  PROG_MCU         ?= usb1286
495 555
 
496 556
 # UltiMachine Archim1 (with DRV8825 drivers)
497 557
 else ifeq ($(HARDWARE_MOTHERBOARD),3023)
498 558
   HARDWARE_VARIANT ?= archim
499 559
   MCPU              = cortex-m3
500
-  F_CPU             = 84000000L
560
+  F_CPU             = 84000000
501 561
   IS_MCU            = 0
502 562
 # UltiMachine Archim2 (with TMC2130 drivers)
503 563
 else ifeq ($(HARDWARE_MOTHERBOARD),3024)
504 564
   HARDWARE_VARIANT ?= archim
505 565
   MCPU              = cortex-m3
506
-  F_CPU             = 84000000L
566
+  F_CPU             = 84000000
507 567
   IS_MCU            = 0
508 568
 endif
509 569
 
510 570
 # Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
511 571
 # if you are setting this to something other than 16MHz
572
+# Do not put the UL suffix, it's done later on.
512 573
 # Set to 16Mhz if not yet set.
513 574
 F_CPU ?= 16000000
514 575
 
@@ -518,7 +579,8 @@ IS_MCU ?= 1
518 579
 ifeq ($(IS_MCU),1)
519 580
   # Set to arduino, ATmega2560 if not yet set.
520 581
   HARDWARE_VARIANT ?= arduino
521
-  MCU ?= atmega2560
582
+  MCU              ?= atmega2560
583
+  PROG_MCU         ?= m2560
522 584
 
523 585
   TOOL_PREFIX = avr
524 586
   MCU_FLAGS   = -mmcu=$(MCU)
@@ -549,27 +611,36 @@ VPATH += $(BUILD_DIR)
549 611
 VPATH += $(HARDWARE_SRC)
550 612
 
551 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 618
 endif
555 619
 
556 620
 ifeq ($(IS_MCU),1)
557 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 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 627
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
561 628
   VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
562 629
 endif
563 630
 
564 631
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
632
+
565 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 636
 endif
570 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 644
 endif
574 645
 ifeq ($(NEOPIXEL), 1)
575 646
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
@@ -641,13 +712,23 @@ ifeq ($(WIRE), 1)
641 712
   LIB_CXXSRC += Wire.cpp
642 713
 endif
643 714
 
715
+ifeq ($(TONE), 1)
716
+  LIB_CXXSRC += Tone.cpp
717
+endif
718
+
644 719
 ifeq ($(U8GLIB), 1)
645 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 724
 endif
648 725
 
649 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 732
 endif
652 733
 
653 734
 ifeq ($(RELOC_WORKAROUND), 1)
@@ -689,17 +770,23 @@ REMOVE = rm -f
689 770
 MV = mv -f
690 771
 
691 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 774
 CXXDEFS  = $(CDEFS)
694 775
 
695 776
 ifeq ($(HARDWARE_VARIANT), Teensy)
696
-  CDEFS  += -DUSB_SERIAL
777
+  CDEFS      += -DUSB_SERIAL
697 778
   LIB_SRC    += usb.c pins_teensy.c
698 779
   LIB_CXXSRC += usb_api.cpp
699 780
 
700 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 790
   LIB_SRC    += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
704 791
 
705 792
   ifeq ($(U8GLIB), 1)
@@ -725,16 +812,20 @@ CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
725 812
 ifneq ($(HARDWARE_MOTHERBOARD),)
726 813
   CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
727 814
 endif
815
+
728 816
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
729 817
 CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
730 818
 CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA)   $(CTUNING) $(CSTANDARD)
731 819
 CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
732 820
 ASFLAGS :=          $(CDEFS)
733 821
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
822
+
734 823
 ifeq ($(HARDWARE_VARIANT), archim)
735 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 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 829
 else
739 830
   LD_PREFIX = -Wl,--gc-sections,--relax
740 831
   LDFLAGS   = -lm
@@ -750,7 +841,7 @@ else
750 841
   AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
751 842
 endif
752 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 845
   -b$(UPLOAD_RATE)
755 846
 
756 847
 # Since Marlin 2.0, the source files may be distributed into several
@@ -851,7 +942,7 @@ extcoff: $(TARGET).elf
851 942
 
852 943
 .elf.eep:
853 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 947
 # Create extended listing file from ELF output file.
857 948
 .elf.lss:
@@ -865,7 +956,7 @@ extcoff: $(TARGET).elf
865 956
 
866 957
 $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
867 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 961
 # Object files that were found in "src" will be stored in $(BUILD_DIR)
871 962
 # in directories that mirror the structure of "src"

+ 4
- 4
buildroot/share/cmake/CMakeLists.txt 查看文件

@@ -47,8 +47,8 @@ set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/marlin-cma
47 47
 #  cmake .. -DARDUINO_SDK_PATH="/path/to/arduino-1.x.x"              #
48 48
 #====================================================================#
49 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 53
 #  Set included cmake files                                          #
54 54
 #====================================================================#
@@ -96,8 +96,8 @@ setup_motherboard(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/../../../Marlin)
96 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 103
 #  Define the port for uploading code to the Arduino                 #

Loading…
取消
儲存