#lang scheme/base ;; This is an example of how to glue the components in Staapl together ;; to get to an interactive console. It loads and compiles the monitor ;; code, uploads it and presents a target REPL. ;; To use, install PLT scheme and piklab. On the hardware side, it ;; uses a serial port on /dev/ttyUSB0 and a microchip ICD2 programmer ;; connected to a PIC18F1220 chip. ;; Load this example as "mzscheme -p zwizwa/staapl/examples/upload-monitor" ;; Create a project with an instantiated PIC18 Forth dialect. (require (planet zwizwa/staapl/prj/pic18) ;; PIC18 compiler in a namespace (planet zwizwa/staapl/prj/pic18-repl) ;; interactive console scheme/runtime-path) ;; Load the interactive monitor target code. The 'define-runtime-path ;; is only here to locate the .f file is in the installed ;; distribution. (define-runtime-path mon "../pic18/monitor-p18f1220.f") (forth-load/compile mon) ;; With a serial cable connected to the target, it is possible to ;; interact with it using a serial connection and the 'forth-command ;; based REPL. This is set here so it's included in the .dict file. (current-console '("/dev/ttyUSB0" 9600)) ;; (current-console '("/dev/ttyS0" 9600)) ;; Write object data + meta data to disk. (save-ihex "monitor.hex") (save-dict "monitor.dict") ;; If you have a PIC18F1220 connected to an ICD2 programmer and have ;; piklab-prog installed, this will upload the just generated .hex to ;; the target, and switch it on: (prog "monitor.hex") (pic18-repl) ;; Now, create a forth file and type 'ul <file>' to replace the ;; current uploaded application (if any) with a freshly compiled one.