Line 5... |
Line 5... |
5 |
# |
5 |
# |
6 |
# USBTINY - the location of this directory |
6 |
# USBTINY - the location of this directory |
7 |
# TARGET_ARCH - gcc -mmcu= option with AVR device type |
7 |
# TARGET_ARCH - gcc -mmcu= option with AVR device type |
8 |
# OBJECTS - the objects in addition to the USBtiny objects |
8 |
# OBJECTS - the objects in addition to the USBtiny objects |
9 |
# FLASH_CMD - command to upload main.hex to flash |
9 |
# FLASH_CMD - command to upload main.hex to flash |
- |
|
10 |
# FUSES_CMD - command to program the fuse bytes |
10 |
# STACK - maximum stack size (optional) |
11 |
# STACK - maximum stack size (optional) |
11 |
# FLASH - flash size (optional) |
12 |
# FLASH - flash size (optional) |
12 |
# SRAM - SRAM size (optional) |
13 |
# SRAM - SRAM size (optional) |
13 |
# SCHEM - Postscript version of the schematic to be generated |
14 |
# SCHEM - Postscript version of the schematic to be generated |
14 |
# |
15 |
# |
15 |
# Copyright (C) 2006 Dick Streefland |
16 |
# Copyright 2006-2010 Dick Streefland |
16 |
# |
17 |
# |
17 |
# This is free software, licensed under the terms of the GNU General |
18 |
# This is free software, licensed under the terms of the GNU General |
18 |
# Public License as published by the Free Software Foundation. |
19 |
# Public License as published by the Free Software Foundation. |
19 |
# ====================================================================== |
20 |
# ====================================================================== |
20 |
|
21 |
|
- |
|
22 |
check = $(shell $(CC) $1 -c -xc /dev/null -o/dev/null 2>/dev/null && echo $1) |
- |
|
23 |
|
21 |
CC = avr-gcc |
24 |
CC = avr-gcc |
22 |
CFLAGS = -Os -g -Wall -I. -I$(USBTINY) |
25 |
OPTIM = -Os -ffunction-sections $(call check,-fno-split-wide-types) |
23 |
ASFLAGS = -Os -g -Wall -I. |
26 |
CFLAGS = -g -Wall -Wattributes -I. -I$(USBTINY) $(OPTIM) |
24 |
LDFLAGS = -g |
27 |
LDFLAGS = -g -Wl,--relax,--gc-sections |
25 |
MODULES = crc.o int.o usb.o $(OBJECTS) |
28 |
MODULES = crc.o int.o usb.o $(OBJECTS) |
26 |
UTIL = $(USBTINY)/../util |
29 |
UTIL = $(USBTINY)/../util |
27 |
|
30 |
|
28 |
main.hex: |
31 |
main.hex: |
29 |
|
32 |
|
Line 40... |
Line 43... |
40 |
|
43 |
|
41 |
main.hex: main.elf $(UTIL)/check.py |
44 |
main.hex: main.elf $(UTIL)/check.py |
42 |
@python $(UTIL)/check.py main.elf $(STACK) $(FLASH) $(SRAM) |
45 |
@python $(UTIL)/check.py main.elf $(STACK) $(FLASH) $(SRAM) |
43 |
avr-objcopy -j .text -j .data -O ihex main.elf main.hex |
46 |
avr-objcopy -j .text -j .data -O ihex main.elf main.hex |
44 |
|
47 |
|
- |
|
48 |
check: main.elf $(UTIL)/check.py |
- |
|
49 |
@python $(UTIL)/check.py main.elf $(STACK) $(FLASH) $(SRAM) |
- |
|
50 |
|
45 |
disasm: main.elf |
51 |
disasm: main.elf |
46 |
avr-objdump -S main.elf |
52 |
avr-objdump -S main.elf |
47 |
|
53 |
|
48 |
flash: main.hex |
54 |
flash: main.hex |
49 |
$(FLASH_CMD) |
55 |
$(FLASH_CMD) |
50 |
|
56 |
|
- |
|
57 |
fuses: |
- |
|
58 |
$(FUSES_CMD) |
- |
|
59 |
|
51 |
crc.o: $(USBTINY)/crc.S $(USBTINY)/def.h usbtiny.h |
60 |
crc.o: $(USBTINY)/crc.S $(USBTINY)/def.h usbtiny.h |
52 |
$(COMPILE.c) $(USBTINY)/crc.S |
61 |
$(COMPILE.c) $(USBTINY)/crc.S |
53 |
int.o: $(USBTINY)/int.S $(USBTINY)/def.h usbtiny.h |
62 |
int.o: $(USBTINY)/int.S $(USBTINY)/def.h usbtiny.h |
54 |
$(COMPILE.c) $(USBTINY)/int.S |
63 |
$(COMPILE.c) $(USBTINY)/int.S |
55 |
usb.o: $(USBTINY)/usb.c $(USBTINY)/def.h $(USBTINY)/usb.h usbtiny.h |
64 |
usb.o: $(USBTINY)/usb.c $(USBTINY)/def.h $(USBTINY)/usb.h usbtiny.h |