2018-04-02 01:21:33 +02:00
|
|
|
# Marlin Firmware Arduino Project Makefile
|
2013-06-07 00:49:25 +02:00
|
|
|
#
|
2012-01-24 03:18:54 +01:00
|
|
|
# Makefile Based on:
|
|
|
|
# Arduino 0011 Makefile
|
|
|
|
# Arduino adaptation by mellis, eighthave, oli.keller
|
2012-11-11 11:05:52 +01:00
|
|
|
# Marlin adaption by Daid
|
2018-04-03 02:36:27 +02:00
|
|
|
# Marlin 2.0 support and RELOC_WORKAROUND by @marcio-ao
|
2012-01-24 03:18:54 +01:00
|
|
|
#
|
|
|
|
# This has been tested with Arduino 0022.
|
2013-06-07 00:49:25 +02:00
|
|
|
#
|
2012-01-24 03:18:54 +01:00
|
|
|
# This makefile allows you to build sketches from the command line
|
|
|
|
# without the Arduino environment (or Java).
|
|
|
|
#
|
|
|
|
# Detailed instructions for using the makefile:
|
|
|
|
#
|
2016-03-06 05:41:15 +01:00
|
|
|
# 1. Modify the line containing "ARDUINO_INSTALL_DIR" to point to the directory that
|
2012-01-24 03:18:54 +01:00
|
|
|
# contains the Arduino installation (for example, under Mac OS X, this
|
2014-01-16 16:58:35 +01:00
|
|
|
# might be /Applications/Arduino.app/Contents/Resources/Java).
|
2012-01-24 03:18:54 +01:00
|
|
|
#
|
2012-11-11 11:05:52 +01:00
|
|
|
# 2. Modify the line containing "UPLOAD_PORT" to refer to the filename
|
2012-01-24 03:18:54 +01:00
|
|
|
# representing the USB or serial connection to your Arduino board
|
2012-11-11 11:05:52 +01:00
|
|
|
# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
|
2016-03-06 05:41:15 +01:00
|
|
|
# changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
|
2012-01-24 03:18:54 +01:00
|
|
|
#
|
2013-06-07 00:49:25 +02:00
|
|
|
# 3. Set the line containing "MCU" to match your board's processor.
|
2012-01-24 03:18:54 +01:00
|
|
|
# Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
|
|
|
# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
|
2012-03-08 00:05:10 +01:00
|
|
|
# change F_CPU to 8000000. If you are using Gen7 electronics, you
|
|
|
|
# probably need to use 20000000. Either way, you must regenerate
|
|
|
|
# the speed lookup table with create_speed_lookuptable.py.
|
2012-01-24 03:18:54 +01:00
|
|
|
#
|
|
|
|
# 4. Type "make" and press enter to compile/verify your program.
|
|
|
|
#
|
|
|
|
# 5. Type "make upload", reset your Arduino board, and press enter to
|
|
|
|
# upload your program to the Arduino board.
|
|
|
|
#
|
2016-08-31 22:10:53 +02:00
|
|
|
# Note that all settings at the top of this file can be overriden from
|
|
|
|
# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
|
|
|
|
#
|
|
|
|
# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
|
|
|
|
#
|
|
|
|
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
|
|
|
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
|
|
|
|
#
|
|
|
|
# To compile and upload simply add "upload" to the end of the line...
|
|
|
|
#
|
|
|
|
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
|
|
|
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
|
2017-03-18 09:17:39 +01:00
|
|
|
#
|
2016-08-31 22:10:53 +02:00
|
|
|
# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
|
|
|
|
# start upload manually (using stk500) like so:
|
|
|
|
#
|
|
|
|
# avrdude -C /root/arduino/hardware/tools/avr/etc/avrdude.conf -v -p m2560 -c stk500 \
|
|
|
|
# -U flash:w:applet/Marlin.hex:i -P /dev/ttyUSB0
|
|
|
|
#
|
|
|
|
# Or, try disconnecting USB to power down and then reconnecting before running avrdude.
|
|
|
|
#
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2016-08-31 22:10:53 +02:00
|
|
|
# This defines the board to compile for (see boards.h for your board's ID)
|
2012-11-11 11:05:52 +01:00
|
|
|
HARDWARE_MOTHERBOARD ?= 11
|
2012-01-25 10:46:27 +01:00
|
|
|
|
2012-11-11 11:05:52 +01:00
|
|
|
# Arduino source install directory, and version number
|
2015-01-13 06:01:43 +01:00
|
|
|
# On most linuxes this will be /usr/share/arduino
|
2016-03-06 20:12:01 +01:00
|
|
|
ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
|
|
|
|
ARDUINO_VERSION ?= 106
|
2012-03-22 14:48:10 +01:00
|
|
|
|
2018-04-13 03:14:01 +02:00
|
|
|
# The installed Libraries are in the User folder
|
|
|
|
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
|
|
|
|
2012-11-11 11:05:52 +01:00
|
|
|
# You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
|
2013-06-07 00:49:25 +02:00
|
|
|
AVR_TOOLS_PATH ?=
|
2012-11-11 11:05:52 +01:00
|
|
|
|
|
|
|
#Programmer configuration
|
2016-03-06 20:12:01 +01:00
|
|
|
UPLOAD_RATE ?= 57600
|
|
|
|
AVRDUDE_PROGRAMMER ?= arduino
|
2017-03-18 09:17:39 +01:00
|
|
|
# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
|
2016-03-06 20:12:01 +01:00
|
|
|
UPLOAD_PORT ?= /dev/ttyUSB0
|
2012-11-11 11:05:52 +01:00
|
|
|
|
2015-01-13 06:01:43 +01:00
|
|
|
#Directory used to build files in, contains all the build files, from object files to the final hex file
|
|
|
|
#on linux it is best to put an absolute path like /home/username/tmp .
|
2012-11-11 11:05:52 +01:00
|
|
|
BUILD_DIR ?= applet
|
|
|
|
|
2013-07-24 12:09:53 +02:00
|
|
|
# This defines whether Liquid_TWI2 support will be built
|
2014-02-05 10:47:12 +01:00
|
|
|
LIQUID_TWI2 ?= 0
|
|
|
|
|
|
|
|
# this defines if Wire is needed
|
|
|
|
WIRE ?= 0
|
2013-07-24 12:09:53 +02:00
|
|
|
|
2017-07-27 15:46:27 +02:00
|
|
|
# this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
|
|
|
|
U8GLIB ?= 1
|
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
# this defines whether to include the Trinamic TMC2630Stepper
|
|
|
|
TMC2630 ?= 1
|
|
|
|
|
|
|
|
############
|
|
|
|
# Try to automatically determine whether RELOC_WORKAROUND is needed based
|
|
|
|
# on GCC versions:
|
|
|
|
# http://www.avrfreaks.net/comment/1789106#comment-1789106
|
|
|
|
|
|
|
|
CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ )
|
|
|
|
CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ )
|
|
|
|
CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d\ )
|
|
|
|
CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) )))
|
|
|
|
ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1)
|
|
|
|
@echo This version of GCC is likely broken. Enabling relocation workaround.
|
|
|
|
RELOC_WORKAROUND = 1
|
|
|
|
endif
|
2017-07-27 15:46:27 +02:00
|
|
|
|
2012-11-11 11:05:52 +01:00
|
|
|
############################################################################
|
|
|
|
# Below here nothing should be changed...
|
|
|
|
|
|
|
|
# Here the Arduino variant is selected by the board type
|
|
|
|
# HARDWARE_VARIANT = "arduino", "Sanguino", "Gen7", ...
|
|
|
|
# MCU = "atmega1280", "Mega2560", "atmega2560", "atmega644p", ...
|
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
ifeq ($(HARDWARE_MOTHERBOARD),0)
|
2012-11-11 11:05:52 +01:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
# No motherboard selected
|
2018-04-02 01:21:33 +02:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
#
|
|
|
|
# RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560
|
|
|
|
#
|
2012-11-11 11:05:52 +01:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
# MEGA/RAMPS up to 1.2
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),3)
|
|
|
|
|
|
|
|
# RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),33)
|
|
|
|
# RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),34)
|
|
|
|
# RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),35)
|
|
|
|
# RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),36)
|
|
|
|
# RAMPS 1.3 (Power outputs: Spindle, Controller Fan)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),38)
|
|
|
|
|
|
|
|
# RAMPS 1.4 (Power outputs: Hotend, Fan, Bed)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),43)
|
|
|
|
# RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),44)
|
|
|
|
# RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),45)
|
|
|
|
# RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),46)
|
|
|
|
# RAMPS 1.4 (Power outputs: Spindle, Controller Fan)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),48)
|
|
|
|
|
|
|
|
# RAMPS Plus 3DYMY (Power outputs: Hotend, Fan, Bed)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),143)
|
|
|
|
# RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Bed)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),144)
|
|
|
|
# RAMPS Plus 3DYMY (Power outputs: Hotend, Fan0, Fan1)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),145)
|
|
|
|
# RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),146)
|
|
|
|
# RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),148)
|
2018-04-02 01:21:33 +02:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
#
|
|
|
|
# RAMPS Derivatives - ATmega1280, ATmega2560
|
|
|
|
#
|
|
|
|
|
|
|
|
# 3Drag Controller
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),77)
|
|
|
|
# Velleman K8200 Controller (derived from 3Drag Controller)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),78)
|
|
|
|
# Velleman K8400 Controller (derived from 3Drag Controller)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),79)
|
|
|
|
# 2PrintBeta BAM&DICE with STK drivers
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),401)
|
|
|
|
# 2PrintBeta BAM&DICE Due with STK drivers
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),402)
|
|
|
|
# MKS BASE v1.0
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),40)
|
|
|
|
# MKS v1.5 with Allegro A4982 stepper drivers
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),405)
|
|
|
|
# MKS BASE 1.0 with Heroic HR4982 stepper drivers
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),41)
|
|
|
|
# MKS GEN v1.3 or 1.4
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),47)
|
|
|
|
# MKS GEN L
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),53)
|
|
|
|
# zrib V2.0 control board (Chinese knock off RAMPS replica)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),504)
|
|
|
|
# Felix 2.0+ Electronics Board (RAMPS like)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),37)
|
|
|
|
# Invent-A-Part RigidBoard
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),42)
|
|
|
|
# Invent-A-Part RigidBoard V2
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),52)
|
|
|
|
# Sainsmart 2-in-1 board
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),49)
|
|
|
|
# Ultimaker
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),7)
|
|
|
|
# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),71)
|
|
|
|
MCU ?= atmega1280
|
|
|
|
# Azteeg X3
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),67)
|
|
|
|
# Azteeg X3 Pro
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),68)
|
|
|
|
# Ultimainboard 2.x (Uses TEMP_SENSOR 20)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),72)
|
|
|
|
# Rumba
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),80)
|
|
|
|
# bq ZUM Mega 3D
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),503)
|
|
|
|
# MakeBoard Mini v2.1.2 is a control board sold by MicroMake
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),431)
|
|
|
|
# TriGorilla Anycubic version 1.3 based on RAMPS EFB
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),343)
|
|
|
|
# TriGorilla Anycubic version 1.4 based on RAMPS EFB
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),443)
|
|
|
|
# Creality: Ender-4, CR-8
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),243)
|
2012-11-11 11:05:52 +01:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
#
|
|
|
|
# Other ATmega1280, ATmega2560
|
|
|
|
#
|
|
|
|
|
|
|
|
# Cartesio CN Controls V11
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),111)
|
|
|
|
# Cartesio CN Controls V12
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),112)
|
|
|
|
# Cheaptronic v1.0
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),2)
|
|
|
|
# Cheaptronic v2.0
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),21)
|
|
|
|
# Makerbot Mightyboard Revision E
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),200)
|
|
|
|
# Megatronics
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),70)
|
|
|
|
# Megatronics v2.0
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),701)
|
|
|
|
# Megatronics v3.0
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),703)
|
|
|
|
# Megatronics v3.1
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),704)
|
|
|
|
# Rambo
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),301)
|
|
|
|
# Mini-Rambo
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),302)
|
|
|
|
# Mini-Rambo 1.0a
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),303)
|
|
|
|
# Einsy Rambo
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),304)
|
|
|
|
# Einsy Retro
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),305)
|
|
|
|
# Elefu Ra Board (v3)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),21)
|
|
|
|
# Leapfrog
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),999)
|
|
|
|
# Mega controller
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),310)
|
|
|
|
# abee Scoovo X9H
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),321)
|
|
|
|
# Geeetech GT2560 Rev. A
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),74)
|
|
|
|
# Geeetech GT2560 Rev. A+ (with auto level probe)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),75)
|
|
|
|
|
|
|
|
#
|
|
|
|
# ATmega1281, ATmega2561
|
|
|
|
#
|
|
|
|
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),702)
|
|
|
|
MCU ?= atmega1281
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),25)
|
|
|
|
MCU ?= atmega1281
|
|
|
|
|
|
|
|
#
|
|
|
|
# Sanguinololu and Derivatives - ATmega644P, ATmega1284P
|
|
|
|
#
|
|
|
|
|
|
|
|
# Sanguinololu < 1.2
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),6)
|
2012-11-11 11:05:52 +01:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
2012-12-09 23:02:03 +01:00
|
|
|
MCU ?= atmega644p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Sanguinololu 1.2 and above
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),62)
|
2012-11-11 11:05:52 +01:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
2012-12-09 23:02:03 +01:00
|
|
|
MCU ?= atmega644p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Melzi
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),63)
|
2012-11-11 11:05:52 +01:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
2012-12-09 23:02:03 +01:00
|
|
|
MCU ?= atmega644p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Melzi with ATmega1284 (MaKr3d version)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),66)
|
2018-04-02 01:21:33 +02:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Melzi Creality3D board (for CR-10 etc)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),89)
|
2013-07-14 10:17:55 +02:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Melzi Malyan M150 board
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),92)
|
2013-07-14 10:17:55 +02:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Tronxy X5S
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),505)
|
2016-03-06 20:12:01 +01:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
# STB V1.1
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),64)
|
2018-04-02 01:21:33 +02:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Azteeg X1
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),65)
|
2018-04-02 01:21:33 +02:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
# Anet 1.0 (Melzi clone)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),69)
|
2018-04-02 01:21:33 +02:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Other ATmega644P, ATmega644, ATmega1284P
|
|
|
|
#
|
|
|
|
|
|
|
|
# Gen3 Monolithic Electronics
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),22)
|
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega644p
|
|
|
|
# Gen3+
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),9)
|
2018-01-15 10:14:23 +01:00
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
2018-04-20 23:09:52 +02:00
|
|
|
MCU ?= atmega644p
|
|
|
|
# Gen6
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),5)
|
|
|
|
HARDWARE_VARIANT ?= Gen6
|
|
|
|
MCU ?= atmega644p
|
|
|
|
# Gen6 deluxe
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),51)
|
|
|
|
HARDWARE_VARIANT ?= Gen6
|
|
|
|
MCU ?= atmega644p
|
|
|
|
# Gen7 custom (Alfons3 Version)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),10)
|
|
|
|
HARDWARE_VARIANT ?= Gen7
|
|
|
|
MCU ?= atmega644
|
|
|
|
F_CPU ?= 20000000
|
|
|
|
# Gen7 v1.1, v1.2
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),11)
|
|
|
|
HARDWARE_VARIANT ?= Gen7
|
|
|
|
MCU ?= atmega644p
|
|
|
|
F_CPU ?= 20000000
|
|
|
|
# Gen7 v1.3
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),12)
|
|
|
|
HARDWARE_VARIANT ?= Gen7
|
|
|
|
MCU ?= atmega644p
|
|
|
|
F_CPU ?= 20000000
|
|
|
|
# Gen7 v1.4
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),13)
|
|
|
|
HARDWARE_VARIANT ?= Gen7
|
2018-01-15 10:14:23 +01:00
|
|
|
MCU ?= atmega1284p
|
2018-04-20 23:09:52 +02:00
|
|
|
F_CPU ?= 20000000
|
|
|
|
# Alpha OMCA board
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),90)
|
|
|
|
HARDWARE_VARIANT ?= SanguinoA
|
|
|
|
MCU ?= atmega644
|
|
|
|
# Final OMCA board
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),91)
|
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega644p
|
|
|
|
# Sethi 3D_1
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),20)
|
|
|
|
HARDWARE_VARIANT ?= Sanguino
|
|
|
|
MCU ?= atmega644p
|
2012-11-11 11:05:52 +01:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
#
|
|
|
|
# Teensyduino - AT90USB1286, AT90USB1286P
|
|
|
|
#
|
2018-04-02 01:21:33 +02:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
# Teensylu
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),8)
|
2012-12-13 11:41:27 +01:00
|
|
|
HARDWARE_VARIANT ?= Teensy
|
2012-11-11 11:05:52 +01:00
|
|
|
MCU ?= at90usb1286
|
2018-04-20 23:09:52 +02:00
|
|
|
# Printrboard (AT90USB1286)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),81)
|
2012-12-13 11:41:27 +01:00
|
|
|
HARDWARE_VARIANT ?= Teensy
|
2012-12-09 23:30:55 +01:00
|
|
|
MCU ?= at90usb1286
|
2018-04-20 23:09:52 +02:00
|
|
|
# Printrboard Revision F (AT90USB1286)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),811)
|
2016-03-10 23:33:53 +01:00
|
|
|
HARDWARE_VARIANT ?= Teensy
|
|
|
|
MCU ?= at90usb1286
|
2018-04-20 23:09:52 +02:00
|
|
|
# Brainwave (AT90USB646)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),82)
|
2012-12-13 11:41:27 +01:00
|
|
|
HARDWARE_VARIANT ?= Teensy
|
2012-12-09 23:30:55 +01:00
|
|
|
MCU ?= at90usb646
|
2018-04-20 23:09:52 +02:00
|
|
|
# Brainwave Pro (AT90USB1286)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),83)
|
2014-01-16 16:58:35 +01:00
|
|
|
HARDWARE_VARIANT ?= Teensy
|
|
|
|
MCU ?= at90usb1286
|
2018-04-20 23:09:52 +02:00
|
|
|
# SAV Mk-I (AT90USB1286)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),84)
|
2014-01-16 16:58:35 +01:00
|
|
|
HARDWARE_VARIANT ?= Teensy
|
|
|
|
MCU ?= at90usb1286
|
2018-04-20 23:09:52 +02:00
|
|
|
# Teensy++2.0 (AT90USB1286)
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),85)
|
|
|
|
HARDWARE_VARIANT ?= Teensy
|
|
|
|
MCU ?= at90usb1286
|
|
|
|
# 5DPrint D8 Driver Board
|
|
|
|
else ifeq ($(HARDWARE_MOTHERBOARD),88)
|
2018-04-02 01:21:33 +02:00
|
|
|
HARDWARE_VARIANT ?= Teensy
|
|
|
|
MCU ?= at90usb1286
|
2014-02-05 10:47:12 +01:00
|
|
|
|
2012-11-11 11:05:52 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
|
|
|
|
# if you are setting this to something other than 16MHz
|
|
|
|
# Set to 16Mhz if not yet set.
|
|
|
|
F_CPU ?= 16000000
|
2012-03-22 14:48:10 +01:00
|
|
|
|
2018-04-20 23:09:52 +02:00
|
|
|
# Set to arduino, ATmega2560 if not yet set.
|
|
|
|
HARDWARE_VARIANT ?= arduino
|
|
|
|
MCU ?= atmega2560
|
|
|
|
|
2016-03-06 05:41:15 +01:00
|
|
|
# Arduino contained the main source code for the Arduino
|
2012-03-22 14:48:10 +01:00
|
|
|
# Libraries, the "hardware variant" are for boards
|
|
|
|
# that derives from that, and their source are present in
|
|
|
|
# the main Marlin source directory
|
2012-12-13 11:41:27 +01:00
|
|
|
|
2012-01-25 10:46:27 +01:00
|
|
|
TARGET = $(notdir $(CURDIR))
|
|
|
|
|
2012-03-22 14:48:10 +01:00
|
|
|
# VPATH tells make to look into these directory for source files,
|
|
|
|
# there is no need to specify explicit pathnames as long as the
|
|
|
|
# directory is added here
|
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
# The Makefile for previous versions of Marlin used VPATH for all
|
|
|
|
# source files, but for Marlin 2.0, we use VPATH only for arduino
|
|
|
|
# library files.
|
|
|
|
|
2012-03-22 14:48:10 +01:00
|
|
|
VPATH = .
|
2012-11-11 11:05:52 +01:00
|
|
|
VPATH += $(BUILD_DIR)
|
2018-04-13 03:14:01 +02:00
|
|
|
VPATH += $(HARDWARE_SRC)
|
|
|
|
|
|
|
|
# U8glib
|
|
|
|
VPATH += $(ARDUINO_USER_DIR)/libraries/U8glib
|
|
|
|
VPATH += $(ARDUINO_USER_DIR)/libraries/U8glib/clib
|
|
|
|
|
|
|
|
ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
|
|
|
|
endif
|
|
|
|
|
2017-03-08 04:11:21 +01:00
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
|
|
|
|
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
2016-08-31 22:10:53 +02:00
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
|
2013-07-24 12:09:53 +02:00
|
|
|
ifeq ($(LIQUID_TWI2), 1)
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
|
|
|
|
endif
|
2014-02-05 10:47:12 +01:00
|
|
|
ifeq ($(WIRE), 1)
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
|
|
|
endif
|
2017-07-13 17:01:21 +02:00
|
|
|
ifeq ($(NEOPIXEL), 1)
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
|
|
|
|
endif
|
2017-07-27 15:46:27 +02:00
|
|
|
ifeq ($(U8GLIB), 1)
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib
|
2018-04-03 02:36:27 +02:00
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/U8glib/clib
|
|
|
|
endif
|
|
|
|
ifeq ($(TMC2630), 1)
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMC2130Stepper/src
|
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/TMC2130Stepper/src/source
|
2017-07-27 15:46:27 +02:00
|
|
|
endif
|
2017-03-08 04:11:21 +01:00
|
|
|
|
2012-11-24 11:46:31 +01:00
|
|
|
ifeq ($(HARDWARE_VARIANT), arduino)
|
2012-12-09 19:19:57 +01:00
|
|
|
HARDWARE_SUB_VARIANT ?= mega
|
2016-08-31 22:10:53 +02:00
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
|
2013-01-07 17:26:50 +01:00
|
|
|
else
|
2016-03-06 20:12:01 +01:00
|
|
|
ifeq ($(HARDWARE_VARIANT), Sanguino)
|
2018-04-13 03:14:01 +02:00
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/variants/sanguino
|
2016-03-06 20:12:01 +01:00
|
|
|
else
|
2013-01-07 17:26:50 +01:00
|
|
|
HARDWARE_SUB_VARIANT ?= standard
|
2018-04-13 03:14:01 +02:00
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/$(HARDWARE_VARIANT)/variants/$(HARDWARE_SUB_VARIANT)
|
2012-11-24 11:46:31 +01:00
|
|
|
endif
|
2016-03-06 20:12:01 +01:00
|
|
|
endif
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_SRC = wiring.c \
|
2012-03-22 14:48:10 +01:00
|
|
|
wiring_analog.c wiring_digital.c \
|
|
|
|
wiring_pulse.c \
|
2016-03-06 20:12:01 +01:00
|
|
|
wiring_shift.c WInterrupts.c hooks.c
|
2017-12-20 06:44:32 +01:00
|
|
|
|
2014-01-16 16:58:35 +01:00
|
|
|
ifeq ($(HARDWARE_VARIANT), Teensy)
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_SRC = wiring.c
|
2014-01-16 16:58:35 +01:00
|
|
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
|
|
|
|
endif
|
2017-12-20 06:44:32 +01:00
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_CXXSRC = WMath.cpp WString.cpp Print.cpp SPI.cpp Tone.cpp
|
2017-12-20 06:44:32 +01:00
|
|
|
|
2017-07-13 17:01:21 +02:00
|
|
|
ifeq ($(NEOPIXEL), 1)
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_CXXSRC += Adafruit_NeoPixel.cpp
|
2017-07-13 17:01:21 +02:00
|
|
|
endif
|
2017-12-20 06:44:32 +01:00
|
|
|
|
2013-07-24 12:09:53 +02:00
|
|
|
ifeq ($(LIQUID_TWI2), 0)
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_CXXSRC += LiquidCrystal.cpp
|
2013-07-24 12:09:53 +02:00
|
|
|
else
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_SRC += twi.c
|
|
|
|
LIB_CXXSRC += Wire.cpp LiquidTWI2.cpp
|
2013-07-24 12:09:53 +02:00
|
|
|
endif
|
2012-11-24 11:46:31 +01:00
|
|
|
|
2014-02-05 10:47:12 +01:00
|
|
|
ifeq ($(WIRE), 1)
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_SRC += twi.c
|
|
|
|
LIB_CXXSRC += Wire.cpp
|
2014-02-05 10:47:12 +01:00
|
|
|
endif
|
|
|
|
|
2017-07-27 15:46:27 +02:00
|
|
|
ifeq ($(U8GLIB), 1)
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_CXXSRC += U8glib.cpp
|
|
|
|
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_data.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TMC2630), 1)
|
|
|
|
LIB_CXXSRC += TMC2130Stepper.cpp TMC2130Stepper_COOLCONF.cpp TMC2130Stepper_DRV_STATUS.cpp TMC2130Stepper_IHOLD_IRUN.cpp TMC2130Stepper_CHOPCONF.cpp TMC2130Stepper_GCONF.cpp TMC2130Stepper_PWMCONF.cpp SW_SPI.cpp
|
2017-07-27 15:46:27 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(RELOC_WORKAROUND), 1)
|
|
|
|
LD_PREFIX=-nodefaultlibs
|
|
|
|
LD_SUFFIX=-lm -lgcc -lc -lgcc
|
|
|
|
endif
|
|
|
|
|
2016-03-06 05:41:15 +01:00
|
|
|
#Check for Arduino 1.0.0 or higher and use the correct source files for that version
|
2012-11-24 11:46:31 +01:00
|
|
|
ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_CXXSRC += main.cpp
|
2012-11-24 11:46:31 +01:00
|
|
|
else
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_SRC += pins_arduino.c main.c
|
2012-11-24 11:46:31 +01:00
|
|
|
endif
|
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
FORMAT = ihex
|
|
|
|
|
|
|
|
# Name of this Makefile (used for "make depend").
|
|
|
|
MAKEFILE = Makefile
|
|
|
|
|
|
|
|
# Debugging format.
|
|
|
|
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
|
|
|
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
|
|
|
|
DEBUG = stabs
|
|
|
|
|
2012-01-24 03:18:54 +01:00
|
|
|
OPT = s
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-12-08 11:49:53 +01:00
|
|
|
DEFINES ?=
|
|
|
|
|
2012-12-13 05:18:31 +01:00
|
|
|
# Program settings
|
|
|
|
CC = $(AVR_TOOLS_PATH)avr-gcc
|
|
|
|
CXX = $(AVR_TOOLS_PATH)avr-g++
|
|
|
|
OBJCOPY = $(AVR_TOOLS_PATH)avr-objcopy
|
|
|
|
OBJDUMP = $(AVR_TOOLS_PATH)avr-objdump
|
|
|
|
AR = $(AVR_TOOLS_PATH)avr-ar
|
|
|
|
SIZE = $(AVR_TOOLS_PATH)avr-size
|
|
|
|
NM = $(AVR_TOOLS_PATH)avr-nm
|
|
|
|
AVRDUDE = avrdude
|
|
|
|
REMOVE = rm -f
|
|
|
|
MV = mv -f
|
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
# Place -D or -U options here
|
2012-12-13 11:41:27 +01:00
|
|
|
CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)}
|
|
|
|
CXXDEFS = $(CDEFS)
|
|
|
|
|
|
|
|
ifeq ($(HARDWARE_VARIANT), Teensy)
|
|
|
|
CDEFS += -DUSB_SERIAL
|
2018-04-03 02:36:27 +02:00
|
|
|
LIB_SRC += usb.c pins_teensy.c
|
|
|
|
LIB_CXXSRC += usb_api.cpp
|
2012-12-13 11:41:27 +01:00
|
|
|
endif
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-03-22 14:48:10 +01:00
|
|
|
# Add all the source directories as include directories too
|
2012-04-11 03:37:55 +02:00
|
|
|
CINCS = ${addprefix -I ,${VPATH}}
|
|
|
|
CXXINCS = ${addprefix -I ,${VPATH}}
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2016-11-15 21:54:12 +01:00
|
|
|
# Compiler flag to set the C/CPP Standard level.
|
|
|
|
CSTANDARD = -std=gnu99
|
|
|
|
CXXSTANDARD = -std=gnu++11
|
2011-11-05 14:13:20 +01:00
|
|
|
CDEBUG = -g$(DEBUG)
|
2012-01-24 03:18:54 +01:00
|
|
|
CWARN = -Wall -Wstrict-prototypes
|
2018-08-15 23:09:10 +02:00
|
|
|
CTUNING = -w -fsigned-char -funsigned-bitfields -fpack-struct \
|
|
|
|
-fshort-enums -ffunction-sections -fdata-sections -flto \
|
2012-11-11 11:05:52 +01:00
|
|
|
-DARDUINO=$(ARDUINO_VERSION)
|
|
|
|
ifneq ($(HARDWARE_MOTHERBOARD),)
|
2012-03-22 14:48:10 +01:00
|
|
|
CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
|
|
|
|
endif
|
2011-11-05 14:13:20 +01:00
|
|
|
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
2017-03-08 04:55:31 +01:00
|
|
|
CEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2016-11-15 21:54:12 +01:00
|
|
|
CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING) $(CSTANDARD)
|
|
|
|
CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) -Wall $(CEXTRA) $(CTUNING) $(CXXSTANDARD)
|
2012-12-13 12:19:12 +01:00
|
|
|
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
|
|
|
LDFLAGS = -lm
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
# Programming support using avrdude. Settings and variables.
|
2012-11-11 11:05:52 +01:00
|
|
|
AVRDUDE_PORT = $(UPLOAD_PORT)
|
2015-01-13 06:01:43 +01:00
|
|
|
AVRDUDE_WRITE_FLASH = -Uflash:w:$(BUILD_DIR)/$(TARGET).hex:i
|
2013-08-01 19:20:27 +02:00
|
|
|
ifeq ($(shell uname -s), Linux)
|
2015-07-20 13:37:39 +02:00
|
|
|
AVRDUDE_CONF = /etc/avrdude/avrdude.conf
|
2013-08-01 19:20:27 +02:00
|
|
|
else
|
|
|
|
AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
|
|
|
|
endif
|
2015-07-20 13:38:52 +02:00
|
|
|
AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
|
2015-01-18 18:18:43 +01:00
|
|
|
-p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
|
2015-01-13 06:01:43 +01:00
|
|
|
-b$(UPLOAD_RATE)
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
# Since Marlin 2.0, the source files may be distributed into several
|
|
|
|
# different directories, so it is necessary to find them recursively
|
|
|
|
|
|
|
|
SRC = $(shell find src -name '*.c' -type f)
|
|
|
|
CXXSRC = $(shell find src -name '*.cpp' -type f)
|
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
# Define all object files.
|
2018-04-03 02:36:27 +02:00
|
|
|
OBJ = ${patsubst %.c, $(BUILD_DIR)/arduino/%.o, ${LIB_SRC}}
|
|
|
|
OBJ += ${patsubst %.cpp, $(BUILD_DIR)/arduino/%.o, ${LIB_CXXSRC}}
|
|
|
|
OBJ += ${patsubst %.S, $(BUILD_DIR)/arduino/%.o, ${LIB_ASRC}}
|
|
|
|
OBJ += ${patsubst %.c, $(BUILD_DIR)/%.o, ${SRC}}
|
2012-11-11 11:05:52 +01:00
|
|
|
OBJ += ${patsubst %.cpp, $(BUILD_DIR)/%.o, ${CXXSRC}}
|
2011-11-05 14:13:20 +01:00
|
|
|
|
|
|
|
# Define all listing files.
|
2018-04-03 02:36:27 +02:00
|
|
|
LST = $(LIB_ASRC:.S=.lst) $(LIB_CXXSRC:.cpp=.lst) $(LIB_SRC:.c=.lst)
|
2011-11-05 14:13:20 +01:00
|
|
|
|
|
|
|
# Combine all necessary flags and optional flags.
|
|
|
|
# Add target processor to flags.
|
2012-01-24 03:18:54 +01:00
|
|
|
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
|
2012-03-22 14:48:10 +01:00
|
|
|
ALL_CXXFLAGS = -mmcu=$(MCU) $(CXXFLAGS)
|
|
|
|
ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS)
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2012-08-01 22:31:38 +02:00
|
|
|
# set V=1 (eg, "make V=1") to print the full commands etc.
|
|
|
|
ifneq ($V,1)
|
|
|
|
Pecho=@echo
|
|
|
|
P=@
|
|
|
|
else
|
|
|
|
Pecho=@:
|
|
|
|
P=
|
|
|
|
endif
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
# Create required build hierarchy if it does not exist
|
|
|
|
|
|
|
|
$(shell mkdir -p $(dir $(OBJ)))
|
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
# Default target.
|
2012-03-22 14:48:10 +01:00
|
|
|
all: sizeafter
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
build: elf hex
|
2012-11-11 11:05:52 +01:00
|
|
|
|
|
|
|
elf: $(BUILD_DIR)/$(TARGET).elf
|
|
|
|
hex: $(BUILD_DIR)/$(TARGET).hex
|
|
|
|
eep: $(BUILD_DIR)/$(TARGET).eep
|
2013-06-07 00:49:25 +02:00
|
|
|
lss: $(BUILD_DIR)/$(TARGET).lss
|
2012-11-11 11:05:52 +01:00
|
|
|
sym: $(BUILD_DIR)/$(TARGET).sym
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2013-06-07 00:49:25 +02:00
|
|
|
# Program the device.
|
2016-03-06 05:41:15 +01:00
|
|
|
# Do not try to reset an Arduino if it's not one
|
2012-11-11 11:05:52 +01:00
|
|
|
upload: $(BUILD_DIR)/$(TARGET).hex
|
2012-03-22 14:48:10 +01:00
|
|
|
ifeq (${AVRDUDE_PROGRAMMER}, arduino)
|
2012-11-11 11:05:52 +01:00
|
|
|
stty hup < $(UPLOAD_PORT); true
|
2012-03-22 14:48:10 +01:00
|
|
|
endif
|
2011-11-05 14:13:20 +01:00
|
|
|
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
|
2012-03-22 14:48:10 +01:00
|
|
|
ifeq (${AVRDUDE_PROGRAMMER}, arduino)
|
2012-11-11 11:05:52 +01:00
|
|
|
stty -hup < $(UPLOAD_PORT); true
|
2012-03-22 14:48:10 +01:00
|
|
|
endif
|
2012-01-24 03:18:54 +01:00
|
|
|
|
|
|
|
# Display size of file.
|
2012-11-11 11:05:52 +01:00
|
|
|
HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex
|
|
|
|
ELFSIZE = $(SIZE) --mcu=$(MCU) -C $(BUILD_DIR)/$(TARGET).elf; \
|
|
|
|
$(SIZE) $(BUILD_DIR)/$(TARGET).elf
|
2011-11-05 14:13:20 +01:00
|
|
|
sizebefore:
|
2012-11-11 11:05:52 +01:00
|
|
|
$P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-03-22 14:48:10 +01:00
|
|
|
sizeafter: build
|
2012-11-11 11:05:52 +01:00
|
|
|
$P if [ -f $(BUILD_DIR)/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
|
|
|
COFFCONVERT=$(OBJCOPY) --debugging \
|
2012-01-25 10:46:27 +01:00
|
|
|
--change-section-address .data-0x800000 \
|
|
|
|
--change-section-address .bss-0x800000 \
|
|
|
|
--change-section-address .noinit-0x800000 \
|
2013-06-07 00:49:25 +02:00
|
|
|
--change-section-address .eeprom-0x810000
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-11-11 11:05:52 +01:00
|
|
|
coff: $(BUILD_DIR)/$(TARGET).elf
|
|
|
|
$(COFFCONVERT) -O coff-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
extcoff: $(TARGET).elf
|
2012-11-11 11:05:52 +01:00
|
|
|
$(COFFCONVERT) -O coff-ext-avr $(BUILD_DIR)/$(TARGET).elf $(TARGET).cof
|
2011-11-05 14:13:20 +01:00
|
|
|
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
.SUFFIXES: .elf .hex .eep .lss .sym
|
2012-01-25 10:46:27 +01:00
|
|
|
.PRECIOUS: .o
|
2011-11-04 18:02:56 +01:00
|
|
|
|
|
|
|
.elf.hex:
|
2012-08-01 22:31:38 +02:00
|
|
|
$(Pecho) " COPY $@"
|
|
|
|
$P $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
2011-11-05 14:13:20 +01:00
|
|
|
|
|
|
|
.elf.eep:
|
2012-01-24 03:18:54 +01:00
|
|
|
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
2012-01-25 10:46:27 +01:00
|
|
|
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
2011-11-05 14:13:20 +01:00
|
|
|
|
|
|
|
# Create extended listing file from ELF output file.
|
|
|
|
.elf.lss:
|
|
|
|
$(OBJDUMP) -h -S $< > $@
|
|
|
|
|
|
|
|
# Create a symbol table from ELF output file.
|
|
|
|
.elf.sym:
|
|
|
|
$(NM) -n $< > $@
|
|
|
|
|
2012-01-24 03:18:54 +01:00
|
|
|
# Link: create ELF output file from library.
|
2018-04-03 02:36:27 +02:00
|
|
|
|
2012-12-13 12:19:12 +01:00
|
|
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
|
2012-08-01 22:31:38 +02:00
|
|
|
$(Pecho) " CXX $@"
|
2017-07-27 15:46:27 +02:00
|
|
|
$P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -Wl,--gc-sections,--relax -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
# Object files that were found in "src" will be stored in $(BUILD_DIR)
|
|
|
|
# in directories that mirror the structure of "src"
|
|
|
|
|
2012-11-11 11:05:52 +01:00
|
|
|
$(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
|
2012-12-09 19:19:57 +01:00
|
|
|
$(Pecho) " CC $<"
|
2012-08-01 22:31:38 +02:00
|
|
|
$P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
|
2012-03-22 14:48:10 +01:00
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
$(BUILD_DIR)/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
|
2012-12-09 19:19:57 +01:00
|
|
|
$(Pecho) " CXX $<"
|
2012-10-16 03:16:25 +02:00
|
|
|
$P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
|
|
|
|
|
2018-04-03 02:36:27 +02:00
|
|
|
# Object files for Arduino libs will be created in $(BUILD_DIR)/arduino
|
|
|
|
|
|
|
|
$(BUILD_DIR)/arduino/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
|
|
|
|
$(Pecho) " CC $<"
|
|
|
|
$P $(CC) -MMD -c $(ALL_CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
$(BUILD_DIR)/arduino/%.o: %.cpp Configuration.h Configuration_adv.h $(MAKEFILE)
|
2012-12-09 19:19:57 +01:00
|
|
|
$(Pecho) " CXX $<"
|
2012-08-01 22:31:38 +02:00
|
|
|
$P $(CXX) -MMD -c $(ALL_CXXFLAGS) $< -o $@
|
2012-03-22 14:48:10 +01:00
|
|
|
|
2011-11-05 14:13:20 +01:00
|
|
|
# Target: clean project.
|
2011-08-12 22:28:35 +02:00
|
|
|
clean:
|
2012-11-11 11:05:52 +01:00
|
|
|
$(Pecho) " RMDIR $(BUILD_DIR)/"
|
|
|
|
$P rm -rf $(BUILD_DIR)
|
2012-03-22 14:48:10 +01:00
|
|
|
|
2012-01-24 03:18:54 +01:00
|
|
|
|
2012-11-11 11:05:52 +01:00
|
|
|
.PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
|
2012-03-22 14:48:10 +01:00
|
|
|
|
|
|
|
# Automaticaly include the dependency files created by gcc
|
2018-04-03 02:36:27 +02:00
|
|
|
-include ${patsubst %.o, %.d, ${OBJ}}
|