Wed Jun 25 12:03:14 EDT 2014

staaplc device selector

It seems that staaplc should be smart about setting up comm correctly
based on usb uart (no baudrate), real uart (baudrate) and the pk2

So if -c is not defined, it should do lookup.

Ok, fixed:

;; Figure out console config
(define (console-spec)

  ;; Unless overridden by command line arguments, get the console
  ;; specs from the Forth source files.
  (define (spec-from-source param id)
    (unless (param)
      (let ((v (eval `(macro-constant ',id))))
        (when v (param v)))))

  (define (device-string x)
    (if (symbol? x) (symbol->string x) x))

  (spec-from-source console 'console-type)
  (spec-from-source device  'console-device)
  (spec-from-source baud    'console-baud)
  `(console ',(console) ,(device-string (device)) ,(baud)))