chiark / gitweb /
Some more shinkansen data
[trains.git] / pic.make
1 # recommended programming order
2 #   one test on PIC#0
3 #       first time:                             erase, write FOO+entire0.hex
4 #       subsequently if only FOO.asm changed:   update FOO.hex
5 #   for all pics
6 #       first time:     for each individually   erase, write perpicNUM.hex
7 #                       then for all            update FOO.hex
8 #       subsequently:   for all                 update FOO.hex
9 #   other possibilities are not ruled out
10 #
11 # For actual program from detpic, we program (with odyssey-train):
12 #      odyssey-train <n> write program+code.hex
13 # and then later
14 #        write/update  program+program/code.hex
15 # etc.
16 #
17 # filename conventions - contents of hex files
18 #   FOO.hex             FOO.o (only)
19 #   FOO-withcfg.hex     FOO.o                           config.o
20 #   FOO+entire0.hex     FOO.o           idlocs0.o       config.o
21 #   perpicNUMBER.hex                    idlocsNUMBER.o  config.o
22
23 #ASFLAGS=       -Dmclock=20000 -Dsclock=20000
24 CLOCKS=         -Dmclock=32000 -Dsclock=4000
25 ASFLAGS=        $(CLOCKS)
26
27 HEXMERGER=      $(CEBPIC)merge-hex
28 MERGEHEX=       ./$^ $o
29
30 PIC=            18f458
31 LINK=           gplink -m -o $@ $^
32 ASSEMBLE=       gpasm -p$(PIC)  $(ASFLAGS)
33 DOASSEMBLE=     $(ASSEMBLE) -c $< && mv $*.lst $*+asm.lst
34
35 PIC_HEADER=     /usr/share/gputils/header/p$(PIC).inc
36
37 %.o:            %.asm $(INCLUDES)
38                 $(DOASSEMBLE)
39
40 TIA_DIR=        ../iwjpictest
41 TIA_TIA=        $(TIA_DIR)/to-insn-aliases
42 TIA_ALIASES=    $(TIA_DIR)/insn-aliases.inc
43 TIA=            $(TIA_TIA) -A $(TIA_ALIASES) -H $(PIC_HEADER)
44
45 %.disasm:       %.hex %.map $(TIA_TIA) $(TIA_ALIASES)
46                 gpdasm -p$(PIC) $(word 1,$+) >$@.tmp
47                 $(TIA) -M $(word 2,$+) <$@.tmp $o
48                 @rm $@.tmp
49
50 .PRECIOUS:      %.o
51
52 pic-clean:
53                 -rm -f -- *~ *.new *.tmp *.disasm
54                 -rm -f *.hex *.cod *.lst *.o *.map