Rev 438 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 438 | Rev 469 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | # $Id: Makefile |
1 | # $Id: Makefile 469 2007-05-17 15:09:35Z arune $ |
| 2 | PRG = bios |
2 | PRG = bios |
| 3 | ASRC = $(BIOSDIR)/vectors.S |
3 | ASRC = $(BIOSDIR)/vectors.S |
| 4 | CSRC = $(BIOSDIR)/bios_export.c $(BIOSDIR)/bios.c $(BIOSDIR)/flash.c |
4 | CSRC = $(BIOSDIR)/bios_export.c $(BIOSDIR)/bios.c $(BIOSDIR)/flash.c |
| 5 | BIOS_VERSION = 0x1338 |
5 | BIOS_VERSION = 0x1338 |
| 6 | OPTIMIZE = -Os -mcall-prologues |
6 | OPTIMIZE = -Os -mcall-prologues |
| Line 53... | Line 53... | ||
| 53 | 53 | ||
| 54 | $(PRG)_pass1.elf: $(BIOSDIR)/config.h $(OBJ) |
54 | $(PRG)_pass1.elf: $(BIOSDIR)/config.h $(OBJ) |
| 55 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) |
55 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) |
| 56 | 56 | ||
| 57 | # Get old node config and build new bios "make update NODE_ID=0x01" |
57 | # Get old node config and build new bios "make update NODE_ID=0x01" |
| - | 58 | # this is now done in two steps, first make oldconfig and then make update |
|
| - | 59 | # this due to re-reading the configfile |
|
| 58 | .PHONY: update oldconfig move |
60 | .PHONY: update oldconfig move updateconfig |
| 59 | update: clean |
61 | update: clean all updateconfig |
| 60 | 62 | ||
| - | 63 | # Move config from a node-folder to avr-lib dir to be able to compile a new version of bios |
|
| - | 64 | # this removes the lines starting with BIOS_RAM_END and BIOS_VERSION becasue they are added in make template |
|
| 61 | oldconfig: |
65 | oldconfig: |
| - | 66 | @$(AWK) '!/^BIOS_RAM_END*/ && !/^BIOS_VERSION*/ { print }' $(PERSONALDIR)/*$(NODE_ID)*/bios.inc > config.inc |
|
| 62 | - cp $(PERSONALDIR)/*$(NODE_ID)*/bios.inc config.inc |
67 | # - cp $(PERSONALDIR)/*$(NODE_ID)*/bios.inc config.inc |
| 63 | 68 | ||
| 64 | # Copy template to personal dir |
69 | # Copy template to personal dir |
| 65 | move: |
70 | move: |
| 66 | - mkdir -p $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME) |
71 | - mkdir -p $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME) |
| 67 | - cp $(TEMPLATEDIR)/bios.h $(TEMPLATEDIR)/bios.inc $(TEMPLATEDIR)/config.inc $(TEMPLATEDIR)/libbios.a $(TEMPLATEDIR)/main.c $(TEMPLATEDIR)/Makefile $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/ |
72 | - cp $(TEMPLATEDIR)/bios.h $(TEMPLATEDIR)/bios.inc $(TEMPLATEDIR)/config.inc $(TEMPLATEDIR)/libbios.a $(TEMPLATEDIR)/main.c $(TEMPLATEDIR)/Makefile $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/ |
| - | 73 | ||
| - | 74 | # Copy template to personal dir but dont copy makefile and main.c as you dont want these files replaced generally |
|
| - | 75 | updateconfig: |
|
| - | 76 | - mkdir -p $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME) |
|
| - | 77 | - cp $(TEMPLATEDIR)/bios.h $(TEMPLATEDIR)/bios.inc $(TEMPLATEDIR)/config.inc $(TEMPLATEDIR)/libbios.a $(PERSONALDIR)/$(NODE_ID)_$(HW_NAME)/ |
|
| 68 | 78 | ||
| 69 | 79 | ||
| 70 | .PHONY: clean cleanintermediate cleantemplate |
80 | .PHONY: clean cleanintermediate cleantemplate |
| 71 | clean: cleanintermediate cleantemplate |
81 | clean: cleanintermediate cleantemplate |
| 72 | -rm -f $(PRG).elf $(PRG).lst $(PRG).map *.hex |
82 | -rm -f $(PRG).elf $(PRG).lst $(PRG).map *.hex |
| Line 89... | Line 99... | ||
| 89 | @$(MAKE) BIOS_START=$(shell $(AWK) '/0x[0-9a-f]+.*__bios_optimal_start/ { print $$1 }' bios.map) $(PRG)_pass1.elf |
99 | @$(MAKE) BIOS_START=$(shell $(AWK) '/0x[0-9a-f]+.*__bios_optimal_start/ { print $$1 }' bios.map) $(PRG)_pass1.elf |
| 90 | @mv $(PRG)_pass1.elf $(PRG).elf |
100 | @mv $(PRG)_pass1.elf $(PRG).elf |
| 91 | 101 | ||
| 92 | $(LIBNAME).S: $(PRG).elf |
102 | $(LIBNAME).S: $(PRG).elf |
| 93 | @echo Generating $@ |
103 | @echo Generating $@ |
| 94 |
|
104 | @$(AWK) '$$1 ~ /0x[0-9a-f]+/ && /BIOS_/ { print "\t.set "$$2","$$1"\n\t.global "$$2 }' $(PRG).map > $@ |
| 95 | 105 | ||
| 96 | $(BIOSDIR)/config.h: config.inc |
106 | $(BIOSDIR)/config.h: config.inc |
| 97 | @echo Generating $@ |
107 | @echo Generating $@ |
| 98 | @$(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "#endif" }' $< > $@ |
108 | @$(AWK) 'BEGIN { FS="="; print "#ifndef CONFIG_H_\n#define CONFIG_H_\n" } /^[^#].*=.*/ { print "#define "$$1,$$2 } END { print "#endif" }' $< > $@ |
| 99 | 109 | ||
| Line 130... | Line 140... | ||
| 130 | # Rules for uploading rom images to flash |
140 | # Rules for uploading rom images to flash |
| 131 | 141 | ||
| 132 | install: hex |
142 | install: hex |
| 133 | $(UPLOAD) $(ULFLAGS) |
143 | $(UPLOAD) $(ULFLAGS) |
| 134 | 144 | ||
| - | 145 | # Update bios over can, get config from old node config and build new bios "make reinstall NODE_ID=0x01" |
|
| - | 146 | # this is now done in two steps, first make oldconfig and then make reinstall |
|
| - | 147 | # this due to re-reading the configfile |
|
| 135 | reinstall: |
148 | reinstall: update |
| - | 149 | #next row not needed when using candude |
|
| 136 | $(OBJCOPY) -I ihex -O ihex --change-addresses=-$(shell $(AWK) '/0x[0-9a-f]+.*__bios_optimal_start/ { print $$1 }' bios.map) bios.hex bios_offset.hex |
150 | # $(OBJCOPY) -I ihex -O ihex --change-addresses=-$(shell $(AWK) '/0x[0-9a-f]+.*__bios_optimal_start/ { print $$1 }' bios.map) bios.hex bios_offset.hex |
| 137 | $( |
151 | $(CANUPLOAD) $(CANULFLAGS) -n $(NODE_ID) -f $(PRG).hex -r -b |
| 138 | 152 | ||
| 139 | # Rules for building the eeprom images |
153 | # Rules for building the eeprom images |
| 140 | 154 | ||
| 141 | eeprom: ehex |
155 | eeprom: ehex |
| 142 | 156 | ||