From cde97b1e57d3dc445a6270ac5b6dc3288d81e742 Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 28 Jan 2005 01:39:40 +0000 Subject: [PATCH] id location stuff done by Makefiles --- cebpic/.cvsignore | 1 + cebpic/Makefile | 15 ++++++++++++++- cebpic/README.protocol | 11 ++++++++--- cebpic/make-idlocs | 18 ++++++++++++++++++ pic.make | 18 ++++++++++++++++-- 5 files changed, 57 insertions(+), 6 deletions(-) create mode 100755 cebpic/make-idlocs diff --git a/cebpic/.cvsignore b/cebpic/.cvsignore index 6bb7294..243b0c3 100644 --- a/cebpic/.cvsignore +++ b/cebpic/.cvsignore @@ -1,4 +1,5 @@ *.hex *.cod *.lst +idlocs*.asm gpsim.log diff --git a/cebpic/Makefile b/cebpic/Makefile index 02ca049..f0b6c86 100644 --- a/cebpic/Makefile +++ b/cebpic/Makefile @@ -2,12 +2,25 @@ PROGRAMS= led-flash send-serial reply-serial \ nmra-stream nmra-stream,slow # booster-output-low -disabled because you forgot to cvs add it +PICNOS= 0 1 3 + +TARGETS= $(foreach i, $(PICNOS), perpic$i.hex) + include ../pic.make clean: pic-clean + rm -f idlocs*.asm %,slow.o: %.asm $(ASSEMBLE) -D SLOW_VERSION -c -o $@ $< -%-full.hex: %.o config.o +idlocs%.asm: make-idlocs + ./$< $* >$@.new && mv -f $@.new $@ + +perpic%.hex: config.o idlocs%.o $(LINK) + +%-entire0.hex: %.o config.o idlocs0.o + $(LINK) + +.PRECIOUS: idlocs%.asm diff --git a/cebpic/README.protocol b/cebpic/README.protocol index 5b5582c..52b880e 100644 --- a/cebpic/README.protocol +++ b/cebpic/README.protocol @@ -18,11 +18,16 @@ most significant bit first 8n1 -Flash memory -============ +Flash memory ID locations +========================= -Byte 20 0000h bit 0 is 1 for the main PIC and 0 otherwise +Byte 20 0000h + bit 0 1 for the main PIC (#0) + 0 otherwise + 1-7 currently unused, set to 0 +Byte 20 0001h + PIC number (guaranteed to be in range 0..63 inclusive) I2C === diff --git a/cebpic/make-idlocs b/cebpic/make-idlocs new file mode 100755 index 0000000..a1447c5 --- /dev/null +++ b/cebpic/make-idlocs @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +@ARGV==1 or die; +$_=shift @ARGV; +m/^\d+$/ or die; +$_<32 or die; + +push @a, $_ ? '0x00' : '0x80'; +push @a, sprintf "0x%02x", $_; + +printf "; automatically generated - do not edit\n" or die $!; +for ($i= 0x200000; + @a; + $i++) { + $_= shift @a; + printf "\t __idlocs \t 0x%06x, %s\n", $i, $_ or die $!; +} +print "\t end\n" or die $!; diff --git a/pic.make b/pic.make index 8c1f5fd..e4e2db8 100644 --- a/pic.make +++ b/pic.make @@ -1,6 +1,20 @@ +# recommended programming order +# one test on PIC#0 +# first time: erase, write FOO-entire0.hex +# subsequently if only FOO.asm changed: update FOO.hex +# for all pics +# first time: for each individually erase, write perpicNUM.hex +# subsequently: for all update FOO.hex +# other possibilities are not ruled out +# +# filename conventions - contents of hex files +# FOO.hex FOO.o (only) +# FOO-withcfg.hex FOO.o config.o +# FOO-entire0.hex FOO.o idlocs0.o config.o +# perpicNUMBER.hex idlocsNUMBER.o config.o PROGRAM_HEXES= $(addsuffix .hex, $(PROGRAMS)) \ - $(addsuffix -full.hex, $(PROGRAMS)) + $(addsuffix -withcfg.hex, $(PROGRAMS)) all: $(TARGETS) $(PROGRAM_HEXES) @@ -9,7 +23,7 @@ o=>$@.new && mv -f $@.new $@ LINK= gplink -o $@ $^ ASSEMBLE= gpasm -p 18f458 -%-full.hex: %.o config.o +%-withcfg.hex: %.o config.o $(LINK) %.hex: %.o -- 2.30.2