- d specifies the port of connection. (시리얼 COM1에 연결한 경우)
- l specifies that the target is little endian.
- 7 specifies the speed. The highest, 7, coresponds to 115000bps.
- v specifies the type of the cpu.
도스 프롬프트에서 위의 커맨드를 치면 아래와 같은 화면이 나타난다.
주의할 것은 window98의 경우 PATH 지정에 문제가 발생할 수 있으므로 폴더를 최소화해서 설치한다.(예 C:\epi\edta )
아니면 아래와 같이 실행파일의 위치를 직접 넣어줄 수도 있다.
D:\>c:\progra~1\epitools\edta20\bin\monice -d com1 -7 -varm7
tdmi -l
EPI Symbolic Assembly Level Debug Monitor, version V6.9.2 - WIN/NT(386)
Copyright (c) 1987-2000 by Embedded Performance Inc. - All Rights Reserved.
Processing register file: c:\progra~1\epitools\edta20\bin\arm/spaces.rd
Processing register file: c:\progra~1\epitools\edta20\bin\arm/majic.rd
Reading command history from: 'c:\progra~1\epitools\edta20\bin\startedb.hst'
Establishing communications with remote target via com1...
Connection verified at 115200 baud
Target System: EPI Majic Probe, Version: 3.2.3, S/N 0209G042
Hardware Rev: 90:3:3:20
Target CPU: ARM7TDMI
Ethernet: at address 00:80:CF:00:14:B8
IP address: 192.168.2.50, Subnet mask: 255.255.255.0
Trace Buffer: 0 frames
Profiler: Not Installed
Connected via: RS-232 Serial Port
Baud rate: 115200
Device name: com1
Target Endian: little
Start Address: 00000000:
EPI-OS (HIF): on
Reset Mode: capture
Reading commands from D:\tutorial\monice\file\startice.cmd
MON> +q // Enter quiet mode
Reading startice.cmd file
Notification from the target:
Target power detected on VREF
Auto JTAG detection process detected 1 TAP
JTAG connection established
Finished reading startice.cmd
MON>
2. 이미지 파일 로드 type l
--------------------------------------------------------------------
MON> l d:\tutorial\monice\file\edbdemo.axf
loading d:\tutorial\monice\file\edbdemo.axf
section le\ram_0 from 02000000 to 0200267f
section le\ram_0 from 02002680 to 020028eb
section le\ram_0 from 020028ec to 02002d47
Entry address set (pc): 02000000
!!!:
02000000: e59f0034 LDR r0,0x200003C
MON>
--------------------------------------------------------------------
이미지 파일을 메모리 0x2000000 번지에 다운로드
3. Displaying memory and registers. MONICE는 어떤 32bit Register나 메모리의
어드레스로부터 byte, 16bit hword, 32-bit word or 64-bit double word로
표현 가능하다.
DB BYTE
DH HALF-WORD (16-bit)
DW WORD (32-bit)
DD DOUBLE-WORD (64-bit)
a) 레지스터 보기
- Stack Pointer 보기
MON> dw sp
.sp 0203FFB8
-현재 상태 Register 보기
MON> dw cpsr
.cpsr 000000D3 (n z c v F I t mode=svc)
- CPSR , bit FIQ 보기
MON> dw cpsr.f
.cpsr.f 00000001
- r0 - r15 보기
MON> dw r0 r15
.r0 00000001 F00000FF E24DD00C 00000000
.r4 02002E48 00000000 02002D54 02002D48
.r8 00000000 02002D54 00000000 00000002
.r12 020027EC 0203FFB8 000100EC 02000000
-현재 Instruction 보기
프로그램 카운트의 메모리 위치의 instruction을 얻기 위해서 @를 사용한다.
MON> dw @pc,i
!!!:
02000000: e59f0034 LDR r0,0x200003C
main 함수의 위치는 0x2000060 시작한다
2) memory 보기
레지스터 보기와 동일하다.
- 10개의 명령 보기, main 함수 시작하기
MON> dw main l 10,i
main:
02000060: e92d4030 STMDB sp!,{r4,r5,lr}
02000064: e24dd00c SUB sp,sp,#0xC
02000068: e1a05000 MOV r5,r0
0200006c: e1a04001 MOV r4,r1
02000070: e28f0f26 ADD r0,pc,#0x98
02000074: e58d0000 STR r0,[sp]
02000078: e28f0f25 ADD r0,pc,#0x94
0200007c: e58d0004 STR r0,[sp,#4]
02000080: e28f0f24 ADD r0,pc,#0x90
02000084: e58d0008 STR r0,[sp,#8]
- 40개의 워드 단위 보기, 0x2000000 번지부터 시작
MON> dw 0x2000000 l 40
!!!:
02000000: E59F0034 E59F1034 E59F3034 E1500001
02000010: 0A000003 E1510003 34902004 34812004
02000020: 3AFFFFFB E59F101C E3A02000 E1530001
02000030: 34832004 3AFFFFFC EA0002D9 02002680
02000040: 02002680 020028EC 02002D48 00000030
02000050: 00000031 00000032 00000033 00000034
main:
02000060: E92D4030 E24DD00C E1A05000 E1A04001
02000070: E28F0F26 E58D0000 E28F0F25 E58D0004
02000080: E28F0F24 E58D0008 E3A01001 E59F0088
02000090: E580115C E59F0080 E590015C E3500000
4. Memory와 Register 값 설정(수정하기) (enter)
EW 커맨드를 사용하여 메모리나 레지스터를 세팅할 수 있다.
EB BYTE
EH HALF-WORD (16-Bit)
EW WORD (32-Bit)
ED DOUBLE-WORD (64-Bit)
1) Register 값 세팅
- set value of r4
MON> ew r4 = 16
MON> dw r4
.r4 00000016
- set r0 to r7 with 0
MON> ew r0 r7 = 0
MON> dw r0 r7
.r0 00000000 00000000 00000000 00000000
.r4 00000000 00000000 00000000 00000000
- set value of r0 to r7. interactive mode
MON> ew r0 r7
.r0 00000000 ? 0
.r1 00000000 ? 2
.r2 00000000 ? 4
.r3 00000000 ? 1
.r4 00000000 ? 3
.r5 00000000 ? 2
.r6 00000000 ? 6
.r7 00000000 ? 7
MON> dw r0 r7
.r0 00000000 00000002 00000004 00000001
.r4 00000003 00000002 00000006 00000007
2) memory 값 세팅
- set value start from 0x2040000
MON> ew 0x2040000
02040000: 1440F7FB ? 6
02040004: 52510180 ? 7
02040008: 82110125 ? 8
0204000c: 2300400A ? .
MON> dw 0x2040000 l 3
02040000: 00000006 00000007 00000008
Note that "." was used to stop the data entry.
- clear memory start from 0x2040000, with size 0x16
MON> ew 0x2040000 l 0x16 = 0
MON> dw 0x2040000 l 0x16
02040000: 00000000 00000000 00000000 00000000
02040010: 00000000 00000000 00000000 00000000
02040020: 00000000 00000000 00000000 00000000
02040030: 00000000 00000000 00000000 00000000
02040040: 00000000 00000000 00000000 00000000
02040050: 00000000 00000000
5. Breakpoint 세팅
- 예를 들면, "BS" 커맨드로 브레이크 포인트 "main" 심블에 세팅하고 run한다.
MON> bs main
MON> g
Software breakpoint <---- note the program had encounter a software breakpoint.
main:
02000060: e92d4030 STMDB sp!,{r4,r5,lr}
- 10개의 instruction 보기
MON> dw @pc l 10,i
main:
02000060: e92d4030 STMDB sp!,{r4,r5,lr}
02000064: e24dd00c SUB sp,sp,#0xC
02000068: e1a05000 MOV r5,r0
0200006c: e1a04001 MOV r4,r1
02000070: e28f0f26 ADD r0,pc,#0x98
02000074: e58d0000 STR r0,[sp]
02000078: e28f0f25 ADD r0,pc,#0x94
0200007c: e58d0004 STR r0,[sp,#4]
02000080: e28f0f24 ADD r0,pc,#0x90
02000084: e58d0008 STR r0,[sp,#8]
- breakpoint를 0x2000080에 걸기 (ADD r0,pc,#0x90)
MON> bs 0x2000080
MON> g
Software breakpoint
main+0x20:
02000080: e28f0f24 ADD r0,pc,#0x90
- 첫 번째 명령으로 jump back 하기 (시작하는 엔트리로 프로그램 카운트 세팅 후)
그리고 breakpoint 테스트 하기
MON> ew pc = 0x2000000
MON> g
Software breakpoint
main:
02000060: e92d4030 STMDB sp!,{r4,r5,lr}
MON> g
Software breakpoint
main+0x20:
02000080: e28f0f24 ADD r0,pc,#0x90
- "BC" command로 브레이크 포인트 지우기
MON> bc main
MON> bc 0x2000080
- second 함수에 breakpoint ( char aaa, short bbb, int ccc ).
MON> bs Second
MON> g
Software breakpoint
Second:
02000128: e92d4078 STMDB sp!,{r3-r6,lr}
6. Step 명령
- 현재의 PC에서 15개의 명령수행 후 보기 ('Second' 함수 시작)
MON> dw @pc l 15 ,i
Second:
02000128: e92d4078 STMDB sp!,{r3-r6,lr}
0200012c: e1a04000 MOV r4,r0
02000130: e1a06001 MOV r6,r1
02000134: e1a05002 MOV r5,r2
02000138: e0840006 ADD r0,r4,r6
0200013c: e0800005 ADD r0,r0,r5
02000140: e58d0000 STR r0,[sp]
02000144: e1a00004 MOV r0,r4
02000148: e28f2f0a ADD r2,pc,#0x28
0200014c: e3e01000 MVN r1,#0
02000150: eb00000c BL 0x2000188 ; Third
02000154: e59d0000 LDR r0,[sp]
02000158: e3500008 CMP r0,#8
0200015c: da000001 BLE 0x2000168 ; Second+0x40
02000160: e3a00000 MOV r0,#0
-Step 1 명령
MON> s
0200012c: e1a04000 MOV r4,r0
MON> s
02000130: e1a06001 MOV r6,r1
-Step 8 명령
MON> s 8
Second+0x28:
02000150: eb00000c BL 0x2000188 ; Third
-Step over, 그래서 'Third' 함수로 갈 수 없다.
MON> so
1
A good message
Software breakpoint
Second:
02000128: e92d4078 STMDB sp!,{r3-r6,lr}
Notice the edbdemo.c. It is seen that function Third will print numbers between 0-2 and "A good message."
-step 10 명령
MON> s 10
Second+0x28:
02000150: eb00000c BL 0x2000188 ; Third
-step into (Third 함수로 step into)
MON> s
Third:
02000188: e92d40f0 STMDB sp!,{r4-r7,lr}
MON> dw @pc l 10,i
Third:
02000188: e92d40f0 STMDB sp!,{r4-r7,lr}
0200018c: e1a04000 MOV r4,r0
02000190: e1a07001 MOV r7,r1
02000194: e1a05002 MOV r5,r2
02000198: e59f1084 LDR r1,0x2000224
0200019c: e51f0088 LDR r0,0x200011C
020001a0: e5801160 STR r1,[r0,#0x160]
020001a4: e3540000 CMP r4,#0
020001a8: 0a000017 BEQ 0x200020C ; Third+0x84
020001ac: e3e06008 MVN r6,#8
7. Assigning names to memory locations or peripheral registers using the
enter alias command 'EN'
1) assign name to instruction or memory location
- assign name "call_third" to instruction "BL 0X2000188" which is located at 0x2000150.
the command is: en call_third = 0x2000150
MON> g
default
A good message
Software breakpoint
Second:
02000128: e92d4078 STMDB sp!,{r3-r6,lr}
MON> dw @pc l 15,i
Second:
02000128: e92d4078 STMDB sp!,{r3-r6,lr}
0200012c: e1a04000 MOV r4,r0
02000130: e1a06001 MOV r6,r1
02000134: e1a05002 MOV r5,r2
02000138: e0840006 ADD r0,r4,r6
0200013c: e0800005 ADD r0,r0,r5
02000140: e58d0000 STR r0,[sp]
02000144: e1a00004 MOV r0,r4
02000148: e28f2f0a ADD r2,pc,#0x28
0200014c: e3e01000 MVN r1,#0
02000150: eb00000c BL 0x2000188 ; Third
02000154: e59d0000 LDR r0,[sp]
02000158: e3500008 CMP r0,#8
0200015c: da000001 BLE 0x2000168 ; call_third+0x18
02000160: e3a00000 MOV r0,#0
MON> en call_third=0x2000150
MON> bs call_third
MON> g
Software breakpoint
call_third:
02000150: eb00000c BL 0x2000188 ; Third
- 'DN' 커맨드를 사용해서 이름이 'call'인 변수 보기
MON> dn call*
USER: call_third = 02000150
- '"first' 이름을 registor r0에 할당하기
MON> en first = r0
MON> dw r0
.r0 00000004
MON> dw first
.r0 00000004
2) Alias 명령을 단축메뉴로 등록
- Alias command "dw @pc l 10,i" as "DIA".
MON> ea DIA dw @pc l 10,i
MON> DIA
Second:
02000128: e92d4078 STMDB sp!,{r3-r6,lr}
0200012c: e1a04000 MOV r4,r0
02000130: e1a06001 MOV r6,r1
02000134: e1a05002 MOV r5,r2
02000138: e0840006 ADD r0,r4,r6
0200013c: e0800005 ADD r0,r0,r5
02000140: e58d0000 STR r0,[sp]
02000144: e1a00004 MOV r0,r4
02000148: e28f2f0a ADD r2,pc,#0x28
0200014c: e3e01000 MVN r1,#0
-모든 aliases 보기
MON> da *
etinst: "fr c etrace.cmd // set up Trace options for instructions "
etdata: "fr c eview.cmd // set up Trace options for Data "
dts: "do ice_trig*; do trace* // display trace control settings"
kts: "eo tt=auto; eo tta=stop; eo tg=none; // kill trace settings (set defaults)
"
dia: "dw @pc l 10,i"
8. 타겟보드 Memory Test 하기
- MONICE에서 MT 치면, help를 볼 수 있다.
MON> h mt
Syntax : MT range [,test[,delay]] [,{H|V|Q|S}...] [,repeat]
or MT range, loop [,data] [,repeat]
Description : The Memory Test command initiates a test of the target's
memory system, or one of three "scope loops".
range has form : { [ addr ] L number } | { addr [ addr ] } (See "H RANGE")
test is a decimal number specifying the test type; available tests are
1 - Basic patterns 2 - Walking 1's and 0's
3 - Rotating address 4 - Inverted rotating address
5 - Partial word
8 - Refresh 9 - Default. Each of 1,2,3,4 and 5 in turn.
loop is a loop type: 10 = read-only, 11 = Write only, 12 = Write/Read
delay is a decimal number specifying the delay time in msec, between
writes and reads. It is required only for test 8 (the refresh test).
data is a data value to be written (required if loop = 11 or 12)
H, V, Q, or S specify Halt-on-error, Verbose, Quiet or Silent mode.
repeat specifies how many times to run the test. Default is forever.
-for example we wants to run memory test 0x02040000 - 0x02040190, combination test (test type = 9) , verbose, run once
MON> mt 0x2040000 l 100,9,v,1
---------- Screen Prompt of Memory test command -------------
Running memory with MT command
over address range: 02040000-02040190, 1 times
Completed pass 1 with 0 errors, total errors = 0
Memory test completed with 0 errors in 1 passes
----------------------------------------------------------------------
9. monice 종료
MON> q
|