My favorites | Sign in
Project Home Downloads Wiki Issues
Checkout   Browse   Changes  
Changes to /trunk/bootloader/Makefile
r21 vs. r29 Compare: vs.  Format:
Revision r29
Go to: 
Sign in to write a code review
/trunk/bootloader/Makefile   r21 /trunk/bootloader/Makefile   r29
1 # Makefile for ATmegaBOOT 1 # Makefile for ATmegaBOOT
2 # E.Lins, 2004-10-14 2 # E.Lins, 2004-10-14
3 3
4 # program name should not be changed... 4 # program name should not be changed...
5 PROGRAM = ATmegaBOOT 5 PROGRAM = ATmegaBOOT
6 6
7 # enter the product name for which you want to build the bootloader/monitor 7 # enter the product name for which you want to build the bootloader/monitor
8 # currently CRUMB8, CRUMB128 and PROBOMEGA128 are supported 8 # currently CRUMB8, CRUMB128 and PROBOMEGA128 are supported
9 PRODUCT = CRUMB8 9 PRODUCT = CRUMB8
10 10
11 # enter the parameters for the UISP isp tool 11 # enter the parameters for the UISP isp tool
12 #ISPPARAMS = -dprog=stk200 -dlpt=0x378 12 #ISPPARAMS = -dprog=stk200 -dlpt=0x378
13 ISPPARAMS = -dprog=stk500 -dserial=/dev/com1 -dspeed=115200 13 ISPPARAMS = -dprog=stk500 -dserial=/dev/com1 -dspeed=115200
14 14
15 15
16 ############################################################ 16 ############################################################
17 # You should not have to change anything below here. 17 # You should not have to change anything below here.
18 ############################################################ 18 ############################################################
19 19
20 DIRAVR = /usr/local/avr 20 #DIRAVR = /usr/local/avr
21 DIRAVRBIN = $(DIRAVR)/bin 21 DIRAVRBIN = $(DIRAVR)/bin
22 DIRAVRUTILS = $(DIRAVR)/utils/bin 22 DIRAVRUTILS = $(DIRAVR)/utils/bin
23 DIRINC = . 23 DIRINC = .
24 DIRLIB = $(DIRAVR)/avr/lib 24 DIRLIB = $(DIRAVR)/avr/lib
25 25
26 26
27 27
28 28
29 ifeq ($(PRODUCT),CRUMB8) 29 ifeq ($(PRODUCT),CRUMB8)
30 MCU_TARGET = atmega8 30 MCU_TARGET = atmega8
31 LDSECTION = --section-start=.text=0x1800 31 LDSECTION = --section-start=.text=0x1800
32 FUSE_L = 0xdf 32 FUSE_L = 0xdf
33 FUSE_H = 0xc8 33 FUSE_H = 0xc8
34 ISPFUSES = $(DIRAVRBIN)/uisp -dpart=ATmega8 $(ISPPARAMS) --wr_fuse_l=$(FUSE_L) --wr_fuse_h=$(FUSE_H) 34 ISPFUSES = $(DIRAVRBIN)/uisp -dpart=ATmega8 $(ISPPARAMS) --wr_fuse_l=$(FUSE_L) --wr_fuse_h=$(FUSE_H)
35 ISPFLASH = $(DIRAVRBIN)/uisp -dpart=ATmega8 $(ISPPARAMS) --erase --upload if=$(PROGRAM).hex -v 35 ISPFLASH = $(DIRAVRBIN)/uisp -dpart=ATmega8 $(ISPPARAMS) --erase --upload if=$(PROGRAM).hex -v
36 endif 36 endif
37 37
38 ifeq ($(PRODUCT),CRUMB128) 38 ifeq ($(PRODUCT),CRUMB128)
39 MCU_TARGET = atmega128 39 MCU_TARGET = atmega128
40 LDSECTION = --section-start=.text=0x1E000 40 LDSECTION = --section-start=.text=0x1E000
41 FUSE_L = 0xdf 41 FUSE_L = 0xdf
42 FUSE_H = 0xc8 42 FUSE_H = 0xc8
43 FUSE_E = 0xff 43 FUSE_E = 0xff
44 ISPFUSES = ./uisp -dpart=ATmega128 $(ISPPARAMS) --wr_fuse_l=$(FUSE_L) --wr_fuse_h=$(FUSE_H) --wr_fuse_e=$(FUSE_E) 44 ISPFUSES = ./uisp -dpart=ATmega128 $(ISPPARAMS) --wr_fuse_l=$(FUSE_L) --wr_fuse_h=$(FUSE_H) --wr_fuse_e=$(FUSE_E)
45 ISPFLASH = ./uisp -dpart=ATmega128 $(ISPPARAMS) --erase --upload if=$(PROGRAM).hex -v 45 ISPFLASH = ./uisp -dpart=ATmega128 $(ISPPARAMS) --erase --upload if=$(PROGRAM).hex -v
46 endif 46 endif
47 47
48 ifeq ($(PRODUCT),PROBOMEGA128) 48 ifeq ($(PRODUCT),PROBOMEGA128)
49 MCU_TARGET = atmega128 49 MCU_TARGET = atmega128
50 LDSECTION = --section-start=.text=0x1E000 50 LDSECTION = --section-start=.text=0x1E000
51 FUSE_L = 0xdf 51 FUSE_L = 0xdf
52 FUSE_H = 0xc8 52 FUSE_H = 0xc8
53 FUSE_E = 0xff 53 FUSE_E = 0xff
54 ISPFUSES = ./uisp -dpart=ATmega128 $(ISPPARAMS) --wr_fuse_l=$(FUSE_L) --wr_fuse_h=$(FUSE_H) --wr_fuse_e=$(FUSE_E) 54 ISPFUSES = ./uisp -dpart=ATmega128 $(ISPPARAMS) --wr_fuse_l=$(FUSE_L) --wr_fuse_h=$(FUSE_H) --wr_fuse_e=$(FUSE_E)
55 ISPFLASH = ./uisp -dpart=ATmega128 $(ISPPARAMS) --erase --upload if=$(PROGRAM).hex -v 55 ISPFLASH = ./uisp -dpart=ATmega128 $(ISPPARAMS) --erase --upload if=$(PROGRAM).hex -v
56 endif 56 endif
57 57
58 58
59 OBJ = $(PROGRAM).o 59 OBJ = $(PROGRAM).o
60 OPTIMIZE = -O3 60 OPTIMIZE = -O3
61 61
62 DEFS = 62 DEFS =
63 LIBS = 63 LIBS =
64 64
65 CC = $(DIRAVRBIN)/avr-gcc 65 CC = $(DIRAVRBIN)/avr-gcc
66 66
67 67
68 # Override is only needed by avr-lib build system. 68 # Override is only needed by avr-lib build system.
69 69
70 override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -D$(PRODUCT) $(DEFS) 70 override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -D$(PRODUCT) $(DEFS)
71 override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION) 71 override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)
72 72
73 OBJCOPY = $(DIRAVRBIN)/avr-objcopy 73 OBJCOPY = $(DIRAVRBIN)/avr-objcopy
74 OBJDUMP = $(DIRAVRBIN)/avr-objdump 74 OBJDUMP = $(DIRAVRBIN)/avr-objdump
75 75
76 all: $(PROGRAM).elf lst text 76 all: $(PROGRAM).elf lst text
77 77
78 isp: $(PROGRAM).hex 78 isp: $(PROGRAM).hex
79 $(ISPFUSES) 79 $(ISPFUSES)
80 $(ISPFLASH) 80 $(ISPFLASH)
81 81
82 $(PROGRAM).elf: $(OBJ) 82 $(PROGRAM).elf: $(OBJ)
83 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 83 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
84 84
85 clean: 85 clean:
86 rm -rf *.o *.elf 86 rm -rf *.o *.elf
87 rm -rf *.lst *.map 87 rm -rf *.lst *.map
88 88
89 lst: $(PROGRAM).lst 89 lst: $(PROGRAM).lst
90 90
91 %.lst: %.elf 91 %.lst: %.elf
92 $(OBJDUMP) -h -S $< > $@ 92 $(OBJDUMP) -h -S $< > $@
93 93
94 # Rules for building the .text rom images 94 # Rules for building the .text rom images
95 95
96 text: hex bin srec 96 text: hex bin srec
97 97
98 hex: $(PROGRAM).hex 98 hex: $(PROGRAM).hex
99 bin: $(PROGRAM).bin 99 bin: $(PROGRAM).bin
100 srec: $(PROGRAM).srec 100 srec: $(PROGRAM).srec
101 101
102 %.hex: %.elf 102 %.hex: %.elf
103 $(OBJCOPY) -j .text -j .data -O ihex $< $@ 103 $(OBJCOPY) -j .text -j .data -O ihex $< $@
104 104
105 %.srec: %.elf 105 %.srec: %.elf
106 $(OBJCOPY) -j .text -j .data -O srec $< $@ 106 $(OBJCOPY) -j .text -j .data -O srec $< $@
107 107
108 %.bin: %.elf 108 %.bin: %.elf
109 $(OBJCOPY) -j .text -j .data -O binary $< $@ 109 $(OBJCOPY) -j .text -j .data -O binary $< $@
Powered by Google Project Hosting