📄 flash.lst
字号:
\ 0000001C 001091E5 LDR R1,[R1, #+0]
\ 00000020 801691E3 ORRS R1,R1,#0x8000000
\ 00000024 001080E5 STR R1,[R0, #+0]
74 /* Select in the CR1 register the Sectors to be erased */
75 FLASHR->CR1 |= Xsectors;
\ 00000028 4402A0E3 MOV R0,#+1073741828
\ 0000002C 400980E3 ORR R0,R0,#0x100000
\ 00000030 4412A0E3 MOV R1,#+1073741828
\ 00000034 401981E3 ORR R1,R1,#0x100000
\ 00000038 001091E5 LDR R1,[R1, #+0]
\ 0000003C 011094E1 ORRS R1,R4,R1
\ 00000040 001080E5 STR R1,[R0, #+0]
76 /* Set the Write Mode Start bit 'WMS' in the CR0 Reg to Start Erase Operation */
77 FLASHR->CR0 |= FLASH_WMS_Mask;
\ 00000044 4004A0E3 MOV R0,#+1073741824
\ 00000048 400980E3 ORR R0,R0,#0x100000
\ 0000004C 4014A0E3 MOV R1,#+1073741824
\ 00000050 401981E3 ORR R1,R1,#0x100000
\ 00000054 001091E5 LDR R1,[R1, #+0]
\ 00000058 801491E3 ORRS R1,R1,#0x80000000
\ 0000005C 001080E5 STR R1,[R0, #+0]
78 /* Wait until the erase operation is completed */
79 FLASH_WaitForLastTask();
\ 00000060 ........ BL FLASH_WaitForLastTask
80 }
\ 00000064 1080BDE8 POP {R4,PC} ;; return
81
82 /*******************************************************************************
83 * Function Name : FLASH_WritePrConfig
84 * Description : Enable Write protection or Disable temporarily Write
85 * protection of a flash sector.
86 * Input 1 : Flash Sector.
87 * Input 2 : Enable or disable Flash sector Write Protection.
88 * Return : None.
89 *******************************************************************************/
\ In segment CODE_Flash, align 4, keep-with-next
90 void FLASH_WritePrConfig(u32 Xsectors, FunctionalState NewState)
91 {
\ FLASH_WritePrConfig:
\ 00000000 30402DE9 PUSH {R4,R5,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
92 /* Wait until another operation going on is completed */
93 FLASH_WaitForLastTask();
\ 0000000C ........ BL FLASH_WaitForLastTask
94 /* Enable Xsectors write protection */
95 if (NewState == ENABLE)
\ 00000010 010055E3 CMP R5,#+1
\ 00000014 1600001A BNE ??FLASH_WritePrConfig_0
96 {
97 /* Set the Set protection Bit */
98 FLASHR->CR0 |= FLASH_SPR_Mask;
\ 00000018 4004A0E3 MOV R0,#+1073741824
\ 0000001C 400980E3 ORR R0,R0,#0x100000
\ 00000020 4014A0E3 MOV R1,#+1073741824
\ 00000024 401981E3 ORR R1,R1,#0x100000
\ 00000028 001091E5 LDR R1,[R1, #+0]
\ 0000002C 401791E3 ORRS R1,R1,#0x1000000
\ 00000030 001080E5 STR R1,[R0, #+0]
99 /* Set the Register Address */
100 FLASHR->AR = 0x4010DFB0;
\ 00000034 4101A0E3 MOV R0,#+1073741840
\ 00000038 400980E3 ORR R0,R0,#0x100000
\ 0000003C 94109FE5 LDR R1,??FLASH_WritePrConfig_1 ;; 0x4010dfb0
\ 00000040 001080E5 STR R1,[R0, #+0]
101 /* Data to be programmed to the Protection Register */
102 FLASHR->DR0 = ~Xsectors;
\ 00000044 8402A0E3 MOV R0,#+1073741832
\ 00000048 400980E3 ORR R0,R0,#0x100000
\ 0000004C 0410F0E1 MVNS R1,R4
\ 00000050 001080E5 STR R1,[R0, #+0]
103 /* Set the WMS bit to Start the Sequence */
104 FLASHR->CR0 |= FLASH_WMS_Mask;
\ 00000054 4004A0E3 MOV R0,#+1073741824
\ 00000058 400980E3 ORR R0,R0,#0x100000
\ 0000005C 4014A0E3 MOV R1,#+1073741824
\ 00000060 401981E3 ORR R1,R1,#0x100000
\ 00000064 001091E5 LDR R1,[R1, #+0]
\ 00000068 801491E3 ORRS R1,R1,#0x80000000
\ 0000006C 001080E5 STR R1,[R0, #+0]
\ 00000070 170000EA B ??FLASH_WritePrConfig_2
105 }
106 /* Unprotect temporarily Flash sector */
107 else
108 {
109 /* Set the Set protection Bit */
110 FLASHR->CR0 |= FLASH_SPR_Mask;
\ ??FLASH_WritePrConfig_0:
\ 00000074 4004A0E3 MOV R0,#+1073741824
\ 00000078 400980E3 ORR R0,R0,#0x100000
\ 0000007C 4014A0E3 MOV R1,#+1073741824
\ 00000080 401981E3 ORR R1,R1,#0x100000
\ 00000084 001091E5 LDR R1,[R1, #+0]
\ 00000088 401791E3 ORRS R1,R1,#0x1000000
\ 0000008C 001080E5 STR R1,[R0, #+0]
111 /* Set the Register Address */
112 FLASHR->AR = 0x4010DFB0;
\ 00000090 4101A0E3 MOV R0,#+1073741840
\ 00000094 400980E3 ORR R0,R0,#0x100000
\ 00000098 38109FE5 LDR R1,??FLASH_WritePrConfig_1 ;; 0x4010dfb0
\ 0000009C 001080E5 STR R1,[R0, #+0]
113 /* Data to be programmed to the Protection Register */
114 FLASHR->DR0 = FLASHPR->NVWPAR|Xsectors;
\ 000000A0 8402A0E3 MOV R0,#+1073741832
\ 000000A4 400980E3 ORR R0,R0,#0x100000
\ 000000A8 28109FE5 LDR R1,??FLASH_WritePrConfig_1 ;; 0x4010dfb0
\ 000000AC 001091E5 LDR R1,[R1, #+0]
\ 000000B0 011094E1 ORRS R1,R4,R1
\ 000000B4 001080E5 STR R1,[R0, #+0]
115 /* Set the WMS bit to Start the Sequence */
116 FLASHR->CR0 |= FLASH_WMS_Mask;
\ 000000B8 4004A0E3 MOV R0,#+1073741824
\ 000000BC 400980E3 ORR R0,R0,#0x100000
\ 000000C0 4014A0E3 MOV R1,#+1073741824
\ 000000C4 401981E3 ORR R1,R1,#0x100000
\ 000000C8 001091E5 LDR R1,[R1, #+0]
\ 000000CC 801491E3 ORRS R1,R1,#0x80000000
\ 000000D0 001080E5 STR R1,[R0, #+0]
117 }
118 }
\ ??FLASH_WritePrConfig_2:
\ 000000D4 3080BDE8 POP {R4,R5,PC} ;; return
\ ??FLASH_WritePrConfig_1:
\ 000000D8 B0DF1040 DC32 0x4010dfb0
119
120 /*******************************************************************************
121 * Function Name : FLASH_WaitForLastTask
122 * Description : Waits for the end of last task on a Flash Bank.
123 * Input 1 : None.
124 * Return : None.
125 *******************************************************************************/
\ In segment CODE_Flash, align 4, keep-with-next
126 void FLASH_WaitForLastTask(void)
127 {
128 while (FLASHR->CR0&0x16);
\ FLASH_WaitForLastTask:
\ ??FLASH_WaitForLastTask_0:
\ 00000000 4004A0E3 MOV R0,#+1073741824
\ 00000004 400980E3 ORR R0,R0,#0x100000
\ 00000008 000090E5 LDR R0,[R0, #+0]
\ 0000000C 160010E3 TST R0,#0x16
\ 00000010 FAFFFF1A BNE ??FLASH_WaitForLastTask_0
129 }
\ 00000014 0EF0A0E1 MOV PC,LR ;; return
130
131 /*******************(C)COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
Maximum stack usage in bytes:
Function CSTACK
-------- ------
FLASH_Init 0
FLASH_SectorErase 8
FLASH_WaitForLastTask 0
FLASH_WordWrite 12
FLASH_WritePrConfig 12
Segment part sizes:
Function/Label Bytes
-------------- -----
FLASH_Init 84
FLASH_WordWrite 104
FLASH_SectorErase 104
FLASH_WritePrConfig 220
??FLASH_WaitForLastTask_0 24
536 bytes in segment CODE_Flash
536 bytes of CODE memory
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -