?? stm32f10x_flash.lst
字號:
596 /* Wait for last operation to be completed */
597 status = FLASH_WaitForLastBank2Operation(EraseTimeout);
598
599 /* Disable the MER Bit */
600 FLASH->CR2 &= CR_MER_Reset;
601 }
602 /* Return the Erase Status */
603 return status;
604 }
605 #endif /* STM32F10X_XL */
606
607 /**
608 * @brief Erases the FLASH option bytes.
609 * @note This functions erases all option bytes except the Read protection (RDP).
610 * @note This function can be used for all STM32F10x devices.
611 * @param None
612 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
613 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
614 */
\ In section .text, align 2, keep-with-next
615 FLASH_Status FLASH_EraseOptionBytes(void)
616 {
\ FLASH_EraseOptionBytes:
\ 00000000 38B5 PUSH {R3-R5,LR}
617 uint16_t rdptmp = RDP_Key;
\ 00000002 A524 MOVS R4,#+165
618
619 FLASH_Status status = FLASH_COMPLETE;
\ 00000004 0425 MOVS R5,#+4
620
621 /* Get the actual read protection Option Byte value */
622 if(FLASH_GetReadOutProtectionStatus() != RESET)
\ 00000006 ........ BL FLASH_GetReadOutProtectionStatus
\ 0000000A 0028 CMP R0,#+0
\ 0000000C 01D0 BEQ.N ??FLASH_EraseOptionBytes_0
623 {
624 rdptmp = 0x00;
\ 0000000E 0020 MOVS R0,#+0
\ 00000010 0400 MOVS R4,R0
625 }
626
627 /* Wait for last operation to be completed */
628 status = FLASH_WaitForLastOperation(EraseTimeout);
\ ??FLASH_EraseOptionBytes_0:
\ 00000012 5FF43020 MOVS R0,#+720896
\ 00000016 ........ BL FLASH_WaitForLastOperation
\ 0000001A 0500 MOVS R5,R0
629 if(status == FLASH_COMPLETE)
\ 0000001C EDB2 UXTB R5,R5 ;; ZeroExt R5,R5,#+24,#+24
\ 0000001E 042D CMP R5,#+4
\ 00000020 53D1 BNE.N ??FLASH_EraseOptionBytes_1
630 {
631 /* Authorize the small information block programming */
632 FLASH->OPTKEYR = FLASH_KEY1;
\ 00000022 ........ LDR.W R0,??DataTable25_6 ;; 0x40022008
\ 00000026 ........ LDR.W R1,??DataTable25_2 ;; 0x45670123
\ 0000002A 0160 STR R1,[R0, #+0]
633 FLASH->OPTKEYR = FLASH_KEY2;
\ 0000002C ........ LDR.W R0,??DataTable25_6 ;; 0x40022008
\ 00000030 ........ LDR.W R1,??DataTable25_3 ;; 0xcdef89ab
\ 00000034 0160 STR R1,[R0, #+0]
634
635 /* if the previous operation is completed, proceed to erase the option bytes */
636 FLASH->CR |= CR_OPTER_Set;
\ 00000036 ........ LDR.W R0,??DataTable25_4 ;; 0x40022010
\ 0000003A 0068 LDR R0,[R0, #+0]
\ 0000003C 50F02000 ORRS R0,R0,#0x20
\ 00000040 ........ LDR.W R1,??DataTable25_4 ;; 0x40022010
\ 00000044 0860 STR R0,[R1, #+0]
637 FLASH->CR |= CR_STRT_Set;
\ 00000046 ........ LDR.W R0,??DataTable25_4 ;; 0x40022010
\ 0000004A 0068 LDR R0,[R0, #+0]
\ 0000004C 50F04000 ORRS R0,R0,#0x40
\ 00000050 ........ LDR.W R1,??DataTable25_4 ;; 0x40022010
\ 00000054 0860 STR R0,[R1, #+0]
638 /* Wait for last operation to be completed */
639 status = FLASH_WaitForLastOperation(EraseTimeout);
\ 00000056 5FF43020 MOVS R0,#+720896
\ 0000005A ........ BL FLASH_WaitForLastOperation
\ 0000005E 0500 MOVS R5,R0
640
641 if(status == FLASH_COMPLETE)
\ 00000060 EDB2 UXTB R5,R5 ;; ZeroExt R5,R5,#+24,#+24
\ 00000062 042D CMP R5,#+4
\ 00000064 25D1 BNE.N ??FLASH_EraseOptionBytes_2
642 {
643 /* if the erase operation is completed, disable the OPTER Bit */
644 FLASH->CR &= CR_OPTER_Reset;
\ 00000066 ........ LDR.W R0,??DataTable25_4 ;; 0x40022010
\ 0000006A 0068 LDR R0,[R0, #+0]
\ 0000006C 41F6DF71 MOVW R1,#+8159
\ 00000070 0840 ANDS R0,R1,R0
\ 00000072 ........ LDR.W R1,??DataTable25_4 ;; 0x40022010
\ 00000076 0860 STR R0,[R1, #+0]
645
646 /* Enable the Option Bytes Programming operation */
647 FLASH->CR |= CR_OPTPG_Set;
\ 00000078 ........ LDR.W R0,??DataTable25_4 ;; 0x40022010
\ 0000007C 0068 LDR R0,[R0, #+0]
\ 0000007E 50F01000 ORRS R0,R0,#0x10
\ 00000082 ........ LDR.W R1,??DataTable25_4 ;; 0x40022010
\ 00000086 0860 STR R0,[R1, #+0]
648 /* Restore the last read protection Option Byte value */
649 OB->RDP = (uint16_t)rdptmp;
\ 00000088 ........ LDR.W R0,??DataTable25_7 ;; 0x1ffff800
\ 0000008C 0480 STRH R4,[R0, #+0]
650 /* Wait for last operation to be completed */
651 status = FLASH_WaitForLastOperation(ProgramTimeout);
\ 0000008E 4FF40050 MOV R0,#+8192
\ 00000092 ........ BL FLASH_WaitForLastOperation
\ 00000096 0500 MOVS R5,R0
652
653 if(status != FLASH_TIMEOUT)
\ 00000098 EDB2 UXTB R5,R5 ;; ZeroExt R5,R5,#+24,#+24
\ 0000009A 052D CMP R5,#+5
\ 0000009C 15D0 BEQ.N ??FLASH_EraseOptionBytes_1
654 {
655 /* if the program operation is completed, disable the OPTPG Bit */
656 FLASH->CR &= CR_OPTPG_Reset;
\ 0000009E ........ LDR.W R0,??DataTable25_4 ;; 0x40022010
\ 000000A2 0068 LDR R0,[R0, #+0]
\ 000000A4 41F6EF71 MOVW R1,#+8175
\ 000000A8 0840 ANDS R0,R1,R0
\ 000000AA ........ LDR.W R1,??DataTable25_4 ;; 0x40022010
\ 000000AE 0860 STR R0,[R1, #+0]
\ 000000B0 0BE0 B.N ??FLASH_EraseOptionBytes_1
657 }
658 }
659 else
660 {
661 if (status != FLASH_TIMEOUT)
\ ??FLASH_EraseOptionBytes_2:
\ 000000B2 EDB2 UXTB R5,R5 ;; ZeroExt R5,R5,#+24,#+24
\ 000000B4 052D CMP R5,#+5
\ 000000B6 08D0 BEQ.N ??FLASH_EraseOptionBytes_1
662 {
663 /* Disable the OPTPG Bit */
664 FLASH->CR &= CR_OPTPG_Reset;
\ 000000B8 ........ LDR.W R0,??DataTable25_4 ;; 0x40022010
\ 000000BC 0068 LDR R0,[R0, #+0]
\ 000000BE 41F6EF71 MOVW R1,#+8175
\ 000000C2 0840 ANDS R0,R1,R0
\ 000000C4 ........ LDR.W R1,??DataTable25_4 ;; 0x40022010
\ 000000C8 0860 STR R0,[R1, #+0]
665 }
666 }
667 }
668 /* Return the erase status */
669 return status;
\ ??FLASH_EraseOptionBytes_1:
\ 000000CA 2800 MOVS R0,R5
\ 000000CC C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 000000CE 32BD POP {R1,R4,R5,PC} ;; return
670 }
671
672 /**
673 * @brief Programs a word at a specified address.
674 * @note This function can be used for all STM32F10x devices.
675 * @param Address: specifies the address to be programmed.
676 * @param Data: specifies the data to be programmed.
677 * @retval FLASH Status: The returned value can be: FLASH_ERROR_PG,
678 * FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.
679 */
\ In section .text, align 2, keep-with-next
680 FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data)
681 {
\ FLASH_ProgramWord:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 82B0 SUB SP,SP,#+8
\ 00000004 0400 MOVS R4,R0
\ 00000006 0D00 MOVS R5,R1
682 FLASH_Status status = FLASH_COMPLETE;
\ 00000008 0426 MOVS R6,#+4
683 __IO uint32_t tmp = 0;
\ 0000000A 0020 MOVS R0,#+0
\ 0000000C 0090 STR R0,[SP, #+0]
684
685 /* Check the parameters */
686 assert_param(IS_FLASH_ADDRESS(Address));
687
688 #ifdef STM32F10X_XL
689 if(Address < FLASH_BANK1_END_ADDRESS - 2)
690 {
691 /* Wait for last operation to be completed */
692 status = FLASH_WaitForLastBank1Operation(ProgramTimeout);
693 if(status == FLASH_COMPLETE)
694 {
695 /* if the previous operation is completed, proceed to program the new first
696 half word */
697 FLASH->CR |= CR_PG_Set;
698
699 *(__IO uint16_t*)Address = (uint16_t)Data;
700 /* Wait for last operation to be completed */
701 status = FLASH_WaitForLastOperation(ProgramTimeout);
702
703 if(status == FLASH_COMPLETE)
704 {
705 /* if the previous operation is completed, proceed to program the new second
706 half word */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -