⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flash.cod

📁 一个berry eboot 源代码
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 298  :         i = 0;
; 299  :         while ((i & 0x00800080) != 0x00800080)
; 300  :         {
; 301  :             i = *pFlash;

  0013c	e5996000	 ldr         r6, [r9]
  00140	e0063001	 and         r3, r6, r1
  00144	e1530001	 cmp         r3, r1
  00148	1afffffb	 bne         |$L40066|

; 302  :         }
; 303  : 
; 304  :         if ((i & 0x00000008) == 0x00000008)

  0014c	e2063008	 and         r3, r6, #8
  00150	e3530008	 cmp         r3, #8
  00154	1a000002	 bne         |$L40068|

; 305  :             EdbgOutputDebugString("ERROR: FlashErase: voltage range error ... lower flash.\r\n");

  00158	e59f0328	 ldr         r0, [pc, #0x328]
  0015c	eb000000	 bl          EdbgOutputDebugString
  00160	e59b4000	 ldr         r4, [r11]
  00164		 |$L40068|

; 306  :         if ((i & 0x00080000) == 0x00080000)

  00164	e2063702	 and         r3, r6, #2, 14
  00168	e3530702	 cmp         r3, #2, 14
  0016c	1a000002	 bne         |$L40070|

; 307  :             EdbgOutputDebugString("ERROR: FlashErase: voltage range error ... upper flash.\r\n");

  00170	e59f030c	 ldr         r0, [pc, #0x30C]
  00174	eb000000	 bl          EdbgOutputDebugString
  00178	e59b4000	 ldr         r4, [r11]
  0017c		 |$L40070|

; 308  : 
; 309  :         if ((i & 0x00000030) == 0x00000030)

  0017c	e2063030	 and         r3, r6, #0x30
  00180	e3530030	 cmp         r3, #0x30
  00184	1a000002	 bne         |$L40072|

; 310  :             EdbgOutputDebugString("ERROR: FlashErase: command sequence error ... lower flash.\r\n");

  00188	e59f02f0	 ldr         r0, [pc, #0x2F0]
  0018c	eb000000	 bl          EdbgOutputDebugString
  00190	e59b4000	 ldr         r4, [r11]
  00194		 |$L40072|

; 311  :         if ((i & 0x00300000) == 0x00300000)

  00194	e2063603	 and         r3, r6, #3, 12
  00198	e3530603	 cmp         r3, #3, 12
  0019c	1a000002	 bne         |$L40074|

; 312  :             EdbgOutputDebugString("ERROR: FlashErase: command sequence error ... upper flash.\r\n");

  001a0	e59f02d4	 ldr         r0, [pc, #0x2D4]
  001a4	eb000000	 bl          EdbgOutputDebugString
  001a8	e59b4000	 ldr         r4, [r11]
  001ac		 |$L40074|

; 313  : 
; 314  :         if ((i & 0x00000020) == 0x00000020)

  001ac	e2063020	 and         r3, r6, #0x20
  001b0	e3530020	 cmp         r3, #0x20
  001b4	1a000002	 bne         |$L40076|

; 315  :             EdbgOutputDebugString("ERROR: FlashErase: clear lock bits error ... lower flash.\r\n");

  001b8	e59f02b8	 ldr         r0, [pc, #0x2B8]
  001bc	eb000000	 bl          EdbgOutputDebugString
  001c0	e59b4000	 ldr         r4, [r11]
  001c4		 |$L40076|

; 316  :         if ((i & 0x00200000) == 0x00200000)

  001c4	e2063602	 and         r3, r6, #2, 12
  001c8	e3530602	 cmp         r3, #2, 12
  001cc	1a000002	 bne         |$L40078|

; 317  :             EdbgOutputDebugString("ERROR: FlashErase: clear lock bits error ... upper flash.\r\n");

  001d0	e59f029c	 ldr         r0, [pc, #0x29C]
  001d4	eb000000	 bl          EdbgOutputDebugString
  001d8	e59b4000	 ldr         r4, [r11]
  001dc		 |$L40078|

; 318  : 
; 319  :         if (i != 0x00800080)

  001dc	e3a01502	 mov         r1, #2, 10
  001e0	e3811080	 orr         r1, r1, #0x80
  001e4	e1560001	 cmp         r6, r1
  001e8	1a000025	 bne         |$L40339|

; 324  :         }
; 325  :         if ( ((g_FlashDeviceType == L18) || (g_FlashDeviceType == L30)) && (num_l3_blocks_erased > 0) )

  001ec	e3540001	 cmp         r4, #1
  001f0	0a000001	 beq         |$L40084|
  001f4	e3540002	 cmp         r4, #2
  001f8	1a000007	 bne         |$L40083|
  001fc		 |$L40084|
  001fc	e59d2004	 ldr         r2, [sp, #4]
  00200	e3520000	 cmp         r2, #0
  00204	159f3244	 ldrne       r3, [pc, #0x244]

; 326  :         {
; 327  :             // We need to take care of the first 16K blocks if there are any
; 328  :             pFlash += (L3_BLOCK_SIZE / 4);
; 329  :             num_l3_blocks_erased--;

  00208	12422001	 subne       r2, r2, #1
  0020c	158d2004	 strne       r2, [sp, #4]
  00210	15933000	 ldrne       r3, [r3]
  00214	11a03123	 movne       r3, r3, lsr #2
  00218	1a000001	 bne         |$L40370|
  0021c		 |$L40083|

; 330  :         }
; 331  :         else
; 332  :         {
; 333  :             pFlash += (BLOCK_SIZE / 4);

  0021c	e59d2000	 ldr         r2, [sp]
  00220	e1a03122	 mov         r3, r2, lsr #2
  00224		 |$L40370|
  00224	e0899103	 add         r9, r9, r3, lsl #2
  00228	e59d3008	 ldr         r3, [sp, #8]
  0022c	e3a0060d	 mov         r0, #0xD, 12
  00230	e38000d0	 orr         r0, r0, #0xD0
  00234	e2833001	 add         r3, r3, #1
  00238	e58d3008	 str         r3, [sp, #8]
  0023c	e1530008	 cmp         r3, r8
  00240	e3a03606	 mov         r3, #6, 12
  00244	e3833060	 orr         r3, r3, #0x60
  00248	3affffb9	 bcc         |$L40062|
  0024c		 |$L40064|

; 334  :         }
; 335  :     }
; 336  :     pFlash = (volatile UINT32 *)(FlashStart);
; 337  : 
; 338  :     // Clear the status register
; 339  :     *pFlash = 0x00500050;

  0024c	e3a03605	 mov         r3, #5, 12
  00250	e3833050	 orr         r3, r3, #0x50

; 340  : 
; 341  :     if ( ((g_FlashDeviceType == L18) || (g_FlashDeviceType == L30)) && (num_l3_blocks_to_erase > 0) )

  00254	e5873000	 str         r3, [r7]
  00258	e1a06007	 mov         r6, r7
  0025c	e3540001	 cmp         r4, #1
  00260	0a000001	 beq         |$L40088|
  00264	e3540002	 cmp         r4, #2
  00268	1a00000a	 bne         |$L40087|
  0026c		 |$L40088|
  0026c	e35a0000	 cmp         r10, #0
  00270	0a000008	 beq         |$L40087|

; 342  :     {
; 343  :         EdbgOutputDebugString("INFO: FlashErase: erasing flash %X to %X.  Please wait... \r\n", FlashStart, FlashStart + (((num_blocks-num_l3_blocks_to_erase)*256*1024) + (num_l3_blocks_to_erase*64*1024)) - 1);

  00274	e045300a	 sub         r3, r5, r10
  00278	e08a3103	 add         r3, r10, r3, lsl #2
  0027c	e0873803	 add         r3, r7, r3, lsl #16

; 344  :     }
; 345  :     else

  00280	ea000005	 b           |$L40371|
  00284		 |$L40339|

; 320  :         {
; 321  :             EdbgOutputDebugString("ERROR: FlashErase: status register returned 0x%X\r\n", i);

  00284	e59f01e4	 ldr         r0, [pc, #0x1E4]
  00288	e1a01006	 mov         r1, r6
  0028c	eb000000	 bl          EdbgOutputDebugString

; 322  :             EdbgOutputDebugString("ERROR: FlashErase: unrecoverable failure encountered while erasing flash.  System halted!\r\n");

  00290	e59f01d4	 ldr         r0, [pc, #0x1D4]

; 323  :             return(FALSE);

  00294	ea000068	 b           |$L40372|
  00298		 |$L40087|

; 346  :     {
; 347  :         EdbgOutputDebugString("INFO: FlashErase: erasing flash %X to %X.  Please wait... \r\n", FlashStart, FlashStart + (num_blocks*256*1024) - 1);

  00298	e0873905	 add         r3, r7, r5, lsl #18
  0029c		 |$L40371|
  0029c	e59f01c4	 ldr         r0, [pc, #0x1C4]
  002a0	e2432001	 sub         r2, r3, #1
  002a4	e1a01007	 mov         r1, r7
  002a8	eb000000	 bl          EdbgOutputDebugString

; 348  :     }
; 349  : 
; 350  :     // For L3, need to set for use within the FOR loop
; 351  :     num_l3_blocks_erased = num_l3_blocks_to_erase;

  002ac	e1a0900a	 mov         r9, r10

; 352  : 
; 353  :     // Erase each block.
; 354  :     for (j = 0; j < num_blocks; j++)

  002b0	e3a08000	 mov         r8, #0
  002b4	e3550000	 cmp         r5, #0
  002b8	0a000027	 beq         |$L40093|
  002bc	e59d3000	 ldr         r3, [sp]
  002c0	e3a0a602	 mov         r10, #2, 12
  002c4	e38aa020	 orr         r10, r10, #0x20
  002c8	e1a0b123	 mov         r11, r3, lsr #2
  002cc		 |$L40091|

; 355  :     {
; 356  :         // Issue erase and confirm command
; 357  :         *pFlash = 0x00200020;
; 358  :         *pFlash = 0x00d000d0;

  002cc	e3a0360d	 mov         r3, #0xD, 12
  002d0	e38330d0	 orr         r3, r3, #0xD0
  002d4	e3a02502	 mov         r2, #2, 10
  002d8	e586a000	 str         r10, [r6]
  002dc	e5863000	 str         r3, [r6]
  002e0	e3822080	 orr         r2, r2, #0x80
  002e4		 |$L40095|

; 359  :         while ((*pFlash & 0x00800080) != 0x00800080);

  002e4	e5963000	 ldr         r3, [r6]
  002e8	e0033002	 and         r3, r3, r2
  002ec	e1530002	 cmp         r3, r2
  002f0	1afffffb	 bne         |$L40095|

; 360  : 
; 361  :         // Check if the flash block erased successfully.
; 362  :         // Was either block locked?
; 363  :         status = *pFlash;

  002f4	e5964000	 ldr         r4, [r6]

; 364  :         if ((status & 0x00200000) || (status & 0x00000020))

  002f8	e3140602	 tst         r4, #2, 12
  002fc	1a000022	 bne         |$L40340|
  00300	e3140020	 tst         r4, #0x20
  00304	1a000020	 bne         |$L40340|

; 378  :         }
; 379  :         EdbgOutputDebugString(".");

  00308	e59f0154	 ldr         r0, [pc, #0x154]
  0030c	eb000000	 bl          EdbgOutputDebugString

; 380  : 
; 381  :         if ( ((g_FlashDeviceType == L18) || (g_FlashDeviceType == L30)) && (num_l3_blocks_erased > 0) )

  00310	e59f2148	 ldr         r2, [pc, #0x148]
  00314	e5923000	 ldr         r3, [r2]
  00318	e3530001	 cmp         r3, #1
  0031c	0a000001	 beq         |$L40106|
  00320	e3530002	 cmp         r3, #2
  00324	1a000006	 bne         |$L40105|
  00328		 |$L40106|
  00328	e3590000	 cmp         r9, #0

; 382  :         {
; 383  :             pFlash += (L3_BLOCK_SIZE / 4);

  0032c	159f311c	 ldrne       r3, [pc, #0x11C]

; 384  :             num_l3_blocks_erased--;

  00330	12499001	 subne       r9, r9, #1
  00334	15933000	 ldrne       r3, [r3]
  00338	11a03123	 movne       r3, r3, lsr #2
  0033c	10866103	 addne       r6, r6, r3, lsl #2
  00340	1a000000	 bne         |$L40092|
  00344		 |$L40105|

; 385  :         }
; 386  :         else
; 387  :         {
; 388  :             pFlash += (BLOCK_SIZE / 4);

  00344	e086610b	 add         r6, r6, r11, lsl #2
  00348		 |$L40092|

; 352  : 
; 353  :     // Erase each block.
; 354  :     for (j = 0; j < num_blocks; j++)

  00348	e2888001	 add         r8, r8, #1
  0034c	e1580005	 cmp         r8, r5
  00350	3affffdd	 bcc         |$L40091|

; 426  :     {
; 427  :         if (*pFlash++ != 0xFFFFFFFF)

  00354	e59da00c	 ldr         r10, [sp, #0xC]
  00358	e59fb100	 ldr         r11, [pc, #0x100]
  0035c		 |$L40093|
  0035c	e59f00f8	 ldr         r0, [pc, #0xF8]
  00360	eb000000	 bl          EdbgOutputDebugString
  00364	e59b3000	 ldr         r3, [r11]
  00368	e1a02007	 mov         r2, r7
  0036c	e3530001	 cmp         r3, #1
  00370	0a00000d	 beq         |$L40111|

; 389  :         }
; 390  :     }
; 391  : 
; 392  :     EdbgOutputDebugString("\r\n");
; 393  :     pFlash = (volatile UINT32 *)(FlashStart);
; 394  : 
; 395  :     // Put the flash back into read mode
; 396  :     if ((g_FlashDeviceType == L18) || (g_FlashDeviceType == L30))

  00374	e3530002	 cmp         r3, #2
  00378	0a00000b	 beq         |$L40111|

; 418  :     }
; 419  :     else
; 420  :     {
; 421  :         *pFlash = 0x00FF00FF;

  0037c	e3a038ff	 mov         r3, #0xFF, 16
  00380	e38330ff	 orr         r3, r3, #0xFF
  00384	e5873000	 str         r3, [r7]
  00388	ea000018	 b           |$L40118|
  0038c		 |$L40340|

; 365  :         {
; 366  :             if (status & 0x00200000)

  0038c	e3140602	 tst         r4, #2, 12

; 367  :             {
; 368  :                 EdbgOutputDebugString("ERROR: FlashErase: block erase failure.  Lock bit upper flash set!\r\n");

  00390	159f00c0	 ldrne       r0, [pc, #0xC0]
  00394	1b000000	 blne        EdbgOutputDebugString

; 369  :             }
; 370  : 
; 371  :             if (status & 0x00000020)

  00398	e3140020	 tst         r4, #0x20
  0039c	0a000025	 beq         |$L40101|

; 372  :             {
; 373  :                 EdbgOutputDebugString("ERROR: FlashErase: block erase failure.  Lock bit lower flash set!\r\n");

  003a0	e59f00ac	 ldr         r0, [pc, #0xAC]
  003a4	eb000000	 bl          EdbgOutputDebugString

; 374  :             }
; 375  : 
; 376  :             EdbgOutputDebugString("ERROR: FlashErase: unrecoverable failure encountered while erasing flash.\r\n");
; 377  :             return(FALSE);

  003a8	ea000022	 b           |$L40101|
  003ac		 |$L40111|

; 397  :     {
; 398  :         // Setting the number of 16K blocks that we have to deal with
; 399  :         num_l3_blocks_erased = num_l3_blocks_to_erase;
; 400  : 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -