; generated by Component: ARM Compiler 5.06 update 7 (build 960) Tool: ArmCC [4d365d]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o..\output\sc32f1xxx_iap.o --asm_dir=..\List\ --list_dir=..\List\ --depend=..\output\sc32f1xxx_iap.d --cpu=Cortex-M0+ --apcs=interwork -O0 --diag_suppress=9931 -I..\FWLib\SC32F1XXX_Lib\inc -I..\User\HeadFiles -I..\User -I..\Drivers -I..\Apps -I..\CMSIS -IF:\Users\SOC\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\Device\ARM\ARMCM0plus\Include -D__UVISION_VERSION=536 -DARMCM0P -DSC32f15xx --omf_browse=..\output\sc32f1xxx_iap.crf ..\FWLib\SC32F1XXX_Lib\src\sc32f1xxx_iap.c]
                          THUMB

                          AREA ||i.DeInitFlashToRam||, CODE, READONLY, ALIGN=2

                  DeInitFlashToRam PROC
;;;74      */
;;;75     static void DeInitFlashToRam(void)
000000  2000              MOVS     r0,#0
;;;76     {
;;;77     		for(uint16_t i=0;i<sizeof(IapProgramInRam);i++)
000002  e004              B        |L1.14|
                  |L1.4|
;;;78     		{
;;;79     				IapProgramInRam[i]    =0;
000004  2100              MOVS     r1,#0
000006  4a05              LDR      r2,|L1.28|
000008  5411              STRB     r1,[r2,r0]
00000a  1c41              ADDS     r1,r0,#1              ;77
00000c  b288              UXTH     r0,r1                 ;77
                  |L1.14|
00000e  28b4              CMP      r0,#0xb4              ;77
000010  d3f8              BCC      |L1.4|
;;;80     		}		
;;;81     		pWriteIapFun=(pInitIapInRam)IAP_NOP;		
000012  4803              LDR      r0,|L1.32|
000014  4903              LDR      r1,|L1.36|
000016  6008              STR      r0,[r1,#0]  ; pWriteIapFun
;;;82     }
000018  4770              BX       lr
;;;83     
                          ENDP

00001a  0000              DCW      0x0000
                  |L1.28|
                          DCD      IapProgramInRam
                  |L1.32|
                          DCD      IAP_NOP
                  |L1.36|
                          DCD      pWriteIapFun

                          AREA ||i.IAP_CONTBurnlength||, CODE, READONLY, ALIGN=2

                  IAP_CONTBurnlength PROC
;;;1543     */
;;;1544   void IAP_CONTBurnlength(uint8_t Burnlength)
000000  4906              LDR      r1,|L2.28|
;;;1545   {
;;;1546      IAP->IAP_CON &=  ~(uint32_t)IAP_CON_CONT;
000002  68c9              LDR      r1,[r1,#0xc]
000004  223f              MOVS     r2,#0x3f
000006  0412              LSLS     r2,r2,#16
000008  4391              BICS     r1,r1,r2
00000a  4a04              LDR      r2,|L2.28|
00000c  60d1              STR      r1,[r2,#0xc]
;;;1547   	
;;;1548   	 IAP->IAP_CON |=  (uint32_t)(Burnlength<<IAP_CON_CONT_Pos);
00000e  4611              MOV      r1,r2
000010  68c9              LDR      r1,[r1,#0xc]
000012  0402              LSLS     r2,r0,#16
000014  4311              ORRS     r1,r1,r2
000016  4a01              LDR      r2,|L2.28|
000018  60d1              STR      r1,[r2,#0xc]
;;;1549   }
00001a  4770              BX       lr
;;;1550   /**
                          ENDP

                  |L2.28|
                          DCD      0x400003c0

                          AREA ||i.IAP_DMAENCmd||, CODE, READONLY, ALIGN=2

                  IAP_DMAENCmd PROC
;;;1521     */
;;;1522   void IAP_DMAENCmd(FunctionalState NewState)
000000  2800              CMP      r0,#0
;;;1523   {
;;;1524     assert_param(IS_FUNCTIONAL_STATE(NewState));
;;;1525   	
;;;1526     if(NewState != SC_DISABLE)
000002  d007              BEQ      |L3.20|
;;;1527     {
;;;1528       IAP->IAP_CON |= (uint32_t)IAP_CON_DMAEN;
000004  4907              LDR      r1,|L3.36|
000006  68c9              LDR      r1,[r1,#0xc]
000008  2201              MOVS     r2,#1
00000a  02d2              LSLS     r2,r2,#11
00000c  4311              ORRS     r1,r1,r2
00000e  4a05              LDR      r2,|L3.36|
000010  60d1              STR      r1,[r2,#0xc]
000012  e006              B        |L3.34|
                  |L3.20|
;;;1529     }
;;;1530     else
;;;1531     {
;;;1532       IAP->IAP_CON &= ~(uint32_t)IAP_CON_DMAEN;
000014  4903              LDR      r1,|L3.36|
000016  68c9              LDR      r1,[r1,#0xc]
000018  2201              MOVS     r2,#1
00001a  02d2              LSLS     r2,r2,#11
00001c  4391              BICS     r1,r1,r2
00001e  4a01              LDR      r2,|L3.36|
000020  60d1              STR      r1,[r2,#0xc]
                  |L3.34|
;;;1533     }
;;;1534   }
000022  4770              BX       lr
;;;1535   
                          ENDP

                  |L3.36|
                          DCD      0x400003c0

                          AREA ||i.IAP_EEPROMEraseSector||, CODE, READONLY, ALIGN=2

                  IAP_EEPROMEraseSector PROC
;;;390      */
;;;391    void IAP_EEPROMEraseSector ( uint32_t IAP_Sector )
000000  b570              PUSH     {r4-r6,lr}
;;;392    {
000002  4605              MOV      r5,r0
;;;393        uint32_t tmpreg = 0;
000004  2400              MOVS     r4,#0
;;;394    		/* Disable interrupt requests (IRQ) */
;;;395    		__disable_irq();
000006  b672              CPSID    i
;;;396        IAP->IAP_SNB = 0x69000000 | IAP_Sector;
000008  2069              MOVS     r0,#0x69
00000a  0600              LSLS     r0,r0,#24
00000c  4328              ORRS     r0,r0,r5
00000e  490c              LDR      r1,|L4.64|
000010  6048              STR      r0,[r1,#4]
;;;397        tmpreg = IAP->IAP_CON;
000012  4608              MOV      r0,r1
000014  68c4              LDR      r4,[r0,#0xc]
;;;398        tmpreg &= (uint32_t)~(IAP_CON_ERASE | IAP_CON_CMD | IAP_CON_PRG);
000016  2193              MOVS     r1,#0x93
000018  4620              MOV      r0,r4
00001a  4388              BICS     r0,r0,r1
00001c  4604              MOV      r4,r0
;;;399        tmpreg |= (uint32_t)(IAP_CON_SERASE  );
00001e  2020              MOVS     r0,#0x20
000020  4304              ORRS     r4,r4,r0
;;;400    		/* Check if software lock is open (IAP write operations are permitted) */
;;;401    		if(IapWriteFlag==IAP_ENABLE)
000022  4808              LDR      r0,|L4.68|
000024  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000026  2869              CMP      r0,#0x69
000028  d103              BNE      |L4.50|
;;;402    		{
;;;403    				IAP->IAP_CON = tmpreg;
00002a  4805              LDR      r0,|L4.64|
00002c  60c4              STR      r4,[r0,#0xc]
;;;404    				/* Trigger the sector erase */
;;;405            IAP_EraseCmd ();
00002e  f7fffffe          BL       IAP_EraseCmd
                  |L4.50|
;;;406    		}
;;;407        IAP->IAP_SNB = 0x4C000000;
000032  2013              MOVS     r0,#0x13
000034  0680              LSLS     r0,r0,#26
000036  4902              LDR      r1,|L4.64|
000038  6048              STR      r0,[r1,#4]
;;;408    		/* Enable interrupt requests (IRQ) */
;;;409        __enable_irq();
00003a  b662              CPSIE    i
;;;410    }
00003c  bd70              POP      {r4-r6,pc}
;;;411    
                          ENDP

00003e  0000              DCW      0x0000
                  |L4.64|
                          DCD      0x400003c0
                  |L4.68|
                          DCD      IapWriteFlag

                          AREA ||i.IAP_EraseCmd||, CODE, READONLY, ALIGN=2

                  IAP_EraseCmd PROC
                  ||__tagsym$$noinline||
;;;347      */
;;;348    __attribute__((noinline)) static void IAP_EraseCmd ( void )
000000  4803              LDR      r0,|L5.16|
;;;349    {
;;;350        /* Write command 0x02 to start the sector erase */
;;;351        IAP->IAP_CON |= ( 0x02 << IAP_CON_CMD_Pos );
000002  68c0              LDR      r0,[r0,#0xc]
000004  2102              MOVS     r1,#2
000006  4308              ORRS     r0,r0,r1
000008  4901              LDR      r1,|L5.16|
00000a  60c8              STR      r0,[r1,#0xc]
;;;352    }
00000c  4770              BX       lr
;;;353    
                          ENDP

00000e  0000              DCW      0x0000
                  |L5.16|
                          DCD      0x400003c0

                          AREA ||i.IAP_EraseSector||, CODE, READONLY, ALIGN=2

                  IAP_EraseSector PROC
;;;361      */
;;;362    void IAP_EraseSector ( uint32_t IAP_Sector )
000000  b570              PUSH     {r4-r6,lr}
;;;363    {
000002  4605              MOV      r5,r0
;;;364        uint32_t tmpreg = 0;
000004  2400              MOVS     r4,#0
;;;365    		/* Disable interrupt requests (IRQ) */
;;;366    		__disable_irq();
000006  b672              CPSID    i
;;;367        IAP->IAP_SNB = 0x4C000000 | IAP_Sector;
000008  2013              MOVS     r0,#0x13
00000a  0680              LSLS     r0,r0,#26
00000c  4328              ORRS     r0,r0,r5
00000e  490a              LDR      r1,|L6.56|
000010  6048              STR      r0,[r1,#4]
;;;368        tmpreg = IAP->IAP_CON;
000012  4608              MOV      r0,r1
000014  68c4              LDR      r4,[r0,#0xc]
;;;369        tmpreg &= ( uint32_t ) ~ ( IAP_CON_ERASE | IAP_CON_CMD | IAP_CON_PRG );
000016  2193              MOVS     r1,#0x93
000018  4620              MOV      r0,r4
00001a  4388              BICS     r0,r0,r1
00001c  4604              MOV      r4,r0
;;;370        tmpreg |= ( uint32_t ) ( IAP_CON_SERASE );
00001e  2020              MOVS     r0,#0x20
000020  4304              ORRS     r4,r4,r0
;;;371    		/* Check if software lock is open (IAP write operations are permitted) */
;;;372    		if(IapWriteFlag==IAP_ENABLE)
000022  4806              LDR      r0,|L6.60|
000024  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000026  2869              CMP      r0,#0x69
000028  d103              BNE      |L6.50|
;;;373    		{
;;;374    				IAP->IAP_CON = tmpreg;
00002a  4803              LDR      r0,|L6.56|
00002c  60c4              STR      r4,[r0,#0xc]
;;;375    				/* Trigger the sector erase */
;;;376            IAP_EraseCmd ();
00002e  f7fffffe          BL       IAP_EraseCmd
                  |L6.50|
;;;377    		}
;;;378        /* Enable interrupt requests (IRQ) */
;;;379        __enable_irq();
000032  b662              CPSIE    i
;;;380    }
000034  bd70              POP      {r4-r6,pc}
;;;381    
                          ENDP

000036  0000              DCW      0x0000
                  |L6.56|
                          DCD      0x400003c0
                  |L6.60|
                          DCD      IapWriteFlag

                          AREA ||i.IAP_Lock||, CODE, READONLY, ALIGN=2

                  IAP_Lock PROC
;;;305      */
;;;306    void IAP_Lock ( void )
000000  b510              PUSH     {r4,lr}
;;;307    {
;;;308        /* Set the LOCK Bit to lock the FLASH Registers access */
;;;309        IAP->IAP_CON = ( uint32_t ) IAP_CON_LOCK;
000002  2001              MOVS     r0,#1
000004  07c0              LSLS     r0,r0,#31
000006  4902              LDR      r1,|L7.16|
000008  60c8              STR      r0,[r1,#0xc]
;;;310    	
;;;311    		DeInitFlashToRam();
00000a  f7fffffe          BL       DeInitFlashToRam
;;;312    }
00000e  bd10              POP      {r4,pc}
;;;313    
                          ENDP

                  |L7.16|
                          DCD      0x400003c0

                          AREA ||i.IAP_NOP||, CODE, READONLY, ALIGN=1

                  IAP_NOP PROC
;;;88      */
;;;89     static boolType IAP_NOP(uint32_t Address, uint32_t Data, IAPWRITE_ALIGNTYPE Type)
000000  4603              MOV      r3,r0
;;;90     {
;;;91     		(void)Address; (void)Data; (void)Type;
;;;92     		__NOP();
000002  bf00              NOP      
;;;93     		return SC_FALSE;
000004  2000              MOVS     r0,#0
;;;94     }
000006  4770              BX       lr
;;;95     
                          ENDP


                          AREA ||i.IAP_ProgramArray_InRam||, CODE, READONLY, ALIGN=2

                  IAP_ProgramArray_InRam PROC
;;;182     */  
;;;183    static uint16_t IAP_ProgramArray_InRam( uint32_t Address, uint32_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type )
000000  b5ff              PUSH     {r0-r7,lr}
;;;184    {
000002  b081              SUB      sp,sp,#4
000004  4604              MOV      r4,r0
000006  4615              MOV      r5,r2
;;;185    		uint16_t tmpCnt = 0;
000008  2000              MOVS     r0,#0
;;;186    		uint8_t flag = 0;
00000a  2300              MOVS     r3,#0
00000c  9300              STR      r3,[sp,#0]
;;;187    		/* Disable non-maskable interrupts */
;;;188    		uint32_t	Temp=RCC->NMI_CFG;
00000e  4b37              LDR      r3,|L9.236|
000010  6ada              LDR      r2,[r3,#0x2c]
;;;189    		Temp =(Temp&0x0000FFFF)|0xA05F0000;
000012  b293              UXTH     r3,r2
000014  4e36              LDR      r6,|L9.240|
000016  199a              ADDS     r2,r3,r6
;;;190    		RCC->NMI_CFG =Temp&0xFFFF0000;
000018  0c13              LSRS     r3,r2,#16
00001a  041b              LSLS     r3,r3,#16
00001c  4e33              LDR      r6,|L9.236|
00001e  62f3              STR      r3,[r6,#0x2c]
;;;191    		/* Disable interrupt requests (IRQ) */
;;;192    		__disable_irq();
000020  b672              CPSID    i
;;;193    	  
;;;194    		/* Enable writing if the IAP software lock is open */
;;;195        /* IAP_WriteCmd(SC_ENABLE); */
;;;196    		if(IapWriteFlag==IAP_ENABLE)
000022  4b34              LDR      r3,|L9.244|
000024  681b              LDR      r3,[r3,#0]  ; IapWriteFlag
000026  2b69              CMP      r3,#0x69
000028  d105              BNE      |L9.54|
;;;197    		{
;;;198    				IAP->IAP_CON |= ( uint32_t ) IAP_CON_PRG;
00002a  4b33              LDR      r3,|L9.248|
00002c  68db              LDR      r3,[r3,#0xc]
00002e  2610              MOVS     r6,#0x10
000030  4333              ORRS     r3,r3,r6
000032  4e31              LDR      r6,|L9.248|
000034  60f3              STR      r3,[r6,#0xc]
                  |L9.54|
;;;199    		}
;;;200    		if(IapWriteFlag==IAP_ENABLE)
000036  4b2f              LDR      r3,|L9.244|
000038  681b              LDR      r3,[r3,#0]  ; IapWriteFlag
00003a  2b69              CMP      r3,#0x69
00003c  d14b              BNE      |L9.214|
;;;201    		{
;;;202    				do
00003e  bf00              NOP      
                  |L9.64|
;;;203    				{			
;;;204    						switch(Type)
000040  9b04              LDR      r3,[sp,#0x10]
000042  2b00              CMP      r3,#0
000044  d004              BEQ      |L9.80|
000046  2b01              CMP      r3,#1
000048  d010              BEQ      |L9.108|
00004a  2b02              CMP      r3,#2
00004c  d138              BNE      |L9.192|
00004e  e022              B        |L9.150|
                  |L9.80|
;;;205    						{
;;;206    								/* Program byte (8-bit) Array at a specified address */
;;;207    								case IAP_BYTE:
;;;208    								{
;;;209    										uint8_t* ByteArray8=(uint8_t*)ByteArray;
000050  460b              MOV      r3,r1
;;;210    										* ( __IO uint8_t* ) Address = (uint8_t)ByteArray8[tmpCnt];
000052  5c1e              LDRB     r6,[r3,r0]
000054  7026              STRB     r6,[r4,#0]
;;;211    										* ( __IO uint8_t* ) Address = (uint8_t)ByteArray8[tmpCnt];
000056  5c1e              LDRB     r6,[r3,r0]
000058  7026              STRB     r6,[r4,#0]
;;;212    										if ( ByteArray8[tmpCnt] != * ( __IO uint8_t * ) Address )
00005a  5c1e              LDRB     r6,[r3,r0]
00005c  7827              LDRB     r7,[r4,#0]
00005e  42be              CMP      r6,r7
000060  d002              BEQ      |L9.104|
;;;213    										{
;;;214    												flag = 1;
000062  2601              MOVS     r6,#1
000064  9600              STR      r6,[sp,#0]
;;;215    												break;
000066  e02b              B        |L9.192|
                  |L9.104|
;;;216    										}
;;;217    										Address = Address + 1;
000068  1c64              ADDS     r4,r4,#1
;;;218    										break;
00006a  e029              B        |L9.192|
                  |L9.108|
;;;219    								}
;;;220    								/* Program halfword (16-bit) Array at a specified address */
;;;221    								case IAP_HALFWORD:
;;;222    								{
;;;223    										uint16_t* ByteArray16=(uint16_t*)ByteArray;
00006c  460b              MOV      r3,r1
;;;224    										if ( ( Address & 0x01 ) == 0 )
00006e  07e6              LSLS     r6,r4,#31
000070  0ff6              LSRS     r6,r6,#31
000072  2e00              CMP      r6,#0
000074  d10e              BNE      |L9.148|
;;;225    										{
;;;226    												* ( __IO uint16_t* ) Address = (uint16_t)ByteArray16[tmpCnt];
000076  0046              LSLS     r6,r0,#1
000078  5b9e              LDRH     r6,[r3,r6]
00007a  8026              STRH     r6,[r4,#0]
;;;227    												* ( __IO uint16_t* ) Address = (uint16_t)ByteArray16[tmpCnt];
00007c  0046              LSLS     r6,r0,#1
00007e  5b9e              LDRH     r6,[r3,r6]
000080  8026              STRH     r6,[r4,#0]
;;;228    												if ( ByteArray16[tmpCnt] != * ( __IO uint16_t * ) Address )
000082  0046              LSLS     r6,r0,#1
000084  5b9e              LDRH     r6,[r3,r6]
000086  8827              LDRH     r7,[r4,#0]
000088  42be              CMP      r6,r7
00008a  d002              BEQ      |L9.146|
;;;229    												{
;;;230    														flag = 1;
00008c  2601              MOVS     r6,#1
00008e  9600              STR      r6,[sp,#0]
;;;231    														break;
000090  e016              B        |L9.192|
                  |L9.146|
;;;232    												}
;;;233    												Address = Address + 2;
000092  1ca4              ADDS     r4,r4,#2
                  |L9.148|
;;;234    										}
;;;235    										break;
000094  e014              B        |L9.192|
                  |L9.150|
;;;236    								}
;;;237    								/* Program word (32-bit) Array at a specified address */
;;;238    								case IAP_WORD:
;;;239    								{
;;;240    										uint32_t* ByteArray32=(uint32_t*)ByteArray;
000096  460b              MOV      r3,r1
;;;241    										if ( ( Address & 0x03 ) == 0 )
000098  07a6              LSLS     r6,r4,#30
00009a  0fb6              LSRS     r6,r6,#30
00009c  2e00              CMP      r6,#0
00009e  d10e              BNE      |L9.190|
;;;242    										{
;;;243    												* ( __IO uint32_t* ) Address = (uint32_t)ByteArray32[tmpCnt];
0000a0  0086              LSLS     r6,r0,#2
0000a2  599e              LDR      r6,[r3,r6]
0000a4  6026              STR      r6,[r4,#0]
;;;244    												* ( __IO uint32_t* ) Address = (uint32_t)ByteArray32[tmpCnt];							
0000a6  0086              LSLS     r6,r0,#2
0000a8  599e              LDR      r6,[r3,r6]
0000aa  6026              STR      r6,[r4,#0]
;;;245    												if ( ByteArray32[tmpCnt] != * ( __IO uint32_t * ) Address )
0000ac  0086              LSLS     r6,r0,#2
0000ae  599e              LDR      r6,[r3,r6]
0000b0  6827              LDR      r7,[r4,#0]
0000b2  42be              CMP      r6,r7
0000b4  d002              BEQ      |L9.188|
;;;246    												{
;;;247    														flag = 1;
0000b6  2601              MOVS     r6,#1
0000b8  9600              STR      r6,[sp,#0]
;;;248    														break;			
0000ba  e001              B        |L9.192|
                  |L9.188|
;;;249    												}									
;;;250    												Address = Address + 4;
0000bc  1d24              ADDS     r4,r4,#4
                  |L9.190|
;;;251    										}	
;;;252    										break;					
0000be  bf00              NOP      
                  |L9.192|
0000c0  bf00              NOP                            ;215
;;;253    								}
;;;254    						}
;;;255    						if(flag == 1)
0000c2  9b00              LDR      r3,[sp,#0]
0000c4  2b01              CMP      r3,#1
0000c6  d100              BNE      |L9.202|
;;;256    						{
;;;257    								break;	
0000c8  e004              B        |L9.212|
                  |L9.202|
;;;258    						}
;;;259    				}while ( ++tmpCnt < ArraySize );
0000ca  1c43              ADDS     r3,r0,#1
0000cc  b29b              UXTH     r3,r3
0000ce  4618              MOV      r0,r3
0000d0  42ab              CMP      r3,r5
0000d2  dbb5              BLT      |L9.64|
                  |L9.212|
0000d4  bf00              NOP                            ;257
                  |L9.214|
;;;260    		}
;;;261    		/* IAP_WriteCmd(SC_DISABLE); */
;;;262        IAP->IAP_CON &= ( uint32_t ) ~IAP_CON_PRG;		
0000d6  4b08              LDR      r3,|L9.248|
0000d8  68db              LDR      r3,[r3,#0xc]
0000da  2610              MOVS     r6,#0x10
0000dc  43b3              BICS     r3,r3,r6
0000de  4e06              LDR      r6,|L9.248|
0000e0  60f3              STR      r3,[r6,#0xc]
;;;263    		/* Enable interrupt requests (IRQ) */
;;;264        __enable_irq();
0000e2  b662              CPSIE    i
;;;265    		/* Restore the previous non-maskable interrupt (NMI) settings */
;;;266    		RCC->NMI_CFG =Temp;
0000e4  4b01              LDR      r3,|L9.236|
0000e6  62da              STR      r2,[r3,#0x2c]
;;;267    		return  tmpCnt;
;;;268    }
0000e8  b005              ADD      sp,sp,#0x14
0000ea  bdf0              POP      {r4-r7,pc}
;;;269    
                          ENDP

                  |L9.236|
                          DCD      0x40003000
                  |L9.240|
                          DCD      0xa05f0000
                  |L9.244|
                          DCD      IapWriteFlag
                  |L9.248|
                          DCD      0x400003c0

                          AREA ||i.IAP_ProgramByte||, CODE, READONLY, ALIGN=2

                  IAP_ProgramByte PROC
;;;664      */
;;;665    boolType IAP_ProgramByte ( uint32_t Address, uint8_t Data )
000000  b570              PUSH     {r4-r6,lr}
;;;666    {
000002  4604              MOV      r4,r0
000004  460d              MOV      r5,r1
;;;667        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;668    		
;;;669    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;670    	     directly write data to FLASH memory at the specified address */
;;;671    		if(((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==SC_RESET) && ((RCCAHB->AHB_CFG &( uint32_t )AHB_CFG_CLKDIV)==SC_RESET))
000006  4813              LDR      r0,|L10.84|
000008  6940              LDR      r0,[r0,#0x14]
00000a  2180              MOVS     r1,#0x80
00000c  4008              ANDS     r0,r0,r1
00000e  2800              CMP      r0,#0
000010  d116              BNE      |L10.64|
000012  4810              LDR      r0,|L10.84|
000014  6800              LDR      r0,[r0,#0]
000016  2107              MOVS     r1,#7
000018  0509              LSLS     r1,r1,#20
00001a  4008              ANDS     r0,r0,r1
00001c  2800              CMP      r0,#0
00001e  d10f              BNE      |L10.64|
;;;672    		{
;;;673    				/* Check if software lock is open (IAP write operations are permitted) */
;;;674    				if(IapWriteFlag==IAP_ENABLE)
000020  480d              LDR      r0,|L10.88|
000022  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000024  2869              CMP      r0,#0x69
000026  d104              BNE      |L10.50|
;;;675    				{
;;;676    						IAP_WriteData ( Address, Data, IAP_BYTE );
000028  2200              MOVS     r2,#0
00002a  4629              MOV      r1,r5
00002c  4620              MOV      r0,r4
00002e  f7fffffe          BL       IAP_WriteData
                  |L10.50|
;;;677    				}
;;;678    				/* Verify the data was written correctly by reading it back */
;;;679    				if ( Data == * ( __IO uint8_t * ) Address )
000032  7820              LDRB     r0,[r4,#0]
000034  42a8              CMP      r0,r5
000036  d101              BNE      |L10.60|
;;;680    						return SC_TRUE;
000038  2001              MOVS     r0,#1
                  |L10.58|
;;;681    				else
;;;682    						return SC_FALSE;
;;;683    		}
;;;684    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;685           which points to the IAP write function that was previously copied to RAM */
;;;686    		else
;;;687    		{
;;;688    				boolType Flag = SC_FALSE;
;;;689    			  /* Execute the IAP write function from RAM via the function pointer */
;;;690    				Flag=(*pWriteIapFun)(Address,Data,IAP_BYTE);
;;;691    			  /* Return the result from the RAM-executed function */
;;;692    				return Flag;
;;;693    		}
;;;694    }
00003a  bd70              POP      {r4-r6,pc}
                  |L10.60|
00003c  2000              MOVS     r0,#0                 ;682
00003e  e7fc              B        |L10.58|
                  |L10.64|
000040  2600              MOVS     r6,#0                 ;688
000042  2200              MOVS     r2,#0                 ;690
000044  4629              MOV      r1,r5                 ;690
000046  4620              MOV      r0,r4                 ;690
000048  4b04              LDR      r3,|L10.92|
00004a  681b              LDR      r3,[r3,#0]            ;690  ; pWriteIapFun
00004c  4798              BLX      r3                    ;690
00004e  4606              MOV      r6,r0                 ;690
000050  4630              MOV      r0,r6                 ;692
000052  e7f2              B        |L10.58|
;;;695    
                          ENDP

                  |L10.84|
                          DCD      0x40003000
                  |L10.88|
                          DCD      IapWriteFlag
                  |L10.92|
                          DCD      pWriteIapFun

                          AREA ||i.IAP_ProgramByteArray||, CODE, READONLY, ALIGN=2

                  IAP_ProgramByteArray PROC
;;;1337     */
;;;1338   uint16_t IAP_ProgramByteArray ( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize )
000000  b5f7              PUSH     {r0-r2,r4-r7,lr}
;;;1339   {
000002  b0c0              SUB      sp,sp,#0x100
000004  4605              MOV      r5,r0
000006  460e              MOV      r6,r1
;;;1340       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1341   		/* Counter for successfully programmed bytes */
;;;1342       uint16_t tmpCnt = 0;
000008  2400              MOVS     r4,#0
;;;1343   		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;1344   	     directly write data to FLASH memory at the specified address */
;;;1345   		if(((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==SC_RESET) && ((RCCAHB->AHB_CFG &( uint32_t )AHB_CFG_CLKDIV)==SC_RESET))
00000a  4825              LDR      r0,|L11.160|
00000c  6940              LDR      r0,[r0,#0x14]
00000e  2180              MOVS     r1,#0x80
000010  4008              ANDS     r0,r0,r1
000012  2800              CMP      r0,#0
000014  d120              BNE      |L11.88|
000016  4822              LDR      r0,|L11.160|
000018  6800              LDR      r0,[r0,#0]
00001a  2107              MOVS     r1,#7
00001c  0509              LSLS     r1,r1,#20
00001e  4008              ANDS     r0,r0,r1
000020  2800              CMP      r0,#0
000022  d119              BNE      |L11.88|
;;;1346   		{
;;;1347   				/* Check if software lock is open (IAP write operations are permitted) */
;;;1348   				if(IapWriteFlag==IAP_ENABLE)
000024  481f              LDR      r0,|L11.164|
000026  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000028  2869              CMP      r0,#0x69
00002a  d112              BNE      |L11.82|
;;;1349   				{
;;;1350   						/* Program each byte in the array until completion or error */
;;;1351   						do
00002c  bf00              NOP      
                  |L11.46|
;;;1352   						{
;;;1353   								IAP_WriteData ( Address, ByteArray[tmpCnt], IAP_BYTE );
00002e  5d31              LDRB     r1,[r6,r4]
000030  2200              MOVS     r2,#0
000032  4628              MOV      r0,r5
000034  f7fffffe          BL       IAP_WriteData
;;;1354   								/* Verify the write operation by reading back the value */
;;;1355   								if ( ByteArray[tmpCnt] != * ( __IO uint8_t * ) Address )
000038  5d30              LDRB     r0,[r6,r4]
00003a  7829              LDRB     r1,[r5,#0]
00003c  4288              CMP      r0,r1
00003e  d000              BEQ      |L11.66|
;;;1356   										break;
000040  e006              B        |L11.80|
                  |L11.66|
;;;1357   								/* Move to next byte address */
;;;1358   								Address = Address + 1;
000042  1c6d              ADDS     r5,r5,#1
;;;1359   						/* Continue until all bytes are programmed */
;;;1360   						} while ( ++tmpCnt < ArraySize );
000044  1c60              ADDS     r0,r4,#1
000046  b281              UXTH     r1,r0
000048  460c              MOV      r4,r1
00004a  9842              LDR      r0,[sp,#0x108]
00004c  4281              CMP      r1,r0
00004e  dbee              BLT      |L11.46|
                  |L11.80|
000050  bf00              NOP                            ;1356
                  |L11.82|
;;;1361   				}
;;;1362   				/* Return count of successfully programmed bytes */
;;;1363   				return tmpCnt;
000052  4620              MOV      r0,r4
                  |L11.84|
;;;1364   		}
;;;1365   		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;1366          which points to the IAP write function that was previously copied to RAM */
;;;1367   		else
;;;1368   		{
;;;1369   				/* Define function pointer type for the RAM-based IAP programming function */
;;;1370   				typedef uint16_t (*pInitFlashInRam)( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type );
;;;1371   				/* Allocate and initialize RAM buffer for the IAP programming function */
;;;1372   				__ALIGNED(4) uint8_t IapWriteInRam[256]={0};	
;;;1373   				/* Copy the IAP programming function from FLASH to RAM */
;;;1374   				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;1375   				{
;;;1376   						IapWriteInRam[i] =*(uint8_t*)((uint32_t)IAP_ProgramArray_InRam-1+i);
;;;1377   				}	
;;;1378   				/* Create function pointer to the RAM-based function and execute it */
;;;1379   				/* The "|0x01" operation sets the Thumb bit for ARM architecture compatibility.
;;;1380   				   In ARM architecture, the least significant bit (LSB) of a function pointer
;;;1381   				   indicates the instruction set (0 for ARM, 1 for Thumb). This ensures the
;;;1382   				   function executes in Thumb mode, which is typically used for RAM-based code.*/
;;;1383   				pInitFlashInRam p=(pInitFlashInRam)((uint32_t)IapWriteInRam|0x01);
;;;1384   				tmpCnt =(*p)(Address,(uint8_t*)ByteArray,ArraySize,IAP_BYTE);
;;;1385   				/* Clear the RAM buffer */
;;;1386   				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;1387   				{
;;;1388   						IapWriteInRam[i] =0;
;;;1389   				}			
;;;1390   				/* Return count of successfully programmed bytes */
;;;1391   				return tmpCnt;	
;;;1392   		}
;;;1393   }
000054  b043              ADD      sp,sp,#0x10c
000056  bdf0              POP      {r4-r7,pc}
                  |L11.88|
000058  21ff              MOVS     r1,#0xff              ;1372
00005a  3101              ADDS     r1,#1                 ;1372
00005c  4668              MOV      r0,sp                 ;1372
00005e  f7fffffe          BL       __aeabi_memclr4
000062  2000              MOVS     r0,#0                 ;1374
000064  e006              B        |L11.116|
                  |L11.102|
000066  4910              LDR      r1,|L11.168|
000068  1e49              SUBS     r1,r1,#1              ;1376
00006a  5c09              LDRB     r1,[r1,r0]            ;1376
00006c  466a              MOV      r2,sp                 ;1376
00006e  5411              STRB     r1,[r2,r0]            ;1376
000070  1c41              ADDS     r1,r0,#1              ;1374
000072  b288              UXTH     r0,r1                 ;1374
                  |L11.116|
000074  28ff              CMP      r0,#0xff              ;1374
000076  d9f6              BLS      |L11.102|
000078  af00              ADD      r7,sp,#0              ;1383
00007a  3701              ADDS     r7,#1                 ;1383
00007c  2300              MOVS     r3,#0                 ;1384
00007e  4631              MOV      r1,r6                 ;1384
000080  4628              MOV      r0,r5                 ;1384
000082  9a42              LDR      r2,[sp,#0x108]        ;1384
000084  47b8              BLX      r7                    ;1384
000086  4604              MOV      r4,r0                 ;1384
000088  2000              MOVS     r0,#0                 ;1386
00008a  e004              B        |L11.150|
                  |L11.140|
00008c  2100              MOVS     r1,#0                 ;1388
00008e  466a              MOV      r2,sp                 ;1388
000090  5411              STRB     r1,[r2,r0]            ;1388
000092  1c41              ADDS     r1,r0,#1              ;1386
000094  b288              UXTH     r0,r1                 ;1386
                  |L11.150|
000096  28ff              CMP      r0,#0xff              ;1386
000098  d9f8              BLS      |L11.140|
00009a  4620              MOV      r0,r4                 ;1391
00009c  e7da              B        |L11.84|
;;;1394   
                          ENDP

00009e  0000              DCW      0x0000
                  |L11.160|
                          DCD      0x40003000
                  |L11.164|
                          DCD      IapWriteFlag
                  |L11.168|
                          DCD      IAP_ProgramArray_InRam

                          AREA ||i.IAP_ProgramHalfWord||, CODE, READONLY, ALIGN=2

                  IAP_ProgramHalfWord PROC
;;;624      */
;;;625    boolType IAP_ProgramHalfWord ( uint32_t Address, uint16_t Data )
000000  b570              PUSH     {r4-r6,lr}
;;;626    {
000002  4604              MOV      r4,r0
000004  460d              MOV      r5,r1
;;;627        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;628    
;;;629    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;630    	     directly write data to FLASH memory at the specified address */
;;;631    		if(((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==SC_RESET) && ((RCCAHB->AHB_CFG &( uint32_t )AHB_CFG_CLKDIV)==SC_RESET))
000006  4813              LDR      r0,|L12.84|
000008  6940              LDR      r0,[r0,#0x14]
00000a  2180              MOVS     r1,#0x80
00000c  4008              ANDS     r0,r0,r1
00000e  2800              CMP      r0,#0
000010  d116              BNE      |L12.64|
000012  4810              LDR      r0,|L12.84|
000014  6800              LDR      r0,[r0,#0]
000016  2107              MOVS     r1,#7
000018  0509              LSLS     r1,r1,#20
00001a  4008              ANDS     r0,r0,r1
00001c  2800              CMP      r0,#0
00001e  d10f              BNE      |L12.64|
;;;632    		{
;;;633    				/* Check if software lock is open (IAP write operations are permitted) */
;;;634    				if(IapWriteFlag==IAP_ENABLE)
000020  480d              LDR      r0,|L12.88|
000022  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000024  2869              CMP      r0,#0x69
000026  d104              BNE      |L12.50|
;;;635    				{
;;;636    						IAP_WriteData ( Address, Data, IAP_HALFWORD );
000028  2201              MOVS     r2,#1
00002a  4629              MOV      r1,r5
00002c  4620              MOV      r0,r4
00002e  f7fffffe          BL       IAP_WriteData
                  |L12.50|
;;;637    				}
;;;638    				/* Verify the data was written correctly by reading it back */
;;;639    				if ( Data == * ( __IO uint16_t * ) Address )
000032  8820              LDRH     r0,[r4,#0]
000034  42a8              CMP      r0,r5
000036  d101              BNE      |L12.60|
;;;640    						return SC_TRUE;
000038  2001              MOVS     r0,#1
                  |L12.58|
;;;641    				else
;;;642    						return SC_FALSE;
;;;643    		}	
;;;644    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;645           which points to the IAP write function that was previously copied to RAM */
;;;646    		else
;;;647    		{
;;;648    				boolType Flag = SC_FALSE;
;;;649    				/* Execute the IAP write function from RAM via the function pointer */
;;;650    				Flag=(*pWriteIapFun)(Address,Data,IAP_HALFWORD);
;;;651    				/* Return the result from the RAM-executed function */
;;;652    				return Flag;	
;;;653    		}
;;;654    }
00003a  bd70              POP      {r4-r6,pc}
                  |L12.60|
00003c  2000              MOVS     r0,#0                 ;642
00003e  e7fc              B        |L12.58|
                  |L12.64|
000040  2600              MOVS     r6,#0                 ;648
000042  2201              MOVS     r2,#1                 ;650
000044  4629              MOV      r1,r5                 ;650
000046  4620              MOV      r0,r4                 ;650
000048  4b04              LDR      r3,|L12.92|
00004a  681b              LDR      r3,[r3,#0]            ;650  ; pWriteIapFun
00004c  4798              BLX      r3                    ;650
00004e  4606              MOV      r6,r0                 ;650
000050  4630              MOV      r0,r6                 ;652
000052  e7f2              B        |L12.58|
;;;655    
                          ENDP

                  |L12.84|
                          DCD      0x40003000
                  |L12.88|
                          DCD      IapWriteFlag
                  |L12.92|
                          DCD      pWriteIapFun

                          AREA ||i.IAP_ProgramHalfWordArray||, CODE, READONLY, ALIGN=2

                  IAP_ProgramHalfWordArray PROC
;;;1268     */
;;;1269   uint16_t IAP_ProgramHalfWordArray ( uint32_t Address, uint16_t* ByteArray, uint16_t ArraySize )
000000  b5f7              PUSH     {r0-r2,r4-r7,lr}
;;;1270   {
000002  b0c0              SUB      sp,sp,#0x100
000004  4604              MOV      r4,r0
000006  460e              MOV      r6,r1
;;;1271       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1272   		/* Counter for successfully programmed half-words */
;;;1273       uint16_t tmpCnt = 0;
000008  2500              MOVS     r5,#0
;;;1274   		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;1275   	     directly write data to FLASH memory at the specified address */
;;;1276   		if(((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==SC_RESET) && ((RCCAHB->AHB_CFG &( uint32_t )AHB_CFG_CLKDIV)==SC_RESET))
00000a  4828              LDR      r0,|L13.172|
00000c  6940              LDR      r0,[r0,#0x14]
00000e  2180              MOVS     r1,#0x80
000010  4008              ANDS     r0,r0,r1
000012  2800              CMP      r0,#0
000014  d126              BNE      |L13.100|
000016  4825              LDR      r0,|L13.172|
000018  6800              LDR      r0,[r0,#0]
00001a  2107              MOVS     r1,#7
00001c  0509              LSLS     r1,r1,#20
00001e  4008              ANDS     r0,r0,r1
000020  2800              CMP      r0,#0
000022  d11f              BNE      |L13.100|
;;;1277   		{
;;;1278   				/* Check if address is 16-bit aligned (required for half-word programming) */
;;;1279   				if ( ( Address & 0x01 ) == 0 )
000024  07e0              LSLS     r0,r4,#31
000026  0fc0              LSRS     r0,r0,#31
000028  2800              CMP      r0,#0
00002a  d118              BNE      |L13.94|
;;;1280   				{
;;;1281   						/* Check if software lock is open (IAP write operations are permitted) */
;;;1282   						if(IapWriteFlag==IAP_ENABLE)
00002c  4820              LDR      r0,|L13.176|
00002e  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000030  2869              CMP      r0,#0x69
000032  d114              BNE      |L13.94|
;;;1283   						{
;;;1284   								/* Program each half-word in the array until completion or error */
;;;1285   								do
000034  bf00              NOP      
                  |L13.54|
;;;1286   								{
;;;1287   										IAP_WriteData ( Address, ByteArray[tmpCnt], IAP_HALFWORD );
000036  0068              LSLS     r0,r5,#1
000038  5a31              LDRH     r1,[r6,r0]
00003a  2201              MOVS     r2,#1
00003c  4620              MOV      r0,r4
00003e  f7fffffe          BL       IAP_WriteData
;;;1288   										/* Verify the write operation by reading back the value */
;;;1289   										if ( ByteArray[tmpCnt] != * ( __IO uint16_t * ) Address )
000042  0068              LSLS     r0,r5,#1
000044  5a30              LDRH     r0,[r6,r0]
000046  8821              LDRH     r1,[r4,#0]
000048  4288              CMP      r0,r1
00004a  d000              BEQ      |L13.78|
;;;1290   												break;
00004c  e006              B        |L13.92|
                  |L13.78|
;;;1291   										/* Move to next 16-bit address */
;;;1292   										Address = Address + 2;
00004e  1ca4              ADDS     r4,r4,#2
;;;1293   								/* Continue until all half-words are programmed */
;;;1294   								} while ( ++tmpCnt < ArraySize );
000050  1c68              ADDS     r0,r5,#1
000052  b281              UXTH     r1,r0
000054  460d              MOV      r5,r1
000056  9842              LDR      r0,[sp,#0x108]
000058  4281              CMP      r1,r0
00005a  dbec              BLT      |L13.54|
                  |L13.92|
00005c  bf00              NOP                            ;1290
                  |L13.94|
;;;1295   					  }
;;;1296   				}
;;;1297   				/* Return count of successfully programmed half-words */
;;;1298   				return tmpCnt;
00005e  4628              MOV      r0,r5
                  |L13.96|
;;;1299   		}
;;;1300   		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;1301          which points to the IAP write function that was previously copied to RAM */
;;;1302   		else
;;;1303   		{
;;;1304   				/* Define function pointer type for the RAM-based IAP programming function */
;;;1305   				typedef uint16_t (*pInitFlashInRam)( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type );
;;;1306   				/* Allocate and initialize RAM buffer for the IAP programming function */
;;;1307   				__ALIGNED(4) uint8_t IapWriteInRam[256]={0};
;;;1308   				/* Copy the IAP programming function from FLASH to RAM */
;;;1309   				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;1310   				{
;;;1311   						IapWriteInRam[i] =*(uint8_t*)((uint32_t)IAP_ProgramArray_InRam-1+i);
;;;1312   				}	
;;;1313   				/* Create function pointer to the RAM-based function and execute it */
;;;1314   				/* The "|0x01" operation sets the Thumb bit for ARM architecture compatibility.
;;;1315   				   In ARM architecture, the least significant bit (LSB) of a function pointer
;;;1316   				   indicates the instruction set (0 for ARM, 1 for Thumb). This ensures the
;;;1317   				   function executes in Thumb mode, which is typically used for RAM-based code.*/
;;;1318   				pInitFlashInRam p=(pInitFlashInRam)((uint32_t)IapWriteInRam|0x01);
;;;1319   				tmpCnt =(*p)(Address,(uint8_t*)ByteArray,ArraySize,IAP_HALFWORD);
;;;1320   				/* Clear the RAM buffer */
;;;1321   				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;1322   				{
;;;1323   						IapWriteInRam[i] =0;
;;;1324   				}
;;;1325   				/* Return count of successfully programmed half-words */
;;;1326   				return tmpCnt;
;;;1327   		}
;;;1328   }
000060  b043              ADD      sp,sp,#0x10c
000062  bdf0              POP      {r4-r7,pc}
                  |L13.100|
000064  21ff              MOVS     r1,#0xff              ;1307
000066  3101              ADDS     r1,#1                 ;1307
000068  4668              MOV      r0,sp                 ;1307
00006a  f7fffffe          BL       __aeabi_memclr4
00006e  2000              MOVS     r0,#0                 ;1309
000070  e006              B        |L13.128|
                  |L13.114|
000072  4910              LDR      r1,|L13.180|
000074  1e49              SUBS     r1,r1,#1              ;1311
000076  5c09              LDRB     r1,[r1,r0]            ;1311
000078  466a              MOV      r2,sp                 ;1311
00007a  5411              STRB     r1,[r2,r0]            ;1311
00007c  1c41              ADDS     r1,r0,#1              ;1309
00007e  b288              UXTH     r0,r1                 ;1309
                  |L13.128|
000080  28ff              CMP      r0,#0xff              ;1309
000082  d9f6              BLS      |L13.114|
000084  af00              ADD      r7,sp,#0              ;1318
000086  3701              ADDS     r7,#1                 ;1318
000088  2301              MOVS     r3,#1                 ;1319
00008a  4631              MOV      r1,r6                 ;1319
00008c  4620              MOV      r0,r4                 ;1319
00008e  9a42              LDR      r2,[sp,#0x108]        ;1319
000090  47b8              BLX      r7                    ;1319
000092  4605              MOV      r5,r0                 ;1319
000094  2000              MOVS     r0,#0                 ;1321
000096  e004              B        |L13.162|
                  |L13.152|
000098  2100              MOVS     r1,#0                 ;1323
00009a  466a              MOV      r2,sp                 ;1323
00009c  5411              STRB     r1,[r2,r0]            ;1323
00009e  1c41              ADDS     r1,r0,#1              ;1321
0000a0  b288              UXTH     r0,r1                 ;1321
                  |L13.162|
0000a2  28ff              CMP      r0,#0xff              ;1321
0000a4  d9f8              BLS      |L13.152|
0000a6  4628              MOV      r0,r5                 ;1326
0000a8  e7da              B        |L13.96|
;;;1329   
                          ENDP

0000aa  0000              DCW      0x0000
                  |L13.172|
                          DCD      0x40003000
                  |L13.176|
                          DCD      IapWriteFlag
                  |L13.180|
                          DCD      IAP_ProgramArray_InRam

                          AREA ||i.IAP_ProgramWord||, CODE, READONLY, ALIGN=2

                  IAP_ProgramWord PROC
;;;584      */
;;;585    boolType IAP_ProgramWord ( uint32_t Address, uint32_t Data )
000000  b570              PUSH     {r4-r6,lr}
;;;586    {
000002  4604              MOV      r4,r0
000004  460d              MOV      r5,r1
;;;587        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;588    		
;;;589    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;590    	     directly write data to FLASH memory at the specified address */
;;;591    		if(((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==SC_RESET) && ((RCCAHB->AHB_CFG &( uint32_t )AHB_CFG_CLKDIV)==SC_RESET))
000006  4813              LDR      r0,|L14.84|
000008  6940              LDR      r0,[r0,#0x14]
00000a  2180              MOVS     r1,#0x80
00000c  4008              ANDS     r0,r0,r1
00000e  2800              CMP      r0,#0
000010  d116              BNE      |L14.64|
000012  4810              LDR      r0,|L14.84|
000014  6800              LDR      r0,[r0,#0]
000016  2107              MOVS     r1,#7
000018  0509              LSLS     r1,r1,#20
00001a  4008              ANDS     r0,r0,r1
00001c  2800              CMP      r0,#0
00001e  d10f              BNE      |L14.64|
;;;592    		{
;;;593    				/* Check if software lock is open (IAP write operations are permitted) */
;;;594    				if(IapWriteFlag==IAP_ENABLE)
000020  480d              LDR      r0,|L14.88|
000022  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000024  2869              CMP      r0,#0x69
000026  d104              BNE      |L14.50|
;;;595    				{
;;;596    						IAP_WriteData ( Address, Data, IAP_WORD );
000028  2202              MOVS     r2,#2
00002a  4629              MOV      r1,r5
00002c  4620              MOV      r0,r4
00002e  f7fffffe          BL       IAP_WriteData
                  |L14.50|
;;;597    				}
;;;598    				/* Verify the data was written correctly by reading it back */
;;;599    				if ( Data == * ( __IO uint32_t * ) Address )
000032  6820              LDR      r0,[r4,#0]
000034  42a8              CMP      r0,r5
000036  d101              BNE      |L14.60|
;;;600    						return SC_TRUE;
000038  2001              MOVS     r0,#1
                  |L14.58|
;;;601    				else
;;;602    						return SC_FALSE;
;;;603    		}
;;;604    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun 
;;;605    		   which points to the IAP write function that was previously copied to RAM */
;;;606    		else
;;;607    		{
;;;608    				boolType Flag = SC_FALSE;
;;;609    				/* Execute the IAP write function from RAM via the function pointer */
;;;610    				Flag=(*pWriteIapFun)(Address,Data,IAP_WORD);
;;;611    				/* Return the result from the RAM-executed function */
;;;612    				return Flag;
;;;613    		}
;;;614    }
00003a  bd70              POP      {r4-r6,pc}
                  |L14.60|
00003c  2000              MOVS     r0,#0                 ;602
00003e  e7fc              B        |L14.58|
                  |L14.64|
000040  2600              MOVS     r6,#0                 ;608
000042  2202              MOVS     r2,#2                 ;610
000044  4629              MOV      r1,r5                 ;610
000046  4620              MOV      r0,r4                 ;610
000048  4b04              LDR      r3,|L14.92|
00004a  681b              LDR      r3,[r3,#0]            ;610  ; pWriteIapFun
00004c  4798              BLX      r3                    ;610
00004e  4606              MOV      r6,r0                 ;610
000050  4630              MOV      r0,r6                 ;612
000052  e7f2              B        |L14.58|
;;;615    
                          ENDP

                  |L14.84|
                          DCD      0x40003000
                  |L14.88|
                          DCD      IapWriteFlag
                  |L14.92|
                          DCD      pWriteIapFun

                          AREA ||i.IAP_ProgramWordArray||, CODE, READONLY, ALIGN=2

                  IAP_ProgramWordArray PROC
;;;1199     */
;;;1200   uint16_t IAP_ProgramWordArray ( uint32_t Address, uint32_t* ByteArray, uint16_t ArraySize )
000000  b5f7              PUSH     {r0-r2,r4-r7,lr}
;;;1201   {
000002  b0c0              SUB      sp,sp,#0x100
000004  4604              MOV      r4,r0
000006  460e              MOV      r6,r1
;;;1202       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1203   		/* Counter for successfully programmed words */
;;;1204       uint16_t tmpCnt = 0;
000008  2500              MOVS     r5,#0
;;;1205   		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;1206   	     directly write data to FLASH memory at the specified address */
;;;1207   		if(((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==SC_RESET) && ((RCCAHB->AHB_CFG &( uint32_t )AHB_CFG_CLKDIV)==SC_RESET))
00000a  4828              LDR      r0,|L15.172|
00000c  6940              LDR      r0,[r0,#0x14]
00000e  2180              MOVS     r1,#0x80
000010  4008              ANDS     r0,r0,r1
000012  2800              CMP      r0,#0
000014  d126              BNE      |L15.100|
000016  4825              LDR      r0,|L15.172|
000018  6800              LDR      r0,[r0,#0]
00001a  2107              MOVS     r1,#7
00001c  0509              LSLS     r1,r1,#20
00001e  4008              ANDS     r0,r0,r1
000020  2800              CMP      r0,#0
000022  d11f              BNE      |L15.100|
;;;1208   		{
;;;1209   				/* Check if address is 32-bit aligned (required for word programming) */
;;;1210   				if ( ( Address & 0x03 ) == 0 )
000024  07a0              LSLS     r0,r4,#30
000026  0f80              LSRS     r0,r0,#30
000028  2800              CMP      r0,#0
00002a  d118              BNE      |L15.94|
;;;1211   				{
;;;1212   						/* Check if software lock is open (IAP write operations are permitted) */
;;;1213   						if(IapWriteFlag==IAP_ENABLE)
00002c  4820              LDR      r0,|L15.176|
00002e  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000030  2869              CMP      r0,#0x69
000032  d114              BNE      |L15.94|
;;;1214   						{
;;;1215   								/* Program each word in the array until completion or error */
;;;1216   								do
000034  bf00              NOP      
                  |L15.54|
;;;1217   								{
;;;1218   										IAP_WriteData ( Address, ByteArray[tmpCnt], IAP_WORD );
000036  00a8              LSLS     r0,r5,#2
000038  5831              LDR      r1,[r6,r0]
00003a  2202              MOVS     r2,#2
00003c  4620              MOV      r0,r4
00003e  f7fffffe          BL       IAP_WriteData
;;;1219   										/* Verify the write operation by reading back the value */
;;;1220   										if ( ByteArray[tmpCnt] != * ( __IO uint32_t * ) Address )
000042  00a8              LSLS     r0,r5,#2
000044  5830              LDR      r0,[r6,r0]
000046  6821              LDR      r1,[r4,#0]
000048  4288              CMP      r0,r1
00004a  d000              BEQ      |L15.78|
;;;1221   												break;
00004c  e006              B        |L15.92|
                  |L15.78|
;;;1222   										/* Move to next 32-bit address */
;;;1223   										Address = Address + 4;
00004e  1d24              ADDS     r4,r4,#4
;;;1224   								/* Continue until all words are programmed */
;;;1225   								} while ( ++tmpCnt < ArraySize );
000050  1c68              ADDS     r0,r5,#1
000052  b281              UXTH     r1,r0
000054  460d              MOV      r5,r1
000056  9842              LDR      r0,[sp,#0x108]
000058  4281              CMP      r1,r0
00005a  dbec              BLT      |L15.54|
                  |L15.92|
00005c  bf00              NOP                            ;1221
                  |L15.94|
;;;1226   						}
;;;1227   				}
;;;1228   				/* Return count of successfully programmed words */
;;;1229   				return tmpCnt;
00005e  4628              MOV      r0,r5
                  |L15.96|
;;;1230   		}
;;;1231   		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;1232          which points to the IAP write function that was previously copied to RAM */
;;;1233   		else
;;;1234   		{
;;;1235   				/* Define function pointer type for the RAM-based IAP programming function */
;;;1236   				typedef uint16_t (*pInitFlashInRam)( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type );
;;;1237   				/* Allocate and initialize RAM buffer for the IAP programming function */
;;;1238   				__ALIGNED(4) uint8_t IapWriteInRam[256]={0};
;;;1239   				/* Copy the IAP programming function from FLASH to RAM */
;;;1240   				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;1241   				{
;;;1242   						IapWriteInRam[i] =*(uint8_t*)((uint32_t)IAP_ProgramArray_InRam-1+i);
;;;1243   				}
;;;1244   				/* Create function pointer to the RAM-based function and execute it */
;;;1245   				/* The "|0x01" operation sets the Thumb bit for ARM architecture compatibility.
;;;1246   				   In ARM architecture, the least significant bit (LSB) of a function pointer
;;;1247   				   indicates the instruction set (0 for ARM, 1 for Thumb). This ensures the
;;;1248   				   function executes in Thumb mode, which is typically used for RAM-based code.*/
;;;1249   				pInitFlashInRam p=(pInitFlashInRam)((uint32_t)IapWriteInRam|0x01);
;;;1250   				tmpCnt =(*p)(Address,(uint8_t*)ByteArray,ArraySize,IAP_WORD);
;;;1251   				/* Clear the RAM buffer */
;;;1252   				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;1253   				{
;;;1254   						IapWriteInRam[i] =0;
;;;1255   				}
;;;1256   				/* Return count of successfully programmed words */
;;;1257   				return tmpCnt;		
;;;1258   		}
;;;1259   }
000060  b043              ADD      sp,sp,#0x10c
000062  bdf0              POP      {r4-r7,pc}
                  |L15.100|
000064  21ff              MOVS     r1,#0xff              ;1238
000066  3101              ADDS     r1,#1                 ;1238
000068  4668              MOV      r0,sp                 ;1238
00006a  f7fffffe          BL       __aeabi_memclr4
00006e  2000              MOVS     r0,#0                 ;1240
000070  e006              B        |L15.128|
                  |L15.114|
000072  4910              LDR      r1,|L15.180|
000074  1e49              SUBS     r1,r1,#1              ;1242
000076  5c09              LDRB     r1,[r1,r0]            ;1242
000078  466a              MOV      r2,sp                 ;1242
00007a  5411              STRB     r1,[r2,r0]            ;1242
00007c  1c41              ADDS     r1,r0,#1              ;1240
00007e  b288              UXTH     r0,r1                 ;1240
                  |L15.128|
000080  28ff              CMP      r0,#0xff              ;1240
000082  d9f6              BLS      |L15.114|
000084  af00              ADD      r7,sp,#0              ;1249
000086  3701              ADDS     r7,#1                 ;1249
000088  2302              MOVS     r3,#2                 ;1250
00008a  4631              MOV      r1,r6                 ;1250
00008c  4620              MOV      r0,r4                 ;1250
00008e  9a42              LDR      r2,[sp,#0x108]        ;1250
000090  47b8              BLX      r7                    ;1250
000092  4605              MOV      r5,r0                 ;1250
000094  2000              MOVS     r0,#0                 ;1252
000096  e004              B        |L15.162|
                  |L15.152|
000098  2100              MOVS     r1,#0                 ;1254
00009a  466a              MOV      r2,sp                 ;1254
00009c  5411              STRB     r1,[r2,r0]            ;1254
00009e  1c41              ADDS     r1,r0,#1              ;1252
0000a0  b288              UXTH     r0,r1                 ;1252
                  |L15.162|
0000a2  28ff              CMP      r0,#0xff              ;1252
0000a4  d9f8              BLS      |L15.152|
0000a6  4628              MOV      r0,r5                 ;1257
0000a8  e7da              B        |L15.96|
;;;1260   
                          ENDP

0000aa  0000              DCW      0x0000
                  |L15.172|
                          DCD      0x40003000
                  |L15.176|
                          DCD      IapWriteFlag
                  |L15.180|
                          DCD      IAP_ProgramArray_InRam

                          AREA ||i.IAP_Program_InRam||, CODE, READONLY, ALIGN=2

                  IAP_Program_InRam PROC
;;;107     */  
;;;108    static boolType IAP_Program_InRam(uint32_t Address, uint32_t Data,IAPWRITE_ALIGNTYPE Type)
000000  b570              PUSH     {r4-r6,lr}
;;;109    {
000002  4603              MOV      r3,r0
000004  4614              MOV      r4,r2
;;;110    		boolType Flag = SC_FALSE;
000006  2000              MOVS     r0,#0
;;;111    		/* Disable non-maskable interrupts */
;;;112    		uint32_t	Temp=RCC->NMI_CFG;
000008  4d23              LDR      r5,|L16.152|
00000a  6aea              LDR      r2,[r5,#0x2c]
;;;113    		Temp =(Temp&0x0000FFFF)|0xA05F0000;
00000c  b295              UXTH     r5,r2
00000e  4e23              LDR      r6,|L16.156|
000010  19aa              ADDS     r2,r5,r6
;;;114    		RCC->NMI_CFG =Temp&0xFFFF0000;
000012  0c15              LSRS     r5,r2,#16
000014  042d              LSLS     r5,r5,#16
000016  4e20              LDR      r6,|L16.152|
000018  62f5              STR      r5,[r6,#0x2c]
;;;115    		/* Disable interrupt requests (IRQ) */
;;;116    		__disable_irq();
00001a  b672              CPSID    i
;;;117    		
;;;118    		/* Enable writing if the IAP software lock is open */
;;;119        /* IAP_WriteCmd(SC_ENABLE); */
;;;120    		if(IapWriteFlag==IAP_ENABLE)
00001c  4d20              LDR      r5,|L16.160|
00001e  682d              LDR      r5,[r5,#0]  ; IapWriteFlag
000020  2d69              CMP      r5,#0x69
000022  d105              BNE      |L16.48|
;;;121    		{
;;;122    				IAP->IAP_CON |= ( uint32_t ) IAP_CON_PRG;
000024  4d1f              LDR      r5,|L16.164|
000026  68ed              LDR      r5,[r5,#0xc]
000028  2610              MOVS     r6,#0x10
00002a  4335              ORRS     r5,r5,r6
00002c  4e1d              LDR      r6,|L16.164|
00002e  60f5              STR      r5,[r6,#0xc]
                  |L16.48|
;;;123    		}
;;;124    		if(IapWriteFlag==IAP_ENABLE)
000030  4d1b              LDR      r5,|L16.160|
000032  682d              LDR      r5,[r5,#0]  ; IapWriteFlag
000034  2d69              CMP      r5,#0x69
000036  d124              BNE      |L16.130|
;;;125    		{
;;;126    				switch(Type)
000038  2c00              CMP      r4,#0
00003a  d004              BEQ      |L16.70|
00003c  2c01              CMP      r4,#1
00003e  d00c              BEQ      |L16.90|
000040  2c02              CMP      r4,#2
000042  d11d              BNE      |L16.128|
000044  e013              B        |L16.110|
                  |L16.70|
;;;127    				{
;;;128    						/* Program a byte (8-bit) at a specified address */
;;;129    						case IAP_BYTE:
;;;130    						{
;;;131    								* ( __IO uint8_t * ) Address = (uint8_t)Data;
000046  7019              STRB     r1,[r3,#0]
;;;132    								* ( __IO uint8_t * ) Address = (uint8_t)Data;
000048  7019              STRB     r1,[r3,#0]
;;;133    								if ( (uint8_t)Data == * ( __IO uint8_t * ) Address )
00004a  b2cd              UXTB     r5,r1
00004c  781e              LDRB     r6,[r3,#0]
00004e  42b5              CMP      r5,r6
000050  d101              BNE      |L16.86|
;;;134    										Flag= SC_TRUE;
000052  2001              MOVS     r0,#1
000054  e000              B        |L16.88|
                  |L16.86|
;;;135    								else
;;;136    										Flag= SC_FALSE;
000056  2000              MOVS     r0,#0
                  |L16.88|
;;;137    								break;
000058  e012              B        |L16.128|
                  |L16.90|
;;;138    						}
;;;139    						/* Program a halfword (16-bit) at a specified address */
;;;140    						case IAP_HALFWORD:
;;;141    						{
;;;142    								* ( __IO uint16_t * ) Address = (uint16_t)Data;
00005a  8019              STRH     r1,[r3,#0]
;;;143    								* ( __IO uint16_t * ) Address = (uint16_t)Data;
00005c  8019              STRH     r1,[r3,#0]
;;;144    								if ( (uint16_t)Data == * ( __IO uint16_t * ) Address )
00005e  b28d              UXTH     r5,r1
000060  881e              LDRH     r6,[r3,#0]
000062  42b5              CMP      r5,r6
000064  d101              BNE      |L16.106|
;;;145    										Flag= SC_TRUE;
000066  2001              MOVS     r0,#1
000068  e000              B        |L16.108|
                  |L16.106|
;;;146    								else
;;;147    										Flag= SC_FALSE;						
00006a  2000              MOVS     r0,#0
                  |L16.108|
;;;148    								break;
00006c  e008              B        |L16.128|
                  |L16.110|
;;;149    						}			
;;;150    						/* Program a word (32-bit) at a specified address */
;;;151    						case IAP_WORD:
;;;152    						{
;;;153    								* ( __IO uint32_t * ) Address = (uint32_t)Data;
00006e  6019              STR      r1,[r3,#0]
;;;154    								* ( __IO uint32_t * ) Address = (uint32_t)Data;
000070  6019              STR      r1,[r3,#0]
;;;155    								if ( (uint32_t)Data == * ( __IO uint32_t * ) Address )
000072  681d              LDR      r5,[r3,#0]
000074  428d              CMP      r5,r1
000076  d101              BNE      |L16.124|
;;;156    										Flag= SC_TRUE;
000078  2001              MOVS     r0,#1
00007a  e000              B        |L16.126|
                  |L16.124|
;;;157    								else
;;;158    										Flag= SC_FALSE;						
00007c  2000              MOVS     r0,#0
                  |L16.126|
;;;159    								break;
00007e  bf00              NOP      
                  |L16.128|
000080  bf00              NOP                            ;137
                  |L16.130|
;;;160    						}
;;;161    				}
;;;162    		}
;;;163    		/* IAP_WriteCmd(SC_DISABLE); */
;;;164        IAP->IAP_CON &= ( uint32_t ) ~IAP_CON_PRG;		
000082  4d08              LDR      r5,|L16.164|
000084  68ed              LDR      r5,[r5,#0xc]
000086  2610              MOVS     r6,#0x10
000088  43b5              BICS     r5,r5,r6
00008a  4e06              LDR      r6,|L16.164|
00008c  60f5              STR      r5,[r6,#0xc]
;;;165    		/* Enable interrupt requests (IRQ) */
;;;166        __enable_irq();
00008e  b662              CPSIE    i
;;;167    		/* Restore the previous non-maskable interrupt (NMI) settings */
;;;168    		RCC->NMI_CFG =Temp; 
000090  4d01              LDR      r5,|L16.152|
000092  62ea              STR      r2,[r5,#0x2c]
;;;169    		return Flag;
;;;170    }	
000094  bd70              POP      {r4-r6,pc}
;;;171    
                          ENDP

000096  0000              DCW      0x0000
                  |L16.152|
                          DCD      0x40003000
                  |L16.156|
                          DCD      0xa05f0000
                  |L16.160|
                          DCD      IapWriteFlag
                  |L16.164|
                          DCD      0x400003c0

                          AREA ||i.IAP_ReadByte||, CODE, READONLY, ALIGN=1

                  IAP_ReadByte PROC
;;;907      */
;;;908    uint8_t IAP_ReadByte ( uint32_t Address )
000000  4601              MOV      r1,r0
;;;909    {
;;;910        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;911    
;;;912        uint8_t Data = 0;
000002  2000              MOVS     r0,#0
;;;913        Data = * ( __IO uint8_t* ) Address;
000004  7808              LDRB     r0,[r1,#0]
;;;914        return Data;
;;;915    }
000006  4770              BX       lr
;;;916    
                          ENDP


                          AREA ||i.IAP_ReadByteArray||, CODE, READONLY, ALIGN=1

                  IAP_ReadByteArray PROC
;;;1453     */
;;;1454   uint16_t IAP_ReadByteArray ( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize )
000000  b510              PUSH     {r4,lr}
;;;1455   {
000002  4603              MOV      r3,r0
;;;1456       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1457   
;;;1458       uint16_t tmpCnt = 0;
000004  2000              MOVS     r0,#0
;;;1459       do
000006  bf00              NOP      
                  |L18.8|
;;;1460       {
;;;1461           ByteArray[tmpCnt] = * ( __IO uint8_t* ) Address;
000008  781c              LDRB     r4,[r3,#0]
00000a  540c              STRB     r4,[r1,r0]
;;;1462           Address = Address + 1;
00000c  1c5b              ADDS     r3,r3,#1
;;;1463   
;;;1464       } while ( ++tmpCnt < ArraySize );
00000e  1c44              ADDS     r4,r0,#1
000010  b2a4              UXTH     r4,r4
000012  4620              MOV      r0,r4
000014  4294              CMP      r4,r2
000016  dbf7              BLT      |L18.8|
;;;1465   
;;;1466       return tmpCnt;
;;;1467   }
000018  bd10              POP      {r4,pc}
;;;1468   
                          ENDP


                          AREA ||i.IAP_ReadHalfWord||, CODE, READONLY, ALIGN=1

                  IAP_ReadHalfWord PROC
;;;892      */
;;;893    uint16_t IAP_ReadHalfWord ( uint32_t Address )
000000  4601              MOV      r1,r0
;;;894    {
;;;895        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;896    
;;;897        uint16_t Data = 0;
000002  2000              MOVS     r0,#0
;;;898        Data = * ( __IO uint16_t* ) Address;
000004  8808              LDRH     r0,[r1,#0]
;;;899        return Data;
;;;900    }
000006  4770              BX       lr
;;;901    
                          ENDP


                          AREA ||i.IAP_ReadHalfWordArray||, CODE, READONLY, ALIGN=1

                  IAP_ReadHalfWordArray PROC
;;;1428     */
;;;1429   uint16_t IAP_ReadHalfWordArray ( uint32_t Address, uint16_t* ByteArray, uint16_t ArraySize )
000000  b530              PUSH     {r4,r5,lr}
;;;1430   {
000002  4603              MOV      r3,r0
;;;1431       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1432   
;;;1433       uint16_t tmpCnt = 0;
000004  2000              MOVS     r0,#0
;;;1434       if ( ( Address & 0x01 ) == 0 )
000006  07dc              LSLS     r4,r3,#31
000008  0fe4              LSRS     r4,r4,#31
00000a  2c00              CMP      r4,#0
00000c  d109              BNE      |L20.34|
;;;1435       {
;;;1436           do
00000e  bf00              NOP      
                  |L20.16|
;;;1437           {
;;;1438               ByteArray[tmpCnt] = * ( __IO uint16_t* ) Address;
000010  881c              LDRH     r4,[r3,#0]
000012  0045              LSLS     r5,r0,#1
000014  534c              STRH     r4,[r1,r5]
;;;1439               Address = Address + 2;
000016  1c9b              ADDS     r3,r3,#2
;;;1440   
;;;1441           } while ( ++tmpCnt < ArraySize );
000018  1c44              ADDS     r4,r0,#1
00001a  b2a4              UXTH     r4,r4
00001c  4620              MOV      r0,r4
00001e  4294              CMP      r4,r2
000020  dbf6              BLT      |L20.16|
                  |L20.34|
;;;1442       }
;;;1443       return tmpCnt;
;;;1444   }
000022  bd30              POP      {r4,r5,pc}
;;;1445   
                          ENDP


                          AREA ||i.IAP_ReadWord||, CODE, READONLY, ALIGN=1

                  IAP_ReadWord PROC
;;;877      */
;;;878    uint32_t IAP_ReadWord ( uint32_t Address )
000000  4601              MOV      r1,r0
;;;879    {
;;;880        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;881    
;;;882        uint32_t Data = 0;
000002  2000              MOVS     r0,#0
;;;883        Data = * ( __IO uint32_t* ) Address;
000004  6808              LDR      r0,[r1,#0]
;;;884        return Data;
;;;885    }
000006  4770              BX       lr
;;;886    
                          ENDP


                          AREA ||i.IAP_ReadWordArray||, CODE, READONLY, ALIGN=1

                  IAP_ReadWordArray PROC
;;;1403     */
;;;1404   uint16_t IAP_ReadWordArray ( uint32_t Address, uint32_t* ByteArray, uint16_t ArraySize )
000000  b530              PUSH     {r4,r5,lr}
;;;1405   {
000002  4603              MOV      r3,r0
;;;1406       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1407   
;;;1408       uint16_t tmpCnt = 0;
000004  2000              MOVS     r0,#0
;;;1409       if ( ( Address & 0x03 ) == 0 )
000006  079c              LSLS     r4,r3,#30
000008  0fa4              LSRS     r4,r4,#30
00000a  2c00              CMP      r4,#0
00000c  d109              BNE      |L22.34|
;;;1410       {
;;;1411           do
00000e  bf00              NOP      
                  |L22.16|
;;;1412           {
;;;1413               ByteArray[tmpCnt] = * ( __IO uint32_t* ) Address;
000010  681c              LDR      r4,[r3,#0]
000012  0085              LSLS     r5,r0,#2
000014  514c              STR      r4,[r1,r5]
;;;1414               Address = Address + 4;
000016  1d1b              ADDS     r3,r3,#4
;;;1415   
;;;1416           } while ( ++tmpCnt < ArraySize );
000018  1c44              ADDS     r4,r0,#1
00001a  b2a4              UXTH     r4,r4
00001c  4620              MOV      r0,r4
00001e  4294              CMP      r4,r2
000020  dbf6              BLT      |L22.16|
                  |L22.34|
;;;1417       }
;;;1418       return tmpCnt;
;;;1419   }
000022  bd30              POP      {r4,r5,pc}
;;;1420   
                          ENDP


                          AREA ||i.IAP_SoftwareReset||, CODE, READONLY, ALIGN=2

                  IAP_SoftwareReset PROC
;;;1492     */
;;;1493   void IAP_SoftwareReset ( IAP_BTLD_TypeDef IAP_BTLDType )
000000  21ff              MOVS     r1,#0xff
;;;1494   {
;;;1495       IAP->IAP_CON = ( IAP_BTLDType | IAP_CON_RST );
000002  3101              ADDS     r1,#1
000004  4301              ORRS     r1,r1,r0
000006  4a01              LDR      r2,|L23.12|
000008  60d1              STR      r1,[r2,#0xc]
;;;1496   }
00000a  4770              BX       lr
;;;1497   /**
                          ENDP

                  |L23.12|
                          DCD      0x400003c0

                          AREA ||i.IAP_Unlock||, CODE, READONLY, ALIGN=2

                  IAP_Unlock PROC
;;;276      */
;;;277    boolType IAP_Unlock ( void )
000000  b510              PUSH     {r4,lr}
;;;278    {
;;;279    		/* Check if software lock is open (IAP write operations are permitted) */
;;;280    		if(IapWriteFlag==IAP_ENABLE)
000002  4809              LDR      r0,|L24.40|
000004  6800              LDR      r0,[r0,#0]  ; IapWriteFlag
000006  2869              CMP      r0,#0x69
000008  d106              BNE      |L24.24|
;;;281    		{
;;;282    #if defined(SC32f10xx)
;;;283    				/* HIRC must be enabled before IAP operation */
;;;284    				RCC_Unlock ( 0xFF );
;;;285    				RCC_HIRCCmd ( SC_ENABLE );
;;;286    #endif
;;;287    				/* Authorize the FLASH Registers access */
;;;288    				IAP->IAPKEY = IAP_KEY1;
00000a  4808              LDR      r0,|L24.44|
00000c  4908              LDR      r1,|L24.48|
00000e  6008              STR      r0,[r1,#0]
;;;289    				IAP->IAPKEY = IAP_KEY2;
000010  4808              LDR      r0,|L24.52|
000012  6008              STR      r0,[r1,#0]
;;;290    	
;;;291    				InitFlashToRam();
000014  f7fffffe          BL       InitFlashToRam
                  |L24.24|
;;;292    		}
;;;293    		if ( IAP->IAPKEY == 0x01 )
000018  4805              LDR      r0,|L24.48|
00001a  6800              LDR      r0,[r0,#0]
00001c  2801              CMP      r0,#1
00001e  d100              BNE      |L24.34|
                  |L24.32|
;;;294    				/* Unlock success */
;;;295    				return SC_TRUE;
;;;296    		else
;;;297    				/* Unlock Error */
;;;298    				return SC_FALSE;
;;;299    }
000020  bd10              POP      {r4,pc}
                  |L24.34|
000022  2000              MOVS     r0,#0                 ;298
000024  e7fc              B        |L24.32|
;;;300    
                          ENDP

000026  0000              DCW      0x0000
                  |L24.40|
                          DCD      IapWriteFlag
                  |L24.44|
                          DCD      0x12345678
                  |L24.48|
                          DCD      0x400003c0
                  |L24.52|
                          DCD      0xa05f05fa

                          AREA ||i.IAP_WriteCmd||, CODE, READONLY, ALIGN=2

                  IAP_WriteCmd PROC
;;;320      */
;;;321    void IAP_WriteCmd ( FunctionalState NewState )
000000  2800              CMP      r0,#0
;;;322    {
;;;323        /* Check the parameters */
;;;324        assert_param ( IS_FUNCTIONAL_STATE ( NewState ) );
;;;325    		
;;;326    		/* Enable writing if the IAP software lock is open */
;;;327    		if ( NewState != SC_DISABLE )
000002  d00a              BEQ      |L25.26|
;;;328    		{
;;;329    				/* Check if software lock is open (IAP write operations are permitted) */
;;;330    				if(IapWriteFlag==IAP_ENABLE)
000004  4908              LDR      r1,|L25.40|
000006  6809              LDR      r1,[r1,#0]  ; IapWriteFlag
000008  2969              CMP      r1,#0x69
00000a  d10c              BNE      |L25.38|
;;;331    				{
;;;332    						IAP->IAP_CON |= ( uint32_t ) IAP_CON_PRG;
00000c  4907              LDR      r1,|L25.44|
00000e  68c9              LDR      r1,[r1,#0xc]
000010  2210              MOVS     r2,#0x10
000012  4311              ORRS     r1,r1,r2
000014  4a05              LDR      r2,|L25.44|
000016  60d1              STR      r1,[r2,#0xc]
000018  e005              B        |L25.38|
                  |L25.26|
;;;333    				}
;;;334    		}
;;;335    		else
;;;336    		{
;;;337    				IAP->IAP_CON &= ~ ( uint32_t ) IAP_CON_PRG;
00001a  4904              LDR      r1,|L25.44|
00001c  68c9              LDR      r1,[r1,#0xc]
00001e  2210              MOVS     r2,#0x10
000020  4391              BICS     r1,r1,r2
000022  4a02              LDR      r2,|L25.44|
000024  60d1              STR      r1,[r2,#0xc]
                  |L25.38|
;;;338    		}
;;;339    }
000026  4770              BX       lr
;;;340    
                          ENDP

                  |L25.40|
                          DCD      IapWriteFlag
                  |L25.44|
                          DCD      0x400003c0

                          AREA ||i.IAP_WriteData||, CODE, READONLY, ALIGN=1

                  IAP_WriteData PROC
                  |symbol_number.220|
;;;423      */
;;;424    __attribute__((noinline)) static void IAP_WriteData ( uint32_t Address, uint32_t Data, IAPWRITE_ALIGNTYPE Align )
000000  2a00              CMP      r2,#0
;;;425    {
;;;426        switch ( Align )
000002  d004              BEQ      |L26.14|
000004  2a01              CMP      r2,#1
000006  d004              BEQ      |L26.18|
000008  2a02              CMP      r2,#2
00000a  d106              BNE      |L26.26|
00000c  e003              B        |L26.22|
                  |L26.14|
;;;427        {
;;;428            case IAP_BYTE:
;;;429    				{
;;;430                /* 8-bit write */
;;;431                *( __IO uint8_t * ) Address = ( uint8_t ) Data;
00000e  7001              STRB     r1,[r0,#0]
;;;432                break;
000010  e004              B        |L26.28|
                  |L26.18|
;;;433    				}
;;;434            case IAP_HALFWORD:
;;;435    				{
;;;436                /* 16-bit write */
;;;437                *( __IO uint16_t * ) Address = ( uint16_t ) Data;
000012  8001              STRH     r1,[r0,#0]
;;;438                break;
000014  e002              B        |L26.28|
                  |L26.22|
;;;439    				}
;;;440            case IAP_WORD:
;;;441    				{
;;;442                /* 32-bit write */
;;;443                *( __IO uint32_t * ) Address = Data;
000016  6001              STR      r1,[r0,#0]
;;;444                break;
000018  e000              B        |L26.28|
                  |L26.26|
;;;445    				}
;;;446            default:
;;;447    				{
;;;448                /* Invalid alignment, do nothing to avoid an unexpected write */
;;;449                break;
00001a  bf00              NOP      
                  |L26.28|
00001c  bf00              NOP                            ;432
;;;450    				}
;;;451        }
;;;452    }
00001e  4770              BX       lr
;;;453    
                          ENDP


                          AREA ||i.InitFlashToRam||, CODE, READONLY, ALIGN=2

                  InitFlashToRam PROC
;;;60     
;;;61     static void InitFlashToRam(void)
000000  2000              MOVS     r0,#0
;;;62     {
;;;63     		for(uint16_t i=0;i<sizeof(IapProgramInRam);i++)
000002  e006              B        |L27.18|
                  |L27.4|
;;;64     		{
;;;65     				IapProgramInRam[i]    =*(uint8_t*)((uint32_t)IAP_Program_InRam-1+i);
000004  4906              LDR      r1,|L27.32|
000006  1e49              SUBS     r1,r1,#1
000008  5c09              LDRB     r1,[r1,r0]
00000a  4a06              LDR      r2,|L27.36|
00000c  5411              STRB     r1,[r2,r0]
00000e  1c41              ADDS     r1,r0,#1              ;63
000010  b288              UXTH     r0,r1                 ;63
                  |L27.18|
000012  28b4              CMP      r0,#0xb4              ;63
000014  d3f6              BCC      |L27.4|
;;;66     		}		
;;;67     		pWriteIapFun=(pInitIapInRam)((uint32_t)IapProgramInRam|0x01);
000016  4803              LDR      r0,|L27.36|
000018  1c40              ADDS     r0,r0,#1
00001a  4903              LDR      r1,|L27.40|
00001c  6008              STR      r0,[r1,#0]  ; pWriteIapFun
;;;68     }
00001e  4770              BX       lr
;;;69     
                          ENDP

                  |L27.32|
                          DCD      IAP_Program_InRam
                  |L27.36|
                          DCD      IapProgramInRam
                  |L27.40|
                          DCD      pWriteIapFun

                          AREA ||.bss||, DATA, NOINIT, ALIGN=2

                  IapProgramInRam
                          %        180

                          AREA ||.data||, DATA, ALIGN=2

                  pWriteIapFun
                          DCD      IAP_NOP
                  IapWriteFlag
                          DCD      0x00000000

;*** Start embedded assembler ***

#line 1 "..\\FWLib\\SC32F1XXX_Lib\\src\\sc32f1xxx_iap.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___15_sc32f1xxx_iap_c_c6871858____REV16|
#line 463 "..\\CMSIS\\cmsis_armcc.h"
|__asm___15_sc32f1xxx_iap_c_c6871858____REV16| PROC
#line 464

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___15_sc32f1xxx_iap_c_c6871858____REVSH|
#line 478
|__asm___15_sc32f1xxx_iap_c_c6871858____REVSH| PROC
#line 479

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
