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

📄 flash.cod

📁 一个berry eboot 源代码
💻 COD
📖 第 1 页 / 共 5 页
字号:
  00078	949de004	 ldrls       lr, [sp], #4
  0007c	912fff1e	 bxls        lr

; 201  :     }
; 202  :     if ((nDeviceID >= FLASH_DEVICE_ID_K18_MIN) && (nDeviceID <= FLASH_DEVICE_ID_K18_MAX))

  00080	e3a03b22	 mov         r3, #0x22, 22
  00084	e3833005	 orr         r3, r3, #5
  00088	e0413003	 sub         r3, r1, r3
  0008c	e3530002	 cmp         r3, #2

; 203  :     {
; 204  :         //EdbgOutputDebugString("INFO: DetectFlashDevice: flash type is K18.\r\n");
; 205  :         return(K18);

  00090	93a00004	 movls       r0, #4

; 215  : }

  00094	949de004	 ldrls       lr, [sp], #4
  00098	912fff1e	 bxls        lr

; 206  :     }
; 207  :     if ((nDeviceID >= FLASH_DEVICE_ID_J3_MIN) && (nDeviceID <= FLASH_DEVICE_ID_J3_MAX))

  0009c	e2413016	 sub         r3, r1, #0x16
  000a0	e3530002	 cmp         r3, #2

; 208  :     {
; 209  :         //EdbgOutputDebugString("INFO: DetectFlashDevice: flash type is J3.\r\n");
; 210  :         return(J3);

  000a4	93a00005	 movls       r0, #5

; 215  : }

  000a8	949de004	 ldrls       lr, [sp], #4
  000ac	912fff1e	 bxls        lr

; 211  :     }
; 212  : 
; 213  :     EdbgOutputDebugString("INFO: DetectFlashDevice: flash type is undetermined.\r\n");

  000b0	e59f000c	 ldr         r0, [pc, #0xC]
  000b4	eb000000	 bl          EdbgOutputDebugString

; 214  :     return(NONE);

  000b8	e3a00000	 mov         r0, #0

; 215  : }

  000bc	e49de004	 ldr         lr, [sp], #4
  000c0	e12fff1e	 bx          lr
  000c4		 |$L40330|
  000c4	00000000	 DCD         |??_C@_0DH@OBMGOPJF@INFO?3?5DetectFlashDevice?3?5flash?5t@|
  000c8		 |$M40326|

			 ENDP  ; |DetectFlashDevice|

	EXPORT	|??_C@_0CO@LAPCIDHL@ERROR?3?5FlashErase?3?5unrecognized?5@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DN@FJFKBFNH@WARNING?3?5FlashErase?3?5calculation@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DK@GJOOKCEM@ERROR?3?5FlashErase?3?5voltage?5range@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DK@BGKLKEKO@ERROR?3?5FlashErase?3?5voltage?5range@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DN@EOEBMPFC@ERROR?3?5FlashErase?3?5command?5seque@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DN@DBAEMJLA@ERROR?3?5FlashErase?3?5command?5seque@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DM@MGNKKOMD@ERROR?3?5FlashErase?3?5clear?5lock?5bi@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DM@LJJPKICB@ERROR?3?5FlashErase?3?5clear?5lock?5bi@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DD@CNMLMBBN@ERROR?3?5FlashErase?3?5status?5regist@| [ DATA ] ; `string'
	EXPORT	|??_C@_0FM@DKNOGHIG@ERROR?3?5FlashErase?3?5unrecoverable@| [ DATA ] ; `string'
	EXPORT	|??_C@_0DN@CNHGHOKP@INFO?3?5FlashErase?3?5erasing?5flash?5@| [ DATA ] ; `string'
	EXPORT	|??_C@_0EF@BGCELHEH@ERROR?3?5FlashErase?3?5block?5erase?5f@| [ DATA ] ; `string'
	EXPORT	|??_C@_0EF@CDGLJFKL@ERROR?3?5FlashErase?3?5block?5erase?5f@| [ DATA ] ; `string'
	EXPORT	|??_C@_0EM@NACFEOGP@ERROR?3?5FlashErase?3?5unrecoverable@| [ DATA ] ; `string'
	EXPORT	|??_C@_01LFCBOECM@?4?$AA@| [ DATA ]	; `string'
	EXPORT	|??_C@_02PCIJFNDE@?$AN?6?$AA@| [ DATA ]	; `string'
	EXPORT	|??_C@_0EL@DOJKFNA@ERROR?3?5FlashErase?3?5erase?5verific@| [ DATA ] ; `string'
	IMPORT	|__rt_udiv|

  00000			 AREA	 |.text| { |FlashErase| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000			 AREA	 |.pdata$$FlashErase|, PDATA, SELECTION=5, ASSOC=|.text| { |FlashErase| } ; comdat associative
|$T40376| DCD	|$L40375|
	DCD	0x40012502

  00000			 AREA	 |.rdata| { |??_C@_0EL@DOJKFNA@ERROR?3?5FlashErase?3?5erase?5verific@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0EL@DOJKFNA@ERROR?3?5FlashErase?3?5erase?5verific@| DCB "ERROR: Fl"
	DCB	"ashErase: erase verification failure at address 0x%X Dat"
	DCB	"a 0x%X.", 0xd, 0xa, 0x0		; `string'

  00000			 AREA	 |.rdata| { |??_C@_02PCIJFNDE@?$AN?6?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_02PCIJFNDE@?$AN?6?$AA@| DCB 0xd, 0xa, 0x0	; `string'

  00000			 AREA	 |.rdata| { |??_C@_0EM@NACFEOGP@ERROR?3?5FlashErase?3?5unrecoverable@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0EM@NACFEOGP@ERROR?3?5FlashErase?3?5unrecoverable@| DCB "ERROR: Fl"
	DCB	"ashErase: unrecoverable failure encountered while erasin"
	DCB	"g flash.", 0xd, 0xa, 0x0		; `string'

  00000			 AREA	 |.rdata| { |??_C@_0EF@CDGLJFKL@ERROR?3?5FlashErase?3?5block?5erase?5f@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0EF@CDGLJFKL@ERROR?3?5FlashErase?3?5block?5erase?5f@| DCB "ERROR: "
	DCB	"FlashErase: block erase failure.  Lock bit lower flash s"
	DCB	"et!", 0xd, 0xa, 0x0			; `string'

  00000			 AREA	 |.rdata| { |??_C@_0EF@BGCELHEH@ERROR?3?5FlashErase?3?5block?5erase?5f@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0EF@BGCELHEH@ERROR?3?5FlashErase?3?5block?5erase?5f@| DCB "ERROR: "
	DCB	"FlashErase: block erase failure.  Lock bit upper flash s"
	DCB	"et!", 0xd, 0xa, 0x0			; `string'

  00000			 AREA	 |.rdata| { |??_C@_01LFCBOECM@?4?$AA@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_01LFCBOECM@?4?$AA@| DCB ".", 0x0			; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DN@CNHGHOKP@INFO?3?5FlashErase?3?5erasing?5flash?5@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DN@CNHGHOKP@INFO?3?5FlashErase?3?5erasing?5flash?5@| DCB "INFO: F"
	DCB	"lashErase: erasing flash %X to %X.  Please wait... ", 0xd
	DCB	0xa, 0x0				; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DD@CNMLMBBN@ERROR?3?5FlashErase?3?5status?5regist@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DD@CNMLMBBN@ERROR?3?5FlashErase?3?5status?5regist@| DCB "ERROR: F"
	DCB	"lashErase: status register returned 0x%X", 0xd, 0xa, 0x0 ; `string'

  00000			 AREA	 |.rdata| { |??_C@_0FM@DKNOGHIG@ERROR?3?5FlashErase?3?5unrecoverable@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0FM@DKNOGHIG@ERROR?3?5FlashErase?3?5unrecoverable@| DCB "ERROR: Fl"
	DCB	"ashErase: unrecoverable failure encountered while erasin"
	DCB	"g flash.  System halted!", 0xd, 0xa, 0x0 ; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DM@LJJPKICB@ERROR?3?5FlashErase?3?5clear?5lock?5bi@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DM@LJJPKICB@ERROR?3?5FlashErase?3?5clear?5lock?5bi@| DCB "ERROR: "
	DCB	"FlashErase: clear lock bits error ... upper flash.", 0xd
	DCB	0xa, 0x0				; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DM@MGNKKOMD@ERROR?3?5FlashErase?3?5clear?5lock?5bi@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DM@MGNKKOMD@ERROR?3?5FlashErase?3?5clear?5lock?5bi@| DCB "ERROR: "
	DCB	"FlashErase: clear lock bits error ... lower flash.", 0xd
	DCB	0xa, 0x0				; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DN@DBAEMJLA@ERROR?3?5FlashErase?3?5command?5seque@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DN@DBAEMJLA@ERROR?3?5FlashErase?3?5command?5seque@| DCB "ERROR: F"
	DCB	"lashErase: command sequence error ... upper flash.", 0xd
	DCB	0xa, 0x0				; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DN@EOEBMPFC@ERROR?3?5FlashErase?3?5command?5seque@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DN@EOEBMPFC@ERROR?3?5FlashErase?3?5command?5seque@| DCB "ERROR: F"
	DCB	"lashErase: command sequence error ... lower flash.", 0xd
	DCB	0xa, 0x0				; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DK@BGKLKEKO@ERROR?3?5FlashErase?3?5voltage?5range@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DK@BGKLKEKO@ERROR?3?5FlashErase?3?5voltage?5range@| DCB "ERROR: F"
	DCB	"lashErase: voltage range error ... upper flash.", 0xd, 0xa
	DCB	0x0					; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DK@GJOOKCEM@ERROR?3?5FlashErase?3?5voltage?5range@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DK@GJOOKCEM@ERROR?3?5FlashErase?3?5voltage?5range@| DCB "ERROR: F"
	DCB	"lashErase: voltage range error ... lower flash.", 0xd, 0xa
	DCB	0x0					; `string'

  00000			 AREA	 |.rdata| { |??_C@_0DN@FJFKBFNH@WARNING?3?5FlashErase?3?5calculation@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0DN@FJFKBFNH@WARNING?3?5FlashErase?3?5calculation@| DCB "WARNING: "
	DCB	"FlashErase: calculation error.  Erase blocks = %d", 0xa, 0xd
	DCB	0x0					; `string'

  00000			 AREA	 |.rdata| { |??_C@_0CO@LAPCIDHL@ERROR?3?5FlashErase?3?5unrecognized?5@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CO@LAPCIDHL@ERROR?3?5FlashErase?3?5unrecognized?5@| DCB "ERROR: F"
	DCB	"lashErase: unrecognized flash part.", 0xd, 0xa, 0x0 ; `string'
; Function compile flags: /Ogsy

  00000			 AREA	 |.text| { |FlashErase| }, CODE, ARM, SELECTION=1 ; comdat noduplicate

  00000		 |FlashErase| PROC

; 219  : {

  00000		 |$L40375|
  00000	e92d4ff0	 stmdb       sp!, {r4 - r11, lr}
  00004	e24dd014	 sub         sp, sp, #0x14
  00008		 |$M40373|
  00008	e1a05001	 mov         r5, r1
  0000c	e58d5010	 str         r5, [sp, #0x10]
  00010	e1a07000	 mov         r7, r0

; 220  :     UINT32 i,j;
; 221  :     UINT32 num_blocks;
; 222  :     UINT32 num_blocks_to_erase;
; 223  :     UINT32 num_l3_blocks_to_erase = 0;
; 224  :     UINT32 num_l3_blocks_erased;
; 225  :     UINT32 flash_start_address = (UINT32) OALPAtoVA(MAINSTONEII_BASE_PA_BOOT_FLASH, FALSE);

  00014	e3a0a000	 mov         r10, #0
  00018	e3a01000	 mov         r1, #0
  0001c	e3a00000	 mov         r0, #0
  00020	e58da00c	 str         r10, [sp, #0xC]
  00024	eb000000	 bl          OALPAtoVA

; 226  :     volatile UINT32 *pFlash;
; 227  :     UINT32 status;
; 228  :     UINT32 BLOCK_SIZE = (FLASH_SIZE / ERASE_BLOCKS);

  00028	e59f3420	 ldr         r3, [pc, #0x420]
  0002c	e1a06000	 mov         r6, r0
  00030	e5930004	 ldr         r0, [r3, #4]
  00034	e5931008	 ldr         r1, [r3, #8]
  00038	eb000000	 bl          __rt_udiv

; 229  : 
; 230  :     // Make sure we know what kind of flash part we have.
; 231  :     //
; 232  :     if (g_FlashDeviceType == NONE)

  0003c	e59fb41c	 ldr         r11, [pc, #0x41C]
  00040	e1a03000	 mov         r3, r0
  00044	e58d3000	 str         r3, [sp]
  00048	e59b4000	 ldr         r4, [r11]
  0004c	e3540000	 cmp         r4, #0

; 233  :     {
; 234  :         EdbgOutputDebugString("ERROR: FlashErase: unrecognized flash part.\r\n");

  00050	059f0438	 ldreq       r0, [pc, #0x438]
  00054	0a0000f8	 beq         |$L40372|

; 235  :         return(FALSE);
; 236  :     }
; 237  : 
; 238  :     // Determine the number of blocks to erase.
; 239  :     num_blocks = (FlashLength / (BLOCK_SIZE));

  00058	e1a00003	 mov         r0, r3
  0005c	e1a01005	 mov         r1, r5
  00060	eb000000	 bl          __rt_udiv
  00064	e3510000	 cmp         r1, #0
  00068	e1a05000	 mov         r5, r0

; 240  :     if (FlashLength % (BLOCK_SIZE))
; 241  :     {
; 242  :         num_blocks++;

  0006c	12855001	 addne       r5, r5, #1

; 243  :     }
; 244  : 
; 245  :     if (num_blocks < 1)

  00070	e3550001	 cmp         r5, #1

; 246  :     {
; 247  :         num_blocks = 1;
; 248  :         EdbgOutputDebugString("WARNING: FlashErase: calculation error.  Erase blocks = %d\n\r", num_blocks);

  00074	33a01001	 movcc       r1, #1
  00078	33a05001	 movcc       r5, #1
  0007c	3a000003	 bcc         |$L40369|

; 249  :     }
; 250  : 
; 251  :     else if (num_blocks > 128)

  00080	e3550080	 cmp         r5, #0x80
  00084	9a000004	 bls         |$L40053|

; 252  :     {
; 253  :         num_blocks = 128;
; 254  :         EdbgOutputDebugString("WARNING: FlashErase: calculation error.  Erase blocks = %d\n\r", num_blocks);

  00088	e3a01080	 mov         r1, #0x80
  0008c	e3a05080	 mov         r5, #0x80
  00090		 |$L40369|
  00090	e59f03f4	 ldr         r0, [pc, #0x3F4]
  00094	eb000000	 bl          EdbgOutputDebugString
  00098	e59b4000	 ldr         r4, [r11]
  0009c		 |$L40053|

; 255  :     }
; 256  : 
; 257  :     // If Tyax flash, need to change block count based on if we're in the first 4 blocks
; 258  :     // as the first 4 blocks are 16KWords (vs. 64KWords/block)
; 259  :     if ((g_FlashDeviceType == L18) || (g_FlashDeviceType == L30))

  0009c	e3540001	 cmp         r4, #1
  000a0	0a000001	 beq         |$L40055|
  000a4	e3540002	 cmp         r4, #2
  000a8	1a000006	 bne         |$L40056|
  000ac		 |$L40055|

; 260  :     {
; 261  :         // Is start address within the first 4 blocks.  As there are 2 devices in parallel,
; 262  :         // are we within the first 128KWords (2 x 64KWords)?  If so, we need to account for
; 263  :         // increased number of blocks - which is the first 256K of addy range
; 264  :         if ((FlashStart >= flash_start_address) && (FlashStart < (flash_start_address + 0x40000)))

  000ac	e1570006	 cmp         r7, r6
  000b0	3a000004	 bcc         |$L40056|
  000b4	e2863701	 add         r3, r6, #1, 14
  000b8	e1570003	 cmp         r7, r3

; 265  :         {
; 266  :             // If we're within the first 128K words (256K), we need to treat the block as a special case
; 267  :             num_l3_blocks_to_erase = 4;

  000bc	33a0a004	 movcc       r10, #4
  000c0	358da00c	 strcc       r10, [sp, #0xC]
  000c4	32855003	 addcc       r5, r5, #3
  000c8		 |$L40056|

; 268  :             num_blocks--; // Decrease the num_blocks count, as it assumes the first block is 64K
; 269  : 
; 270  :             // Now add the # of L3 blocks to the # blocks calc.'ed at the beginning to get total
; 271  :             // # of blocks to erase on a given L3 device INCLUDING the first 4 16kWord blocks
; 272  :             num_blocks = num_blocks + num_l3_blocks_to_erase;
; 273  :         }
; 274  :     }
; 275  : 
; 276  :     pFlash = (volatile UINT32 *)(FlashStart);
; 277  : 
; 278  :     // Issue the clear lock bits and confirm command.
; 279  :     if (g_FlashDeviceType == J3)

  000c8	e3540005	 cmp         r4, #5

; 280  :     {
; 281  :         // For J3 FLASH, unlock all blocks at once with one command
; 282  :         num_blocks_to_erase = 1;

  000cc	03a08001	 moveq       r8, #1
  000d0	e1a09007	 mov         r9, r7
  000d4	0a00000a	 beq         |$L40060|

; 283  :     }
; 284  :     else if ((g_FlashDeviceType == K3) || (g_FlashDeviceType == K18)|| (g_FlashDeviceType == L18) || (g_FlashDeviceType == L30))

  000d8	e3540003	 cmp         r4, #3
  000dc	0a000005	 beq         |$L40061|
  000e0	e3540004	 cmp         r4, #4
  000e4	0a000003	 beq         |$L40061|
  000e8	e3540001	 cmp         r4, #1
  000ec	0a000001	 beq         |$L40061|
  000f0	e3540002	 cmp         r4, #2
  000f4	1a000001	 bne         |$L40349|
  000f8		 |$L40061|

; 285  :     {
; 286  :         // For K3/K18 FLASH, unlock individual blocks one at a time
; 287  :         num_blocks_to_erase = num_blocks;

  000f8	e1a08005	 mov         r8, r5
  000fc	ea000000	 b           |$L40060|
  00100		 |$L40349|
  00100	e59d8010	 ldr         r8, [sp, #0x10]
  00104		 |$L40060|

; 288  :     }
; 289  : 
; 290  :     // For L3, need to set for use within the FOR loop
; 291  :     num_l3_blocks_erased = num_l3_blocks_to_erase;
; 292  : 
; 293  :     for (j = 0; j < num_blocks_to_erase; j++)

  00104	e3a03000	 mov         r3, #0
  00108	e3a0060d	 mov         r0, #0xD, 12
  0010c	e3a01502	 mov         r1, #2, 10
  00110	e58d3008	 str         r3, [sp, #8]
  00114	e38000d0	 orr         r0, r0, #0xD0
  00118	e3811080	 orr         r1, r1, #0x80
  0011c	e58da004	 str         r10, [sp, #4]
  00120	e3580000	 cmp         r8, #0
  00124	0a000048	 beq         |$L40064|
  00128	e3a03606	 mov         r3, #6, 12
  0012c	e59de000	 ldr         lr, [sp]
  00130	e3833060	 orr         r3, r3, #0x60
  00134		 |$L40062|

; 294  :     {
; 295  :         *pFlash = 0x00600060;

  00134	e5893000	 str         r3, [r9]

; 296  :         *pFlash = 0x00d000d0;

  00138	e5890000	 str         r0, [r9]
  0013c		 |$L40066|

; 297  : 

⌨️ 快捷键说明

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