From: ianmdlvl Date: Sun, 26 Sep 2004 15:26:02 +0000 (+0000) Subject: reorganise test stuff; copybits now flashes per-pic led too X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=4a2f40bd7e565aeb20562ee5d23d6e38a34b6963;p=trains.git reorganise test stuff; copybits now flashes per-pic led too --- diff --git a/.cvsignore b/.cvsignore index efffb63..b679e92 100644 --- a/.cvsignore +++ b/.cvsignore @@ -17,12 +17,6 @@ bulkres-items.partlist bulkres-select.partlist bulkres.bom divider-table.txt -flasher.lst -flasher.hex -flasher.cod -flash-all.lst -flash-all.hex -flash-all.cod reversers.net reversers.net-info reversers.net-spec diff --git a/cebpic/config.asm b/cebpic/config.asm new file mode 100644 index 0000000..088b9d0 --- /dev/null +++ b/cebpic/config.asm @@ -0,0 +1,20 @@ +; -*- fundamental -*- + + include /usr/share/gputils/header/p18f458.inc + +; __config _CONFIG1L, 0xff + __config _CONFIG1H, _OSCS_OFF_1H & _ECIO_OSC_1H + __config _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L + __config _CONFIG2H, _WDT_OFF_2H +; __config _CONFIG3L, 0xff +; __config _CONFIG3H, 0xff + __config _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L +; __config _CONFIG4H, 0xff + __config _CONFIG5L, 0xff + __config _CONFIG5H, 0xff + __config _CONFIG6L, 0xff + __config _CONFIG6H, 0xff + __config _CONFIG7L, 0xff + __config _CONFIG7H, 0xff + + end diff --git a/iwjpictest/.cvsignore b/iwjpictest/.cvsignore new file mode 100644 index 0000000..b9fbbeb --- /dev/null +++ b/iwjpictest/.cvsignore @@ -0,0 +1,3 @@ +*.hex +*.cod +*.lst diff --git a/iwjpictest/Makefile b/iwjpictest/Makefile new file mode 100644 index 0000000..25207b7 --- /dev/null +++ b/iwjpictest/Makefile @@ -0,0 +1,10 @@ +TARGETS= config.hex \ + flasher.hex copybits.hex \ + flasher-full.hex copybits-full.hex + +include ../pic.make + +clean: pic-clean + +%-full.hex: %.o config.o + $(LINK) diff --git a/iwjpictest/config.asm b/iwjpictest/config.asm new file mode 100644 index 0000000..088b9d0 --- /dev/null +++ b/iwjpictest/config.asm @@ -0,0 +1,20 @@ +; -*- fundamental -*- + + include /usr/share/gputils/header/p18f458.inc + +; __config _CONFIG1L, 0xff + __config _CONFIG1H, _OSCS_OFF_1H & _ECIO_OSC_1H + __config _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L + __config _CONFIG2H, _WDT_OFF_2H +; __config _CONFIG3L, 0xff +; __config _CONFIG3H, 0xff + __config _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L +; __config _CONFIG4H, 0xff + __config _CONFIG5L, 0xff + __config _CONFIG5H, 0xff + __config _CONFIG6L, 0xff + __config _CONFIG6H, 0xff + __config _CONFIG7L, 0xff + __config _CONFIG7H, 0xff + + end diff --git a/iwjpictest/copybits.asm b/iwjpictest/copybits.asm index 1cfa1d3..a404711 100644 --- a/iwjpictest/copybits.asm +++ b/iwjpictest/copybits.asm @@ -1,22 +1,7 @@ -; +; -*- fundamental -*- include /usr/share/gputils/header/p18f458.inc -; __config _CONFIG1L, 0xff - __config _CONFIG1H, _OSCS_OFF_1H & _ECIO_OSC_1H - __config _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L - __config _CONFIG2H, _WDT_OFF_2H -; __config _CONFIG3L, 0xff -; __config _CONFIG3H, 0xff - __config _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L -; __config _CONFIG4H, 0xff - __config _CONFIG5L, 0xff - __config _CONFIG5H, 0xff - __config _CONFIG6L, 0xff - __config _CONFIG6H, 0xff - __config _CONFIG7L, 0xff - __config _CONFIG7H, 0xff - ACCSFR equ 0x0f00 COUNTINNER equ 0x00 @@ -28,8 +13,11 @@ OUTEREXP equ 7 ; 2^7 * 2.6ms = 332ms ; entry we assume it's already 0. For the loops which want to ; count all the way (256 iterations) that's good. + code + start - bcf TRISA, 0, 0 ; enable flasher output + bcf TRISA, 0, 0 ; enable flasher pin output + bcf TRISD, 2, 0 ; enable per-pic led output movlw 0x07 ; turn off A-to-D so we get movwf ADCON1, 0 ; digital inputs on RA0-3 (AN0-3) bcf TRISD, 4, 0 ; enable output D @@ -37,7 +25,8 @@ start movwf TRISC, 0 ; (RC7,6,5) loop - btg LATA, 0, 0 + btg LATA, 0, 0 ; toggle flasher pin output + btg LATD, 2, 0 ; toggle per-pic led output ; set a bit which says how fast the led ; should flash and count down from 2^(that bit) @@ -64,18 +53,18 @@ copybit macro sreg, sbitno, dreg, dbitvals endm copybiti PORTB, 5, TRISA, 0x06 ; C enable - copybit PORTB, 4, PORTA, 0x06 ; C data + copybit PORTB, 4, LATA, 0x06 ; C data copybiti PORTB, 3, TRISA, 0x18 ; B enable - copybit PORTB, 2, PORTA, 0x18 ; B data + copybit PORTB, 2, LATA, 0x18 ; B data copybiti PORTB, 1, TRISA, 0x20 ; A enable copybiti PORTB, 1, TRISE, 0x01 ; A enable - copybit PORTB, 0, PORTA, 0x20 ; A data - copybit PORTB, 0, PORTE, 0x01 ; A data + copybit PORTB, 0, LATA, 0x20 ; A data + copybit PORTB, 0, LATE, 0x01 ; A data - copybiti PORTA, 6, PORTD, 0x10 ; D - copybiti PORTC, 0, PORTC, 0x80 ; E - copybiti PORTC, 1, PORTC, 0x40 ; F - copybiti PORTC, 2, PORTC, 0x20 ; G + copybiti PORTA, 6, LATD, 0x10 ; D + copybiti PORTC, 0, LATC, 0x80 ; E + copybiti PORTC, 1, LATC, 0x40 ; F + copybiti PORTC, 2, LATC, 0x20 ; G ; 12 x copybit @6 = 48cy decfsz COUNTINNER, 1, 0 ; 1 cycle diff --git a/iwjpictest/flasher.asm b/iwjpictest/flasher.asm index 0d7d24b..5e53372 100644 --- a/iwjpictest/flasher.asm +++ b/iwjpictest/flasher.asm @@ -1,22 +1,7 @@ -; +; -*- fundamental -*- include /usr/share/gputils/header/p18f458.inc -; __config _CONFIG1L, 0xff - __config _CONFIG1H, _OSCS_OFF_1H & _ECIO_OSC_1H - __config _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L - __config _CONFIG2H, _WDT_OFF_2H -; __config _CONFIG3L, 0xff -; __config _CONFIG3H, 0xff - __config _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L -; __config _CONFIG4H, 0xff - __config _CONFIG5L, 0xff - __config _CONFIG5H, 0xff - __config _CONFIG6L, 0xff - __config _CONFIG6H, 0xff - __config _CONFIG7L, 0xff - __config _CONFIG7H, 0xff - COUNTFAST equ 0x00 COUNTMEDIUM equ 0x01 COUNTSLOW equ 0x02 @@ -27,6 +12,8 @@ SLOWEXP equ 2 ; 2^2 * 40ms = 160ms ; entry we assume it's already 0. For the loops which want to ; count all the way (256 iterations) that's good. + code + start loop call red diff --git a/iwjpictest/serialloop.asm b/iwjpictest/serialloop.asm index 1cfa1d3..a404711 100644 --- a/iwjpictest/serialloop.asm +++ b/iwjpictest/serialloop.asm @@ -1,22 +1,7 @@ -; +; -*- fundamental -*- include /usr/share/gputils/header/p18f458.inc -; __config _CONFIG1L, 0xff - __config _CONFIG1H, _OSCS_OFF_1H & _ECIO_OSC_1H - __config _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L - __config _CONFIG2H, _WDT_OFF_2H -; __config _CONFIG3L, 0xff -; __config _CONFIG3H, 0xff - __config _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L -; __config _CONFIG4H, 0xff - __config _CONFIG5L, 0xff - __config _CONFIG5H, 0xff - __config _CONFIG6L, 0xff - __config _CONFIG6H, 0xff - __config _CONFIG7L, 0xff - __config _CONFIG7H, 0xff - ACCSFR equ 0x0f00 COUNTINNER equ 0x00 @@ -28,8 +13,11 @@ OUTEREXP equ 7 ; 2^7 * 2.6ms = 332ms ; entry we assume it's already 0. For the loops which want to ; count all the way (256 iterations) that's good. + code + start - bcf TRISA, 0, 0 ; enable flasher output + bcf TRISA, 0, 0 ; enable flasher pin output + bcf TRISD, 2, 0 ; enable per-pic led output movlw 0x07 ; turn off A-to-D so we get movwf ADCON1, 0 ; digital inputs on RA0-3 (AN0-3) bcf TRISD, 4, 0 ; enable output D @@ -37,7 +25,8 @@ start movwf TRISC, 0 ; (RC7,6,5) loop - btg LATA, 0, 0 + btg LATA, 0, 0 ; toggle flasher pin output + btg LATD, 2, 0 ; toggle per-pic led output ; set a bit which says how fast the led ; should flash and count down from 2^(that bit) @@ -64,18 +53,18 @@ copybit macro sreg, sbitno, dreg, dbitvals endm copybiti PORTB, 5, TRISA, 0x06 ; C enable - copybit PORTB, 4, PORTA, 0x06 ; C data + copybit PORTB, 4, LATA, 0x06 ; C data copybiti PORTB, 3, TRISA, 0x18 ; B enable - copybit PORTB, 2, PORTA, 0x18 ; B data + copybit PORTB, 2, LATA, 0x18 ; B data copybiti PORTB, 1, TRISA, 0x20 ; A enable copybiti PORTB, 1, TRISE, 0x01 ; A enable - copybit PORTB, 0, PORTA, 0x20 ; A data - copybit PORTB, 0, PORTE, 0x01 ; A data + copybit PORTB, 0, LATA, 0x20 ; A data + copybit PORTB, 0, LATE, 0x01 ; A data - copybiti PORTA, 6, PORTD, 0x10 ; D - copybiti PORTC, 0, PORTC, 0x80 ; E - copybiti PORTC, 1, PORTC, 0x40 ; F - copybiti PORTC, 2, PORTC, 0x20 ; G + copybiti PORTA, 6, LATD, 0x10 ; D + copybiti PORTC, 0, LATC, 0x80 ; E + copybiti PORTC, 1, LATC, 0x40 ; F + copybiti PORTC, 2, LATC, 0x20 ; G ; 12 x copybit @6 = 48cy decfsz COUNTINNER, 1, 0 ; 1 cycle diff --git a/pic.make b/pic.make index d6b297d..7dc84f1 100644 --- a/pic.make +++ b/pic.make @@ -1,190 +1,18 @@ -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: netlists picprogs -layers: $(LAYERS) -lpages: $(LPAGES) - -all: default layers bulkres.bom divider-tables \ - picprogs netlists panel3.pcb +all: $(TARGETS) o=>$@.new && mv -f $@.new $@ -CIRCUITPARTS= control.partlist circuit.partlist -BULKRESPARTS= bulkres-select.partlist bulkres-items.partlist - -picprogs: flasher.hex - -netlists: reversers.net detectors.net \ - reversers.hole-rep detectors.hole-rep \ - both.hole-rep panel3.hole-rep - -# print from pcb(1) as follows: -# File / Print Layout / ... -# select media and offsets: A4 -# rotate -# ok -# (If `... exists, use anyway?', Sequence OK) -# -# 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 - -%.hole-rep: %.pcb hole-report.pl - ./hole-report.pl <$< $o - -include reversers.layers.dep -include detectors.layers.dep -include panel3.layers.dep - -%.zip: layers.txt.tmpl Makefile - rm -rf $@.d; mkdir -p $@.d - set -e; exec <$<; cd $@.d; perl -pe ' \ - m/^(\S+)\s+(\w+)\s+(\w+)\s+(\S.*)$$/ or die; \ - system "cp ../$*.pcb.output_$$1.$$3 $$2.$$3"; \ - die $$? if $$?; \ - $$_= sprintf "%-20s %s\n", "$$2.$$3", $$4; \ - ' >readme.txt; \ - zip -l ../$@.new * - mv -f $@.new $@ - unzip -v $@ - -PANEL3_PCBS= reversers.pcb detectors.pcb detectors.pcb - -panel3.pcb: pcb-panelise $(PANEL3_PCBS) Makefile - ./$< -g100 $(PANEL3_PCBS) $o - -$*.zip: $*.pcb.output_$$1.$$2/ or die' \ - -%.out-ps.tar: - GZIP=-9v tar zvcf $@.gz $*.pcb.output_*.ps - -%.layers.dep: layers.txt.tmpl Makefile - perl -pe \ - 's/^(\S+)\s+\w+\s+(\w+)\s.*/$*.zip: $*.pcb.output_$$1.$$2/ or die' \ - <$< $o - -both.hole-rep: hole-report.pl reversers.pcb detectors.pcb - ./$^ $o - -%.oprints: $(OPRINTS) - echo $^ >$@-l-tmp - -%.oprints-l: $(OPRINTS) %.oprints Makefile - cp $@-tmp $@ - -pcboprints: reversers.oprints-l detectors.oprints-l - -%.oprints-lpr: %.oprints-l - set -ex; for f in `cat $^`; do 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