chiark / gitweb /
more accurate peco_y peco_c[rl]
[trains.git] / pic.make
index b24a80c07efc9b49c7a9174d96f9f0da09b23bb5..d445442b7335a2ee17a4b33b84c7d9d2e41cf69f 100644 (file)
--- a/pic.make
+++ b/pic.make
-
-M4INCS=                parts.i4
-
-E_TRACK=       ArsCLMNo
-LAYOUTOPTS_ALL=        -ep=*Cm
-LAYOUTOPTS=    -E=*$(E_TRACK) $(LAYOUTOPTS_ALL)
-LAYOUTOPTS_PHYS= -S1.0 $(LAYOUTOPTS) '-e*A'
-XLAYOUTOPTS_LAYER= -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l'
-
-LAYERS_LS=     0 10 20
-LAYERS_PS=     $(addsuffix .ps, $(LAYERS_LS))
-LAYERS_L=      $(addprefix ours-l, $(LAYERS_PS))
-LAYERS_E=      $(addprefix ours-e, $(LAYERS_PS))
-LAYERS=                $(LAYERS_L) $(LAYERS_E)
-
-LPAGES=         $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps))
-
-default:       ours-a.ps ours-al.ps parts.ps
-layers:                $(LAYERS)
-lpages:                $(LPAGES)
-
-all:           default layers bulkres.bom divider-tables \
-               picprogs netlists
-
-o=>$@.new && mv -f $@.new $@
-
-CIRCUITPARTS=  control.partlist circuit.partlist
-BULKRESPARTS=  bulkres-select.partlist bulkres-items.partlist
-
-picprogs:      flasher.hex flash-all.hex
-
-netlists:      reversers.net detectors.net
-
-# print from pcb(1) as follows:
-#   File / Print Layout / ...
-#      select media and offsets: A4
-#      rotate
-#      ok
-#    (If `... exists, use anyway?', Sequence OK)
+# 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
+#                      then for all            update FOO.hex
+#      subsequently:   for all                 update FOO.hex
+#   other possibilities are not ruled out
 #
-# then
-#   make {reversers,detectors}.oprints{-l,-lpr}
-#   for f in *.oprint-*.ps; do gv -scale -1 -media A4 $f; done
-#   etc.
-
-OPRINTS=       %.oprint-copper.ps              \
-               %.pcb.output_fab.ps             \
-               %.pcb.output_frontsilk.ps       \
-               %.oprint-assembly.ps
-
-%.oprints:     $(OPRINTS)
-                       echo $^ >$@-l-tmp
-
-%.oprints-l:   $(OPRINTS) %.oprints Makefile
-                       cp $@-tmp $@
-
-pcboprints:    reversers.oprints-l detectors.oprints-l
-
-%.oprints-lpr: %.oprints-l
-               set -e; for f in `cat $^`; do echo lpr $$f; done
-
-%.distilled.ps:        %.ps
-               ps2ps $< $@
-
-%.oprint-copper.ps:    %.pcb.output_back.distilled.ps \
-                       %.pcb.output_front.distilled.ps
-               cat $^ >$@.tmp
-               ps2ps $@.tmp $@-2.tmp
-               pstops '2:0(-50mm,0mm)+1(50mm,0mm)' <$@-2.tmp $o
-
-%.oprint-copper.ps:    Makefile
-
-%.oprint-assembly.ps:  %.pcb.output_assembly.ps Makefile
-               pstops -pa4 '0@2(-109mm,-290mm)' <$< $o
-
-%.net:         %.net-info
-               sed -e '/^\#/d' <$< $o
-
-%.net-info:    %.net-spec netlist-expand
-               ./netlist-expand $< $o
-
-%.net-spec:    generate-netspec.pl
-               ./$< $@ $o
-
-%.hex:         %.asm
-               gpasm -p 18f458 $<
-
-circuit.bom:   farnell-find $(CIRCUITPARTS)
-               ./farnell-find bom $(CIRCUITPARTS) $o
-
-bulkres.bom:   farnell-find $(BULKRESPARTS)
-               ./farnell-find bom $(BULKRESPARTS) $o
-
-bulkres-select.partlist:       bulkres-select-gen.pl
-               ./$^ $o
-
-bulkres-items.suggest:
-               cat bulkres-searchout*[0-9] | ./farnell-resistor-convert.pl $o
-
-bulkres-items.descs:   bulkres-items.suggest
-               xargs ./farnell-find describe <$< $o
-
-bulkres-items.partlist:
-               ./farnell-resistor-convert.pl <bulkres-items.descs MRS25 std $o
-
-divider-table.txt:     divider-table.pl
-               ./$< $o
-
-divider-tables:                divider-table.ps divider-table.txt
-
-divider-table.ps:      divider-table.txt Makefile
-               a2ps -o- -R -1 --borders no -B -L"$$(wc -l <$<)" -l158 \
-                --center-title='E24 resistor ratios and logarithms' <$< $o
-
-%.d4:          %.m4 $(M4INCS) Makefile
-               m4 -s <$< $o
+# 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
 
-%-a.ps:                %.d4 layout
-               ./layout <$< $(LAYOUTOPTS) '-E*l' $o
+#ASFLAGS=      -Dmclock=20000 -Dsclock=20000
+CLOCKS=                -Dmclock=32000 -Dsclock=4000
+ASFLAGS=       $(CLOCKS)
 
-%-al.ps:       %.d4 layout
-               ./layout <$< $(LAYOUTOPTS) '-e*C' '-ep=rm' $o
+HEXMERGER=     $(CEBPIC)merge-hex
+MERGEHEX=      ./$^ $o
 
-%-ap.ps:       %.d4 layout
-               ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o
+PIC=           18f458
+LINK=          gplink -m -o $@ $^
+ASSEMBLE=      gpasm -p$(PIC)  $(ASFLAGS)
+DOASSEMBLE=    $(ASSEMBLE) -c $< && mv $*.lst $*+asm.lst
 
-ours-l%.ps:    ours.d4 layout
-               ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o
+PIC_HEADER=    /usr/share/gputils/header/p$(PIC).inc
 
-ours-e%.ps:    ours.d4 layout
-               ./layout <$< -l$* -E'=*aRsclMno' \
-                       -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o
+%.o:           %.asm $(INCLUDES)
+               $(DOASSEMBLE)
 
-ours-p%.ps:    ours.d4 layout
-               ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \
-                       $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o
+TIA_DIR=       ../iwjpictest
+TIA_TIA=       $(TIA_DIR)/to-insn-aliases
+TIA_ALIASES=   $(TIA_DIR)/insn-aliases.inc
+TIA=           $(TIA_TIA) -A $(TIA_ALIASES) -H $(PIC_HEADER)
 
-parts.ps:      showlib.d4 layout
-               ./layout <$< $(LAYOUTOPTS_ALL) $o
+%.disasm:      %.hex %.map $(TIA_TIA) $(TIA_ALIASES)
+               gpdasm -p$(PIC) $(word 1,$+) >$@.tmp
+               $(TIA) -M $(word 2,$+) <$@.tmp $o
+               @rm $@.tmp
 
-clean:
-               -rm -f -- *.d4 farn.* *~ *.new
-               -rm -f bulkres-*.partlist bulkres-items.suggest *.bom
-               -rm -f t,*.gnuplot-data t,*.gnuplot-cmd t,gnuplot-fifo
-               -rm -f t,gnuplots.sh reversers.net reversers.net-info
-               -rm -f flasher.hex flasher.cod flasher.lst
-               -rm -f ours-*.ps parts.ps
-               -rm -f *.oprint-*.ps
+.PRECIOUS:     %.o
 
-.PRECIOUS:     %.net-info %.net-spec
-.PRECIOUS:     $(OPRINTS)
+pic-clean:
+               -rm -f -- *~ *.new *.tmp *.disasm
+               -rm -f *.hex *.cod *.lst *.o *.map