📄 flash.cod
字号:
00004 e59f0014 ldr r0, [pc, #0x14]
00008 e5901000 ldr r1, [r0]
0000c e3510000 cmp r1, #0
; 195 : pfnContinueErase();
00010 11a0e00f movne lr, pc
00014 112fff11 bxne r1
; 196 : }
00018 e8bd4000 ldmia sp!, {lr}
0001c e12fff1e bx lr
00020 |$L36742|
00020 00000000 DCD |pfnContinueErase|
00024 |$M36739|
ENDP ; |OEMContinueEraseFlash|
EXPORT |OEMFinishEraseFlash|
EXPORT |??_C@_0CH@COKG@Continue?5to?5Erase?5the?5rest?5of?5Fl@| [ DATA ] ; `string'
EXPORT |??_C@_0CG@GAAC@?$AN?6Flash?5Erase?5Successfully?5Finis@| [ DATA ] ; `string'
EXPORT |??_C@_0CF@PPAC@?$AN?6ERROR?3?5Error?5while?5erasing?5fla@| [ DATA ] ; `string'
00000 AREA |.text| { |OEMFinishEraseFlash| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$OEMFinishEraseFlash|, PDATA, SELECTION=5, ASSOC=|.text| { |OEMFinishEraseFlash| } ; comdat associative
|$T36750| DCD |OEMFinishEraseFlash|
DCD 0x40001601
00000 AREA |.rdata| { |??_C@_0CH@COKG@Continue?5to?5Erase?5the?5rest?5of?5Fl@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CH@COKG@Continue?5to?5Erase?5the?5rest?5of?5Fl@| DCB "Continue to"
DCB " Erase the rest of Flash.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CG@GAAC@?$AN?6Flash?5Erase?5Successfully?5Finis@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CG@GAAC@?$AN?6Flash?5Erase?5Successfully?5Finis@| DCB 0xd, 0xa, "F"
DCB "lash Erase Successfully Finished", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CF@PPAC@?$AN?6ERROR?3?5Error?5while?5erasing?5fla@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CF@PPAC@?$AN?6ERROR?3?5Error?5while?5erasing?5fla@| DCB 0xd, 0xa, "E"
DCB "RROR: Error while erasing flash", 0xd, 0xa, 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |OEMFinishEraseFlash| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |OEMFinishEraseFlash| PROC
; 205 : {
00000 e92d4010 stmdb sp!, {r4, lr}
00004 |$M36748|
; 206 : BOOL bSuccess = FALSE;
; 207 :
; 208 : EdbgOutputDebugString("Continue to Erase the rest of Flash.\r\n" );
00004 e59f0048 ldr r0, [pc, #0x48]
00008 e3a04000 mov r4, #0
0000c eb000000 bl EdbgOutputDebugString
; 209 :
; 210 : //
; 211 : // Finish erasing the flash.
; 212 : //
; 213 : if(pfnFinishErase)
00010 e59f3038 ldr r3, [pc, #0x38]
00014 e5930000 ldr r0, [r3]
00018 e3500000 cmp r0, #0
0001c 0a000004 beq |$L36626|
; 214 : {
; 215 : bSuccess = pfnFinishErase();
00020 e1a0e00f mov lr, pc
00024 e12fff10 bx r0
00028 e1b04000 movs r4, r0
; 216 : }
; 217 :
; 218 :
; 219 : if(bSuccess)
; 220 : {
; 221 : EdbgOutputDebugString("\r\nFlash Erase Successfully Finished\r\n" );
0002c 159f0018 ldrne r0, [pc, #0x18]
00030 1a000000 bne |$L36747|
00034 |$L36626|
; 222 : }
; 223 : else
; 224 : {
; 225 : EdbgOutputDebugString("\r\nERROR: Error while erasing flash\r\n" );
00034 e59f000c ldr r0, [pc, #0xC]
00038 |$L36747|
00038 eb000000 bl EdbgOutputDebugString
; 226 :
; 227 : }
; 228 :
; 229 : return bSuccess;
0003c e1a00004 mov r0, r4
; 230 : }
00040 e8bd4010 ldmia sp!, {r4, lr}
00044 e12fff1e bx lr
00048 |$L36752|
00048 00000000 DCD |??_C@_0CF@PPAC@?$AN?6ERROR?3?5Error?5while?5erasing?5fla@|
0004c 00000000 DCD |??_C@_0CG@GAAC@?$AN?6Flash?5Erase?5Successfully?5Finis@|
00050 00000000 DCD |pfnFinishErase|
00054 00000000 DCD |??_C@_0CH@COKG@Continue?5to?5Erase?5the?5rest?5of?5Fl@|
00058 |$M36749|
ENDP ; |OEMFinishEraseFlash|
EXPORT |OEMWriteFlash|
EXPORT |??_C@_0DD@DICP@Writing?5to?5flash?5at?5Address?$DN?50x?$CF@| [ DATA ] ; `string'
EXPORT |??_C@_0DN@BKHG@ERROR?3?5OEMWriteFlash?5?9?5not?5a?5fla@| [ DATA ] ; `string'
EXPORT |??_C@_0EN@EJN@ERROR?3?5OEMWriteFlash?5?9?5Flash?5not@| [ DATA ] ; `string'
EXPORT |??_C@_0FD@BCGE@ERROR?3?5OEMWriteFlash?5?9?5Miscompar@| [ DATA ] ; `string'
00000 AREA |.text| { |OEMWriteFlash| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$OEMWriteFlash|, PDATA, SELECTION=5, ASSOC=|.text| { |OEMWriteFlash| } ; comdat associative
|$T36776| DCD |OEMWriteFlash|
DCD 0x40006402
00000 AREA |.rdata| { |??_C@_0DD@DICP@Writing?5to?5flash?5at?5Address?$DN?50x?$CF@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DD@DICP@Writing?5to?5flash?5at?5Address?$DN?50x?$CF@| DCB "Writin"
DCB "g to flash at Address= 0x%x, Length = 0x%x", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0DN@BKHG@ERROR?3?5OEMWriteFlash?5?9?5not?5a?5fla@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DN@BKHG@ERROR?3?5OEMWriteFlash?5?9?5not?5a?5fla@| DCB "ERROR: OEM"
DCB "WriteFlash - not a flash address (0x%x or 0x%x).", 0xd, 0xa
DCB 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0EN@EJN@ERROR?3?5OEMWriteFlash?5?9?5Flash?5not@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0EN@EJN@ERROR?3?5OEMWriteFlash?5?9?5Flash?5not@| DCB "ERROR: OEMWr"
DCB "iteFlash - Flash not erased at location = 0x%x, value ="
DCB " 0x%x ", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0FD@BCGE@ERROR?3?5OEMWriteFlash?5?9?5Miscompar@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0FD@BCGE@ERROR?3?5OEMWriteFlash?5?9?5Miscompar@| DCB "ERROR: OEMWr"
DCB "iteFlash - Miscompare at pSource = 0x%x, pDest = 0x%x, 0"
DCB "x%x != 0x%x ", 0xd, 0xa, 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |OEMWriteFlash| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |OEMWriteFlash| PROC
; 245 : {
00000 e92d41f0 stmdb sp!, {r4 - r8, lr}
00004 e24dd004 sub sp, sp, #4
00008 |$M36774|
00008 e1a07000 mov r7, r0
0000c e1a05001 mov r5, r1
; 246 : ULONG ulSMC;
; 247 : ULONG ulCount;
; 248 : BOOL bSuccess = TRUE;
; 249 : PULONG pulSource, pulDest;
; 250 :
; 251 : EdbgOutputDebugString
; 252 : (
; 253 : "Writing to flash at Address= 0x%x, Length = 0x%x\r\n",
; 254 : dwStartAddr,
; 255 : dwLength
; 256 : );
00010 e59f0174 ldr r0, [pc, #0x174]
00014 e1a02005 mov r2, r5
00018 e1a01007 mov r1, r7
0001c e3a08001 mov r8, #1
00020 eb000000 bl EdbgOutputDebugString
; 257 :
; 258 : //
; 259 : // Check to make sure that the flash routine exists.
; 260 : //
; 261 : if(!pfnWriteFlash)
00024 e59f415c ldr r4, [pc, #0x15C]
00028 e5940000 ldr r0, [r4]
0002c e3500000 cmp r0, #0
; 262 : {
; 263 : bSuccess = FALSE;
00030 03a06000 moveq r6, #0
00034 01a08006 moveq r8, r6
00038 0a00001a beq |$L36658|
; 264 : }
; 265 :
; 266 : //
; 267 : // Make sure the start and end addresses are in flash.
; 268 : //
; 269 : if(bSuccess)
; 270 : {
; 271 : if (!OEMIsFlashAddr(dwStartAddr) || !OEMIsFlashAddr(dwStartAddr + dwLength - 1))
0003c e1a00007 mov r0, r7
00040 eb000000 bl OEMIsFlashAddr
00044 e3500000 cmp r0, #0
00048 0a000004 beq |$L36645|
0004c e0870005 add r0, r7, r5
00050 e2400001 sub r0, r0, #1
00054 eb000000 bl OEMIsFlashAddr
00058 e3500000 cmp r0, #0
0005c 1a000026 bne |$L36763|
00060 |$L36645|
; 272 : {
; 273 : EdbgOutputDebugString
; 274 : (
; 275 : "ERROR: OEMWriteFlash - not a flash address (0x%x or 0x%x).\r\n",
; 276 : dwStartAddr,
; 277 : (dwStartAddr + dwLength - 1)
; 278 : );
00060 e0870005 add r0, r7, r5
00064 e2402001 sub r2, r0, #1
00068 e59f0114 ldr r0, [pc, #0x114]
0006c e1a01007 mov r1, r7
00070 eb000000 bl EdbgOutputDebugString
; 279 : bSuccess = FALSE;
00074 e3a06000 mov r6, #0
00078 e1a08006 mov r8, r6
0007c |$L36651|
; 304 : }
; 305 : }
; 306 :
; 307 :
; 308 : //
; 309 : // Write the flash
; 310 : //
; 311 : if(pfnWriteFlash && bSuccess)
0007c e5943000 ldr r3, [r4]
00080 e3530000 cmp r3, #0
00084 0a000007 beq |$L36658|
00088 e3580000 cmp r8, #0
0008c 0a000005 beq |$L36658|
; 312 : {
; 313 : bSuccess = pfnWriteFlash( dwStartAddr, FLASH_CACHE_VIRTUAL_MEMORY ,dwLength);
00090 e1a02005 mov r2, r5
00094 e3a01602 mov r1, #2, 12
00098 e1a00007 mov r0, r7
0009c e1a0e00f mov lr, pc
000a0 e12fff13 bx r3
000a4 e1a08000 mov r8, r0
000a8 |$L36658|
; 314 : }
; 315 : //
; 316 : // Clear the Flash write protect for chip select 6.
; 317 : //
; 318 : ulSMC = *SMC_SMCBCR6;
000a8 e59f20d0 ldr r2, [pc, #0xD0]
; 319 : *SMC_SMCBCR6 = ulSMC | SMCBCR_WP | SMCBCR_WPERR ;
; 320 :
; 321 : //
; 322 : // Check to make sure that the image has been flashed correctly.
; 323 : //
; 324 : if(bSuccess)
000ac e3580000 cmp r8, #0
000b0 e5920000 ldr r0, [r2]
000b4 e3801406 orr r1, r0, #6, 8
000b8 e5821000 str r1, [r2]
000bc 0a000029 beq |$L36666|
; 325 : {
; 326 : pulSource = (PULONG) FLASH_CACHE_VIRTUAL_MEMORY;
; 327 : pulDest = (PULONG) dwStartAddr;
; 328 : for(ulCount = 0; ulCount < (dwLength>>2) ; ulCount++)
000c0 e1a02125 mov r2, r5, lsr #2
000c4 e3a04602 mov r4, #2, 12
000c8 e1a03006 mov r3, r6
000cc e3520000 cmp r2, #0
000d0 9a000024 bls |$L36666|
000d4 |$L36664|
; 329 : {
; 330 : if(*pulSource != *pulDest)
000d4 e5941000 ldr r1, [r4]
000d8 e5970000 ldr r0, [r7]
000dc e1510000 cmp r1, r0
000e0 1a000018 bne |$L36759|
000e4 e2833001 add r3, r3, #1
; 341 : break;
; 342 : }
; 343 : pulSource++;
000e8 e2844004 add r4, r4, #4
; 344 : pulDest++;
000ec e2877004 add r7, r7, #4
000f0 e1530002 cmp r3, r2
000f4 3afffff6 bcc |$L36664|
; 329 : {
; 330 : if(*pulSource != *pulDest)
000f8 ea00001a b |$L36666|
000fc |$L36763|
; 280 : }
; 281 : }
; 282 :
; 283 : //
; 284 : // Perform a quick check to make sure that the flash is erased.
; 285 : //
; 286 : if(bSuccess)
; 287 : {
; 288 : pulDest =(PULONG) dwStartAddr;
; 289 : for(ulCount = 0; ulCount < (dwLength>>2) ; ulCount++)
000fc e3a06000 mov r6, #0
00100 e1a01125 mov r1, r5, lsr #2
00104 e1a03007 mov r3, r7
00108 e1a02006 mov r2, r6
0010c e3510000 cmp r1, #0
00110 9affffd9 bls |$L36651|
00114 |$L36649|
; 290 : {
; 291 : if(*pulDest != 0xFFFFFFFF)
00114 e5930000 ldr r0, [r3]
00118 e3700001 cmn r0, #1
0011c 1a000004 bne |$L36758|
00120 e2822001 add r2, r2, #1
; 301 : break;
; 302 : }
; 303 : pulDest++;
00124 e2833004 add r3, r3, #4
00128 e1520001 cmp r2, r1
0012c 3afffff8 bcc |$L36649|
; 329 : {
; 330 : if(*pulSource != *pulDest)
00130 eaffffd1 b |$L36651|
00134 |$L36758|
; 292 : {
; 293 : EdbgOutputDebugString
; 294 : (
; 295 : "ERROR: OEMWriteFlash - Flash not erased at location = 0x%x, value = 0x%x \r\n",
; 296 : (ULONG)pulDest,
; 297 : *pulDest
; 298 : );
00134 e5932000 ldr r2, [r3]
00138 e1a01003 mov r1, r3
0013c e59f0038 ldr r0, [pc, #0x38]
00140 eb000000 bl EdbgOutputDebugString
00144 |$L36656|
; 299 : bSuccess = FALSE;
; 300 : while(1);
00144 eafffffe b |$L36656|
00148 |$L36759|
; 331 : {
; 332 : EdbgOutputDebugString
; 333 : (
; 334 : "ERROR: OEMWriteFlash - Miscompare at pSource = 0x%x, pDest = 0x%x, 0x%x != 0x%x \r\n",
; 335 : (ULONG)pulSource,
; 336 : (ULONG)pulDest,
; 337 : *pulSource,
; 338 : *pulDest
; 339 : );
00148 e5970000 ldr r0, [r7]
0014c e1a02007 mov r2, r7
00150 e5943000 ldr r3, [r4]
00154 e1a01004 mov r1, r4
00158 e58d0000 str r0, [sp]
0015c e59f0014 ldr r0, [pc, #0x14]
00160 eb000000 bl EdbgOutputDebugString
; 340 : bSuccess = FALSE;
00164 e1a08006 mov r8, r6
00168 |$L36666|
; 345 : }
; 346 : }
; 347 :
; 348 :
; 349 : return bSuccess;
00168 e1a00008 mov r0, r8
; 350 : }
0016c e28dd004 add sp, sp, #4
00170 e8bd41f0 ldmia sp!, {r4 - r8, lr}
00174 e12fff1e bx lr
00178 |$L36778|
00178 00000000 DCD |??_C@_0FD@BCGE@ERROR?3?5OEMWriteFlash?5?9?5Miscompar@|
0017c 00000000 DCD |??_C@_0EN@EJN@ERROR?3?5OEMWriteFlash?5?9?5Flash?5not@|
00180 80080018 DCD 0x80080018
00184 00000000 DCD |??_C@_0DN@BKHG@ERROR?3?5OEMWriteFlash?5?9?5not?5a?5fla@|
00188 00000000 DCD |pfnWriteFlash|
0018c 00000000 DCD |??_C@_0DD@DICP@Writing?5to?5flash?5at?5Address?$DN?50x?$CF@|
00190 |$M36775|
ENDP ; |OEMWriteFlash|
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -