STYXMON(10.8)              (Strongarm)              STYXMON(10.8)

     NAME
          styxmon - first stage bootstrap for SA110 and SA1100

     SYNOPSIS
          echo b9600 >/dev/eia0ctl
          mount -A /dev/eia0 /n/rdbg

     DESCRIPTION
          Styxmon is the first stage bootstrap program for Inferno on
          various Strongarm platforms.  It also acts as a Styx server,
          responding to T messages on the serial port, allowing a
          debugging host to do an unauthenticated mount (see bind(1))
          of the device to access it.

          Styxmon is burned in the non-volatile (flash) RAM at an
          address such that processor reset executes it.  Styxmon is
          responsible for basic machine initialization, loading and
          executing the secondary bootloader (or any other standalone
          program).  It provides a specialised interface to the stan-
          dalone program, used only by sboot(10.8); see the source
          code.

          Initially, styxmon exports four files into the namespace.
          Programs that are run from Styxmon, such as sboot, can add
          additional files to the namespace that is exported.

               /n/rdbg/boot
               /n/rdbg/cons
               /n/rdbg/ctl
               /n/rdbg/mem

          These files are described below.

          boot  Any file copied here will be executed, if it has a
                standard Plan 9 or AIF (ARM) header.  For example, to
                boot `sbsword.aif' (the AIF executable for sboot), do
                the following:

                     cp sbsword.aif /n/rdbg/boot

                This is equivalent to finding a region of memory that
                is known to be unused, and doing the following set of
                commands (assuming that such a region exists at
                `0x10000'):

                     dd -if sbsword.aif -of /n/rdbg/mem -bs 1024 -oseek 64
                     echo e0x10000 > /n/rdbg/ctl

          cons  The console file, which can be read to get console

     Page 1                       Plan 9             (printed 4/19/24)

     STYXMON(10.8)              (Strongarm)              STYXMON(10.8)

                output; when written to, the data is sent as console
                input to any program currently running on the device.
                For instance, to keep an ongoing log of console out-
                put:

                     cat /n/rbdg/cons&

                If sboot is running, a `P' command can be typed to it
                with:

                     echo P > /n/rdbg/cons

                For an interactive console:

                     cat /n/rbdg/cons&
                     cat >/n/rbdg/cons

          ctl   The control file, to which commands can be written,
                described below.

          mem   A seekable file that represents all of the device's
                memory.  It should be used with utilities that selec-
                tively seek and read or write parts of it, such as
                dd(1) and mdb(1).

          The control file ctl accepts the following commands:

          Eoffset
               Execute at the specified flash offset, which can be
               decimal, or hexadecimal with a `0x' prefix).  For
               instance, to execute the program at offset `0x8000' in
               the flash:

                    echo E0x8000 > /n/rdbg/ctl

               The program at the specified offset is expected to have
               a standard Plan 9 or AIF header.

               The address of a boot parameters structure (see
               /os/sa1100/bootparam.h) is passed as the first argument
               to the call to the entry routine.

          E    Execute the default boot program from flash.

          eaddress
               Execute at the specified memory address.

          Soffset
               Start at the specified flash offset. A call will actu-
               ally be made directly to the specified address.  The
               address of the BPI structure is still passed as the
               first argument.

     Page 2                       Plan 9             (printed 4/19/24)

     STYXMON(10.8)              (Strongarm)              STYXMON(10.8)

          saddress
               Start at the specified memory address.

          r0   Soft reset (reinitialize).

          r1   Hard reset.

          raddress
               Reset to specified address.  This allows replacement
               monitor code to be tested.  Essentially, this stores a
               magic number and the address in registers that survive
               the reset, and when the system resets and sees the
               magic number, it vectors to the specified address
               instead of running the normal monitor initialization.

          xval Force the current program to exit with the specified
               exit code val. This will return Styxmon to the hangout
               state.

          bbaud
               Set the serial speed to the specified baud rate.  This
               does not change the current speed, but instead changes
               the connection speed used after the device is unmounted
               and remounted.

          C    Console reset.  This makes all text in the circular
               message buffer act as if it is new, so that the next
               read of cons or ctl will display all of it.  For
               instance, if text was put in the circular message
               buffer and then the kernel crashed, the following can
               be done to recover the final messages:

                    echo C > /n/rdbg/ctl
                    cat /n/rdbg/ctl

               Or alternatively:

                    cat /n/rdbg/cons&
                    echo C > /n/rdbg/ctl

               ctl can also be read, in which case it acts like a
               non-blocking form of `cons' (ie, it will return the
               latest console output, then end-of-file).  In most
               cases, it is better to leave `cat /n/rdbg/cons&' run-
               ning instead, so that all console output can be seen
               when it becomes available.  There may be cases, how-
               ever, where it is desirable just to capture new output
               at specified moments.

     EXAMPLES
          To initiate a connection to a Styxmon-enabled board:

     Page 3                       Plan 9             (printed 4/19/24)

     STYXMON(10.8)              (Strongarm)              STYXMON(10.8)

               echo b9600 > /dev/eia0ctl
               mount -A /dev/eia0 /n/rdbg

          To connect at a faster rate:

               # first connect at 9600:
               echo b9600 > /dev/eia0ctl
               mount -A /dev/eia0 /n/rdbg
               # tell styxmon what rate to use next time:
               echo b38400 > /n/rdbg/ctl
               unmount /n/rdbg
               # now reconnect at the faster rate:
               echo b38400 > /dev/eia0ctl
               mount -A /dev/eia0 /n/rdbg

          To see the initial styxmon startup message (including memory
          size, CPU speed, FIDs opened, etc.) after mounting:

               cat /n/rdbg/ctl

          The script `/usr/ddk/lib/mashinit' has menus to handle con-
          necting, changing the speed, downloading kernels, etc. auto-
          matically.

          In the styxmon console output, a `*' on a line by itself
          means that styxmon has returned from executing a command,
          and is now polling for Styx messages.

          Styxmon on the SA1100 uses DMA channel 3 to collect data
          from the FIFO's of serial port 3.  If that serial port is to
          be reused for some other purpose, it is important to make
          sure that the DMA channel is disabled first.

     SEE ALSO
          sboot(10.8)

     Page 4                       Plan 9             (printed 4/19/24)