Fri Nov 19 08:16:04 EST 2010


Starting with something tangible: ttlmono-2620-54.fm

It has the following load statements that are to be eliminated:

load p18f2620.f        \ chip macros
load monitor-serial.f  \ boot block + serial monitor code

The place to start is probably to model model-serial.f as a
parameterized unit.  That file consists of:

load monitor-serial-core.f
load monitor-serial-warm.f

The first one doesn't have any unbound names, so can be replaced by a
module directly.  Nope, it needs:

       - init-chip
       - fosc

       - init-serial
       - baud

What does this mean?  The monitor APPLICATION needs chip-specific code
for serial and whole chip init.  That sounds reasonable.

Next: turn monitor-serial-core.ss into a unit.

This needs components:
  - define new unit signatures
  - import / export
  - link

So it introduces some red tape.  Let's stick to s-expr syntax for the
signatures and link files.  Add these units:


Let's just keep these inside the pic18/sig.ss for now:

(define-macro-set pic18-chip^   (fosc init-chip))
(define-macro-set pic18-serial^ (baud init-serial))

And let's just stick with one interface:

;; Chip-specific code.
(define-macro-set pic18-chip^
  (fosc        ;; oscillator Hz
   init-chip   ;; chip-specific init
   baud        ;; hard-coded monitor baud rate
   init-serial ;; chip-specific serial port init

Next problem: the .ss files use #lang scheme/unit
How to expose these to Staapl?

I've added pic18-unit/lang.ss based on scheme/unit instead of
scheme/base but I run into trouble that indicates I don't know what
I'm doing.

To investigate: how does the lang/reader.ss mechanism work again?  It
expands to a "module" form, but the scheme/unit/lang/reader.ss might
do something else.