YAMON Quick Start

YAMON Quick Start

当前版本: 1.0
完成日期: 2011-2-23
作者: Jack Tan
Email: jiankemeng@gmail.com
版权声明: 转载请注明出处,商业用途请联系作者

1. YAMON Boot Log

YAMON ROM Monitor, Revision 02.13.
Copyright (c) 1999-2006 MIPS Technologies, Inc. - All Rights Reserved.

For a list of available commands, type 'help'.

Compilation time =              Dec  7 2006  19:01:12
Board type/revision =           0x02 (Malta) / 0x00
Core board type/revision =      0x04 (CoreFPGA) / 0x00
System controller/revision =    Galileo / GT_64120A-B-2
FPGA revision =                 0x0001
MAC address =                   00.d0.a0.00.05.b6
Board S/N =                     0000001194
PCI bus frequency =             33.33 MHz
Processor Company ID/options =  0x01 (MIPS Technologies, Inc.) / 0x00
Processor ID/revision =         0x81 (MIPS 5Kf) / 0x0c
Endianness =                    Big
CPU/Bus frequency =             10000 kHz / 40 MHz
Flash memory size =             4 MByte
SDRAM size =                    64 MByte
First free SDRAM address =      0x800b7160


2. Config to bootstrap

2.0 Display enviroment variables

Using ‘setenv’ without any other arguments to display all enviroment variables:

YAMON> setenv
baseboardserial (RO)   0000001194
bootfile        (R/W)
bootprot        (R/W)  tftp
bootserport     (R/W)  tty0
bootserver      (R/W)
cpuconfig       (R/W)
ethaddr         (RO)   00.d0.a0.00.05.b6
fpu             (R/W)
gateway         (R/W)
ipaddr          (R/W)
memsize         (RO)   0x04000000
modetty0        (R/W)  38400,n,8,1,hw
modetty1        (R/W)  38400,n,8,1,hw
prompt          (R/W)  YAMON
start           (R/W)
startdelay      (R/W)
subnetmask      (R/W)
yamonrev        (RO)   02.13

2.1 Set ethernet variables

YAMON does not supply explicit ethernet configure commands. You need to set following environment variables (YAMON predefine) for supporting ethernet:


Using ‘setenv’ to set these variable:

YAMON> setenv ipaddr
YAMON> setenv subnetmask
YAMON> setenv gateway

‘setenv’ store the environment variable permanently in the NVRAM.

After seting the ethernet, you can use the ‘ping’ command to test the network:

YAMON> ping

If the setting is OK, it’ll output like following:

. 64 bytes ICMP-ECHO-REPLY user data received from


Error : Gateway IP-address is not set
Diag  : Gateway IP-address:
Hint  : Check environment variable 'gateway'

2.2 Load & execute

YAMON supply ‘load’ command to load image from serial port or Ethernet to RAM. The only image type currently supported is SREC:

YAMON> load tftp://
YAMON> load asc://tty0

‘load’ command does not support loading file to a user specified address.

You can use following YAMON predefined variable to specify the default value:

bootprot                        -------> specify the default boot protocol used by 'load' command (tftp/asc)
bootserver                      -------> specify the default TFTP server ip
bootfile                        -------> specify the default TFTP file
bootserport                     -------> specify the default serial port used by 'load' command

So after executing following commands:

YAMON> setenv bootprot tftp
YAMON> setenv bootserver
YAMON> setenv bootfile vlm-boards/15440/vmlinux.srec

We only need type ‘load’ without following long strings:

YAMON> load
About to load tftp://
Press Ctrl-C to break
Start = 0x80410b90, range = (0x80100000,0x80533085), format = SREC

After loading kernel, we need to use ‘go’ command to start kernel at target address:

YAMON> go . root=/dev/nfs rw nfsroot= ip= console=ttyS0,38400

‘.’ reference to the default execution address which is from the last sucessful ‘load’ or ‘go’ command (if any). This default address can be showed by:

YAMON> go ? Address = 0x80410b90

Following command equal to the previous command:

YAMON> go 0x80410b90 root=/dev/nfs rw nfsroot= ip= console=ttyS0,38400

2.3 Automatic bootstrap

YAMON use predefined variable ‘start’ as the automatic bootstrap command, YAMON will give the user the option to press Ctrl-C within 2 seconds to cancel execution of the start command.

We can set ‘startdelay’ variable to specify the delay seconds. But if set ‘startdelay’ to 0, the start command will not be executed.

YAMON> setenv start "load; go . root=/dev/nfs rw nfsroot= ip= console=ttyS0,38400"
YAMON> setenv startdelay 1

If you predefine some variables like following:

YAMON> setenv nfsboot "root=/dev/nfs rw nfsroot="
YAMON> setenv addtty "console=ttyS0,38400"
YAMON> setenv ip "ip="

You can define the ‘start’ like this:

YAMON> setenv start "load; go . ${nfsboot} ${addtty} ${ip}"

3. Memory commands

3.1 Disassemble instructions

Disassemble 5 instuctions at 0xbfc00100:

YAMON> dis 0xbfc00100 5
BFC00100:  3C1ABFC0  lui         k0,0xbfc0
BFC00104:  8F5A0010  lw          k0,16(k0)
BFC00108:  001AD682  srl         k0,k0,0x1a
BFC0010C:  335A003F  andi        k0,k0,0x3f
BFC00110:  3B5A0001  xori        k0,k0,0x1

3.2 Dump memory


dump [-m][-8|-16|-32] address [size]
YAMON> dump -8 0xa0000000 0x40
A0000000: 08 00 ED E7 24 1A 00 00 00 00 00 02 00 00 00 03  ....$...........
A0000010: 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 07  ................
A0000020: 00 00 00 08 00 00 00 09 00 00 00 0A 00 00 00 0B  ................
A0000030: 00 00 00 0C 00 00 00 0D 00 00 00 0E 00 00 00 0F  ................

YAMON> dump -32 0xa0000000 0x50
A0000000: 0800EDE7 241A0000 00000002 00000003  ....$...........
A0000010: 00000004 00000005 00000006 00000007  ................
A0000020: 00000008 00000009 0000000A 0000000B  ................
A0000030: 0000000C 0000000D 0000000E 0000000F  ................
A0000040: 00000010 00000011 00000012 00000013  ................

3.3 Modify memory


edit [-8|-16|-32] address

‘-’ cause the address to be decremented a unit (8/16/32 bit).

YAMON> edit -32 0x81000000
0x81000000:  (00000000)  55aa55aa
0x81000004:  (00000400)  55aa55aa
0x81000008:  (00000001)  55aa55aa
0x8100000C:  (FFFFFFDF)  -
0x81000008:  (55AA55AA)  -
0x81000004:  (55AA55AA)
0x81000008:  (55AA55AA)
0x8100000C:  (FFFFFFDF)  .

Typing ‘.’ or Ctro-c to exit edit mode.

3.4 Fill memory


fill [-8|-16|-32] address size data
YAMON> fill -16 0x82000000 0x20 0x55aa
Filling from 0x82000000 to 0x8200001f with halfword data 0x55AA.

YAMON> dump -16 0x82000000 0x20
82000000: 55AA 55AA 55AA 55AA 55AA 55AA 55AA 55AA  U�U�U�U�U�U�U�U�
82000010: 55AA 55AA 55AA 55AA 55AA 55AA 55AA 55AA  U�U�U�U�U�U�U�U�

4. Flash commands

4.1 Erase flash


erase -e | address size

WARNING: Using following command, you need to be familiar with the flash start address and its size. Do not erase the YAMON!

erase 0xbfc00000 20

Following command erase environment flash, the system environment variables are reinitialised to factory default values.

erase -e

4.2 update flash

You can use ‘copy’, ‘disk’ and ‘load’ commands to update the flash

copy [-f] src_addr dst_addr size
disk [-f] read hda/b/c/d sector count dst_addr

‘-f’ Don’t flush caches

Using ‘load’ to downloading S-records may include flash programming if the S-record is bound to a flash memory area. This area must be erased before downloading.

5. Miscellaneous

5.1 Reset system

YAMON> reset

5.2 Read/write TLB

YAMON> tlb 

Index Page  VA         G ASID PA0        C0 D0 V0 PA1        C1 D1 V1
0x0   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n
0x1   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n
0x2   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n
0x3   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n
0x4   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n

You can use following command to edit the TLB:

YAMON> tlb 2 4kB 0 y ff 200000 3 y y 300000 3 n y

YAMON> tlb
Index Page  VA         G ASID PA0        C0 D0 V0 PA1        C1 D1 V1
0x0   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n
0x1   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n
0x2   4kB   0x00000000 y 0xff 0x00200000 3  y  y  0x00300000 3  n  y
0x3   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n
0x4   4kB   0x00000000 n 0x00 0x00000000 0  n  n  0x00000000 0  n  n

5.3 Read/Write CP0

You can use ‘cp0′ to read and write CP0 register:

YAMON> cp0
BadVAddr      = 0x0000000000000000  CacheErr      = 0x00000000
Cause         = 0x00808000          Compare       = 0x00000000
Config        = 0xb601c083          Config1       = 0x5ea3519b
Context       = 0x0000000000000000  Count         = 0x33319249
DEPC          = 0x0000000000000000  DESAVE        = 0x0000000000000000
DataHi        = 0x00000000          DataLo        = 0x00000000
Debug         = 0x02010000          EPC           = 0xffffffff80028dac
EntryHi       = 0x0000000000000000  EntryLo0      = 0x0000000000000000
EntryLo1      = 0x0000000000000000  ErrCtl        = 0x00000000
ErrorEPC      = 0x0000000000000000  Index         = 0x00000013
PRId          = 0x0001810c          PageMask      = 0x00000000
PerfCntCount0 = 0x00000000          PerfCntCount1 = 0x00000000
PerfCntCtrl0  = 0x80000000          PerfCntCtrl1  = 0x00000000
Random        = 0x0000002f          Status        = 0x24002c01
TagHi         = 0x00000000          TagLo         = 0x00000000
WatchHi       = 0x0000000080000000  WatchLo       = 0x0000000000000000
Wired         = 0x00000000          XContext      = 0x0000000000000000
YAMON> cp0 WatchLo
WatchLo = 0x0000000000000000
YAMON> cp0 WatchLo 0x55aa
YAMON> cp0 WatchLo
WatchLo = 0x00000000000055aa

5.4 Help

YAMON> help cp1

MON> help cp1


    cp1 [ ( | ) [] ]

    Read/write CP1 control register(s).

    If no arguments are applied, all CP1 control registers are read.
    A register may be selected by name or number.
    If a value is given, this value is written to the register, otherwise
    the register is read.
    Writing a CP1 control register takes effect immediately.

    Settings of CP1 control registers are also applied to user applications
    (started with 'go' or 'gdb').



4 + 7 = ?