; 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 --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 -DSC32f10xx --omf_browse=..\output\sc32f1xxx_iap.crf ..\FWLib\SC32F1XXX_Lib\src\sc32f1xxx_iap.c]
                          THUMB

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

                  IAP_EraseSector PROC
;;;336      */
;;;337    void IAP_EraseSector ( uint32_t IAP_Sector )
000000  2113              MOVS     r1,#0x13
;;;338    {
;;;339        uint32_t tmpreg;
;;;340        IAP->IAP_SNB = 0x4C000000 | IAP_Sector;
000002  0689              LSLS     r1,r1,#26
000004  4308              ORRS     r0,r0,r1
000006  4908              LDR      r1,|L1.40|
000008  6048              STR      r0,[r1,#4]
;;;341        tmpreg = IAP->IAP_CON;
00000a  68c8              LDR      r0,[r1,#0xc]
;;;342        tmpreg &= ( uint32_t ) ~ ( IAP_CON_ERASE | IAP_CON_CMD | IAP_CON_PRG );
00000c  2293              MOVS     r2,#0x93
00000e  4390              BICS     r0,r0,r2
;;;343        tmpreg |= ( uint32_t ) ( IAP_CON_SERASE );
000010  2220              MOVS     r2,#0x20
000012  4310              ORRS     r0,r0,r2
;;;344    		/* Check if software lock is open (IAP write operations are permitted) */
;;;345    		if(IapWriteFlag==IAP_ENABLE)
000014  4a05              LDR      r2,|L1.44|
000016  6852              LDR      r2,[r2,#4]  ; IapWriteFlag
000018  2a69              CMP      r2,#0x69
00001a  d104              BNE      |L1.38|
;;;346    		{
;;;347    				IAP->IAP_CON = tmpreg;
00001c  60c8              STR      r0,[r1,#0xc]
;;;348    				IAP->IAP_CON |= ( 0x02 << IAP_CON_CMD_Pos );
00001e  68c8              LDR      r0,[r1,#0xc]
000020  2202              MOVS     r2,#2
000022  4310              ORRS     r0,r0,r2
000024  60c8              STR      r0,[r1,#0xc]
                  |L1.38|
;;;349    		}
;;;350    }
000026  4770              BX       lr
;;;351    
                          ENDP

                  |L1.40|
                          DCD      0x400003c0
                  |L1.44|
                          DCD      ||.data||

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

                  IAP_Lock PROC
;;;294      */
;;;295    void IAP_Lock ( void )
000000  2001              MOVS     r0,#1
;;;296    {
;;;297        /* Set the LOCK Bit to lock the FLASH Registers access */
;;;298        IAP->IAP_CON = ( uint32_t ) IAP_CON_LOCK;
000002  4907              LDR      r1,|L2.32|
000004  07c0              LSLS     r0,r0,#31
000006  60c8              STR      r0,[r1,#0xc]
000008  2000              MOVS     r0,#0
00000a  4a06              LDR      r2,|L2.36|
00000c  4601              MOV      r1,r0
                  |L2.14|
00000e  5411              STRB     r1,[r2,r0]
000010  1c40              ADDS     r0,r0,#1
000012  b280              UXTH     r0,r0
000014  28b4              CMP      r0,#0xb4
000016  d3fa              BCC      |L2.14|
000018  4904              LDR      r1,|L2.44|
00001a  4803              LDR      r0,|L2.40|
00001c  6008              STR      r0,[r1,#0]  ; pWriteIapFun
;;;299    	
;;;300    		DeInitFlashToRam();
;;;301    }
00001e  4770              BX       lr
;;;302    
                          ENDP

                  |L2.32|
                          DCD      0x400003c0
                  |L2.36|
                          DCD      ||.bss||
                  |L2.40|
                          DCD      IAP_NOP
                  |L2.44|
                          DCD      ||.data||

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

                  IAP_NOP PROC
;;;87      */
;;;88     static boolType IAP_NOP(void)
000000  bf00              NOP      
;;;89     {
;;;90     		__NOP();
;;;91     		return FALSE;
000002  2000              MOVS     r0,#0
;;;92     }
000004  4770              BX       lr
;;;93     
                          ENDP


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

                  IAP_ProgramArray_InRam PROC
;;;180     */  
;;;181    static uint16_t IAP_ProgramArray_InRam( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type )
000000  b5f0              PUSH     {r4-r7,lr}
;;;182    {
;;;183    		uint16_t tmpCnt = 0;
;;;184    		/* Disable non-maskable interrupts */
;;;185    		uint32_t	Temp=RCC->NMI_CFG;
000002  4d27              LDR      r5,|L4.160|
000004  469c              MOV      r12,r3                ;182
000006  6aeb              LDR      r3,[r5,#0x2c]
000008  2400              MOVS     r4,#0                 ;183
;;;186    		Temp =(Temp&0x0000FFFF)|0xA05F0000;
00000a  4e26              LDR      r6,|L4.164|
00000c  b29b              UXTH     r3,r3
00000e  199f              ADDS     r7,r3,r6
;;;187    		RCC->NMI_CFG =Temp&0xFFFF0000;
000010  0c3b              LSRS     r3,r7,#16
000012  041b              LSLS     r3,r3,#16
000014  62eb              STR      r3,[r5,#0x2c]
;;;188    		/* Disable interrupt requests (IRQ) */
;;;189    		__disable_irq();
000016  b672              CPSID    i
;;;190    	  
;;;191    		/* Enable writing if the IAP software lock is open */
;;;192        /* IAP_WriteCmd(ENABLE); */
;;;193    		if(IapWriteFlag==IAP_ENABLE)
000018  4b23              LDR      r3,|L4.168|
00001a  685b              LDR      r3,[r3,#4]  ; IapWriteFlag
00001c  2b69              CMP      r3,#0x69
00001e  d135              BNE      |L4.140|
;;;194    		{
;;;195    				IAP->IAP_CON |= ( uint32_t ) IAP_CON_PRG;
000020  4e22              LDR      r6,|L4.172|
000022  68f3              LDR      r3,[r6,#0xc]
000024  2510              MOVS     r5,#0x10
000026  432b              ORRS     r3,r3,r5
000028  60f3              STR      r3,[r6,#0xc]
                  |L4.42|
;;;196    		}
;;;197    		if(IapWriteFlag==IAP_ENABLE)
;;;198    		{
;;;199    				do
;;;200    				{			
;;;201    						switch(Type)
00002a  4663              MOV      r3,r12
00002c  2b00              CMP      r3,#0
00002e  d004              BEQ      |L4.58|
000030  2b01              CMP      r3,#1
000032  d00c              BEQ      |L4.78|
000034  2b02              CMP      r3,#2
000036  d125              BNE      |L4.132|
000038  e017              B        |L4.106|
                  |L4.58|
;;;202    						{
;;;203    								/* Program byte (8-bit) Array at a specified address */
;;;204    								case IAP_BYTE:
;;;205    								{
;;;206    										* ( __IO uint8_t* ) Address = ByteArray[tmpCnt];
00003a  5d0b              LDRB     r3,[r1,r4]
00003c  7003              STRB     r3,[r0,#0]
;;;207    										* ( __IO uint8_t* ) Address = ByteArray[tmpCnt];
00003e  5d0b              LDRB     r3,[r1,r4]
000040  7003              STRB     r3,[r0,#0]
;;;208    										if ( ByteArray[tmpCnt] != * ( __IO uint8_t * ) Address )
000042  5d0b              LDRB     r3,[r1,r4]
000044  7805              LDRB     r5,[r0,#0]
000046  42ab              CMP      r3,r5
000048  d11c              BNE      |L4.132|
00004a  1c40              ADDS     r0,r0,#1
;;;209    										{
;;;210    												break;
;;;211    										}
;;;212    										Address = Address + 1;
;;;213    										break;
00004c  e01a              B        |L4.132|
                  |L4.78|
;;;214    								}
;;;215    								/* Program halfword (16-bit) Array at a specified address */
;;;216    								case IAP_HALFWORD:
;;;217    								{
;;;218    										uint16_t* ByteArray16=(uint16_t*)ByteArray;
00004e  460e              MOV      r6,r1
;;;219    										if ( ( Address & 0x01 ) == 0 )
000050  07c3              LSLS     r3,r0,#31
000052  d117              BNE      |L4.132|
;;;220    										{
;;;221    												* ( __IO uint16_t* ) Address = ByteArray16[tmpCnt];
000054  0065              LSLS     r5,r4,#1
000056  5b73              LDRH     r3,[r6,r5]
000058  8003              STRH     r3,[r0,#0]
;;;222    												* ( __IO uint16_t* ) Address = ByteArray16[tmpCnt];
00005a  5b73              LDRH     r3,[r6,r5]
00005c  8003              STRH     r3,[r0,#0]
;;;223    												if ( ByteArray16[tmpCnt] != * ( __IO uint16_t * ) Address )
00005e  5b4b              LDRH     r3,[r1,r5]
000060  8805              LDRH     r5,[r0,#0]
000062  42ab              CMP      r3,r5
000064  d10e              BNE      |L4.132|
000066  1c80              ADDS     r0,r0,#2
;;;224    												{
;;;225    														break;
;;;226    												}
;;;227    												Address = Address + 2;
000068  e00c              B        |L4.132|
                  |L4.106|
;;;228    										}
;;;229    										break;
;;;230    								}
;;;231    								/* Program word (32-bit) Array at a specified address */
;;;232    								case IAP_WORD:
;;;233    								{
;;;234    										uint32_t* ByteArray32=(uint32_t*)ByteArray;;
00006a  460e              MOV      r6,r1
;;;235    										if ( ( Address & 0x03 ) == 0 )
00006c  0783              LSLS     r3,r0,#30
00006e  d109              BNE      |L4.132|
;;;236    										{
;;;237    												* ( __IO uint32_t* ) Address = (uint32_t)ByteArray32[tmpCnt];
000070  00a5              LSLS     r5,r4,#2
000072  5973              LDR      r3,[r6,r5]
000074  6003              STR      r3,[r0,#0]
;;;238    												* ( __IO uint32_t* ) Address = (uint32_t)ByteArray32[tmpCnt];							
000076  5973              LDR      r3,[r6,r5]
000078  6003              STR      r3,[r0,#0]
;;;239    												if ( ByteArray32[tmpCnt] != * ( __IO uint32_t * ) Address )
00007a  594b              LDR      r3,[r1,r5]
00007c  6805              LDR      r5,[r0,#0]
00007e  42ab              CMP      r3,r5
000080  d100              BNE      |L4.132|
000082  1d00              ADDS     r0,r0,#4
                  |L4.132|
000084  1c64              ADDS     r4,r4,#1
;;;240    												{
;;;241    														break;			
;;;242    												}									
;;;243    												Address = Address + 4;
;;;244    										}	
;;;245    										break;					
;;;246    								}
;;;247    						}
;;;248    				}while ( ++tmpCnt < ArraySize );
000086  b2a4              UXTH     r4,r4
000088  4294              CMP      r4,r2
00008a  d3ce              BCC      |L4.42|
                  |L4.140|
;;;249    		}
;;;250    		/* IAP_WriteCmd(DISABLE); */
;;;251        IAP->IAP_CON &= ( uint32_t ) ~IAP_CON_PRG;		
00008c  4807              LDR      r0,|L4.172|
00008e  68c1              LDR      r1,[r0,#0xc]
000090  2210              MOVS     r2,#0x10
000092  4391              BICS     r1,r1,r2
000094  60c1              STR      r1,[r0,#0xc]
;;;252    		/* Enable interrupt requests (IRQ) */
;;;253        __enable_irq();
000096  b662              CPSIE    i
;;;254    		/* Restore the previous non-maskable interrupt (NMI) settings */
;;;255    		RCC->NMI_CFG =Temp;
000098  4801              LDR      r0,|L4.160|
00009a  62c7              STR      r7,[r0,#0x2c]
;;;256    		return  tmpCnt;
00009c  4620              MOV      r0,r4
;;;257    }
00009e  bdf0              POP      {r4-r7,pc}
;;;258    
                          ENDP

                  |L4.160|
                          DCD      0x40003000
                  |L4.164|
                          DCD      0xa05f0000
                  |L4.168|
                          DCD      ||.data||
                  |L4.172|
                          DCD      0x400003c0

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

                  IAP_ProgramByte PROC
;;;468      */
;;;469    boolType IAP_ProgramByte ( uint32_t Address, uint8_t Data )
000000  4a09              LDR      r2,|L5.40|
;;;470    {
;;;471        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;472    		
;;;473    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;474    	     directly write data to FLASH memory at the specified address */
;;;475    		if((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==RESET)
000002  6952              LDR      r2,[r2,#0x14]
;;;476    		{
;;;477    				/* Check if software lock is open (IAP write operations are permitted) */
;;;478    				if(IapWriteFlag==IAP_ENABLE)
000004  4b09              LDR      r3,|L5.44|
000006  0612              LSLS     r2,r2,#24             ;475
000008  d40a              BMI      |L5.32|
00000a  685a              LDR      r2,[r3,#4]  ; IapWriteFlag
00000c  2a69              CMP      r2,#0x69
00000e  d100              BNE      |L5.18|
;;;479    				{
;;;480    						* ( uint8_t* ) Address = Data;
000010  7001              STRB     r1,[r0,#0]
                  |L5.18|
;;;481    				}
;;;482    				/* Verify the data was written correctly by reading it back */
;;;483    				if ( Data == * ( uint8_t * ) Address )
000012  7800              LDRB     r0,[r0,#0]
000014  4288              CMP      r0,r1
000016  d101              BNE      |L5.28|
;;;484    						return TRUE;
000018  2001              MOVS     r0,#1
;;;485    				else
;;;486    						return FALSE;
;;;487    		}
;;;488    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;489           which points to the IAP write function that was previously copied to RAM */
;;;490    		else
;;;491    		{
;;;492    				boolType Flag;
;;;493    			  /* Execute the IAP write function from RAM via the function pointer */
;;;494    				Flag=(*pWriteIapFun)(Address,Data,IAP_BYTE);
;;;495    			  /* Return the result from the RAM-executed function */
;;;496    				return Flag;
;;;497    		}
;;;498    }
00001a  4770              BX       lr
                  |L5.28|
00001c  2000              MOVS     r0,#0                 ;486
00001e  4770              BX       lr
                  |L5.32|
000020  681b              LDR      r3,[r3,#0]            ;494  ; pWriteIapFun
000022  2200              MOVS     r2,#0                 ;494
000024  4718              BX       r3                    ;494
;;;499    
                          ENDP

000026  0000              DCW      0x0000
                  |L5.40|
                          DCD      0x40003000
                  |L5.44|
                          DCD      ||.data||

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

                  IAP_ProgramByteArray PROC
;;;943      */
;;;944    uint16_t IAP_ProgramByteArray ( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize )
000000  b5f0              PUSH     {r4-r7,lr}
;;;945    {
000002  460d              MOV      r5,r1
;;;946        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;947    		/* Counter for successfully programmed bytes */
;;;948        uint16_t tmpCnt = 0;
;;;949    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;950    	     directly write data to FLASH memory at the specified address */
;;;951    		if((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==RESET)
000004  491b              LDR      r1,|L6.116|
000006  4604              MOV      r4,r0                 ;945
000008  6949              LDR      r1,[r1,#0x14]
00000a  b0c1              SUB      sp,sp,#0x104          ;945
00000c  4616              MOV      r6,r2                 ;945
00000e  2000              MOVS     r0,#0                 ;948
000010  0609              LSLS     r1,r1,#24
000012  d410              BMI      |L6.54|
;;;952    		{
;;;953    				/* Check if software lock is open (IAP write operations are permitted) */
;;;954    				if(IapWriteFlag==IAP_ENABLE)
000014  4918              LDR      r1,|L6.120|
000016  6849              LDR      r1,[r1,#4]  ; IapWriteFlag
000018  2969              CMP      r1,#0x69
00001a  d10a              BNE      |L6.50|
                  |L6.28|
;;;955    				{
;;;956    						/* Program each byte in the array until completion or error */
;;;957    						do
;;;958    						{
;;;959    								* ( __IO uint8_t* ) Address = ByteArray[tmpCnt];
00001c  5c29              LDRB     r1,[r5,r0]
00001e  7021              STRB     r1,[r4,#0]
;;;960    								/* Verify the write operation by reading back the value */
;;;961    								if ( ByteArray[tmpCnt] != * ( __IO uint8_t * ) Address )
000020  5c29              LDRB     r1,[r5,r0]
000022  7822              LDRB     r2,[r4,#0]
000024  4291              CMP      r1,r2
000026  d104              BNE      |L6.50|
000028  1c40              ADDS     r0,r0,#1
;;;962    										break;
;;;963    								/* Move to next byte address */
;;;964    								Address = Address + 1;
;;;965    						/* Continue until all bytes are programmed */
;;;966    						} while ( ++tmpCnt < ArraySize );
00002a  b280              UXTH     r0,r0
00002c  1c64              ADDS     r4,r4,#1
00002e  42b0              CMP      r0,r6
000030  d3f4              BCC      |L6.28|
                  |L6.50|
;;;967    				}
;;;968    				/* Return count of successfully programmed bytes */
;;;969    				return tmpCnt;
;;;970    		}
;;;971    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;972           which points to the IAP write function that was previously copied to RAM */
;;;973    		else
;;;974    		{
;;;975    				/* Define function pointer type for the RAM-based IAP programming function */
;;;976    				typedef uint16_t (*pInitFlashInRam)( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type );
;;;977    				/* Allocate and initialize RAM buffer for the IAP programming function */
;;;978    				__align(4) uint8_t IapWriteInRam[256]={0};	
;;;979    				/* Copy the IAP programming function from FLASH to RAM */
;;;980    				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;981    				{
;;;982    						IapWriteInRam[i] =*(uint8_t*)((uint32_t)IAP_ProgramArray_InRam-1+i);
;;;983    				}	
;;;984    				/* Create function pointer to the RAM-based function and execute it */
;;;985    				/* The "|0x01" operation sets the Thumb bit for ARM architecture compatibility.
;;;986    				   In ARM architecture, the least significant bit (LSB) of a function pointer
;;;987    				   indicates the instruction set (0 for ARM, 1 for Thumb). This ensures the
;;;988    				   function executes in Thumb mode, which is typically used for RAM-based code.*/
;;;989    				pInitFlashInRam p=(pInitFlashInRam)((uint32_t)IapWriteInRam|0x01);
;;;990    				tmpCnt =(*p)(Address,(uint8_t*)ByteArray,ArraySize,IAP_BYTE);
;;;991    				/* Clear the RAM buffer */
;;;992    				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;993    				{
;;;994    						IapWriteInRam[i] =0;
;;;995    				}			
;;;996    				/* Return count of successfully programmed bytes */
;;;997    				return tmpCnt;	
;;;998    		}
;;;999    }
000032  b041              ADD      sp,sp,#0x104
000034  bdf0              POP      {r4-r7,pc}
                  |L6.54|
000036  21ff              MOVS     r1,#0xff              ;978
000038  3101              ADDS     r1,#1                 ;978
00003a  4668              MOV      r0,sp                 ;978
00003c  f7fffffe          BL       __aeabi_memclr4
000040  4a0e              LDR      r2,|L6.124|
000042  2300              MOVS     r3,#0                 ;980
000044  4668              MOV      r0,sp                 ;978
                  |L6.70|
000046  18d1              ADDS     r1,r2,r3              ;982
000048  3920              SUBS     r1,r1,#0x20           ;982
00004a  7fc9              LDRB     r1,[r1,#0x1f]         ;982
00004c  54c1              STRB     r1,[r0,r3]            ;982
00004e  1c5b              ADDS     r3,r3,#1              ;982
000050  b29b              UXTH     r3,r3                 ;980
000052  2bff              CMP      r3,#0xff              ;980
000054  d9f7              BLS      |L6.70|
000056  1c47              ADDS     r7,r0,#1              ;989
000058  2300              MOVS     r3,#0                 ;990
00005a  4632              MOV      r2,r6                 ;990
00005c  4629              MOV      r1,r5                 ;990
00005e  4620              MOV      r0,r4                 ;990
000060  47b8              BLX      r7                    ;990
000062  2100              MOVS     r1,#0                 ;992
000064  460b              MOV      r3,r1                 ;992
000066  466a              MOV      r2,sp                 ;978
                  |L6.104|
000068  5453              STRB     r3,[r2,r1]            ;994
00006a  1c49              ADDS     r1,r1,#1              ;994
00006c  b289              UXTH     r1,r1                 ;992
00006e  29ff              CMP      r1,#0xff              ;992
000070  d9fa              BLS      |L6.104|
000072  e7de              B        |L6.50|
;;;1000   
                          ENDP

                  |L6.116|
                          DCD      0x40003000
                  |L6.120|
                          DCD      ||.data||
                  |L6.124|
                          DCD      IAP_ProgramArray_InRam

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

                  IAP_ProgramHalfWord PROC
;;;428      */
;;;429    boolType IAP_ProgramHalfWord ( uint32_t Address, uint16_t Data )
000000  4a09              LDR      r2,|L7.40|
;;;430    {
;;;431        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;432    
;;;433    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;434    	     directly write data to FLASH memory at the specified address */
;;;435    		if((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==RESET)
000002  6952              LDR      r2,[r2,#0x14]
;;;436    		{
;;;437    				/* Check if software lock is open (IAP write operations are permitted) */
;;;438    				if(IapWriteFlag==IAP_ENABLE)
000004  4b09              LDR      r3,|L7.44|
000006  0612              LSLS     r2,r2,#24             ;435
000008  d40a              BMI      |L7.32|
00000a  685a              LDR      r2,[r3,#4]  ; IapWriteFlag
00000c  2a69              CMP      r2,#0x69
00000e  d100              BNE      |L7.18|
;;;439    				{
;;;440    						* ( __IO uint16_t* ) Address = Data;
000010  8001              STRH     r1,[r0,#0]
                  |L7.18|
;;;441    				}
;;;442    				/* Verify the data was written correctly by reading it back */
;;;443    				if ( Data == * ( __IO uint16_t * ) Address )
000012  8800              LDRH     r0,[r0,#0]
000014  4288              CMP      r0,r1
000016  d101              BNE      |L7.28|
;;;444    						return TRUE;
000018  2001              MOVS     r0,#1
;;;445    				else
;;;446    						return FALSE;
;;;447    		}	
;;;448    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;449           which points to the IAP write function that was previously copied to RAM */
;;;450    		else
;;;451    		{
;;;452    				boolType Flag;
;;;453    				/* Execute the IAP write function from RAM via the function pointer */
;;;454    				Flag=(*pWriteIapFun)(Address,Data,IAP_HALFWORD);
;;;455    				/* Return the result from the RAM-executed function */
;;;456    				return Flag;	
;;;457    		}
;;;458    }
00001a  4770              BX       lr
                  |L7.28|
00001c  2000              MOVS     r0,#0                 ;446
00001e  4770              BX       lr
                  |L7.32|
000020  681b              LDR      r3,[r3,#0]            ;454  ; pWriteIapFun
000022  2201              MOVS     r2,#1                 ;454
000024  4718              BX       r3                    ;454
;;;459    
                          ENDP

000026  0000              DCW      0x0000
                  |L7.40|
                          DCD      0x40003000
                  |L7.44|
                          DCD      ||.data||

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

                  IAP_ProgramHalfWordArray PROC
;;;874    
;;;875    uint16_t IAP_ProgramHalfWordArray ( uint32_t Address, uint16_t* ByteArray, uint16_t ArraySize )
000000  b5f0              PUSH     {r4-r7,lr}
;;;876    {
000002  460d              MOV      r5,r1
;;;877        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;878    		/* Counter for successfully programmed half-words */
;;;879        uint16_t tmpCnt = 0;
;;;880    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;881    	     directly write data to FLASH memory at the specified address */
;;;882    		if((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==RESET)
000004  491d              LDR      r1,|L8.124|
000006  4604              MOV      r4,r0                 ;876
000008  6949              LDR      r1,[r1,#0x14]
00000a  b0c1              SUB      sp,sp,#0x104          ;876
00000c  4616              MOV      r6,r2                 ;876
00000e  2000              MOVS     r0,#0                 ;879
000010  0609              LSLS     r1,r1,#24
000012  d413              BMI      |L8.60|
;;;883    		{
;;;884    				/* Check if address is 16-bit aligned (required for half-word programming) */
;;;885    				if ( ( Address & 0x01 ) == 0 )
000014  07e1              LSLS     r1,r4,#31
000016  d10f              BNE      |L8.56|
;;;886    				{
;;;887    						/* Check if software lock is open (IAP write operations are permitted) */
;;;888    						if(IapWriteFlag==IAP_ENABLE)
000018  4919              LDR      r1,|L8.128|
00001a  6849              LDR      r1,[r1,#4]  ; IapWriteFlag
00001c  2969              CMP      r1,#0x69
00001e  d10b              BNE      |L8.56|
                  |L8.32|
;;;889    						{
;;;890    								/* Program each half-word in the array until completion or error */
;;;891    								do
;;;892    								{
;;;893    										* ( __IO uint16_t* ) Address = ByteArray[tmpCnt];
000020  0041              LSLS     r1,r0,#1
000022  5a6a              LDRH     r2,[r5,r1]
000024  8022              STRH     r2,[r4,#0]
;;;894    										/* Verify the write operation by reading back the value */
;;;895    										if ( ByteArray[tmpCnt] != * ( __IO uint16_t * ) Address )
000026  5a69              LDRH     r1,[r5,r1]
000028  8822              LDRH     r2,[r4,#0]
00002a  4291              CMP      r1,r2
00002c  d104              BNE      |L8.56|
00002e  1c40              ADDS     r0,r0,#1
;;;896    												break;
;;;897    										/* Move to next 16-bit address */
;;;898    										Address = Address + 2;
;;;899    								/* Continue until all half-words are programmed */
;;;900    								} while ( ++tmpCnt < ArraySize );
000030  b280              UXTH     r0,r0
000032  1ca4              ADDS     r4,r4,#2
000034  42b0              CMP      r0,r6
000036  d3f3              BCC      |L8.32|
                  |L8.56|
;;;901    					  }
;;;902    				}
;;;903    				/* Return count of successfully programmed half-words */
;;;904    				return tmpCnt;
;;;905    		}
;;;906    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;907           which points to the IAP write function that was previously copied to RAM */
;;;908    		else
;;;909    		{
;;;910    				/* Define function pointer type for the RAM-based IAP programming function */
;;;911    				typedef uint16_t (*pInitFlashInRam)( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type );
;;;912    				/* Allocate and initialize RAM buffer for the IAP programming function */
;;;913    				__align(4) uint8_t IapWriteInRam[256]={0};
;;;914    				/* Copy the IAP programming function from FLASH to RAM */
;;;915    				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;916    				{
;;;917    						IapWriteInRam[i] =*(uint8_t*)((uint32_t)IAP_ProgramArray_InRam-1+i);
;;;918    				}	
;;;919    				/* Create function pointer to the RAM-based function and execute it */
;;;920    				/* The "|0x01" operation sets the Thumb bit for ARM architecture compatibility.
;;;921    				   In ARM architecture, the least significant bit (LSB) of a function pointer
;;;922    				   indicates the instruction set (0 for ARM, 1 for Thumb). This ensures the
;;;923    				   function executes in Thumb mode, which is typically used for RAM-based code.*/
;;;924    				pInitFlashInRam p=(pInitFlashInRam)((uint32_t)IapWriteInRam|0x01);
;;;925    				tmpCnt =(*p)(Address,(uint8_t*)ByteArray,ArraySize,IAP_HALFWORD);
;;;926    				/* Clear the RAM buffer */
;;;927    				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;928    				{
;;;929    						IapWriteInRam[i] =0;
;;;930    				}
;;;931    				/* Return count of successfully programmed half-words */
;;;932    				return tmpCnt;
;;;933    		}
;;;934    }
000038  b041              ADD      sp,sp,#0x104
00003a  bdf0              POP      {r4-r7,pc}
                  |L8.60|
00003c  21ff              MOVS     r1,#0xff              ;913
00003e  3101              ADDS     r1,#1                 ;913
000040  4668              MOV      r0,sp                 ;913
000042  f7fffffe          BL       __aeabi_memclr4
000046  4a0f              LDR      r2,|L8.132|
000048  2300              MOVS     r3,#0                 ;915
00004a  4668              MOV      r0,sp                 ;913
                  |L8.76|
00004c  18d1              ADDS     r1,r2,r3              ;917
00004e  3920              SUBS     r1,r1,#0x20           ;917
000050  7fc9              LDRB     r1,[r1,#0x1f]         ;917
000052  54c1              STRB     r1,[r0,r3]            ;917
000054  1c5b              ADDS     r3,r3,#1              ;917
000056  b29b              UXTH     r3,r3                 ;915
000058  2bff              CMP      r3,#0xff              ;915
00005a  d9f7              BLS      |L8.76|
00005c  1c47              ADDS     r7,r0,#1              ;924
00005e  2301              MOVS     r3,#1                 ;925
000060  4632              MOV      r2,r6                 ;925
000062  4629              MOV      r1,r5                 ;925
000064  4620              MOV      r0,r4                 ;925
000066  47b8              BLX      r7                    ;925
000068  2100              MOVS     r1,#0                 ;927
00006a  460b              MOV      r3,r1                 ;927
00006c  466a              MOV      r2,sp                 ;913
                  |L8.110|
00006e  5453              STRB     r3,[r2,r1]            ;929
000070  1c49              ADDS     r1,r1,#1              ;929
000072  b289              UXTH     r1,r1                 ;927
000074  29ff              CMP      r1,#0xff              ;927
000076  d9fa              BLS      |L8.110|
000078  e7de              B        |L8.56|
;;;935    
                          ENDP

00007a  0000              DCW      0x0000
                  |L8.124|
                          DCD      0x40003000
                  |L8.128|
                          DCD      ||.data||
                  |L8.132|
                          DCD      IAP_ProgramArray_InRam

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

                  IAP_ProgramWord PROC
;;;388      */
;;;389    boolType IAP_ProgramWord ( uint32_t Address, uint32_t Data )
000000  4a09              LDR      r2,|L9.40|
;;;390    {
;;;391        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;392    		
;;;393    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;394    	     directly write data to FLASH memory at the specified address */
;;;395    		if((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==RESET)
000002  6952              LDR      r2,[r2,#0x14]
;;;396    		{
;;;397    				/* Check if software lock is open (IAP write operations are permitted) */
;;;398    				if(IapWriteFlag==IAP_ENABLE)
000004  4b09              LDR      r3,|L9.44|
000006  0612              LSLS     r2,r2,#24             ;395
000008  d40a              BMI      |L9.32|
00000a  685a              LDR      r2,[r3,#4]  ; IapWriteFlag
00000c  2a69              CMP      r2,#0x69
00000e  d100              BNE      |L9.18|
;;;399    				{
;;;400    						* ( __IO uint32_t* ) Address = Data;
000010  6001              STR      r1,[r0,#0]
                  |L9.18|
;;;401    				}
;;;402    				/* Verify the data was written correctly by reading it back */
;;;403    				if ( Data == * ( __IO uint32_t * ) Address )
000012  6800              LDR      r0,[r0,#0]
000014  4288              CMP      r0,r1
000016  d101              BNE      |L9.28|
;;;404    						return TRUE;
000018  2001              MOVS     r0,#1
;;;405    				else
;;;406    						return FALSE;
;;;407    		}
;;;408    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun 
;;;409    		   which points to the IAP write function that was previously copied to RAM */
;;;410    		else
;;;411    		{
;;;412    				boolType Flag;
;;;413    				/* Execute the IAP write function from RAM via the function pointer */
;;;414    				Flag=(*pWriteIapFun)(Address,Data,IAP_WORD);
;;;415    				/* Return the result from the RAM-executed function */
;;;416    				return Flag;
;;;417    		}
;;;418    }
00001a  4770              BX       lr
                  |L9.28|
00001c  2000              MOVS     r0,#0                 ;406
00001e  4770              BX       lr
                  |L9.32|
000020  681b              LDR      r3,[r3,#0]            ;414  ; pWriteIapFun
000022  2202              MOVS     r2,#2                 ;414
000024  4718              BX       r3                    ;414
;;;419    
                          ENDP

000026  0000              DCW      0x0000
                  |L9.40|
                          DCD      0x40003000
                  |L9.44|
                          DCD      ||.data||

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

                  IAP_ProgramWordArray PROC
;;;804      */
;;;805    uint16_t IAP_ProgramWordArray ( uint32_t Address, uint32_t* ByteArray, uint16_t ArraySize )
000000  b5f0              PUSH     {r4-r7,lr}
;;;806    {
000002  460d              MOV      r5,r1
;;;807        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;808    		/* Counter for successfully programmed words */
;;;809        uint16_t tmpCnt = 0;
;;;810    		/* Check if the system clock source is HIRC, if using HIRC as system clock, 
;;;811    	     directly write data to FLASH memory at the specified address */
;;;812    		if((RCC->RCC_CFG0 &( uint32_t )RCC_CFG0_SYSCLKSW)==RESET)
000004  491d              LDR      r1,|L10.124|
000006  4604              MOV      r4,r0                 ;806
000008  6949              LDR      r1,[r1,#0x14]
00000a  b0c1              SUB      sp,sp,#0x104          ;806
00000c  4616              MOV      r6,r2                 ;806
00000e  2000              MOVS     r0,#0                 ;809
000010  0609              LSLS     r1,r1,#24
000012  d413              BMI      |L10.60|
;;;813    		{
;;;814    				/* Check if address is 32-bit aligned (required for word programming) */
;;;815    				if ( ( Address & 0x03 ) == 0 )
000014  07a1              LSLS     r1,r4,#30
000016  d10f              BNE      |L10.56|
;;;816    				{
;;;817    						/* Check if software lock is open (IAP write operations are permitted) */
;;;818    						if(IapWriteFlag==IAP_ENABLE)
000018  4919              LDR      r1,|L10.128|
00001a  6849              LDR      r1,[r1,#4]  ; IapWriteFlag
00001c  2969              CMP      r1,#0x69
00001e  d10b              BNE      |L10.56|
                  |L10.32|
;;;819    						{
;;;820    								/* Program each word in the array until completion or error */
;;;821    								do
;;;822    								{
;;;823    										* ( __IO uint32_t* ) Address = ByteArray[tmpCnt];
000020  0081              LSLS     r1,r0,#2
000022  586a              LDR      r2,[r5,r1]
000024  6022              STR      r2,[r4,#0]
;;;824    										/* Verify the write operation by reading back the value */
;;;825    										if ( ByteArray[tmpCnt] != * ( __IO uint32_t * ) Address )
000026  5869              LDR      r1,[r5,r1]
000028  6822              LDR      r2,[r4,#0]
00002a  4291              CMP      r1,r2
00002c  d104              BNE      |L10.56|
00002e  1c40              ADDS     r0,r0,#1
;;;826    												break;
;;;827    										/* Move to next 32-bit address */
;;;828    										Address = Address + 4;
;;;829    								/* Continue until all words are programmed */
;;;830    								} while ( ++tmpCnt < ArraySize );
000030  b280              UXTH     r0,r0
000032  1d24              ADDS     r4,r4,#4
000034  42b0              CMP      r0,r6
000036  d3f3              BCC      |L10.32|
                  |L10.56|
;;;831    						}
;;;832    				}
;;;833    				/* Return count of successfully programmed words */
;;;834    				return tmpCnt;
;;;835    		}
;;;836    		/* If not using HIRC as system clock, we need to jump to the function pointer pWriteIapFun
;;;837           which points to the IAP write function that was previously copied to RAM */
;;;838    		else
;;;839    		{
;;;840    				/* Define function pointer type for the RAM-based IAP programming function */
;;;841    				typedef uint16_t (*pInitFlashInRam)( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize,IAPWRITE_ALIGNTYPE Type );
;;;842    				/* Allocate and initialize RAM buffer for the IAP programming function */
;;;843    				__align(4) uint8_t IapWriteInRam[256]={0};
;;;844    				/* Copy the IAP programming function from FLASH to RAM */
;;;845    				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;846    				{
;;;847    						IapWriteInRam[i] =*(uint8_t*)((uint32_t)IAP_ProgramArray_InRam-1+i);
;;;848    				}
;;;849    				/* Create function pointer to the RAM-based function and execute it */
;;;850    				/* The "|0x01" operation sets the Thumb bit for ARM architecture compatibility.
;;;851    				   In ARM architecture, the least significant bit (LSB) of a function pointer
;;;852    				   indicates the instruction set (0 for ARM, 1 for Thumb). This ensures the
;;;853    				   function executes in Thumb mode, which is typically used for RAM-based code.*/
;;;854    				pInitFlashInRam p=(pInitFlashInRam)((uint32_t)IapWriteInRam|0x01);
;;;855    				tmpCnt =(*p)(Address,(uint8_t*)ByteArray,ArraySize,IAP_WORD);
;;;856    				/* Clear the RAM buffer */
;;;857    				for(uint16_t i=0;i<sizeof(IapWriteInRam);i++)
;;;858    				{
;;;859    						IapWriteInRam[i] =0;
;;;860    				}
;;;861    				/* Return count of successfully programmed words */
;;;862    				return tmpCnt;		
;;;863    		}
;;;864    }
000038  b041              ADD      sp,sp,#0x104
00003a  bdf0              POP      {r4-r7,pc}
                  |L10.60|
00003c  21ff              MOVS     r1,#0xff              ;843
00003e  3101              ADDS     r1,#1                 ;843
000040  4668              MOV      r0,sp                 ;843
000042  f7fffffe          BL       __aeabi_memclr4
000046  4a0f              LDR      r2,|L10.132|
000048  2300              MOVS     r3,#0                 ;845
00004a  4668              MOV      r0,sp                 ;843
                  |L10.76|
00004c  18d1              ADDS     r1,r2,r3              ;847
00004e  3920              SUBS     r1,r1,#0x20           ;847
000050  7fc9              LDRB     r1,[r1,#0x1f]         ;847
000052  54c1              STRB     r1,[r0,r3]            ;847
000054  1c5b              ADDS     r3,r3,#1              ;847
000056  b29b              UXTH     r3,r3                 ;845
000058  2bff              CMP      r3,#0xff              ;845
00005a  d9f7              BLS      |L10.76|
00005c  1c47              ADDS     r7,r0,#1              ;854
00005e  2302              MOVS     r3,#2                 ;855
000060  4632              MOV      r2,r6                 ;855
000062  4629              MOV      r1,r5                 ;855
000064  4620              MOV      r0,r4                 ;855
000066  47b8              BLX      r7                    ;855
000068  2100              MOVS     r1,#0                 ;857
00006a  460b              MOV      r3,r1                 ;857
00006c  466a              MOV      r2,sp                 ;843
                  |L10.110|
00006e  5453              STRB     r3,[r2,r1]            ;859
000070  1c49              ADDS     r1,r1,#1              ;859
000072  b289              UXTH     r1,r1                 ;857
000074  29ff              CMP      r1,#0xff              ;857
000076  d9fa              BLS      |L10.110|
000078  e7de              B        |L10.56|
;;;865    
                          ENDP

00007a  0000              DCW      0x0000
                  |L10.124|
                          DCD      0x40003000
                  |L10.128|
                          DCD      ||.data||
                  |L10.132|
                          DCD      IAP_ProgramArray_InRam

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

                  IAP_Program_InRam PROC
;;;105     */  
;;;106    static boolType IAP_Program_InRam(uint32_t Address, uint32_t Data,IAPWRITE_ALIGNTYPE Type)
000000  b5f0              PUSH     {r4-r7,lr}
;;;107    {
;;;108    		boolType Flag;
;;;109    		/* Disable non-maskable interrupts */
;;;110    		uint32_t	Temp=RCC->NMI_CFG;
000002  4f14              LDR      r7,|L11.84|
000004  6afb              LDR      r3,[r7,#0x2c]
;;;111    		Temp =(Temp&0x0000FFFF)|0xA05F0000;
000006  4c14              LDR      r4,|L11.88|
000008  b29b              UXTH     r3,r3
00000a  191b              ADDS     r3,r3,r4
;;;112    		RCC->NMI_CFG =Temp&0xFFFF0000;
00000c  0c1c              LSRS     r4,r3,#16
00000e  0424              LSLS     r4,r4,#16
000010  62fc              STR      r4,[r7,#0x2c]
;;;113    		/* Disable interrupt requests (IRQ) */
;;;114    		__disable_irq();
000012  b672              CPSID    i
;;;115    		
;;;116    		/* Enable writing if the IAP software lock is open */
;;;117        /* IAP_WriteCmd(ENABLE); */
;;;118    		if(IapWriteFlag==IAP_ENABLE)
000014  4c11              LDR      r4,|L11.92|
;;;119    		{
;;;120    				IAP->IAP_CON |= ( uint32_t ) IAP_CON_PRG;
000016  4e12              LDR      r6,|L11.96|
000018  6865              LDR      r5,[r4,#4]  ; IapWriteFlag
00001a  2410              MOVS     r4,#0x10
00001c  2d69              CMP      r5,#0x69              ;118
00001e  d112              BNE      |L11.70|
000020  68f5              LDR      r5,[r6,#0xc]
000022  4325              ORRS     r5,r5,r4
000024  60f5              STR      r5,[r6,#0xc]
;;;121    		}
;;;122    		if(IapWriteFlag==IAP_ENABLE)
;;;123    		{
;;;124    				switch(Type)
000026  2a00              CMP      r2,#0
000028  d004              BEQ      |L11.52|
00002a  2a01              CMP      r2,#1
00002c  d005              BEQ      |L11.58|
00002e  2a02              CMP      r2,#2
000030  d109              BNE      |L11.70|
000032  e005              B        |L11.64|
                  |L11.52|
;;;125    				{
;;;126    						/* Program a byte (8-bit) at a specified address */
;;;127    						case IAP_BYTE:
;;;128    						{
;;;129    								* ( uint8_t * ) Address = (uint8_t)Data;
;;;130    								* ( uint8_t * ) Address = (uint8_t)Data;
000034  7001              STRB     r1,[r0,#0]
;;;131    								if ( (uint8_t)Data == * ( __IO uint8_t * ) Address )
000036  7800              LDRB     r0,[r0,#0]
000038  e004              B        |L11.68|
                  |L11.58|
;;;132    										Flag= TRUE;
;;;133    								else
;;;134    										Flag= FALSE;
;;;135    								break;
;;;136    						}
;;;137    						/* Program a halfword (16-bit) at a specified address */
;;;138    						case IAP_HALFWORD:
;;;139    						{
;;;140    								* ( uint16_t * ) Address = (uint16_t)Data;
;;;141    								* ( uint16_t * ) Address = (uint16_t)Data;
00003a  8001              STRH     r1,[r0,#0]
;;;142    								if ( (uint16_t)Data == * ( __IO uint16_t * ) Address )
00003c  8800              LDRH     r0,[r0,#0]
00003e  e001              B        |L11.68|
                  |L11.64|
;;;143    										Flag= TRUE;
;;;144    								else
;;;145    										Flag= FALSE;						
;;;146    								break;
;;;147    						}			
;;;148    						/* Program a word (32-bit) at a specified address */
;;;149    						case IAP_WORD:
;;;150    						{
;;;151    								* ( uint32_t * ) Address = (uint32_t)Data;
;;;152    								* ( uint32_t * ) Address = (uint32_t)Data;
;;;153    								if ( (uint32_t)Data == * ( __IO uint32_t * ) Address )
000040  6001              STR      r1,[r0,#0]
000042  6800              LDR      r0,[r0,#0]
                  |L11.68|
;;;154    										Flag= TRUE;
000044  2001              MOVS     r0,#1
                  |L11.70|
;;;155    								else
;;;156    										Flag= FALSE;						
;;;157    								break;
;;;158    						}
;;;159    				}
;;;160    		}
;;;161    		/* IAP_WriteCmd(DISABLE); */
;;;162        IAP->IAP_CON &= ( uint32_t ) ~IAP_CON_PRG;		
000046  68f1              LDR      r1,[r6,#0xc]
000048  43a1              BICS     r1,r1,r4
00004a  60f1              STR      r1,[r6,#0xc]
;;;163    		/* Enable interrupt requests (IRQ) */
;;;164        __enable_irq();
00004c  b662              CPSIE    i
;;;165    		/* Restore the previous non-maskable interrupt (NMI) settings */
;;;166    		RCC->NMI_CFG =Temp; 
00004e  62fb              STR      r3,[r7,#0x2c]
;;;167    		return Flag;
;;;168    }	
000050  bdf0              POP      {r4-r7,pc}
;;;169    
                          ENDP

000052  0000              DCW      0x0000
                  |L11.84|
                          DCD      0x40003000
                  |L11.88|
                          DCD      0xa05f0000
                  |L11.92|
                          DCD      ||.data||
                  |L11.96|
                          DCD      0x400003c0

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

                  IAP_ReadByte PROC
;;;714      */
;;;715    uint8_t IAP_ReadByte ( uint32_t Address )
000000  7800              LDRB     r0,[r0,#0]
;;;716    {
;;;717        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;718    
;;;719        uint8_t Data;
;;;720        Data = * ( uint8_t* ) Address;
;;;721        return Data;
;;;722    }
000002  4770              BX       lr
;;;723    
                          ENDP


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

                  IAP_ReadByteArray PROC
;;;1059     */
;;;1060   uint16_t IAP_ReadByteArray ( uint32_t Address, uint8_t* ByteArray, uint16_t ArraySize )
000000  b510              PUSH     {r4,lr}
;;;1061   {
000002  4603              MOV      r3,r0
;;;1062       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1063   
;;;1064       uint16_t tmpCnt = 0;
000004  2000              MOVS     r0,#0
                  |L13.6|
;;;1065       do
;;;1066       {
;;;1067           ByteArray[tmpCnt] = * ( __IO uint8_t* ) Address;
000006  781c              LDRB     r4,[r3,#0]
000008  540c              STRB     r4,[r1,r0]
00000a  1c40              ADDS     r0,r0,#1
;;;1068           Address = Address + 1;
;;;1069   
;;;1070       } while ( ++tmpCnt < ArraySize );
00000c  b280              UXTH     r0,r0
00000e  1c5b              ADDS     r3,r3,#1
000010  4290              CMP      r0,r2
000012  d3f8              BCC      |L13.6|
;;;1071   
;;;1072       return tmpCnt;
;;;1073   }
000014  bd10              POP      {r4,pc}
;;;1074   
                          ENDP


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

                  IAP_ReadHalfWord PROC
;;;699      */
;;;700    uint16_t IAP_ReadHalfWord ( uint32_t Address )
000000  8800              LDRH     r0,[r0,#0]
;;;701    {
;;;702        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;703    
;;;704        uint16_t Data;
;;;705        Data = * ( __IO uint16_t* ) Address;
;;;706        return Data;
;;;707    }
000002  4770              BX       lr
;;;708    
                          ENDP


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

                  IAP_ReadHalfWordArray PROC
;;;1034     */
;;;1035   uint16_t IAP_ReadHalfWordArray ( uint32_t Address, uint16_t* ByteArray, uint16_t ArraySize )
000000  b530              PUSH     {r4,r5,lr}
;;;1036   {
000002  4603              MOV      r3,r0
;;;1037       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1038   
;;;1039       uint16_t tmpCnt = 0;
000004  2000              MOVS     r0,#0
;;;1040       if ( ( Address & 0x01 ) == 0 )
000006  07dc              LSLS     r4,r3,#31
000008  d107              BNE      |L15.26|
                  |L15.10|
;;;1041       {
;;;1042           do
;;;1043           {
;;;1044               ByteArray[tmpCnt] = * ( __IO uint16_t* ) Address;
00000a  881c              LDRH     r4,[r3,#0]
00000c  0045              LSLS     r5,r0,#1
00000e  1c40              ADDS     r0,r0,#1
;;;1045               Address = Address + 2;
;;;1046   
;;;1047           } while ( ++tmpCnt < ArraySize );
000010  b280              UXTH     r0,r0
000012  1c9b              ADDS     r3,r3,#2
000014  534c              STRH     r4,[r1,r5]            ;1044
000016  4290              CMP      r0,r2
000018  d3f7              BCC      |L15.10|
                  |L15.26|
;;;1048       }
;;;1049       return tmpCnt;
;;;1050   }
00001a  bd30              POP      {r4,r5,pc}
;;;1051   
                          ENDP


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

                  IAP_ReadWord PROC
;;;684      */
;;;685    uint32_t IAP_ReadWord ( uint32_t Address )
000000  6800              LDR      r0,[r0,#0]
;;;686    {
;;;687        assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;688    
;;;689        uint32_t Data;
;;;690        Data = * ( __IO uint32_t* ) Address;
;;;691        return Data;
;;;692    }
000002  4770              BX       lr
;;;693    
                          ENDP


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

                  IAP_ReadWordArray PROC
;;;1009     */
;;;1010   uint16_t IAP_ReadWordArray ( uint32_t Address, uint32_t* ByteArray, uint16_t ArraySize )
000000  b530              PUSH     {r4,r5,lr}
;;;1011   {
000002  4603              MOV      r3,r0
;;;1012       assert_param ( IS_IAP_ADDRESS ( Address ) );
;;;1013   
;;;1014       uint16_t tmpCnt = 0;
000004  2000              MOVS     r0,#0
;;;1015       if ( ( Address & 0x03 ) == 0 )
000006  079c              LSLS     r4,r3,#30
000008  d106              BNE      |L17.24|
                  |L17.10|
;;;1016       {
;;;1017           do
;;;1018           {
;;;1019               ByteArray[tmpCnt] = * ( __IO uint32_t* ) Address;
00000a  cb10              LDM      r3!,{r4}
00000c  0085              LSLS     r5,r0,#2
00000e  1c40              ADDS     r0,r0,#1
;;;1020               Address = Address + 4;
;;;1021   
;;;1022           } while ( ++tmpCnt < ArraySize );
000010  b280              UXTH     r0,r0
000012  514c              STR      r4,[r1,r5]            ;1019
000014  4290              CMP      r0,r2
000016  d3f8              BCC      |L17.10|
                  |L17.24|
;;;1023       }
;;;1024       return tmpCnt;
;;;1025   }
000018  bd30              POP      {r4,r5,pc}
;;;1026   
                          ENDP


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

                  IAP_SoftwareReset PROC
;;;1098     */
;;;1099   void IAP_SoftwareReset ( IAP_BTLD_TypeDef IAP_BTLDType )
000000  21ff              MOVS     r1,#0xff
;;;1100   {
;;;1101       IAP->IAP_CON = ( IAP_BTLDType | IAP_CON_RST );
000002  3101              ADDS     r1,#1
000004  4308              ORRS     r0,r0,r1
000006  4901              LDR      r1,|L18.12|
000008  60c8              STR      r0,[r1,#0xc]
;;;1102   }
00000a  4770              BX       lr
;;;1103   
                          ENDP

                  |L18.12|
                          DCD      0x400003c0

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

                  IAP_Unlock PROC
;;;265      */
;;;266    boolType IAP_Unlock ( void )
000000  b570              PUSH     {r4-r6,lr}
;;;267    {
;;;268    		/* Check if software lock is open (IAP write operations are permitted) */
;;;269    		if(IapWriteFlag==IAP_ENABLE)
000002  4d11              LDR      r5,|L19.72|
;;;270    		{
;;;271    #if defined(SC32f10xx)
;;;272    				/* HIRC must be enabled before IAP operation */
;;;273    				RCC_Unlock ( 0xFF );
;;;274    				RCC_HIRCCmd ( ENABLE );
;;;275    #endif
;;;276    				/* Authorize the FLASH Registers access */
;;;277    				IAP->IAPKEY = IAP_KEY1;
000004  4c11              LDR      r4,|L19.76|
000006  6868              LDR      r0,[r5,#4]            ;269  ; IapWriteFlag
000008  2869              CMP      r0,#0x69              ;269
00000a  d117              BNE      |L19.60|
00000c  20ff              MOVS     r0,#0xff              ;273
00000e  f7fffffe          BL       RCC_Unlock
000012  2001              MOVS     r0,#1                 ;274
000014  f7fffffe          BL       RCC_HIRCCmd
000018  480d              LDR      r0,|L19.80|
00001a  6020              STR      r0,[r4,#0]
;;;278    				IAP->IAPKEY = IAP_KEY2;
00001c  480d              LDR      r0,|L19.84|
00001e  6020              STR      r0,[r4,#0]
000020  490d              LDR      r1,|L19.88|
000022  4b0e              LDR      r3,|L19.92|
000024  2000              MOVS     r0,#0
                  |L19.38|
000026  180a              ADDS     r2,r1,r0
000028  3a20              SUBS     r2,r2,#0x20
00002a  7fd2              LDRB     r2,[r2,#0x1f]
00002c  541a              STRB     r2,[r3,r0]
00002e  1c40              ADDS     r0,r0,#1
000030  b280              UXTH     r0,r0
000032  28b4              CMP      r0,#0xb4
000034  d3f7              BCC      |L19.38|
000036  4809              LDR      r0,|L19.92|
000038  1c40              ADDS     r0,r0,#1
00003a  6028              STR      r0,[r5,#0]  ; pWriteIapFun
                  |L19.60|
;;;279    	
;;;280    				InitFlashToRam();
;;;281    		}
;;;282    		if ( IAP->IAPKEY == 0x01 )
00003c  6820              LDR      r0,[r4,#0]
00003e  2801              CMP      r0,#1
000040  d000              BEQ      |L19.68|
;;;283    				/* Unlock success */
;;;284    				return TRUE;
;;;285    		else
;;;286    				/* Unlock Error */
;;;287    				return FALSE;
000042  2000              MOVS     r0,#0
                  |L19.68|
;;;288    }
000044  bd70              POP      {r4-r6,pc}
;;;289    
                          ENDP

000046  0000              DCW      0x0000
                  |L19.72|
                          DCD      ||.data||
                  |L19.76|
                          DCD      0x400003c0
                  |L19.80|
                          DCD      0x12345678
                  |L19.84|
                          DCD      0xa05f05fa
                  |L19.88|
                          DCD      IAP_Program_InRam
                  |L19.92|
                          DCD      ||.bss||

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

                  IAP_WriteCmd PROC
;;;309      */
;;;310    void IAP_WriteCmd ( FunctionalState NewState )
000000  4907              LDR      r1,|L20.32|
;;;311    {
;;;312        /* Check the parameters */
;;;313        assert_param ( IS_FUNCTIONAL_STATE ( NewState ) );
;;;314    
;;;315        if ( NewState != DISABLE )
;;;316        {
;;;317    				/* Check if software lock is open (IAP write operations are permitted) */
;;;318    				if(IapWriteFlag==IAP_ENABLE)
;;;319    				{
;;;320    						IAP->IAP_CON |= ( uint32_t ) IAP_CON_PRG;
000002  2210              MOVS     r2,#0x10
000004  2800              CMP      r0,#0                 ;315
000006  d007              BEQ      |L20.24|
000008  4806              LDR      r0,|L20.36|
00000a  6840              LDR      r0,[r0,#4]            ;318  ; IapWriteFlag
00000c  2869              CMP      r0,#0x69              ;318
00000e  d102              BNE      |L20.22|
000010  68c8              LDR      r0,[r1,#0xc]
000012  4310              ORRS     r0,r0,r2
                  |L20.20|
;;;321    				}
;;;322        }
;;;323        else
;;;324        {
;;;325            IAP->IAP_CON &= ~ ( uint32_t ) IAP_CON_PRG;
000014  60c8              STR      r0,[r1,#0xc]
                  |L20.22|
;;;326        }
;;;327    }
000016  4770              BX       lr
                  |L20.24|
000018  68c8              LDR      r0,[r1,#0xc]          ;325
00001a  4390              BICS     r0,r0,r2              ;325
00001c  e7fa              B        |L20.20|
;;;328    
                          ENDP

00001e  0000              DCW      0x0000
                  |L20.32|
                          DCD      0x400003c0
                  |L20.36|
                          DCD      ||.data||

                          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 ***
