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

📄 stm32f10x_flash.txt

📁 ucos2.86版本结合STM板极支持包
💻 TXT
📖 第 1 页 / 共 3 页
字号:
000168  200f              MOVS     r0,#0xf
00016a  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;282     
;;;283          if(status != FLASH_BUSY)
00016e  2801              CMP      r0,#1
000170  d002              BEQ      |L1.376|
;;;284          {
;;;285            /* if the program operation is completed, disable the OPTPG Bit */
;;;286            FLASH->CR &= CR_OPTPG_Reset;
000172  6921              LDR      r1,[r4,#0x10]
000174  4029              ANDS     r1,r1,r5
000176  6121              STR      r1,[r4,#0x10]
                  |L1.376|
;;;287          }
;;;288        }
;;;289        else
;;;290        {
;;;291          if (status != FLASH_BUSY)
;;;292          {
;;;293            /* Disable the OPTPG Bit */
;;;294            FLASH->CR &= CR_OPTPG_Reset;
;;;295          }
;;;296        }  
;;;297      }
;;;298      /* Return the erase status */
;;;299      return status;
;;;300    }
000178  bd30              POP      {r4,r5,pc}
                  |L1.378|
00017a  2801              CMP      r0,#1
00017c  d0fc              BEQ      |L1.376|
00017e  6921              LDR      r1,[r4,#0x10]
000180  4029              ANDS     r1,r1,r5
000182  6121              STR      r1,[r4,#0x10]
000184  bd30              POP      {r4,r5,pc}
;;;301    
                          ENDP

                  FLASH_ProgramWord PROC
;;;312    FLASH_Status FLASH_ProgramWord(u32 Address, u32 Data)
;;;313    {
000186  b5f0              PUSH     {r4-r7,lr}
000188  4604              MOV      r4,r0
00018a  460d              MOV      r5,r1
;;;314      FLASH_Status status = FLASH_COMPLETE;
;;;315    
;;;316      /* Check the parameters */
;;;317      assert(IS_FLASH_ADDRESS(Address));
;;;318    
;;;319      /* Wait for last operation to be completed */
;;;320      status = FLASH_WaitForLastOperation(ProgramTimeout);
00018c  200f              MOVS     r0,#0xf
00018e  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;321      
;;;322      if(status == FLASH_COMPLETE)
000192  2804              CMP      r0,#4
000194  d116              BNE      |L1.452|
;;;323      {
;;;324        /* if the previous operation is completed, proceed to program the new first 
;;;325        half word */
;;;326        FLASH->CR |= CR_PG_Set;
000196  4e97              LDR      r6,|L1.1012|
000198  6930              LDR      r0,[r6,#0x10]
00019a  f040f040          ORR      r0,r0,#1
00019e  6130              STR      r0,[r6,#0x10]
;;;327      
;;;328        *(vu16*)Address = (u16)Data;
0001a0  8025              STRH     r5,[r4,#0]
;;;329    
;;;330        /* Wait for last operation to be completed */
;;;331        status = FLASH_WaitForLastOperation(ProgramTimeout);
0001a2  200f              MOVS     r0,#0xf
0001a4  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;332     
;;;333        if(status == FLASH_COMPLETE)
0001a8  f641f641          MOV      r7,#0x1ffe
0001ac  2804              CMP      r0,#4
0001ae  d10a              BNE      |L1.454|
;;;334        {
;;;335          /* if the previous operation is completed, proceed to program the new second 
;;;336          half word */
;;;337          *(vu16*)(Address + 2) = Data >> 16;
0001b0  0c28              LSRS     r0,r5,#16
0001b2  8060              STRH     r0,[r4,#2]
;;;338        
;;;339          /* Wait for last operation to be completed */
;;;340          status = FLASH_WaitForLastOperation(ProgramTimeout);
0001b4  200f              MOVS     r0,#0xf
0001b6  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;341            
;;;342          if(status != FLASH_BUSY)
0001ba  2801              CMP      r0,#1
0001bc  d002              BEQ      |L1.452|
;;;343          {
;;;344            /* Disable the PG Bit */
;;;345            FLASH->CR &= CR_PG_Reset;
0001be  6931              LDR      r1,[r6,#0x10]
0001c0  4039              ANDS     r1,r1,r7
0001c2  6131              STR      r1,[r6,#0x10]
                  |L1.452|
;;;346          }
;;;347        }
;;;348        else
;;;349        {
;;;350          if (status != FLASH_BUSY)
;;;351          {
;;;352            /* Disable the PG Bit */
;;;353            FLASH->CR &= CR_PG_Reset;
;;;354          }
;;;355         }
;;;356      }
;;;357      /* Return the Program Status */
;;;358      return status;
;;;359    }
0001c4  bdf0              POP      {r4-r7,pc}
                  |L1.454|
0001c6  2801              CMP      r0,#1
0001c8  d0fc              BEQ      |L1.452|
0001ca  6931              LDR      r1,[r6,#0x10]
0001cc  4039              ANDS     r1,r1,r7
0001ce  6131              STR      r1,[r6,#0x10]
0001d0  bdf0              POP      {r4-r7,pc}
;;;360    
                          ENDP

                  FLASH_ProgramHalfWord PROC
;;;371    FLASH_Status FLASH_ProgramHalfWord(u32 Address, u16 Data)
;;;372    {
0001d2  b570              PUSH     {r4-r6,lr}
0001d4  4606              MOV      r6,r0
0001d6  460d              MOV      r5,r1
;;;373      FLASH_Status status = FLASH_COMPLETE;
;;;374    
;;;375      /* Check the parameters */
;;;376      assert(IS_FLASH_ADDRESS(Address));
;;;377    
;;;378      /* Wait for last operation to be completed */
;;;379      status = FLASH_WaitForLastOperation(ProgramTimeout);
0001d8  200f              MOVS     r0,#0xf
0001da  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;380      
;;;381      if(status == FLASH_COMPLETE)
0001de  2804              CMP      r0,#4
0001e0  d10f              BNE      |L1.514|
;;;382      {
;;;383        /* if the previous operation is completed, proceed to program the new data */
;;;384        FLASH->CR |= CR_PG_Set;
0001e2  4c84              LDR      r4,|L1.1012|
0001e4  6920              LDR      r0,[r4,#0x10]
0001e6  f040f040          ORR      r0,r0,#1
0001ea  6120              STR      r0,[r4,#0x10]
;;;385      
;;;386        *(vu16*)Address = Data;
0001ec  8035              STRH     r5,[r6,#0]
;;;387        /* Wait for last operation to be completed */
;;;388        status = FLASH_WaitForLastOperation(ProgramTimeout);
0001ee  200f              MOVS     r0,#0xf
0001f0  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;389    
;;;390        if(status != FLASH_BUSY)
0001f4  2801              CMP      r0,#1
0001f6  d004              BEQ      |L1.514|
;;;391        {
;;;392          /* if the program operation is completed, disable the PG Bit */
;;;393          FLASH->CR &= CR_PG_Reset;
0001f8  6921              LDR      r1,[r4,#0x10]
0001fa  f641f641          MOV      r2,#0x1ffe
0001fe  4011              ANDS     r1,r1,r2
000200  6121              STR      r1,[r4,#0x10]
                  |L1.514|
;;;394        }
;;;395      } 
;;;396      /* Return the Program Status */
;;;397      return status;
;;;398    }
000202  bd70              POP      {r4-r6,pc}
;;;399    
                          ENDP

                  FLASH_ProgramOptionByteData PROC
;;;411    FLASH_Status FLASH_ProgramOptionByteData(u32 Address, u8 Data)
;;;412    {
000204  b570              PUSH     {r4-r6,lr}
000206  4606              MOV      r6,r0
000208  460d              MOV      r5,r1
;;;413      FLASH_Status status = FLASH_COMPLETE;
;;;414    
;;;415      /* Check the parameters */
;;;416      assert(IS_OB_DATA_ADDRESS(Address));
;;;417    
;;;418      status = FLASH_WaitForLastOperation(ProgramTimeout);
00020a  200f              MOVS     r0,#0xf
00020c  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;419    
;;;420      if(status == FLASH_COMPLETE)
000210  2804              CMP      r0,#4
000212  d113              BNE      |L1.572|
;;;421      {
;;;422        /* Authorize the small information block programming */
;;;423        FLASH->OPTKEYR = FLASH_KEY1;
000214  4c77              LDR      r4,|L1.1012|
000216  4878              LDR      r0,|L1.1016|
000218  60a0              STR      r0,[r4,#8]
;;;424        FLASH->OPTKEYR = FLASH_KEY2;
00021a  4878              LDR      r0,|L1.1020|
00021c  60a0              STR      r0,[r4,#8]
;;;425    
;;;426        /* Enables the Option Bytes Programming operation */
;;;427        FLASH->CR |= CR_OPTPG_Set; 
00021e  6920              LDR      r0,[r4,#0x10]
000220  f040f040          ORR      r0,r0,#0x10
000224  6120              STR      r0,[r4,#0x10]
;;;428        *(vu16*)Address = Data;
000226  8035              STRH     r5,[r6,#0]
;;;429        
;;;430        /* Wait for last operation to be completed */
;;;431        status = FLASH_WaitForLastOperation(ProgramTimeout);
000228  200f              MOVS     r0,#0xf
00022a  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;432    
;;;433        if(status != FLASH_BUSY)
00022e  2801              CMP      r0,#1
000230  d004              BEQ      |L1.572|
;;;434        {
;;;435          /* if the program operation is completed, disable the OPTPG Bit */
;;;436          FLASH->CR &= CR_OPTPG_Reset;
000232  6921              LDR      r1,[r4,#0x10]
000234  f641f641          MOV      r2,#0x1fef
000238  4011              ANDS     r1,r1,r2
00023a  6121              STR      r1,[r4,#0x10]
                  |L1.572|
;;;437        }
;;;438      }    
;;;439      /* Return the Option Byte Data Program Status */
;;;440      return status;      
;;;441    }
00023c  bd70              POP      {r4-r6,pc}
;;;442    
                          ENDP

                  FLASH_EnableWriteProtection PROC
;;;456    FLASH_Status FLASH_EnableWriteProtection(u32 FLASH_Pages)
;;;457    {
00023e  e92de92d          PUSH     {r4-r9,lr}
;;;458      u16 WRP0_Data = 0xFFFF, WRP1_Data = 0xFFFF, WRP2_Data = 0xFFFF, WRP3_Data = 0xFFFF;
;;;459      
;;;460      FLASH_Status status = FLASH_COMPLETE;
;;;461      
;;;462      /* Check the parameters */
;;;463      assert(IS_FLASH_WRPROT_PAGE(FLASH_Pages));
;;;464      
;;;465      FLASH_Pages = (u32)(~FLASH_Pages);
000242  43c0              MVNS     r0,r0
;;;466      WRP0_Data = (vu16)(FLASH_Pages & WRP0_Mask);
000244  b2c4              UXTB     r4,r0
;;;467      WRP1_Data = (vu16)((FLASH_Pages & WRP1_Mask) >> 8);
000246  f3c0f3c0          UBFX     r5,r0,#8,#8
;;;468      WRP2_Data = (vu16)((FLASH_Pages & WRP2_Mask) >> 16);
00024a  f3c0f3c0          UBFX     r6,r0,#16,#8
;;;469      WRP3_Data = (vu16)((FLASH_Pages & WRP3_Mask) >> 24);
00024e  0e07              LSRS     r7,r0,#24
;;;470      
;;;471      /* Wait for last operation to be completed */
;;;472      status = FLASH_WaitForLastOperation(ProgramTimeout);
000250  200f              MOVS     r0,#0xf
000252  f7fff7ff          BL       FLASH_WaitForLastOperation
;;;473      
;;;474      if(status == FLASH_COMPLETE)
000256  2804              CMP      r0,#4
000258  d13a              BNE      |L1.720|
;;;475      {
;;;476        /* Authorizes the small information block programming */
;;;477        FLASH->OPTKEYR = FLASH_KEY1;
00025a  f8dff8df          LDR      r9,|L1.1012|
00025e  4966              LDR      r1,|L1.1016|
000260  f8c9f8c9          STR      r1,[r9,#8]
;;;478        FLASH->OPTKEYR = FLASH_KEY2;
000264  4965              LDR      r1,|L1.1020|
000266  f8c9f8c9          STR      r1,[r9,#8]
;;;479        FLASH->CR |= CR_OPTPG_Set;
00026a  f8d9f8d9          LDR      r1,[r9,#0x10]
00026e  f041f041          ORR      r1,r1,#0x10
000272  f8c9f8c9          STR      r1,[r9,#0x10]
;;;480    
;;;481        if(WRP0_Data != 0xFF)
000276  f8dff8df          LDR      r8,|L1.1028|
00027a  2cff              CMP      r4,#0xff
00027c  d004              BEQ      |L1.648|
;;;482        {
;;;483          OB->WRP0 = WRP0_Data;
00027e  f8a8f8a8          STRH     r4,[r8,#0x808]
;;;484          
;;;485          /* Wait for last operation to be completed */
;;;486          status = FLASH_WaitForLastOperation(ProgramTimeout);
000282  200f              MOVS     r0,#0xf
000284  f7fff7ff          BL       FLASH_WaitForLastOperation
                  |L1.648|
;;;487        }
;;;488        if((status == FLASH_COMPLETE) && (WRP1_Data != 0xFF))
000288  2804              CMP      r0,#4
00028a  d106              BNE      |L1.666|
00028c  2dff              CMP      r5,#0xff
00028e  d004              BEQ      |L1.666|
;;;489        {
;;;490          OB->WRP1 = WRP1_Data;
000290  f8a8f8a8          STRH     r5,[r8,#0x80a]
;;;491          
;;;492          /* Wait for last operation to be completed */
;;;493          status = FLASH_WaitForLastOperation(ProgramTimeout);
000294  200f              MOVS     r0,#0xf
000296  f7fff7ff          BL       FLASH_WaitForLastOperation
                  |L1.666|
;;;494        }
;;;495    
;;;496        if((status == FLASH_COMPLETE) && (WRP2_Data != 0xFF))
00029a  2804              CMP      r0,#4
00029c  d106              BNE      |L1.684|
00029e  2eff              CMP      r6,#0xff
0002a0  d004              BEQ      |L1.684|
;;;497        {
;;;498          OB->WRP2 = WRP2_Data;
0002a2  f8a8f8a8          STRH     r6,[r8,#0x80c]
;;;499          
;;;500          /* Wait for last operation to be completed */
;;;501          status = FLASH_WaitForLastOperation(ProgramTimeout);
0002a6  200f              MOVS     r0,#0xf
0002a8  f7fff7ff          BL       FLASH_WaitForLastOperation
                  |L1.684|
;;;502        }
;;;503        
;;;504        if((status == FLASH_COMPLETE)&& (WRP3_Data != 0xFF))
0002ac  2804              CMP      r0,#4
0002ae  d106              BNE      |L1.702|
0002b0  2fff              CMP      r7,#0xff
0002b2  d004              BEQ      |L1.702|
;;;505        {
;;;506          OB->WRP3 = WRP3_Data;
0002b4  f8a8f8a8          STRH     r7,[r8,#0x80e]
;;;507         
;;;508          /* Wait for last operation to be completed */
;;;509          status = FLASH_WaitForLastOperation(ProgramTimeout);
0002b8  200f              MOVS     r0,#0xf
0002ba  f7fff7ff          BL       FLASH_WaitForLastOperation
                  |L1.702|
;;;510        }
;;;511              
;;;512        if(status != FLASH_BUSY)
0002be  2801              CMP      r0,#1
0002c0  d006              BEQ      |L1.720|
;;;513        {
;;;514          /* if the program operation is completed, disable the OPTPG Bit */
;;;515          FLASH->CR &= CR_OPTPG_Reset;
0002c2  f8d9f8d9          LDR      r1,[r9,#0x10]
0002c6  f641f641          MOV      r2,#0x1fef
0002ca  4011              ANDS     r1,r1,r2
0002cc  f8c9f8c9          STR      r1,[r9,#0x10]
                  |L1.720|
;;;516        }
;;;517      } 
;;;518      /* Return the write protection operation Status */
;;;519      return status;       
;;;520    }
0002d0  e8bde8bd          POP      {r4-r9,pc}
;;;521    
                          ENDP

⌨️ 快捷键说明

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