Debian Codegraph @

docs/firmware/Makefile

raw symbols SCIP
1 # Makefile for ATmegaBOOT
2 # E.Lins, 18.7.2005
3 # $Id$
4 #
5 # Instructions
6 #
7 # To make bootloader .hex file:
8 # make diecimila
9 # make lilypad
10 # make ng
11 # etc...
12 #
13 # To burn bootloader .hex file:
14 # make diecimila_isp
15 # make lilypad_isp
16 # make ng_isp
17 # etc...
18 #
19 # Edit History
20 # 201303xx: WestfW: Major Makefile restructuring.
21 # Allows options on Make command line "make xx LED=B3"
22 # (see also pin_defs.h)
23 # Divide into "chip" targets and "board" targets.
24 # Most boards are (recursive) board targets with options.
25 # Move isp target to separate makefile (fixes m8 EFUSE)
26 # Some (many) targets will now be rebuilt when not
27 # strictly necessary, so that options will be included.
28 # (any "make" with options will always compile.)
29 # Set many variables with ?= so they can be overridden
30 # Use arduinoISP settings as default for ISP targets
31 #
32
33 #----------------------------------------------------------------------
34 #
35 # program name should not be changed...
36 PROGRAM = optiboot
37
38 # The default behavior is to build using tools that are in the users
39 # current path variables, but we can also build using an installed
40 # Arduino user IDE setup, or the Arduino source tree.
41 # Uncomment this next lines to build within the arduino environment,
42 # using the arduino-included avrgcc toolset (mac and pc)
43 # ENV ?= arduino
44 # ENV ?= arduinodev
45 # OS ?= macosx
46 # OS ?= windows
47
48 # export symbols to recursive makes (for ISP)
49 export
50
51 # defaults
52 MCU_TARGET = atmega168
53 LDSECTIONS = -Wl,--section-start=.text=0x3800
54
55 # Build environments
56 # Start of some ugly makefile-isms to allow optiboot to be built
57 # in several different environments. See the README.TXT file for
58 # details.
59
60 # default
61 fixpath = $(1)
62
63 ifeq ($(ENV), arduino)
64 # For Arduino, we assume that we're connected to the optiboot directory
65 # included with the arduino distribution, which means that the full set
66 # of avr-tools are "right up there" in standard places.
67 TOOLROOT = ../../../tools
68 GCCROOT = $(TOOLROOT)/avr/bin/
69
70 ifeq ($(OS), windows)
71 # On windows, SOME of the tool paths will need to have backslashes instead
72 # of forward slashes (because they use windows cmd.exe for execution instead
73 # of a unix/mingw shell?) We also have to ensure that a consistent shell
74 # is used even if a unix shell is installed (ie as part of WINAVR)
75 fixpath = $(subst /,\,$1)
76 SHELL = cmd.exe
77 endif
78
79 else ifeq ($(ENV), arduinodev)
80 # Arduino IDE source code environment. Use the unpacked compilers created
81 # by the build (you'll need to do "ant build" first.)
82 ifeq ($(OS), macosx)
83 TOOLROOT = ../../../../build/macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools
84 endif
85 ifeq ($(OS), windows)
86 TOOLROOT = ../../../../build/windows/work/hardware/tools
87 endif
88
89 GCCROOT = $(TOOLROOT)/avr/bin/
90 AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf
91
92 else
93 GCCROOT =
94 AVRDUDE_CONF =
95 endif
96
97 STK500 = "C:\Program Files\Atmel\AVR Tools\STK500\Stk500.exe"
98 STK500-1 = $(STK500) -e -d$(MCU_TARGET) -pf -vf -if$(PROGRAM)_$(TARGET).hex \
99 -lFF -LFF -f$(HFUSE)$(LFUSE) -EF8 -ms -q -cUSB -I200kHz -s -wt
100 STK500-2 = $(STK500) -d$(MCU_TARGET) -ms -q -lCF -LCF -cUSB -I200kHz -s -wt
101 #
102 # End of build environment code.
103
104
105 OBJ = $(PROGRAM).o
106 OPTIMIZE = -Os -fno-inline-small-functions -fno-split-wide-types
107
108 DEFS =
109 LIBS =
110
111 CC = $(GCCROOT)avr-gcc
112
113 # Override is only needed by avr-lib build system.
114
115 override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
116 override LDFLAGS = $(LDSECTIONS) -Wl,--relax -nostartfiles -nostdlib -Wl,-Map,tmp.map
117 #-Wl,--gc-sections
118
119 OBJCOPY = $(GCCROOT)avr-objcopy
120 OBJDUMP = $(call fixpath,$(GCCROOT)avr-objdump)
121
122 SIZE = $(GCCROOT)avr-size
123
124 #
125 # Make command-line Options.
126 # Permit commands like "make atmega328 LED_START_FLASHES=10" to pass the
127 # appropriate parameters ("-DLED_START_FLASHES=10") to gcc
128 #
129
130 ifdef BAUD_RATE
131 BAUD_RATE_CMD = -DBAUD_RATE=$(BAUD_RATE)
132 dummy = FORCE
133 else
134 BAUD_RATE_CMD = -DBAUD_RATE=38400
135 endif
136
137 ifdef LED_START_FLASHES
138 LED_START_FLASHES_CMD = -DLED_START_FLASHES=$(LED_START_FLASHES)
139 dummy = FORCE
140 else
141 LED_START_FLASHES_CMD = -DLED_START_FLASHES=3
142 endif
143
144 # BIG_BOOT: Include extra features, up to 1K.
145 ifdef BIGBOOT
146 BIGBOOT_CMD = -DBIGBOOT=1
147 dummy = FORCE
148 endif
149
150 ifdef SOFT_UART
151 SOFT_UART_CMD = -DSOFT_UART=1
152 dummy = FORCE
153 endif
154
155 ifdef LED_DATA_FLASH
156 LED_DATA_FLASH_CMD = -DLED_DATA_FLASH=1
157 dummy = FORCE
158 endif
159
160 ifdef LED
161 LED_CMD = -DLED=$(LED)
162 dummy = FORCE
163 endif
164
165 ifdef LED_KUTTY
166 LED_KUTTY = -DLED=$(LED_KUTTY)
167 dummy = FORCE
168 endif
169
170
171 ifdef SINGLESPEED
172 SSCMD = -DSINGLESPEED=1
173 endif
174
175 COMMON_OPTIONS = $(BAUD_RATE_CMD) $(LED_START_FLASHES_CMD) $(BIGBOOT_CMD)
176 COMMON_OPTIONS += $(SOFT_UART_CMD) $(LED_DATA_FLASH_CMD) $(LED_CMD) $(SSCMD)
177
178 #UART is handled separately and only passed for devices with more than one.
179 ifdef UART
180 UARTCMD = -DUART=$(UART)
181 endif
182
183 # Not supported yet
184 # ifdef SUPPORT_EEPROM
185 # SUPPORT_EEPROM_CMD = -DSUPPORT_EEPROM
186 # dummy = FORCE
187 # endif
188
189 # Not supported yet
190 # ifdef TIMEOUT_MS
191 # TIMEOUT_MS_CMD = -DTIMEOUT_MS=$(TIMEOUT_MS)
192 # dummy = FORCE
193 # endif
194 #
195
196 #---------------------------------------------------------------------------
197 # "Chip-level Platform" targets.
198 # A "Chip-level Platform" compiles for a particular chip, but probably does
199 # not have "standard" values for things like clock speed, LED pin, etc.
200 # Makes for chip-level platforms should usually explicitly define their
201 # options like: "make atmega1285 AVR_FREQ=16000000L LED=D0"
202 #---------------------------------------------------------------------------
203 #
204 # Note about fuses:
205 # the efuse should really be 0xf8; since, however, only the lower
206 # three bits of that byte are used on the atmega168, avrdude gets
207 # confused if you specify 1's for the higher bits, see:
208 # http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/
209 #
210 # similarly, the lock bits should be 0xff instead of 0x3f (to
211 # unlock the bootloader section) and 0xcf instead of 0x2f (to
212 # lock it), but since the high two bits of the lock byte are
213 # unused, avrdude would get confused.
214 #---------------------------------------------------------------------------
215 #
216
217 # Test platforms
218 # Virtual boot block test
219 virboot328: TARGET = atmega328
220 virboot328: MCU_TARGET = atmega328p
221 virboot328: CFLAGS += $(COMMON_OPTIONS) '-DVIRTUAL_BOOT'
222 virboot328: AVR_FREQ ?= 16000000L
223 virboot328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
224 virboot328: $(PROGRAM)_atmega328.hex
225 virboot328: $(PROGRAM)_atmega328.lst
226
227 # Diecimila, Duemilanove with m168, and NG use identical bootloaders
228 # Call it "atmega168" for generality and clarity, keep "diecimila" for
229 # backward compatibility of makefile
230 #
231 atmega168: TARGET = atmega168
232 atmega168: MCU_TARGET = atmega168
233 atmega168: CFLAGS += $(COMMON_OPTIONS)
234 atmega168: AVR_FREQ ?= 16000000L
235 atmega168: $(PROGRAM)_atmega168.hex
236 atmega168: $(PROGRAM)_atmega168.lst
237
238 atmega168_isp: atmega168
239 atmega168_isp: TARGET = atmega168
240 # 2.7V brownout
241 atmega168_isp: HFUSE ?= DD
242 # Low power xtal (16MHz) 16KCK/14CK+65ms
243 atmega168_isp: LFUSE ?= FF
244 # 512 byte boot
245 atmega168_isp: EFUSE ?= 04
246 atmega168_isp: isp
247
248 atmega328: TARGET = atmega328
249 atmega328: MCU_TARGET = atmega328p
250 atmega328: CFLAGS += $(COMMON_OPTIONS)
251 atmega328: AVR_FREQ ?= 16000000L
252 atmega328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
253 atmega328: $(PROGRAM)_atmega328.hex
254 atmega328: $(PROGRAM)_atmega328.lst
255
256
257
258 kuttynano: TARGET = atmega328
259 kuttynano: MCU_TARGET = atmega328p
260 kuttynano: CFLAGS += $(COMMON_OPTIONS)
261 kuttynano: AVR_FREQ ?= 16000000L
262 kuttynano: START_LED_FLASHES ?= 1
263 kuttynano: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
264 kuttynano: $(PROGRAM)_atmega328.hex
265 kuttynano: $(PROGRAM)_atmega328.lst
266 kuttynano: KUTTYPY_TYPE ?= 99
267
268
269
270
271
272
273 atmega328_isp: atmega328
274 atmega328_isp: TARGET = atmega328
275 atmega328_isp: MCU_TARGET = atmega328p
276 # 512 byte boot, SPIEN
277 atmega328_isp: HFUSE ?= DE
278 # Low power xtal (16MHz) 16KCK/14CK+65ms
279 atmega328_isp: LFUSE ?= FF
280 # 2.7V brownout
281 atmega328_isp: EFUSE ?= FD
282 atmega328_isp: isp
283
284 atmega644p: TARGET = atmega644p
285 atmega644p: MCU_TARGET = atmega644p
286 atmega644p: CFLAGS += $(COMMON_OPTIONS) -DBIGBOOT $(LED_CMD)
287 atmega644p: AVR_FREQ ?= 16000000L
288 atmega644p: LDSECTIONS = -Wl,--section-start=.text=0xfc00 -Wl,--section-start=.version=0xfffe
289 atmega644p: CFLAGS += $(UARTCMD)
290 atmega644p: $(PROGRAM)_atmega644p.hex
291 atmega644p: $(PROGRAM)_atmega644p.lst
292
293 atmega1284: TARGET = atmega1284p
294 atmega1284: MCU_TARGET = atmega1284p
295 atmega1284: CFLAGS += $(COMMON_OPTIONS) -DBIGBOOT $(LED_CMD)
296 atmega1284: AVR_FREQ ?= 16000000L
297 atmega1284: LDSECTIONS = -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe
298 atmega1284: CFLAGS += $(UARTCMD)
299 atmega1284: $(PROGRAM)_atmega1284p.hex
300 atmega1284: $(PROGRAM)_atmega1284p.lst
301
302 atmega1284p: atmega1284
303
304 atmega1284_isp: atmega1284
305 atmega1284_isp: TARGET = atmega1284p
306 atmega1284_isp: MCU_TARGET = atmega1284p
307 # 1024 byte boot
308 atmega1284_isp: HFUSE ?= DE
309 # Full Swing xtal (16MHz) 16KCK/14CK+65ms
310 atmega1284_isp: LFUSE ?= F7
311 # 2.7V brownout
312 atmega1284_isp: EFUSE ?= FD
313 atmega1284_isp: isp
314
315 #Atmega1280
316 atmega1280: MCU_TARGET = atmega1280
317 atmega1280: CFLAGS += $(COMMON_OPTIONS) -DBIGBOOT $(UART_CMD)
318 atmega1280: AVR_FREQ ?= 16000000L
319 atmega1280: LDSECTIONS = -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe
320 atmega1280: $(PROGRAM)_atmega1280.hex
321 atmega1280: $(PROGRAM)_atmega1280.lst
322
323
324 # ATmega8
325 #
326 atmega8: TARGET = atmega8
327 atmega8: MCU_TARGET = atmega8
328 atmega8: CFLAGS += $(COMMON_OPTIONS)
329 atmega8: AVR_FREQ ?= 16000000L
330 atmega8: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe
331 atmega8: $(PROGRAM)_atmega8.hex
332 atmega8: $(PROGRAM)_atmega8.lst
333
334 atmega8_isp: atmega8
335 atmega8_isp: TARGET = atmega8
336 atmega8_isp: MCU_TARGET = atmega8
337 # SPIEN, CKOPT (for full swing xtal), Bootsize=512B
338 atmega8_isp: HFUSE ?= CC
339 # 2.7V brownout, 16MHz Xtal, 16KCK/14CK+65ms
340 atmega8_isp: LFUSE ?= BF
341 atmega8_isp: isp
342
343 # ATmega88
344 #
345 atmega88: TARGET = atmega88
346 atmega88: MCU_TARGET = atmega88
347 atmega88: CFLAGS += $(COMMON_OPTIONS)
348 atmega88: AVR_FREQ ?= 16000000L
349 atmega88: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe
350 atmega88: $(PROGRAM)_atmega88.hex
351 atmega88: $(PROGRAM)_atmega88.lst
352
353 atmega88_isp: atmega88
354 atmega88_isp: TARGET = atmega88
355 atmega88_isp: MCU_TARGET = atmega88
356 # 2.7V brownout
357 atmega88_isp: HFUSE ?= DD
358 # Low power xtal (16MHz) 16KCK/14CK+65ms
359 atemga88_isp: LFUSE ?= FF
360 # 512 byte boot
361 atmega88_isp: EFUSE ?= 04
362 atmega88_isp: isp
363
364 atmega32: TARGET = atmega32
365 atmega32: MCU_TARGET = atmega32
366 atmega32: CFLAGS += $(COMMON_OPTIONS)
367 atmega32: AVR_FREQ ?= 8000000L
368 atmega32: START_LED_FLASHES ?= 1
369 atmega32: LED_KUTTY ?= PB3
370 atmega32: KUTTYPY_TYPE ?= 99
371 atmega32: LDSECTIONS = -Wl,--section-start=.text=0x7800
372 atmega32: $(PROGRAM)_atmega32.hex
373 atmega32: $(PROGRAM)_atmega32.lst
374
375 atmega32_isp: atmega32
376 atmega32_isp: TARGET = atmega32
377 atmega32_isp: MCU_TARGET = atmega32
378 # No OCD or JTAG, SPIEN, CKOPT (for full swing xtal), Bootsize=512B
379 atmega32_isp: HFUSE ?= CE
380 # 2.7V brownout, 16MHz Xtal, 16KCK/14CK+65ms
381 atemga32_isp: LFUSE ?= BF
382 atmega32_isp: isp
383
384
385
386 #---------------------------------------------------------------------------
387 # "Board-level Platform" targets.
388 # A "Board-level Platform" implies a manufactured platform with a particular
389 # AVR_FREQ, LED, and so on. Parameters are not particularly changable from
390 # the "make" command line.
391 # Most of the board-level platform builds should envoke make recursively
392 # appropriate specific options
393 #---------------------------------------------------------------------------
394 # 20MHz clocked platforms
395 #
396 # These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue)
397 #
398
399 pro20: TARGET = pro_20mhz
400 pro20: CHIP = atmega168
401 pro20:
402 $(MAKE) atmega168 AVR_FREQ=20000000L LED_START_FLASHES=3
403 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
404 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
405
406 pro20_isp: pro20
407 pro20_isp: TARGET = pro_20mhz
408 # 2.7V brownout
409 pro20_isp: HFUSE ?= DD
410 # Full swing xtal (20MHz) 258CK/14CK+4.1ms
411 pro20_isp: LFUSE ?= C6
412 # 512 byte boot
413 pro20_isp: EFUSE ?= 04
414 pro20_isp: isp
415
416 # 16MHz clocked platforms
417 #
418 # These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue)
419 #
420
421 pro16: TARGET = pro_16MHz
422 pro16: CHIP = atmega168
423 pro16:
424 $(MAKE) $(CHIP) AVR_FREQ=16000000L LED_START_FLASHES=3
425 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
426 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
427
428 pro16_isp: pro16
429 pro16_isp: TARGET = pro_16MHz
430 # 2.7V brownout
431 pro16_isp: HFUSE ?= DD
432 # Full swing xtal (20MHz) 258CK/14CK+4.1ms
433 pro16_isp: LFUSE ?= C6
434 # 512 byte boot
435 pro16_isp: EFUSE ?= 04
436 pro16_isp: isp
437
438 diecimila: TARGET = diecimila
439 diecimila: CHIP = atmega168
440 diecimila:
441 $(MAKE) $(CHIP) AVR_FREQ=16000000L LED_START_FLASHES=3
442 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
443 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
444
445 diecimila_isp: diecimila
446 diecimila_isp: TARGET = diecimila
447 # 2.7V brownout
448 diecimila_isp: HFUSE ?= DD
449 # Low power xtal (16MHz) 16KCK/14CK+65ms
450 diecimila_isp: LFUSE ?= FF
451 # 512 byte boot
452 diecimila_isp: EFUSE ?= 04
453 diecimila_isp: isp
454
455 # Sanguino has a minimum boot size of 1024 bytes, so enable extra functions
456 #
457 sanguino: TARGET = $@
458 sanguino: CHIP = atmega644p
459 sanguino:
460 $(MAKE) $(CHIP) AVR_FREQ=16000000L LED=B0
461 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
462 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
463
464 sanguino_isp: sanguino
465 sanguino_isp: TARGET = sanguino
466 sanguino_isp: MCU_TARGET = atmega644p
467 # 1024 byte boot
468 sanguino_isp: HFUSE ?= DE
469 # Full swing xtal (16MHz) 16KCK/14CK+65ms
470 sanguino_isp: LFUSE ?= F7
471 # 2.7V brownout
472 sanguino_isp: EFUSE ?= FD
473 sanguino_isp: isp
474
475 mighty1284: TARGET = $@
476 mighty1284: CHIP = atmega1284p
477 mighty1284:
478 $(MAKE) $(CHIP) AVR_FREQ=16000000L LED=B7
479 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
480 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
481
482 mighty1284_isp: mighty1284
483 mighty1284_isp: TARGET = mighty1284
484 mighty1284_isp: MCU_TARGET = atmega1284p
485 # 1024 byte boot
486 mighty1284_isp: HFUSE ?= DE
487 # Full swing xtal (16MHz) 16KCK/14CK+65ms
488 mighty1284_isp: LFUSE ?= F7
489 # 2.7V brownout
490 mighty1284_isp: EFUSE ?= FD
491 mighty1284_isp: isp
492
493 bobuino: TARGET = $@
494 bobuino: CHIP = atmega1284p
495 bobuino:
496 $(MAKE) $(CHIP) AVR_FREQ=16000000L LED=B5
497 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
498 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
499
500 bobuino_isp: bobuino
501 bobuino_isp: TARGET = bobuino
502 bobuino_isp: MCU_TARGET = atmega1284p
503 # 1024 byte boot
504 bobuino_isp: HFUSE ?= DE
505 # Full swing xtal (16MHz) 16KCK/14CK+65ms
506 bobuino_isp: LFUSE ?= F7
507 # 2.7V brownout
508 bobuino_isp: EFUSE ?= FD
509 bobuino_isp: isp
510
511 # MEGA1280 Board (this is different from the atmega1280 chip platform)
512 # Mega has a minimum boot size of 1024 bytes, so enable extra functions
513 # Note that optiboot does not (can not) work on the MEGA2560
514 #mega: TARGET = atmega1280
515 mega1280: atmega1280
516
517
518 mega1280_isp: mega1280
519 mega1280_isp: TARGET = atmega1280
520 mega1280_isp: MCU_TARGET = atmega1280
521 # 1024 byte boot
522 mega1280_isp: HFUSE ?= DE
523 # Low power xtal (16MHz) 16KCK/14CK+65ms
524 mega1280_isp: LFUSE ?= FF
525 # 2.7V brownout; wants F5 for some reason...
526 mega1280_isp: EFUSE ?= F5
527 mega1280_isp: isp
528
529 # 8MHz clocked platforms
530 #
531 # These are capable of 115200 baud
532 # Note that "new" Arduinos with an AVR as USB/Serial converter will NOT work
533 # with an 8MHz target Arduino. The bitrate errors are in opposite directions,
534 # and total too large a number.
535 #
536
537 lilypad: TARGET = $@
538 lilypad: CHIP = atmega168
539 lilypad:
540 $(MAKE) $(CHIP) AVR_FREQ=8000000L LED_START_FLASHES=3
541 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
542 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
543
544 lilypad_isp: lilypad
545 lilypad_isp: TARGET = lilypad
546 # 2.7V brownout
547 lilypad_isp: HFUSE ?= DD
548 # Internal 8MHz osc (8MHz) Slow rising power
549 lilypad_isp: LFUSE ?= E2
550 # 512 byte boot
551 lilypad_isp: EFUSE ?= 04
552 lilypad_isp: isp
553
554 # lilypad_resonator is the same as a 8MHz lilypad, except for fuses.
555 lilypad_resonator: lilypad
556
557 lilypad_resonator_isp: lilypad
558 lilypad_resonator_isp: TARGET = lilypad
559 # 2.7V brownout
560 lilypad_resonator_isp: HFUSE ?= DD
561 # Full swing xtal (20MHz) 258CK/14CK+4.1ms
562 lilypad_resonator_isp: LFUSE ?= C6
563 # 512 byte boot
564 lilypad_resonator_isp: EFUSE ?= 04
565 lilypad_resonator_isp: isp
566
567 pro8: TARGET = pro_8MHz
568 pro8: CHIP = atmega168
569 pro8:
570 $(MAKE) $(CHIP) AVR_FREQ=8000000L LED_START_FLASHES=3
571 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
572 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
573
574 pro8_isp: pro8
575 pro8_isp: TARGET = pro_8MHz
576 # 2.7V brownout
577 pro8_isp: HFUSE ?= DD
578 # Full swing xtal (20MHz) 258CK/14CK+4.1ms
579 pro8_isp: LFUSE ?= C6
580 # 512 byte boot
581 pro8_isp: EFUSE ?= 04
582 pro8_isp: isp
583
584 atmega328_pro8: TARGET = atmega328_pro_8MHz
585 atmega328_pro8: CHIP = atmega328
586 atmega328_pro8:
587 $(MAKE) $(CHIP) AVR_FREQ=8000000L LED_START_FLASHES=3
588 mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
589 mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
590
591 atmega328_pro8_isp: atmega328_pro8
592 atmega328_pro8_isp: TARGET = atmega328_pro_8MHz
593 atmega328_pro8_isp: MCU_TARGET = atmega328p
594 # 512 byte boot, SPIEN
595 atmega328_pro8_isp: HFUSE ?= DE
596 # Low power xtal (16MHz) 16KCK/14CK+65ms
597 atmega328_pro8_isp: LFUSE ?= FF
598 # 2.7V brownout
599 atmega328_pro8_isp: EFUSE ?= DE
600 atmega328_pro8_isp: isp
601
602 # 1MHz clocked platforms
603 #
604 # These are capable of 9600 baud
605 #
606
607 luminet: TARGET = luminet
608 luminet: MCU_TARGET = attiny84
609 luminet: CFLAGS += $(COMMON_OPTIONS) '-DSOFT_UART' '-DBAUD_RATE=9600'
610 luminet: CFLAGS += '-DVIRTUAL_BOOT_PARTITION'
611 luminet: AVR_FREQ ?= 1000000L
612 luminet: LDSECTIONS = -Wl,--section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe
613 luminet: $(PROGRAM)_luminet.hex
614 luminet: $(PROGRAM)_luminet.lst
615
616 luminet_isp: luminet
617 luminet_isp: TARGET = luminet
618 luminet_isp: MCU_TARGET = attiny84
619 # Brownout disabled
620 luminet_isp: HFUSE ?= DF
621 # 1MHz internal oscillator, slowly rising power
622 luminet_isp: LFUSE ?= 62
623 # Self-programming enable
624 luminet_isp: EFUSE ?= FE
625 luminet_isp: isp
626
627
628 #---------------------------------------------------------------------------
629 #
630 # Generic build instructions
631 #
632
633 FORCE:
634
635 baudcheck: FORCE
636 - @$(CC) $(CFLAGS) -E baudcheck.c -o baudcheck.tmp.sh
637 - @sh baudcheck.tmp.sh
638
639 isp: $(TARGET)
640 $(MAKE) -f Makefile.isp isp TARGET=$(TARGET)
641
642 isp-stk500: $(PROGRAM)_$(TARGET).hex
643 $(STK500-1)
644 $(STK500-2)
645
646 %.elf: $(OBJ) baudcheck $(dummy)
647 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
648 $(SIZE) $@
649
650 clean:
651 rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex *.tmp.sh
652
653 %.lst: %.elf
654 $(OBJDUMP) -h -S $< > $@
655
656 %.hex: %.elf
657 $(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex $< $@
658
659 %.srec: %.elf
660 $(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O srec $< $@
661
662 %.bin: %.elf
663 $(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O binary $< $@