AXD调试BLOB
今天终于又有所进步 ,把AXD连上板子后,烧了一个没有源代码但是可以正常工作的BIN文件。
设置一个断点地址在0X0处,就可以看见汇编代码了,终于初始化的所有设置都一清二楚了,不过
我改了一下主频后(直接修改二进制文件),不能正常工作,不知道原因,反正肯定是影响到其他地方了。
然后一步一步的跟踪代码,发现在FLASH中调试只能设两个断点,否则就没用了(直接跑飞到RAM去了)。
希望通过模仿这个BOOTLOADER,自己的BOOTLADER早日诞生。
可以参考下面的汇编代码来设置特殊寄存器了。
[0xea000007] * b 0x24
[0xe28ff303] add pc,pc,#0xc000000 ; #0xc00000c
[0xe28ff303] add pc,pc,#0xc000000 ; #0xc000010
[0xe28ff303] add pc,pc,#0xc000000 ; #0xc000014
[0xe28ff303] add pc,pc,#0xc000000 ; #0xc000018
[0xe28ff303] add pc,pc,#0xc000000 ; #0xc00001c
[0xe28ff303] add pc,pc,#0xc000000 ; #0xc000020
[0xe28ff303] add pc,pc,#0xc000000 ; #0xc000024
[0x0c200400] stceq p4,c0,[r0],#-0
[0xe59f0228] ldr r0,0x00000254 ; = #0x01d30000
[0xe3a01000] mov r1,#0
[0xe5801000] str r1,[r0,#0]
[0xe3a00507] mov r0,#0x1c00000
[0xe3a0100e] mov r1,#0xe
[0xe5801000] str r1,[r0,#0]
[0xe59f0214] ldr r0,0x00000258 ; = #0x01c00004
[0xe3a01103] mov r1,#0xc0000000
[0xe5801000] str r1,[r0,#0]
[0xe59f120c] ldr r1,0x0000025c ; = #0x01d20000
[0xe59f020c] ldr r0,0x00000260 ; = #0x000003ff
[0xe5810000] str r0,[r1,#0]
[0xe59f1208] ldr r1,0x00000264 ; = #0x01d20004
[0xe59f0200] ldr r0,0x00000260 ; = #0x000003ff
[0xe5810000] str r0,[r1,#0]
[0xe59f1200] ldr r1,0x00000268 ; = #0x01d20008
[0xe59f0200] ldr r0,0x0000026c ; = #0x000007cf
[0xe5810000] str r0,[r1,#0]
[0xe59f11fc] ldr r1,0x00000270 ; = #0x01d2000c
[0xe59f01fc] ldr r0,0x00000274 ; = #0x000007ff
[0xe5810000] str r0,[r1,#0]
[0xe59f11f8] ldr r1,0x00000278 ; = #0x01d20010
[0xe59f01f8] ldr r0,0x0000027c ; = #0x5f55ffff
[0xe5810000] str r0,[r1,#0]
[0xe59f11f4] ldr r1,0x00000280 ; = #0x01d20014
[0xe59f01f4] ldr r0,0x00000284 ; = #0x00007fff
[0xe5810000] str r0,[r1,#0]
[0xe59f11f0] ldr r1,0x00000288 ; = #0x01d20018
[0xe3a00a03] mov r0,#0x3000
[0xe5810000] str r0,[r1,#0]
[0xe59f11e8] ldr r1,0x0000028c ; = #0x01d2001c
[0xe59f01e8] ldr r0,0x00000290 ; = #0x0000aaaa
[0xe5810000] str r0,[r1,#0]
[0xe59f11e4] ldr r1,0x00000294 ; = #0x01d20024
[0xe3a00000] mov r0,#0
[0xe5810000] str r0,[r1,#0]
[0xe59f11dc] ldr r1,0x00000298 ; = #0x01d20028
[0xe59f01dc] ldr r0,0x0000029c ; = #0x0002aaa8
[0xe5810000] str r0,[r1,#0]
[0xe59f11d8] ldr r1,0x000002a0 ; = #0x01d2002c
[0xe59f01d8] ldr r0,0x000002a4 ; = #0x000001ff
[0xe5810000] str r0,[r1,#0]
[0xe59f11d4] ldr r1,0x000002a8 ; = #0x01d20030
[0xe59f01d4] ldr r0,0x000002ac ; = #0x00000106
[0xe5810000] str r0,[r1,#0]
[0xe59f11d0] ldr r1,0x000002b0 ; = #0x01d20034
[0xe59f01d0] ldr r0,0x000002b4 ; = #0x001b2c1a
[0xe5810000] str r0,[r1,#0]
[0xe59f11cc] ldr r1,0x000002b8 ; = #0x01d20038
[0xe59f01cc] ldr r0,0x000002bc ; = #0x000001fb
[0xe5810000] str r0,[r1,#0]
[0xe59f11c8] ldr r1,0x000002c0 ; = #0x01d2003c
[0xe3a00003] mov r0,#3
[0xe5810000] str r0,[r1,#0]
[0xe59f11c0] ldr r1,0x000002c4 ; = #0x01d20040
[0xe59f01c0] ldr r0,0x000002c8 ; = #0x0000ffff
[0xe5810000] str r0,[r1,#0]
[0xe59f11bc] ldr r1,0x000002cc ; = #0x01d20048
[0xe3a00000] mov r0,#0
[0xe5810000] str r0,[r1,#0]
[0xe3a0140a] mov r1,#0xa000000
[0xe3a000ff] mov r0,#0xff
[0xe5810000] str r0,[r1,#0]
[0xe59f11a8] ldr r1,0x000002d0 ; = #0x01d2004c
[0xe3a00007] mov r0,#7
[0xe5c10000] strb r0,[r1,#0]
[0xe59f11a0] ldr r1,0x000002d4 ; = #0x01d20050
[0xe3a00040] mov r0,#0x40
[0xe5810000] str r0,[r1,#0]
[0xe59f1198] ldr r1,0x000002d8 ; = #0x01e0000c
[0xe59f0198] ldr r0,0x000002dc ; = #0x03fffeff
[0xe5810000] str r0,[r1,#0]
[0xe3a0161e] mov r1,#0x1e00000
[0xe3a00005] mov r0,#5
[0xe5810000] str r0,[r1,#0]
[0xe59f1188] ldr r1,0x000002e0 ; = #0x01d8000c
[0xe3a00e32] mov r0,#0x320
[0xe5c10000] strb r0,[r1,#0]
[0xe3a01776] mov r1,#0x1d80000
[0xe59f017c] ldr r0,0x000002e4 ; = #0x00052021
[0xe5810000] str r0,[r1,#0]
[0xe59f1178] ldr r1,0x000002e8 ; = #0x01d80004
[0xe59f0178] ldr r0,0x000002ec ; = #0x00007ff8
[0xe5810000] str r0,[r1,#0]
[0xeb000088] bl 0x39c
[0xe24f0d06] sub r0,pc,#0x180 ; #0
[0xe2802801] add r2,r0,#0x10000
[0xe2800b01] add r0,r0,#0x400
[0xe51f116c] ldr r1,0x00000020 ; = #0x0c200400
[0xe8b007f8] ldmia r0!,{r3-r10}
[0xe8a107f8] stmia r1!,{r3-r10}
[0xe1500002] cmp r0,r2
[0xdafffffb] ble 0x188
[0xe28f0020] add r0,pc,#0x20 ; #0x1c0
[0xe2802b01] add r2,r0,#0x400
[0xe3a01303] mov r1,#0xc000000
[0xe2811008] add r1,r1,#8
[0xe8b007f8] ldmia r0!,{r3-r10}
[0xe8a107f8] stmia r1!,{r3-r10}
[0xe1500002] cmp r0,r2
[0xdafffffb] ble 0x1a8
[0xe51f01a0] ldr r0,0x00000020 ; = #0x0c200400
[0xe1a0f000] mov pc,r0
[0xeaffff97] b 0x24
[0xea000005] b 0x1e0
[0xea000006] b 0x1e8
[0xea000007] b 0x1f0
[0xea000008] b 0x1f8
[0xea000009] b 0x200
[0xea00000a] b 0x208
[0xea000014] b 0x234
[0xe3a06003] mov r6,#3
[0xea000014] b 0x23c
[0xe3a06004] mov r6,#4
[0xea000012] b 0x23c
[0xe3a06005] mov r6,#5
[0xea000010] b 0x23c
[0xe3a06006] mov r6,#6
[0xea00000e] b 0x23c
[0xe3a06007] mov r6,#7
[0xea00000c] b 0x23c
[0xe59fd0e0] ldr r13,0x000002f0 ; = #0x0c200524
[0xe92d0003] stmfd r13!,{r0,r1}
[0xe59f00dc] ldr r0,0x000002f4 ; = #0x01e00024
[0xe3a01c01] mov r1,#0x100
[0xe5801000] str r1,[r0,#0]
[0xe59f00d4] ldr r0,0x000002f8 ; = #0x0c200494
[0xe5901000] ldr r1,[r0,#0]
[0xe2811001] add r1,r1,#1
[0xe5801000] str r1,[r0,#0]
[0xe8bd0003] ldmfd r13!,{r0,r1}
[0xe25ef004] subs pc,r14,#4
[0xe3a06009] mov r6,#9
[0xeaffffff] b 0x23c
[0xe3a05502] mov r5,#0x800000
[0xe2555001] subs r5,r5,#1
[0x1afffffd] bne 0x240
[0xe1a00006] mov r0,r6
[0xeb00003a] bl 0x33c
[0xeafffff9] b 0x23c
[0x01d30000] biceqs r0,r3,r0
[0x01c00004] biceq r0,r0,r4
[0x01d20000] biceqs r0,r2,r0
[0x000003ff] streqd r0,[r0],-pc
[0x01d20004] biceqs r0,r2,r4
[0x01d20008] biceqs r0,r2,r8
[0x000007cf] andeq r0,r0,pc,asr #15
[0x01d2000c] biceqs r0,r2,r12
[0x000007ff] streqd r0,[r0],-pc
[0x01d20010] biceqs r0,r2,r0,lsl r0
[0x5f55ffff] swipl 0x55ffff
[0x01d20014] biceqs r0,r2,r4,lsl r0
[0x00007fff] streqd r7,[r0],-pc
[0x01d20018] biceqs r0,r2,r8,lsl r0
[0x01d2001c] biceqs r0,r2,r12,lsl r0
[0x0000aaaa] andeq r10,r0,r10,lsr #21
[0x01d20024] biceqs r0,r2,r4,lsr #32
[0x01d20028] biceqs r0,r2,r8,lsr #32
[0x0002aaa8] andeq r10,r2,r8,lsr #21
[0x01d2002c] biceqs r0,r2,r12,lsr #32
[0x000001ff] streqd r0,[r0],-pc
[0x01d20030] biceqs r0,r2,r0,lsr r0
[0x00000106] andeq r0,r0,r6,lsl #2
[0x01d20034] biceqs r0,r2,r4,lsr r0
[0x001b2c1a] andeqs r2,r11,r10,lsl r12
[0x01d20038] biceqs r0,r2,r8,lsr r0
[0x000001fb] streqd r0,[r0],-r11
[0x01d2003c] biceqs r0,r2,r12,lsr r0
[0x01d20040] biceqs r0,r2,r0,asr #32
[0x0000ffff] streqd pc,[r0],-pc
[0x01d20048] biceqs r0,r2,r8,asr #32
[0x01d2004c] biceqs r0,r2,r12,asr #32
[0x01d20050] biceqs r0,r2,r0,asr r0
[0x01e0000c] mvneq r0,r12
[0x03fffeff] mvneqs pc,#0xff0 ; ? rn = 0xf
[0x01d8000c] biceqs r0,r8,r12
[0x00052021] andeq r2,r5,r1,lsr #32
[0x01d80004] biceqs r0,r8,r4
[0x00007ff8] streqd r7,[r0],-r8
[0x0c200524] stceq p5,c0,[r0],#-0x90
[0x01e00024] mvneq r0,r4,lsr #32
[0x0c200494] stceq p4,c0,[r0],#-0x250
[0xe1a0f00e] mov pc,r14
[0xe59f005c] ldr r0,0x00000364 ; = #0x01d2000c
[0xe5901000] ldr r1,[r0,#0]
[0xe3c11c02] bic r1,r1,#0x200
[0xe5801000] str r1,[r0,#0]
[0xe1a0f00e] mov pc,r14
[0xe1a0f00e] mov pc,r14
[0xe59f0044] ldr r0,0x00000364 ; = #0x01d2000c
[0xe5901000] ldr r1,[r0,#0]
[0xe3811c02] orr r1,r1,#0x200
[0xe5801000] str r1,[r0,#0]
[0xe1a0f00e] mov pc,r14
[0xe3a00501] mov r0,#0x400000
[0xe2500001] subs r0,r0,#1
[0x1afffffd] bne 0x330
[0xe1a0f00e] mov pc,r14
[0xe1a0f00e] mov pc,r14
[0xe1a0400e] mov r4,r14
[0xe1a03000] mov r3,r0
[0xebfffff1] bl 0x314
[0xebfffff6] bl 0x32c
[0xebffffe9] bl 0x2fc
[0xebfffff4] bl 0x32c
[0xe2533001] subs r3,r3,#1
[0x1afffff9] bne 0x348
[0xe1a0f004] mov pc,r4
[0x01d2000c] biceqs r0,r2,r12
[0x11110002] tstne r1,r2
[0x00000600] andeq r0,r0,r0,lsl #12
[0x00007ffc] streqd r7,[r0],-r12
[0x00007ffc] streqd r7,[r0],-r12
[0x00007ffc] streqd r7,[r0],-r12
[0x00007ffc] streqd r7,[r0],-r12
[0x00007ffc] streqd r7,[r0],-r12
[0x00018000] andeq r8,r1,r0
[0x00018000] andeq r8,r1,r0
[0x00960591] umulleqs r0,r6,r1,r5
[0x00000010] andeq r0,r0,r0,lsl r0
[0x00000020] andeq r0,r0,r0,lsr #32
[0x00000020] andeq r0,r0,r0,lsr #32
[0xe59f000c] ldr r0,0x000003b0 ; = #0x00000368
[0xe8903ffe] ldmia r0,{r1-r13}
[0xe3a00772] mov r0,#0x1c80000
[0xe8803ffe] stmia r0,{r1-r13}
[0xe1a0f00e] mov pc,r14
[0x00000368] andeq r0,r0,r8,ror #6
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0
[0x00000000] andeq r0,r0,r0