all: @echo @echo Pick a target from one of the source files in: @ls *.fm @echo @echo by replacing the .fm extension by one of the following: @echo " .hex Compile HEX file." @echo " .dict Create interactive dictionary." @echo " .flash Build HEX and upload to target." @echo " .live Build HEX and upload and connect to target." # INTERP=racket # COMP=??? INTERP=mzscheme COMP=mzc # console to record in the .dict file (defaults to /dev/staapl) # STAAPLC_FLAGS = -c /dev/ttyUSB0 # STAAPLC_FLAGS = -c /dev/tty-FTDCIX5Z # STAAPLC_FLAGS = -c /dev/tty3V3 # STAAPLC_FLAGS = -c /dev/tty5V # STAAPLC_FLAGS = -c /dev/ttyUPS STAAPLC_FLAGS = -c pickit2 # make sure this works without the "staaplc" command line app wrapper installed STAAPLC = $(INTERP) -p zwizwa/staapl/staaplc -- PROGRAM = pk2cmd -I -M -R # compile the module first before instantiating it in staaplc %.hex: %.fm $(COMP) -vk $< $(STAAPLC) $(STAAPLC_FLAGS) $< chmod +x $*.hex %.dict: %.fm $(COMP) -vk $< $(STAAPLC) $(STAAPLC_FLAGS) $< chmod +x $@ # In order for this to work, you need a special comment line in the .f # file. See staapler.f which contains a command for the pk2cmd program. %.program: %.fm cat $< | grep '\\ #sh#' | cut -b7- >$@ %.flash: %.program %.hex sh $*.program $*.hex # Note: if you're sure the microcontroller's flash memory is # consistent with the data in the .dict file, it's OK to just run # "staapl ". However, we don't know that here so we program # the device before connecting. %.live: %.dict %.flash $(COMP) -vk ../staapl/live.ss $(INTERP) $*.dict clean: rm -rf *~ *.hex *.dict *.program test.md5sum *.timestamp *.dasm compiled # Regression tests for binary code generator. # Tests depend on compiler: use the .zo file as a timestamp HEX = synth-1220-8.hex logan.hex 2620-40.hex 1220-8.hex picstamp.hex 452-40.hex blink-a-led.hex DASM = $(HEX:.hex=.dasm) DIFF = $(HEX:.hex=.diff) test.md5sum: $(HEX) md5sum *.hex >$@ dasm: $(DASM) test: $(DIFF) %.dasm: %.hex gpdasm -p 18F1220 $< >$@ # We diff the hex instead of the dasm as gpdasm produces output # dependent on 32bit or 64bit host. %.diff: %.hex diff $< hex/$< _test: make clean ; make test