
##all

exec -- execute a command file  
l    -- load elf file to target memory 
load -- load binary file to target memory
fr   -- Read indicated file
fw   -- Write to the indicated  file
mt   -- Test memory region 
dv   -- Put some information to display terminal
+Q   -- enable debug message show in console
-Q   -- disable debug message show in console
exit -- exit driver
delay-- delay for a while and driver will do nothing during it 
g    -- force processor to run from specified address
stop/k/sp -- trigger processor to debug mode . usually used together with "g"
rp   -- reset the processor
ew/eh/eb/EW/EH/EB -- Write data to target memory or variable
rw/rh/rb/mw/mh/mb -- Read data from an address and store it to a variable
dw/dh/db -- display word/half-word/byte size objects in specified range
if   -- condition statement
dump -- dump data of a target memory region to file
mon  -- monitor specified address in target memory
cache -- do some cache operation.
flash -- do flash erase and write
goto  -- Jump to label and execute commands from there
help  -- get help informaion about a command
fo    -- Open elf file to debug .
lf    -- Load target elf file to memory.
c     -- Continue.
si/SI/step -- Single instruction step.
R/r   -- Run target program.
B     -- Show all breakpoints.
D     -- Delete all breakpoints.
ei    -- write to Imem
mi    -- read from Imem
imemon -- set IMEM on
sib    -- single step binary,cpu will take the parameter as an instruction and run it 
ldimem -- load file to IMEM
dpimem --Dump IMEM to file
hb     -- set hardware breakpoint
hbc    -- clear hardware breakpoint
mj     -- read EJTAG register
ej     -- write EJTAG register
mpr    -- read probe register
epr    -- write probe reigster
pds    -- start PDTrace
pdsp   --  stop PDTrace
pddump -- dump trace data in probe memory to file
pdparse -- parse trace file 
mp     -- read probe memory
ep     -- write probe memory
fopen  -- open a file
fread  -- read data from a file
fwrite -- write data to a file
fclose -- close a file
ftell  -- get the iostream location of a file
fseek  -- set the iostream location of a file
fsize  -- get the byte size of a file
watch  -- set a watchpoint
rwatch -- set a read watchpoint
rwatchc -- cleat a read watchpoint
##exec Exec

Syntax: exec [op1]

Description: execute a command file  
             op1 specifies the command file to execute.

Example: "exec e:\script.txt"

##l L

Syntax: l [op1]

Description: load elf file to target memory 
             op1 specifies elf file, Since address information is already exist in the elf file, there is no need to specify target address.

Example: "l d:\ vmlinux.dat"

##load Load

Syntax: load [op1] [op2]

Description: Load binary file to target memory
             op1 : full path name including path
             op2 : base address

Example : "load e:\file.bin 0x80000000"

##fr FR

Syntax: fr [op1] [op2] [op3]

Description: Read indicated file
           op1: m or c, m means load file to memory, c to execute a command script file
           op2 : full name of file.
           op3 : target memory address when op1 is m

Example: fr m d:\file.load 0x80000000, load the file d:\file.load to target memory address begin at 0x80000000.
         fr c d:\script.txt , execute the command script file d:\script.txt.

##fw FW

Syntax: fw [op1] [op2] [op3]

Description: Read a memory region, and write to the specified file
            op1 : o or a, overwrite or append mode for file write
            op2 : full path name
            op3 : start address of target memory
            op4 : size of memory

Example: "fw o d:\temp.file 0x80000000 0x100"  It will read 0x100 bytes from address 0x80000000 of target memory, and write to file d:\temp.file with overwrite mode.
         "fw a d:\temp.file 0x80000000 0x100"  It will read 0x100 bytes from address 0x80000000 of target memory, and write to file d:\temp.file with append mode.
           
##mt MT

Syntax: mt [op1] [op2] [op3] [op4]

Description: Test memory region 
             op1 : start address of the test memory
             op2 : end address of the test memory
             op3 : this field is optional , defines the mode of test, default value of op3 is 9.
             op4 : this field is needed ONLY when op3 is 1, specifies memory test data.
             op3 = 1, Basic pattern, scan all memory address in the range
             op3 = 2, walking "0" & "1" test
             op3 = 3, Rotating address test
             op3 = 5, partial write test
             op3 = 9, default value, do all above memory test

Example: "mt 0x80000000 0x81000000" It will do memory test of all mode from address 0x80000000 to 0x81000000 in target memory. It is same with mt 0x80000000 0x81000000 9
         "mt 0x80000000 0x81000000 1 0xffffffff" when do memory test, it will use data 0xffffffff  to write to memory, and read out to compare.


##dv DV

Syntax: dv [op1] [op2] [op3] ...

Description: Put some information to display terminal
             op1 : print format
             op2, op3...: are optional, addional data to print.

Example :"dv "Hello world! variable abc = %lx\n", $abc ", It will print Hello world ! variable abc =  and value of $abc in hexadecimal to the display terminal.

## +Q

Syntax: +Q

Description: Using +Q to enable debug message show in console

Example :"+Q" enable debug message show in console


## -Q

Syntax: -Q

Description: Using -Q to disable debug message show in console

Example : -Q disable debug message show in console

##exit Exit

Syntax: exit

Description: Exit the driver.

Example: "exit"

##delay

syntax: dalay [op1]

Description: Delay for a while and driver will do nothing during it.
             op1: delay time(ms)

Example : "delay 200" Which means delay for 200 ms.

##g 

syntax: g [=op1]

Description: Force processor to run from specified address
             op1: specifies where to go from

Example : "g = 0x80008000" Force processor to run from address 0x80008000

##stop Stop

syntax:stop/k/sp

Description: Trigger processor to debug mode . usually used together with "g"

##rp

syntax: rp

Description:Reset the processor. 

##ew eh eb EW EH EB

Description: Write data to target memory or variable . ew, write a word; eh, write half a word; eb,write a byte.

Example: "ew 0xbd011000=0x5f3fffff"
         Which means write a word value of 0x5f3fffff to address 0xbd011000.
         "ew $a = 1" //means set variable a to 1.
         eh : write half word to address .
         Example: "eh 0xbd011000=0x5f3f"
         eb : write a byte to address .
         Example: "eb 0xbd011000=0x5f"
         Loop write supported.
         Example: "ew 0xbd011000 l 3 = 0x7f3fffff 0x1234 0x5678"
         Probe will write data 0x7f3fffff to address 0xbd011000 , write data 0x1234 to address 0xbd011004 and write data 0x5678 to address 0xbd011008.


## rw rh rb mw mh mb RW RH RB MW MH MB

Description:  Read data from an address and store it to a variable

Example:  rw/mw means read a word
          Example: "rw $abc, 0xbd011000" means read a word from address 0xbd011000 and save it to the variable abc.
          rh/mh : read half word
          Example: rh $abc,0xbd011000.
          rb/mb : read a byte
          Example: rb $abc,0xbd011000.
          If no variable need to be set , probe will display the value read from memory or register.
          Example : mw 0xbd011000


##dw dh db DW DH DB

Description:  Display word/half-word/byte size objects in specified range

Example : "dw 0x80000000" Display a word in address 0x80000000
          "dh 0x80000000" Display a half word in address 0x80000000
          "db 0x80000000" Display a byte in address 0x80000000

##if IF

Description: Condition statement.

Example: "if (expr ) {statement }"
         when the expression "expr" is not false, the following statement will be executed, or else not.


##dump

syntax: dump [op1] [op2] [op3]

Description: Dump data of a target memory region to file
            op1 : bases address
            op2 : data size
            op3 : full path name include directory and file name

Example : "dump 0x80000000 0x100 e:\file.dump" It will dump 0x100 bytes (from 0x80000000 to 0x80000100) of target memory to the file e:\file.dump.

##mon

Description: Monitor specified address in target memory.

Example: "mon 0x80000000 1 3 10" Monitor 1,3 and 10 bit in address 0x80000000 of target memory , and show the value when any of the bits changed

##cache

syntax:  cache [op1] [op2]

Description: do some cache operation.
           op1 :i/I : Icache
                d/D : Dcache
                imem
                dmem
           op2 :
                inv/clr/clear : cache invalidate
                wb : dcache write back
                wbinv : write back and invalidate
                lock1 : lock cache to way 1 (for LX/RLX processor)
                lockdown : Lock cache down (for LX/RLX processor)
                fill : Imem fill
                off : Imem/Dmem off
                on : Dmem on


##flash 

syntax: flash [op1] [op2]

Description:  do flash erase and write
             op1:
                 e : erase
                 w : program
             op2 :
                 erase : flash base address
                 program : filename
             op3 :
                 flash base address
             op4 :
                 flash program destination address

Example : "flash e 0xbfc00000"
          It will erase the flash totally from base address 0xbfc00000.
          "flash w filename 0xbfc00000 0xbfc10000"
          It will program data of binary file to flash begin at address 0xbfc10000, the base address of flash is 0xbfc00000.


##goto

Description: Jump to label and execute commands from there, the label can be defined either above or below the goto sentence.

Example: goto labelname


##help h

Description: get help informaion about a command

Example : "help ew" get usage of "ew"

##fo

Description: open ELF file for debug

Example : fo e:\test.elf

##lf

Description: load ELF file to memory

Example : lf

##si/SI/step

Description: single instruction step

Example : si

##c

Description: continue

Example : c

##r/R

Description: Run target program

Example : r


##B

Description: list all breakpoints

Example : B


##D

Description: delete all breakpoints

Example : D


##ei    -- write to Imem
Description: write data(a word) to Imem

Example : ei 0x80000000 0x12345678

##mi    -- read a word from Imem
Description:  read a word from Imem

Example : mi 0x80000000

#imemon -- set IMEM on
Description:  set IMEM on

Example : imemon

#sib   
Description : single step , if any data followed , cpu will take it as an instruction and run it 
 
Example : sib 0x03800008  (cpu will execute binary code 0x03800008 and then return)

#ldimem
 Description : -- load file to IMEM
 ldimem [OP1] [OP2]
 [OP1] : full file name
 [OP2] : base address to load
 Example : ldimem  e:/proj/EJTAG/IP/ej_test/ej_test.bin 0x80000000
 
 #dpimem 
 Description : --Dump IMEM to file
 dpimem [OP1] [OP2] [OP3] [OP4]
 [OP1]: o 
       "o" means overwrite , "a" means append
 [OP2]: file name and full path
 [OP3]: base address
 [OP4]: dump size
 Example : dpimem o e:/proj/EJTAG/IP/ej_test/ej_test.bin 0x80000000 0x1000

#hb
Description:  set hardware breakpoint

Example : hb 0x90000008

#hbc
Description:  clear hardware breakpoint

Example1 : hbc  //clear all hardware bp
Example2 : hbc 0x90000008 //clear hb at special address 

##ej EJ 

Description: Write data to EJTAG register or variable . ej, write a word;

Example: "ej 0x1 = 0x5f3fffff"
         Which means write a word value of 0x5f3fffff to EJTAG regiter address 0x1.
         Loop write supported.
         Example: "ej 0x2 l 3 = 0x7f3fffff 0x1234 0x5678"
         Probe will write data 0x7f3fffff to EJTAG register address 0x2 , 
         write data 0x1234 to EJTAG register address 0x3 and write data 0x5678 to EJTAG register address 0x4.


## rj mj

Description:  Read data from EJTAG register and store it to a variable

Example:  rj/mj means read a word
          Example: "rj $abc, 0x0" means read a word from EJTAG register 0 and save it to the variable abc.
          If no variable need to be set , probe will display the value read from memory or register.
          Example : mj 0x1

##epr 

Description: Write byte data to probe register

Example: "epr 0x1, 0xaa"
         Which means write a byte value of 0xaa to probe regiter address 0x1.


## rpr mpr

Description:  Read byte data from probe register and store it to a variable

Example:  rpr/mpr means read a byte
          Example: "rpr $abc, 0x0" means read a byte from probe register 0 and save it to the variable abc.
          If no variable need to be set , probe will display the value read from register.
          Example : mpr 0x1
    
#pds    -- start PDTrace
Description:  Start PDTrace , for PC trace

Example:  pds

#pdsp   --  stop PDTrace

#pddump -- dump trace data in probe memory to file
Description:  Dump trace data in probe memory to file
Example : pddump e:\pdtrace.bin

#pdparse -- parse trace file     
Description:  parse the trace data to a file

Example:  pdparse e:\pdtrace.bin e:\pdtrace.txt

##ep

Description: Write data to probe memory 

Example: "ep 0xff200000=0x5f3fffff"
         Which means write a word value of 0x5f3fffff to address 0xff200000.


## mp

Description:  Read data from probe address

Example:  mp 0xff200000
          Example: "mp $abc, 0xff20000" means read a word from address 0xff200000 and save it to the variable abc.
