sanguino/firmwares/arduino-usbdfu/makefile

Thu, 07 Jul 2016 12:23:34 +0200

author
mbayer
date
Thu, 07 Jul 2016 12:23:34 +0200
changeset 2
b373b0288715
permissions
-rw-r--r--

added missing sanguino files

2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
1 # Hey Emacs, this is a -*- makefile -*-
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
2 #----------------------------------------------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
3 # WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
4 # >> Modified for use with the LUFA project. <<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
5 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
6 # Released to the Public Domain
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
7 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
8 # Additional material for this makefile was written by:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
9 # Peter Fleury
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
10 # Tim Henigan
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
11 # Colin O'Flynn
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
12 # Reiner Patommel
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
13 # Markus Pfaff
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
14 # Sander Pool
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
15 # Frederik Rouleau
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
16 # Carlos Lamas
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
17 # Dean Camera
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
18 # Opendous Inc.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
19 # Denver Gingerich
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
20 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
21 #----------------------------------------------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
22 # On command line:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
23 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
24 # make all = Make software.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
25 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
26 # make clean = Clean out built project files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
27 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
28 # make coff = Convert ELF to AVR COFF.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
29 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
30 # make extcoff = Convert ELF to AVR Extended COFF.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
31 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
32 # make program = Download the hex file to the device, using avrdude.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
33 # Please customize the avrdude settings below first!
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
34 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
35 # make doxygen = Generate DoxyGen documentation for the project (must have
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
36 # DoxyGen installed)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
37 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
38 # make debug = Start either simulavr or avarice as specified for debugging,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
39 # with avr-gdb or avr-insight as the front end for debugging.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
40 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
41 # make filename.s = Just compile filename.c into the assembler code only.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
42 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
43 # make filename.i = Create a preprocessed source file for use in submitting
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
44 # bug reports to the GCC project.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
45 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
46 # To rebuild project do "make clean" then "make all".
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
47 #----------------------------------------------------------------------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
48
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
49
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
50 # MCU name
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
51 MCU = atmega8u2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
52 MCU_AVRDUDE = at90usb82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
53
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
54 # Specify the Arduino model using the assigned PID. This is used by Descriptors.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
55 # to set the product descriptor string (for DFU we must use the PID for each
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
56 # chip that dfu-bootloader or Flip expect)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
57 # Uno PID:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
58 ARDUINO_MODEL_PID = 0x0001
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
59 # Mega 2560 PID:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
60 #ARDUINO_MODEL_PID = 0x0010
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
61
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
62 # Target board (see library "Board Types" documentation, NONE for projects not requiring
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
63 # LUFA board drivers). If USER is selected, put custom board drivers in a directory called
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
64 # "Board" inside the application directory.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
65 BOARD = USER
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
66
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
67
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
68 # Processor frequency.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
69 # This will define a symbol, F_CPU, in all source code files equal to the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
70 # processor frequency in Hz. You can then use this symbol in your source code to
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
71 # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
72 # automatically to create a 32-bit value in your source code.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
73 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
74 # This will be an integer division of F_CLOCK below, as it is sourced by
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
75 # F_CLOCK after it has run through any CPU prescalers. Note that this value
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
76 # does not *change* the processor frequency - it should merely be updated to
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
77 # reflect the processor speed set externally so that the code can use accurate
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
78 # software delays.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
79 F_CPU = 16000000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
80
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
81
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
82 # Input clock frequency.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
83 # This will define a symbol, F_CLOCK, in all source code files equal to the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
84 # input clock frequency (before any prescaling is performed) in Hz. This value may
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
85 # differ from F_CPU if prescaling is used on the latter, and is required as the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
86 # raw input clock is fed directly to the PLL sections of the AVR for high speed
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
87 # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
88 # at the end, this will be done automatically to create a 32-bit value in your
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
89 # source code.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
90 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
91 # If no clock division is performed on the input clock inside the AVR (via the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
92 # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
93 F_CLOCK = $(F_CPU)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
94
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
95
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
96 # Starting byte address of the bootloader, as a byte address - computed via the formula
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
97 # BOOT_START = ((TOTAL_FLASH_BYTES - BOOTLOADER_SECTION_SIZE_BYTES) * 1024)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
98 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
99 # Note that the bootloader size and start address given in AVRStudio is in words and not
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
100 # bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
101 BOOT_START = 0x1000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
102
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
103
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
104 # Output format. (can be srec, ihex, binary)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
105 FORMAT = ihex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
106
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
107
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
108 # Target file name (without extension).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
109 TARGET = Arduino-usbdfu
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
110
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
111
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
112 # Object files directory
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
113 # To put object files in current directory, use a dot (.), do NOT make
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
114 # this an empty or blank macro!
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
115 OBJDIR = .
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
116
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
117
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
118 # Path to the LUFA library
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
119 LUFA_PATH = ../..
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
120
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
121
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
122 # LUFA library compile-time options and predefined tokens
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
123 LUFA_OPTS = -D USB_DEVICE_ONLY
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
124 LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
125 LUFA_OPTS += -D CONTROL_ONLY_DEVICE
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
126 LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=32
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
127 LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
128 LUFA_OPTS += -D USE_RAM_DESCRIPTORS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
129 LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
130 LUFA_OPTS += -D NO_INTERNAL_SERIAL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
131 LUFA_OPTS += -D NO_DEVICE_SELF_POWER
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
132 LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
133 LUFA_OPTS += -D NO_STREAM_CALLBACKS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
134
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
135
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
136 # Create the LUFA source path variables by including the LUFA root makefile
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
137 include $(LUFA_PATH)/LUFA/makefile
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
138
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
139
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
140 # List C source files here. (C dependencies are automatically generated.)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
141 SRC = $(TARGET).c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
142 Descriptors.c \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
143 $(LUFA_SRC_USB) \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
144
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
145
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
146 # List C++ source files here. (C dependencies are automatically generated.)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
147 CPPSRC =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
148
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
149
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
150 # List Assembler source files here.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
151 # Make them always end in a capital .S. Files ending in a lowercase .s
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
152 # will not be considered source files but generated files (assembler
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
153 # output from the compiler), and will be deleted upon "make clean"!
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
154 # Even though the DOS/Win* filesystem matches both .s and .S the same,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
155 # it will preserve the spelling of the filenames, and gcc itself does
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
156 # care about how the name is spelled on its command-line.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
157 ASRC =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
158
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
159
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
160 # Optimization level, can be [0, 1, 2, 3, s].
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
161 # 0 = turn off optimization. s = optimize for size.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
162 # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
163 OPT = s
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
164
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
165
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
166 # Debugging format.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
167 # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
168 # AVR Studio 4.10 requires dwarf-2.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
169 # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
170 DEBUG = dwarf-2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
171
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
172
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
173 # List any extra directories to look for include files here.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
174 # Each directory must be seperated by a space.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
175 # Use forward slashes for directory separators.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
176 # For a directory that has spaces, enclose it in quotes.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
177 EXTRAINCDIRS = $(LUFA_PATH)/
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
178
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
179
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
180 # Compiler flag to set the C Standard level.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
181 # c89 = "ANSI" C
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
182 # gnu89 = c89 plus GCC extensions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
183 # c99 = ISO C99 standard (not yet fully implemented)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
184 # gnu99 = c99 plus GCC extensions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
185 CSTANDARD = -std=c99
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
186
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
187
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
188 # Place -D or -U options here for C sources
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
189 CDEFS = -DF_CPU=$(F_CPU)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
190 CDEFS += -DARDUINO_MODEL_PID=$(ARDUINO_MODEL_PID)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
191 CDEFS += -DF_CLOCK=$(F_CLOCK)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
192 CDEFS += -DBOARD=BOARD_$(BOARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
193 CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
194 CDEFS += -DTX_RX_LED_PULSE_MS=3
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
195 CDEFS += $(LUFA_OPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
196
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
197
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
198 # Place -D or -U options here for ASM sources
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
199 ADEFS = -DF_CPU=$(F_CPU)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
200 ADEFS += -DF_CLOCK=$(F_CLOCK)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
201 ADEFS += -DBOARD=BOARD_$(BOARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
202 CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
203 ADEFS += $(LUFA_OPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
204
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
205 # Place -D or -U options here for C++ sources
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
206 CPPDEFS = -DF_CPU=$(F_CPU)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
207 CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
208 CPPDEFS += -DBOARD=BOARD_$(BOARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
209 CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
210 CPPDEFS += $(LUFA_OPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
211 #CPPDEFS += -D__STDC_LIMIT_MACROS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
212 #CPPDEFS += -D__STDC_CONSTANT_MACROS
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
213
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
214
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
215
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
216 #---------------- Compiler Options C ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
217 # -g*: generate debugging information
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
218 # -O*: optimization level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
219 # -f...: tuning, see GCC manual and avr-libc documentation
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
220 # -Wall...: warning level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
221 # -Wa,...: tell GCC to pass this to the assembler.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
222 # -adhlns...: create assembler listing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
223 CFLAGS = -g$(DEBUG)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
224 CFLAGS += $(CDEFS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
225 CFLAGS += -O$(OPT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
226 CFLAGS += -funsigned-char
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
227 CFLAGS += -funsigned-bitfields
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
228 CFLAGS += -ffunction-sections
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
229 CFLAGS += -fno-inline-small-functions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
230 CFLAGS += -fpack-struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
231 CFLAGS += -fshort-enums
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
232 CFLAGS += -fno-strict-aliasing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
233 CFLAGS += -Wall
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
234 CFLAGS += -Wstrict-prototypes
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
235 #CFLAGS += -mshort-calls
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
236 #CFLAGS += -fno-unit-at-a-time
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
237 #CFLAGS += -Wundef
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
238 #CFLAGS += -Wunreachable-code
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
239 #CFLAGS += -Wsign-compare
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
240 CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
241 CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
242 CFLAGS += $(CSTANDARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
243
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
244
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
245 #---------------- Compiler Options C++ ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
246 # -g*: generate debugging information
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
247 # -O*: optimization level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
248 # -f...: tuning, see GCC manual and avr-libc documentation
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
249 # -Wall...: warning level
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
250 # -Wa,...: tell GCC to pass this to the assembler.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
251 # -adhlns...: create assembler listing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
252 CPPFLAGS = -g$(DEBUG)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
253 CPPFLAGS += $(CPPDEFS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
254 CPPFLAGS += -O$(OPT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
255 CPPFLAGS += -funsigned-char
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
256 CPPFLAGS += -funsigned-bitfields
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
257 CPPFLAGS += -fpack-struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
258 CPPFLAGS += -fshort-enums
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
259 CPPFLAGS += -fno-exceptions
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
260 CPPFLAGS += -Wall
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
261 CPPFLAGS += -Wundef
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
262 #CPPFLAGS += -mshort-calls
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
263 #CPPFLAGS += -fno-unit-at-a-time
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
264 #CPPFLAGS += -Wstrict-prototypes
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
265 #CPPFLAGS += -Wunreachable-code
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
266 #CPPFLAGS += -Wsign-compare
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
267 CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
268 CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
269 #CPPFLAGS += $(CSTANDARD)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
270
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
271
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
272 #---------------- Assembler Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
273 # -Wa,...: tell GCC to pass this to the assembler.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
274 # -adhlns: create listing
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
275 # -gstabs: have the assembler create line number information; note that
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
276 # for use in COFF files, additional information about filenames
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
277 # and function names needs to be present in the assembler source
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
278 # files -- see avr-libc docs [FIXME: not yet described there]
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
279 # -listing-cont-lines: Sets the maximum number of continuation lines of hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
280 # dump that will be displayed for a given single line of source input.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
281 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
282
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
283
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
284 #---------------- Library Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
285 # Minimalistic printf version
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
286 PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
287
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
288 # Floating point printf version (requires MATH_LIB = -lm below)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
289 PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
290
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
291 # If this is left blank, then it will use the Standard printf version.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
292 PRINTF_LIB =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
293 #PRINTF_LIB = $(PRINTF_LIB_MIN)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
294 #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
295
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
296
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
297 # Minimalistic scanf version
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
298 SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
299
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
300 # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
301 SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
302
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
303 # If this is left blank, then it will use the Standard scanf version.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
304 SCANF_LIB =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
305 #SCANF_LIB = $(SCANF_LIB_MIN)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
306 #SCANF_LIB = $(SCANF_LIB_FLOAT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
307
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
308
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
309 MATH_LIB = -lm
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
310
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
311
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
312 # List any extra directories to look for libraries here.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
313 # Each directory must be seperated by a space.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
314 # Use forward slashes for directory separators.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
315 # For a directory that has spaces, enclose it in quotes.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
316 EXTRALIBDIRS =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
317
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
318
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
319
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
320 #---------------- External Memory Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
321
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
322 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
323 # used for variables (.data/.bss) and heap (malloc()).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
324 #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
325
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
326 # 64 KB of external RAM, starting after internal RAM (ATmega128!),
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
327 # only used for heap (malloc()).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
328 #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
329
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
330 EXTMEMOPTS =
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
331
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
332
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
333
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
334 #---------------- Linker Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
335 # -Wl,...: tell GCC to pass this to linker.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
336 # -Map: create map file
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
337 # --cref: add cross reference to map file
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
338 LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
339 LDFLAGS += -Wl,--section-start=.text=$(BOOT_START)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
340 LDFLAGS += -Wl,--relax
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
341 LDFLAGS += -Wl,--gc-sections
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
342 LDFLAGS += $(EXTMEMOPTS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
343 LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
344 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
345 #LDFLAGS += -T linker_script.x
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
346
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
347
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
348
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
349 #---------------- Programming Options (avrdude) ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
350
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
351 # Fuse settings for Arduino Uno DFU bootloader project
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
352 AVRDUDE_FUSES = -U efuse:w:0xF4:m -U hfuse:w:0xD9:m -U lfuse:w:0xFF:m
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
353
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
354 # Lock settings for Arduino Uno DFU bootloader project
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
355 AVRDUDE_LOCK = -U lock:w:0x0F:m
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
356
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
357 # Programming hardware
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
358 # Type: avrdude -c ?
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
359 # to get a full listing.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
360 #
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
361 AVRDUDE_PROGRAMMER = avrispmkii
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
362
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
363 # com1 = serial port. Use lpt1 to connect to parallel port.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
364 AVRDUDE_PORT = usb
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
365
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
366 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
367 #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
368
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
369 # Uncomment the following if you want avrdude's erase cycle counter.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
370 # Note that this counter needs to be initialized first using -Yn,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
371 # see avrdude manual.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
372 #AVRDUDE_ERASE_COUNTER = -y
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
373
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
374 # Uncomment the following if you do /not/ wish a verification to be
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
375 # performed after programming the device.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
376 #AVRDUDE_NO_VERIFY = -V
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
377
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
378 # Increase verbosity level. Please use this when submitting bug
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
379 # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
380 # to submit bug reports.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
381 #AVRDUDE_VERBOSE = -v -v
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
382
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
383 AVRDUDE_FLAGS = -p $(MCU_AVRDUDE) -F -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
384 AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
385 AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
386 AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
387
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
388
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
389
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
390 #---------------- Debugging Options ----------------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
391
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
392 # For simulavr only - target MCU frequency.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
393 DEBUG_MFREQ = $(F_CPU)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
394
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
395 # Set the DEBUG_UI to either gdb or insight.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
396 # DEBUG_UI = gdb
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
397 DEBUG_UI = insight
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
398
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
399 # Set the debugging back-end to either avarice, simulavr.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
400 DEBUG_BACKEND = avarice
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
401 #DEBUG_BACKEND = simulavr
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
402
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
403 # GDB Init Filename.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
404 GDBINIT_FILE = __avr_gdbinit
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
405
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
406 # When using avarice settings for the JTAG
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
407 JTAG_DEV = /dev/com1
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
408
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
409 # Debugging port used to communicate between GDB / avarice / simulavr.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
410 DEBUG_PORT = 4242
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
411
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
412 # Debugging host used to communicate between GDB / avarice / simulavr, normally
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
413 # just set to localhost unless doing some sort of crazy debugging when
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
414 # avarice is running on a different computer.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
415 DEBUG_HOST = localhost
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
416
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
417
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
418
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
419 #============================================================================
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
420
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
421
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
422 # Define programs and commands.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
423 SHELL = sh
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
424 CC = avr-gcc
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
425 OBJCOPY = avr-objcopy
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
426 OBJDUMP = avr-objdump
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
427 SIZE = avr-size
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
428 AR = avr-ar rcs
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
429 NM = avr-nm
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
430 AVRDUDE = avrdude
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
431 REMOVE = rm -f
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
432 REMOVEDIR = rm -rf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
433 COPY = cp
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
434 WINSHELL = cmd
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
435
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
436
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
437 # Define Messages
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
438 # English
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
439 MSG_ERRORS_NONE = Errors: none
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
440 MSG_BEGIN = -------- begin --------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
441 MSG_END = -------- end --------
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
442 MSG_SIZE_BEFORE = Size before:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
443 MSG_SIZE_AFTER = Size after:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
444 MSG_COFF = Converting to AVR COFF:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
445 MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
446 MSG_FLASH = Creating load file for Flash:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
447 MSG_EEPROM = Creating load file for EEPROM:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
448 MSG_EXTENDED_LISTING = Creating Extended Listing:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
449 MSG_SYMBOL_TABLE = Creating Symbol Table:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
450 MSG_LINKING = Linking:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
451 MSG_COMPILING = Compiling C:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
452 MSG_COMPILING_CPP = Compiling C++:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
453 MSG_ASSEMBLING = Assembling:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
454 MSG_CLEANING = Cleaning project:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
455 MSG_CREATING_LIBRARY = Creating library:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
456
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
457
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
458
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
459
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
460 # Define all object files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
461 OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
462
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
463 # Define all listing files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
464 LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
465
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
466
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
467 # Compiler flags to generate dependency files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
468 GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
469
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
470
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
471 # Combine all necessary flags and optional flags.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
472 # Add target processor to flags.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
473 ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
474 ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
475 ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
476
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
477
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
478
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
479
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
480
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
481 # Default target.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
482 all: begin gccversion sizebefore build sizeafter end
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
483
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
484 # Change the build target to build a HEX file or a library.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
485 build: elf hex eep lss sym
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
486 #build: lib
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
487
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
488
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
489 elf: $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
490 hex: $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
491 eep: $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
492 lss: $(TARGET).lss
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
493 sym: $(TARGET).sym
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
494 LIBNAME=lib$(TARGET).a
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
495 lib: $(LIBNAME)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
496
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
497
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
498
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
499 # Eye candy.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
500 # AVR Studio 3.x does not check make's exit code but relies on
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
501 # the following magic strings to be generated by the compile job.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
502 begin:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
503 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
504 @echo $(MSG_BEGIN)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
505
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
506 end:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
507 @echo $(MSG_END)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
508 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
509
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
510
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
511 # Display size of file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
512 HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
513 ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
514 MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
515 FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
516
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
517
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
518 sizebefore:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
519 @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
520 2>/dev/null; echo; fi
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
521
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
522 sizeafter:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
523 @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
524 2>/dev/null; echo; fi
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
525
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
526
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
527
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
528 # Display compiler version information.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
529 gccversion :
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
530 @$(CC) --version
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
531
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
532
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
533 # Program the device.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
534 program: $(TARGET).hex $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
535 $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) $(AVRDUDE_FUSES) $(AVRDUDE_LOCK)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
536
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
537
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
538 # Generate avr-gdb config/init file which does the following:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
539 # define the reset signal, load the target file, connect to target, and set
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
540 # a breakpoint at main().
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
541 gdb-config:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
542 @$(REMOVE) $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
543 @echo define reset >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
544 @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
545 @echo end >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
546 @echo file $(TARGET).elf >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
547 @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
548 ifeq ($(DEBUG_BACKEND),simulavr)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
549 @echo load >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
550 endif
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
551 @echo break main >> $(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
552
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
553 debug: gdb-config $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
554 ifeq ($(DEBUG_BACKEND), avarice)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
555 @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
556 @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
557 $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
558 @$(WINSHELL) /c pause
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
559
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
560 else
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
561 @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
562 $(DEBUG_MFREQ) --port $(DEBUG_PORT)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
563 endif
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
564 @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
565
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
566
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
567
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
568
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
569 # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
570 COFFCONVERT = $(OBJCOPY) --debugging
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
571 COFFCONVERT += --change-section-address .data-0x800000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
572 COFFCONVERT += --change-section-address .bss-0x800000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
573 COFFCONVERT += --change-section-address .noinit-0x800000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
574 COFFCONVERT += --change-section-address .eeprom-0x810000
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
575
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
576
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
577
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
578 coff: $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
579 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
580 @echo $(MSG_COFF) $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
581 $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
582
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
583
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
584 extcoff: $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
585 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
586 @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
587 $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
588
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
589
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
590
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
591 # Create final output files (.hex, .eep) from ELF output file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
592 %.hex: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
593 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
594 @echo $(MSG_FLASH) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
595 $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
596
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
597 %.eep: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
598 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
599 @echo $(MSG_EEPROM) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
600 -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
601 --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
602
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
603 # Create extended listing file from ELF output file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
604 %.lss: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
605 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
606 @echo $(MSG_EXTENDED_LISTING) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
607 $(OBJDUMP) -h -S -z $< > $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
608
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
609 # Create a symbol table from ELF output file.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
610 %.sym: %.elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
611 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
612 @echo $(MSG_SYMBOL_TABLE) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
613 $(NM) -n $< > $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
614
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
615
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
616
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
617 # Create library from object files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
618 .SECONDARY : $(TARGET).a
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
619 .PRECIOUS : $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
620 %.a: $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
621 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
622 @echo $(MSG_CREATING_LIBRARY) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
623 $(AR) $@ $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
624
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
625
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
626 # Link: create ELF output file from object files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
627 .SECONDARY : $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
628 .PRECIOUS : $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
629 %.elf: $(OBJ)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
630 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
631 @echo $(MSG_LINKING) $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
632 $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
633
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
634
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
635 # Compile: create object files from C source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
636 $(OBJDIR)/%.o : %.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
637 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
638 @echo $(MSG_COMPILING) $<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
639 $(CC) -c $(ALL_CFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
640
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
641
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
642 # Compile: create object files from C++ source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
643 $(OBJDIR)/%.o : %.cpp
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
644 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
645 @echo $(MSG_COMPILING_CPP) $<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
646 $(CC) -c $(ALL_CPPFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
647
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
648
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
649 # Compile: create assembler files from C source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
650 %.s : %.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
651 $(CC) -S $(ALL_CFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
652
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
653
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
654 # Compile: create assembler files from C++ source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
655 %.s : %.cpp
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
656 $(CC) -S $(ALL_CPPFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
657
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
658
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
659 # Assemble: create object files from assembler source files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
660 $(OBJDIR)/%.o : %.S
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
661 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
662 @echo $(MSG_ASSEMBLING) $<
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
663 $(CC) -c $(ALL_ASFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
664
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
665
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
666 # Create preprocessed source for use in sending a bug report.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
667 %.i : %.c
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
668 $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
669
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
670
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
671 # Target: clean project.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
672 clean: begin clean_list end
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
673
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
674 clean_list :
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
675 @echo
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
676 @echo $(MSG_CLEANING)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
677 $(REMOVE) $(TARGET).hex
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
678 $(REMOVE) $(TARGET).eep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
679 $(REMOVE) $(TARGET).cof
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
680 $(REMOVE) $(TARGET).elf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
681 $(REMOVE) $(TARGET).map
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
682 $(REMOVE) $(TARGET).sym
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
683 $(REMOVE) $(TARGET).lss
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
684 $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
685 $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
686 $(REMOVE) $(SRC:.c=.s)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
687 $(REMOVE) $(SRC:.c=.d)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
688 $(REMOVE) $(SRC:.c=.i)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
689 $(REMOVEDIR) .dep
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
690
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
691 doxygen:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
692 @echo Generating Project Documentation...
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
693 @doxygen Doxygen.conf
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
694 @echo Documentation Generation Complete.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
695
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
696 clean_doxygen:
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
697 rm -rf Documentation
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
698
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
699 # Create object files directory
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
700 $(shell mkdir $(OBJDIR) 2>/dev/null)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
701
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
702
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
703 # Include the dependency files.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
704 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
705
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
706
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
707 # Listing of phony targets.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
708 .PHONY : all begin finish end sizebefore sizeafter gccversion \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
709 build elf hex eep lss sym coff extcoff doxygen clean \
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
710 clean_list clean_doxygen program debug gdb-config

mercurial