; generated by Component: ARM Compiler 5.05 update 2 (build 169) Tool: ArmCC [4d0f38]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o..\..\..\..\build\bootloader\mico-fire_f429\obj_rvmdk\paltform_rtc.o --asm_dir=..\..\..\..\Build\Bootloader\MICO-Fire_F429\list_RVMDK\ --list_dir=..\..\..\..\Build\Bootloader\MICO-Fire_F429\list_RVMDK\ --depend=..\..\..\..\build\bootloader\mico-fire_f429\obj_rvmdk\paltform_rtc.d --cpu=Cortex-M4.fp --apcs=interwork --diag_suppress=9931,1,1293 -I..\..\..\..\Bootloader -I..\..\..\..\Board\fire_F429 -I..\..\..\..\include -I..\..\..\..\libraries\utilities -I..\..\..\..\libraries\utilities\json_c -I..\..\..\..\MICO\core -I..\..\..\..\MICO\security -I..\..\..\..\MICO\system -I..\..\..\..\MICO\system\command_console -I..\..\..\..\Platform\include -I..\..\..\..\Platform\Cortex-M4 -I..\..\..\..\Platform\Cortex-M4\CMSIS -I..\..\..\..\Platform\MCU\STM32F4xx\peripherals -I..\..\..\..\Platform\MCU\STM32F4xx\peripherals\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\..\..\Platform\MCU\STM32F4xx\peripherals\Libraries -I..\..\..\..\Platform\MCU\STM32F4xx\wlan_bus_driver -I..\..\..\..\Platform\Drivers\spi_flash -I..\..\..\..\Platform\Drivers -IG:\GIT_OSC\F429_OV2640_MICO_SDRAM\Projects\STM32F429\bootloader\RVMDK\RTE -ID:\work\keil5\ARM\PACK\Keil\STM32F4xx_DFP\2.5.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -ID:\work\keil5\ARM\CMSIS\Include -ID:\work\keil5\ARM\PACK\Keil\STM32F4xx_DFP\2.5.0 -D__MICROLIB -D__UVISION_VERSION=516 -DSTM32F429xx -DUSE_STDPERIPH_DRIVER -DBOOTLOADER -DNO_MICO_RTOS -DHSE_VALUE=25000000 --omf_browse=..\..\..\..\build\bootloader\mico-fire_f429\obj_rvmdk\paltform_rtc.crf ..\..\..\..\Platform\MCU\STM32F4xx\peripherals\paltform_rtc.c]
                          THUMB

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

                  add_second_to_time PROC
;;;516    
;;;517    static void add_second_to_time( platform_rtc_time_t* time )
000000  b530              PUSH     {r4,r5,lr}
;;;518    {
;;;519        if ( time->sec == 59 )
000002  7801              LDRB     r1,[r0,#0]
000004  293b              CMP      r1,#0x3b
000006  d001              BEQ      |L1.12|
000008  1c49              ADDS     r1,r1,#1              ;518
;;;520        {
;;;521            if ( time->min == 59 )
;;;522            {
;;;523                if ( time->hr == 23 )
;;;524                {
;;;525                    if( time->date == ( LEAP_YEAR_OR_NOT(time->year) ? leap_days[time->month] :not_leap_days[time->month] ) )
;;;526                    {
;;;527                        if( time->month == 12 )
;;;528                        {
;;;529                            /* Adding one second leads to year increment */
;;;530                            time->year++;
;;;531                            time->month=1;
;;;532                            time->date=1;
;;;533                            time->hr=0;
;;;534                            time->min=0;
;;;535                            time->sec=0;
;;;536                            if( time->weekday == 7 )
;;;537                            {
;;;538                                time->weekday=1;
;;;539                            }
;;;540                            else
;;;541                            {
;;;542                                time->weekday++;
;;;543                            }
;;;544                        }
;;;545                        else
;;;546                        {
;;;547                            /* Adding one seconds leads to month increment */
;;;548                            time->month++;
;;;549                            time->date=1;
;;;550                            time->hr=0;
;;;551                            time->min=0;
;;;552                            time->sec=0;
;;;553                            if( time->weekday == 7 )
;;;554                            {
;;;555                                time->weekday=1;
;;;556                            }
;;;557                            else
;;;558                            {
;;;559                                time->weekday++;
;;;560                            }
;;;561                        }
;;;562                    }
;;;563                    else
;;;564                    {
;;;565                        /* Adding one seconds leads to data increment */
;;;566                        if ( time->weekday == 7 )
;;;567                        {
;;;568                            time->weekday=1;
;;;569                        }
;;;570                        else
;;;571                        {
;;;572                            time->weekday++;
;;;573                        }
;;;574                        time->date++;
;;;575                        time->hr=0;
;;;576                        time->min=0;
;;;577                        time->sec=0;
;;;578                    }
;;;579                }
;;;580                else
;;;581                {
;;;582                    /* Adding one seconds leads to hour increment */
;;;583                    time->hr++;
;;;584                    time->min=0;
;;;585                    time->sec=0;
;;;586                }
;;;587            }
;;;588            else
;;;589            {
;;;590                /* Adding one seconds leads to minute increment */
;;;591                time->min++;
;;;592                time->sec=0;
;;;593            }
;;;594        }
;;;595        else
;;;596        {
;;;597            time->sec++;
00000a  e037              B        |L1.124|
                  |L1.12|
00000c  7842              LDRB     r2,[r0,#1]            ;521
00000e  2100              MOVS     r1,#0                 ;521
000010  2a3b              CMP      r2,#0x3b              ;521
000012  d002              BEQ      |L1.26|
000014  1c52              ADDS     r2,r2,#1              ;521
000016  7042              STRB     r2,[r0,#1]            ;591
000018  e030              B        |L1.124|
                  |L1.26|
00001a  7882              LDRB     r2,[r0,#2]            ;523
00001c  2a17              CMP      r2,#0x17              ;523
00001e  d002              BEQ      |L1.38|
000020  1c52              ADDS     r2,r2,#1              ;523
000022  7082              STRB     r2,[r0,#2]            ;583
000024  e029              B        |L1.122|
                  |L1.38|
000026  7982              LDRB     r2,[r0,#6]            ;525
000028  7903              LDRB     r3,[r0,#4]            ;525
00002a  0794              LSLS     r4,r2,#30             ;525
00002c  7944              LDRB     r4,[r0,#5]            ;525
00002e  d013              BEQ      |L1.88|
000030  4d14              LDR      r5,|L1.132|
                  |L1.50|
000032  5d2c              LDRB     r4,[r5,r4]            ;525
000034  2501              MOVS     r5,#1                 ;531
000036  42a3              CMP      r3,r4                 ;525
000038  d117              BNE      |L1.106|
00003a  7943              LDRB     r3,[r0,#5]            ;527
00003c  2b0c              CMP      r3,#0xc               ;527
00003e  d00e              BEQ      |L1.94|
000040  1c5b              ADDS     r3,r3,#1              ;527
000042  7143              STRB     r3,[r0,#5]            ;548
                  |L1.68|
000044  7105              STRB     r5,[r0,#4]            ;532
000046  7081              STRB     r1,[r0,#2]            ;533
000048  7041              STRB     r1,[r0,#1]            ;534
00004a  7001              STRB     r1,[r0,#0]            ;535
00004c  78c1              LDRB     r1,[r0,#3]            ;536
00004e  2907              CMP      r1,#7                 ;536
000050  d009              BEQ      |L1.102|
000052  1c49              ADDS     r1,r1,#1              ;536
000054  70c1              STRB     r1,[r0,#3]            ;559
;;;598        }
;;;599    }
000056  bd30              POP      {r4,r5,pc}
                  |L1.88|
000058  4d0a              LDR      r5,|L1.132|
00005a  350d              ADDS     r5,r5,#0xd            ;525
00005c  e7e9              B        |L1.50|
                  |L1.94|
00005e  1c52              ADDS     r2,r2,#1              ;525
000060  7182              STRB     r2,[r0,#6]            ;530
000062  7145              STRB     r5,[r0,#5]            ;531
000064  e7ee              B        |L1.68|
                  |L1.102|
000066  70c5              STRB     r5,[r0,#3]            ;555
000068  bd30              POP      {r4,r5,pc}
                  |L1.106|
00006a  78c2              LDRB     r2,[r0,#3]            ;566
00006c  2a07              CMP      r2,#7                 ;566
00006e  d007              BEQ      |L1.128|
000070  1c52              ADDS     r2,r2,#1              ;566
000072  70c2              STRB     r2,[r0,#3]            ;572
                  |L1.116|
000074  1c5b              ADDS     r3,r3,#1              ;572
000076  7103              STRB     r3,[r0,#4]            ;574
000078  7081              STRB     r1,[r0,#2]            ;575
                  |L1.122|
00007a  7041              STRB     r1,[r0,#1]            ;576
                  |L1.124|
00007c  7001              STRB     r1,[r0,#0]            ;597
00007e  bd30              POP      {r4,r5,pc}
                  |L1.128|
000080  70c5              STRB     r5,[r0,#3]            ;568
000082  e7f7              B        |L1.116|
;;;600    
                          ENDP

                  |L1.132|
                          DCD      ||.constdata||

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

                  compensate_time_error PROC
;;;684    
;;;685    static OSStatus compensate_time_error( uint32_t sec, bool subtract )
000000  b510              PUSH     {r4,lr}
;;;686    {
000002  4604              MOV      r4,r0
000004  b929              CBNZ     r1,|L2.18|
                  |L2.6|
;;;687        if( subtract == false )
;;;688        {
;;;689            /* Adding seconds to time */
;;;690            for( sec=sec ; sec > 0; sec--)
000006  b154              CBZ      r4,|L2.30|
;;;691            {
;;;692                add_second_to_time(&saved_rtc_time);
000008  4806              LDR      r0,|L2.36|
00000a  f7fffffe          BL       add_second_to_time
00000e  1e64              SUBS     r4,r4,#1
000010  e7f9              B        |L2.6|
                  |L2.18|
;;;693            }
;;;694        }
;;;695        else
;;;696        {
;;;697            /* Subtracting seconds from time */
;;;698            for( sec=sec ; sec > 0; sec-- )
000012  b124              CBZ      r4,|L2.30|
;;;699            {
;;;700                subtract_second_from_time(&saved_rtc_time);
000014  4803              LDR      r0,|L2.36|
000016  f7fffffe          BL       subtract_second_from_time
00001a  1e64              SUBS     r4,r4,#1
00001c  e7f9              B        |L2.18|
                  |L2.30|
;;;701            }
;;;702        }
;;;703        return kNoErr;
00001e  2000              MOVS     r0,#0
;;;704    }
000020  bd10              POP      {r4,pc}
;;;705    
                          ENDP

000022  0000              DCW      0x0000
                  |L2.36|
                          DCD      ||.data||+0xf

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

                  convert_rtc_calendar_values_to_units_passed PROC
;;;463    
;;;464    static uint32_t convert_rtc_calendar_values_to_units_passed( void )
000000  b57c              PUSH     {r2-r6,lr}
;;;465    {
;;;466        long int        temp1=0;
;;;467        long int        temp2=0;
000002  2500              MOVS     r5,#0
;;;468        int             temp=0;
;;;469        long int        temp_days=0;
000004  462c              MOV      r4,r5
;;;470        uint8_t         current_year;
;;;471        RTC_TimeTypeDef rtc_read_time;
;;;472        RTC_DateTypeDef rtc_read_date;
;;;473    
;;;474    
;;;475        /* Read current rtc time */
;;;476        RTC_GetTime( RTC_Format_BIN, &rtc_read_time );
000006  4669              MOV      r1,sp
000008  4628              MOV      r0,r5
00000a  f7fffffe          BL       RTC_GetTime
;;;477        RTC_GetDate( RTC_Format_BIN, &rtc_read_date );
00000e  a901              ADD      r1,sp,#4
000010  2000              MOVS     r0,#0
000012  f7fffffe          BL       RTC_GetDate
;;;478    
;;;479        /* Calculate number of days in the previous years */
;;;480        if( rtc_read_date.RTC_Year != 0 )
000016  f89d2007          LDRB     r2,[sp,#7]
00001a  b18a              CBZ      r2,|L3.64|
00001c  1e50              SUBS     r0,r2,#1
;;;481        {
;;;482            for( temp = (int)( rtc_read_date.RTC_Year - 1 ); temp >= 0; temp-- )
00001e  d40f              BMI      |L3.64|
;;;483            {
;;;484                temp_days += (LEAP_YEAR_OR_NOT(temp)) ? (LEAP_YEAR_DAY_COUNT): (NOT_LEAP_YEAR_DAY_COUNT);
000020  f44f73b7          MOV      r3,#0x16e
000024  1e5e              SUBS     r6,r3,#1
                  |L3.38|
000026  17c1              ASRS     r1,r0,#31
000028  eb007191          ADD      r1,r0,r1,LSR #30
00002c  f0210103          BIC      r1,r1,#3
000030  4281              CMP      r1,r0
000032  d101              BNE      |L3.56|
000034  4619              MOV      r1,r3
000036  e000              B        |L3.58|
                  |L3.56|
000038  4631              MOV      r1,r6
                  |L3.58|
00003a  440c              ADD      r4,r4,r1
00003c  1e40              SUBS     r0,r0,#1
00003e  d5f2              BPL      |L3.38|
                  |L3.64|
;;;485            }
;;;486        }
;;;487    
;;;488        current_year = rtc_read_date.RTC_Year;
;;;489        check_string( (rtc_read_date.RTC_Month != 0), "Inappropriate month value in RTC");
000040  f89d0005          LDRB     r0,[sp,#5]
000044  b118              CBZ      r0,|L3.78|
;;;490        if( rtc_read_date.RTC_Month != 0 )
;;;491        {
;;;492            /* Calculate number of days passed in the current year and add them to previous days value */
;;;493            for( temp = (int)( rtc_read_date.RTC_Month - 1 ); temp > 0; temp-- )
;;;494            {
;;;495                temp_days += LEAP_YEAR_OR_NOT(current_year)?(leap_days[temp]):(not_leap_days[temp]);
000046  4b15              LDR      r3,|L3.156|
000048  f1a3060d          SUB      r6,r3,#0xd
00004c  e005              B        |L3.90|
                  |L3.78|
00004e  be00              BKPT     #0                    ;489
000050  e006              B        |L3.96|
                  |L3.82|
000052  0791              LSLS     r1,r2,#30
000054  d01d              BEQ      |L3.146|
000056  5c31              LDRB     r1,[r6,r0]
                  |L3.88|
000058  440c              ADD      r4,r4,r1
                  |L3.90|
00005a  1e40              SUBS     r0,r0,#1
00005c  2800              CMP      r0,#0                 ;493
00005e  dcf8              BGT      |L3.82|
                  |L3.96|
;;;496            }
;;;497        }
;;;498    
;;;499        /* Convert passed hours, seconds and minutes to seconds */
;;;500        temp1 = rtc_read_time.RTC_Seconds + rtc_read_time.RTC_Minutes*NUM_SECONDS_IN_MINUTE + rtc_read_time.RTC_Hours*NUM_SECONDS_IN_HOUR;
000060  f89d0001          LDRB     r0,[sp,#1]
000064  ebc01000          RSB      r0,r0,r0,LSL #4
000068  0081              LSLS     r1,r0,#2
00006a  f89d0000          LDRB     r0,[sp,#0]
00006e  ebc01240          RSB      r2,r0,r0,LSL #5
000072  ebc22000          RSB      r0,r2,r0,LSL #8
000076  eb011000          ADD      r0,r1,r0,LSL #4
00007a  f89d1002          LDRB     r1,[sp,#2]
00007e  4401              ADD      r1,r1,r0
;;;501    
;;;502        check_string(( rtc_read_date.RTC_Date != 0 ), "Inappropriate date value in RTC");
000080  f89d0006          LDRB     r0,[sp,#6]
000084  b138              CBZ      r0,|L3.150|
000086  1e64              SUBS     r4,r4,#1
;;;503    
;;;504        /* Convert passed days to seconds */
;;;505        if( rtc_read_date.RTC_Date != 0 )
;;;506        {
;;;507            temp2 = ( ( rtc_read_date.RTC_Date - 1 ) + temp_days ) * NUM_SECONDS_IN_HOUR * 24;
000088  1905              ADDS     r5,r0,r4
00008a  4805              LDR      r0,|L3.160|
00008c  4345              MULS     r5,r0,r5
                  |L3.142|
;;;508        }
;;;509    
;;;510        /* Return total number of seconds passed  */
;;;511        return (uint32_t)( temp1 + temp2 );
00008e  1948              ADDS     r0,r1,r5
;;;512    
;;;513    }
000090  bd7c              POP      {r2-r6,pc}
                  |L3.146|
000092  5c19              LDRB     r1,[r3,r0]            ;495
000094  e7e0              B        |L3.88|
                  |L3.150|
000096  be00              BKPT     #0                    ;502
000098  e7f9              B        |L3.142|
;;;514    
                          ENDP

00009a  0000              DCW      0x0000
                  |L3.156|
                          DCD      ||.constdata||+0xd
                  |L3.160|
                          DCD      0x00015180

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

                  platform_rtc_abort_powersave PROC
;;;284    
;;;285    OSStatus platform_rtc_abort_powersave( void )
000000  b510              PUSH     {r4,lr}
;;;286    {
;;;287        /* Change the clocking state of the RTC, so its tick is back to normal */
;;;288        stm32f2_rtc_change_clock( &current_clock_state, CLOCKING_EVERY_SEC );
000002  2100              MOVS     r1,#0
000004  4804              LDR      r0,|L4.24|
000006  f7fffffe          BL       stm32f2_rtc_change_clock
;;;289    
;;;290    //#ifdef RTC_ENABLED /* !!If we dont set the time after the clocks have been changed. */
;;;291        /*get an error while trying to enter STM RTC initialisation mode */
;;;292        /* restore time saved before */
;;;293        platform_rtc_set_time( &saved_rtc_time );
00000a  4803              LDR      r0,|L4.24|
00000c  300f              ADDS     r0,r0,#0xf
00000e  f7fffffe          BL       platform_rtc_set_time
;;;294    //#endif /* #ifdef RTC_ENABLED */
;;;295        return kNoErr;
000012  2000              MOVS     r0,#0
;;;296    }
000014  bd10              POP      {r4,pc}
;;;297    
                          ENDP

000016  0000              DCW      0x0000
                  |L4.24|
                          DCD      ||.data||

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

                  platform_rtc_enter_powersave PROC
;;;267    
;;;268    OSStatus platform_rtc_enter_powersave ( void )
000000  b510              PUSH     {r4,lr}
;;;269    {
;;;270    
;;;271    //#ifdef RTC_ENABLED /* !!If we dont read the time and store it. get an error while trying to enter STM RTC initialisation mode */
;;;272        /* save current rtc time locally */
;;;273        platform_rtc_get_time( &saved_rtc_time );
000002  4806              LDR      r0,|L5.28|
000004  f7fffffe          BL       platform_rtc_get_time
;;;274    //#endif /* #ifdef RTC_ENABLED */
;;;275    
;;;276        /* Reset RTC values */
;;;277        reset_rtc_values();
000008  f7fffffe          BL       reset_rtc_values
;;;278    
;;;279        /* Change the clocking state of the RTC, so it ticks every 1.25ms while cpu is sleeping - 800Hz clock */
;;;280        stm32f2_rtc_change_clock( &current_clock_state, CLOCKING_EVERY_1p25MSEC );
00000c  4803              LDR      r0,|L5.28|
00000e  2101              MOVS     r1,#1
000010  380f              SUBS     r0,r0,#0xf
000012  f7fffffe          BL       stm32f2_rtc_change_clock
;;;281    
;;;282        return kNoErr;
000016  2000              MOVS     r0,#0
;;;283    }
000018  bd10              POP      {r4,pc}
;;;284    
                          ENDP

00001a  0000              DCW      0x0000
                  |L5.28|
                          DCD      ||.data||+0xf

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

                  platform_rtc_exit_powersave PROC
;;;297    
;;;298    OSStatus platform_rtc_exit_powersave( uint32_t requested_sleep_time, uint32_t *cpu_sleep_time )
000000  e92d41f0          PUSH     {r4-r8,lr}
;;;299    {
000004  460d              MOV      r5,r1
000006  ed2d8b02          VPUSH    {d8}
00000a  4606              MOV      r6,r0
;;;300        uint32_t    time_units_passed_since_powersave_enter; /* time unit is 1.25ms when we are sleeping */
;;;301    #ifdef MICO_ENABLE_MCU_RTC
;;;302        uint32_t    seconds_contribution;
;;;303        static int  leftover=0;
;;;304    #endif /* #ifdef MICO_ENABLE_MCU_RTC */
;;;305        float       temp;
;;;306    
;;;307        /* Get current calendar register values and convert them to a number of 1.25ms that passed since power-save entry */
;;;308        time_units_passed_since_powersave_enter = convert_rtc_calendar_values_to_units_passed();
00000c  f7fffffe          BL       convert_rtc_calendar_values_to_units_passed
000010  4604              MOV      r4,r0
000012  ee004a10          VMOV     s0,r4
000016  eeb78a04          VMOV.F32 s16,#1.25000000
00001a  f44f717a          MOV      r1,#0x3e8
00001e  eeb80a40          VCVT.F32.U32 s0,s0
000022  ee200a08          VMUL.F32 s0,s0,s16
000026  eebc0ac0          VCVT.U32.F32 s0,s0
00002a  ee100a10          VMOV     r0,s0
00002e  fbb0f0f1          UDIV     r0,r0,r1
000032  b110              CBZ      r0,|L6.58|
000034  2100              MOVS     r1,#0
000036  f7fffffe          BL       compensate_time_error
                  |L6.58|
00003a  f44f7148          MOV      r1,#0x320
00003e  fbb4f2f1          UDIV     r2,r4,r1
;;;309    #ifdef MICO_ENABLE_MCU_RTC
;;;310    
;;;311        /* Make contribution of time-units to the current time, get the leftover that is less then a second */
;;;312        leftover+= add_1p25ms_contribution( time_units_passed_since_powersave_enter, &seconds_contribution );
000042  4f16              LDR      r7,|L6.156|
000044  fb014012          MLS      r0,r1,r2,r4
000048  687a              LDR      r2,[r7,#4]  ; leftover
00004a  4410              ADD      r0,r0,r2
;;;313    
;;;314        /* Subtract 1 second for every 1.25 * 800, because in reality we are running 799,2195Hz which wil give the tick value = 1.25122 */
;;;315        if( leftover > NUM_1P25MS_IN_SEC )
00004c  6078              STR      r0,[r7,#4]  ; leftover
00004e  4288              CMP      r0,r1
000050  dd07              BLE      |L6.98|
;;;316        {
;;;317            compensate_time_error(1, false);
000052  2100              MOVS     r1,#0
000054  2001              MOVS     r0,#1
000056  f7fffffe          BL       compensate_time_error
;;;318            leftover -= NUM_1P25MS_IN_SEC;
00005a  6878              LDR      r0,[r7,#4]  ; leftover
00005c  f5a07048          SUB      r0,r0,#0x320
000060  6078              STR      r0,[r7,#4]  ; leftover
                  |L6.98|
;;;319        }
;;;320    #endif /* #ifdef MICO_ENABLE_MCU_RTC */
;;;321    
;;;322    //#ifdef RTC_ENABLED /* !!If we dont set the time after the clocks have been changed. */
;;;323        /*get an error while trying to enter STM RTC initialisation mode */
;;;324    
;;;325        /* update RTC time */
;;;326        platform_rtc_set_time(&saved_rtc_time);
000062  480e              LDR      r0,|L6.156|
000064  300f              ADDS     r0,r0,#0xf
000066  f7fffffe          BL       platform_rtc_set_time
;;;327    //#endif /* #ifdef RTC_ENABLED */
;;;328    
;;;329        /* Change, rtc clock state and update rtc peripheral, even when RTC is not enabled */
;;;330        /* reducing clock frequency is better for power consumption */
;;;331        stm32f2_rtc_change_clock( &current_clock_state, CLOCKING_EVERY_SEC );
00006a  2100              MOVS     r1,#0
00006c  480b              LDR      r0,|L6.156|
00006e  f7fffffe          BL       stm32f2_rtc_change_clock
;;;332        temp = (float)time_units_passed_since_powersave_enter * (float)1.25;
000072  ee004a10          VMOV     s0,r4
;;;333    
;;;334        /* Round up to milliseconds, not a problem if the system will get less ticks as expected, it is not a time which is populated to a user */
;;;335        if( requested_sleep_time > 1 )
000076  2e01              CMP      r6,#1
000078  eeb80a40          VCVT.F32.U32 s0,s0                 ;332
00007c  ee200a08          VMUL.F32 s0,s0,s16             ;332
000080  d904              BLS      |L6.140|
;;;336        {
;;;337            *cpu_sleep_time = (uint32_t)temp;
000082  eebc0ac0          VCVT.U32.F32 s0,s0
000086  ed850a00          VSTR     s0,[r5,#0]
00008a  e001              B        |L6.144|
                  |L6.140|
;;;338        }
;;;339        else
;;;340        {
;;;341            /* When a delay was set to 1, we will get a wake up interrupt before RTC tick */
;;;342            /* we will think that there were no rtc tick, and the cpu_sleep_time will be set to 0 */
;;;343            /* operating system will miss a tick which in reality did happen */
;;;344            *cpu_sleep_time = 1;
00008c  2001              MOVS     r0,#1
00008e  6028              STR      r0,[r5,#0]
                  |L6.144|
;;;345        }
;;;346    
;;;347        return kNoErr;
000090  2000              MOVS     r0,#0
;;;348    }
000092  ecbd8b02          VPOP     {d8}
000096  e8bd81f0          POP      {r4-r8,pc}
;;;349    
                          ENDP

00009a  0000              DCW      0x0000
                  |L6.156|
                          DCD      ||.data||

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

                  platform_rtc_get_time PROC
;;;197    */
;;;198    OSStatus platform_rtc_get_time( platform_rtc_time_t* time)
000000  b51c              PUSH     {r2-r4,lr}
;;;199    {
000002  0004              MOVS     r4,r0
000004  d01e              BEQ      |L7.68|
;;;200    #ifdef MICO_ENABLE_MCU_RTC
;;;201      RTC_TimeTypeDef rtc_read_time;
;;;202      RTC_DateTypeDef rtc_read_date;
;;;203      
;;;204      if( time == 0 )
;;;205      {
;;;206        return kParamErr;
;;;207      }
;;;208      
;;;209      /* save current rtc time */
;;;210      RTC_GetTime( RTC_Format_BIN, &rtc_read_time );
000006  a901              ADD      r1,sp,#4
000008  2000              MOVS     r0,#0
00000a  f7fffffe          BL       RTC_GetTime
;;;211      RTC_GetDate( RTC_Format_BIN, &rtc_read_date );
00000e  4669              MOV      r1,sp
000010  2000              MOVS     r0,#0
000012  f7fffffe          BL       RTC_GetDate
;;;212      
;;;213      /* fill structure */
;;;214      time->sec     = rtc_read_time.RTC_Seconds;
000016  f89d0006          LDRB     r0,[sp,#6]
00001a  7020              STRB     r0,[r4,#0]
;;;215      time->min     = rtc_read_time.RTC_Minutes;
00001c  f89d0005          LDRB     r0,[sp,#5]
000020  7060              STRB     r0,[r4,#1]
;;;216      time->hr      = rtc_read_time.RTC_Hours;
000022  f89d0004          LDRB     r0,[sp,#4]
000026  70a0              STRB     r0,[r4,#2]
;;;217      time->weekday = rtc_read_date.RTC_WeekDay;
000028  f89d0000          LDRB     r0,[sp,#0]
00002c  70e0              STRB     r0,[r4,#3]
;;;218      time->date    = rtc_read_date.RTC_Date;
00002e  f89d0002          LDRB     r0,[sp,#2]
000032  7120              STRB     r0,[r4,#4]
;;;219      time->month   = rtc_read_date.RTC_Month;
000034  f89d0001          LDRB     r0,[sp,#1]
000038  7160              STRB     r0,[r4,#5]
;;;220      time->year    = rtc_read_date.RTC_Year;
00003a  f89d0003          LDRB     r0,[sp,#3]
00003e  71a0              STRB     r0,[r4,#6]
;;;221      
;;;222      return kNoErr;
000040  2000              MOVS     r0,#0
;;;223    #else /* #ifdef MICO_ENABLE_MCU_RTC */
;;;224      UNUSED_PARAMETER(time);
;;;225      return kUnsupportedErr;
;;;226    #endif /* #ifdef MICO_ENABLE_MCU_RTC */
;;;227    }
000042  bd1c              POP      {r2-r4,pc}
                  |L7.68|
000044  4800              LDR      r0,|L7.72|
000046  bd1c              POP      {r2-r4,pc}
;;;228    
                          ENDP

                  |L7.72|
                          DCD      0xffffe5cf

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

                  platform_rtc_init PROC
;;;132    
;;;133    OSStatus platform_rtc_init(void)
000000  b53e              PUSH     {r1-r5,lr}
;;;134    {
;;;135    #ifdef MICO_ENABLE_MCU_RTC
;;;136      RTC_InitTypeDef RTC_InitStruct;
;;;137      
;;;138      RTC_DeInit( );
000002  f7fffffe          BL       RTC_DeInit
;;;139      
;;;140      RTC_InitStruct.RTC_HourFormat = RTC_HourFormat_24;
000006  2000              MOVS     r0,#0
;;;141      
;;;142      /* RTC ticks every second */
;;;143      RTC_InitStruct.RTC_AsynchPrediv = 0x7F;
000008  9000              STR      r0,[sp,#0]
00000a  207f              MOVS     r0,#0x7f
;;;144      RTC_InitStruct.RTC_SynchPrediv = 0xFF;
00000c  9001              STR      r0,[sp,#4]
00000e  20ff              MOVS     r0,#0xff
;;;145      
;;;146      RTC_Init( &RTC_InitStruct );
000010  9002              STR      r0,[sp,#8]
000012  4668              MOV      r0,sp
000014  f7fffffe          BL       RTC_Init
;;;147    
;;;148    #ifdef USE_RTC_BKP
;;;149      /* Enable the PWR clock */
;;;150      RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
000018  2101              MOVS     r1,#1
00001a  0708              LSLS     r0,r1,#28
00001c  f7fffffe          BL       RCC_APB1PeriphClockCmd
;;;151      /* Allow access to BKP Domain */
;;;152      PWR_BackupAccessCmd(ENABLE);
000020  2001              MOVS     r0,#1
000022  f7fffffe          BL       PWR_BackupAccessCmd
;;;153      PWR_BackupRegulatorCmd(ENABLE);
000026  2001              MOVS     r0,#1
000028  f7fffffe          BL       PWR_BackupRegulatorCmd
;;;154    #endif
;;;155    
;;;156      /* Enable the LSE OSC */
;;;157      RCC_LSEConfig(RCC_LSE_ON);
00002c  2001              MOVS     r0,#1
00002e  f7fffffe          BL       RCC_LSEConfig
                  |L8.50|
;;;158      /* Wait till LSE is ready */
;;;159      while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
000032  2041              MOVS     r0,#0x41
000034  f7fffffe          BL       RCC_GetFlagStatus
000038  2800              CMP      r0,#0
00003a  d0fa              BEQ      |L8.50|
;;;160      {
;;;161      }
;;;162      /* Select the RTC Clock Source */
;;;163      RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
00003c  f44f7080          MOV      r0,#0x100
000040  f7fffffe          BL       RCC_RTCCLKConfig
;;;164      
;;;165      /* Enable the RTC Clock */
;;;166      RCC_RTCCLKCmd(ENABLE);
000044  2001              MOVS     r0,#1
000046  f7fffffe          BL       RCC_RTCCLKCmd
;;;167      
;;;168      /* RTC configuration -------------------------------------------------------*/
;;;169      /* Wait for RTC APB registers synchronisation */
;;;170      RTC_WaitForSynchro();
00004a  f7fffffe          BL       RTC_WaitForSynchro
;;;171      
;;;172    #ifdef USE_RTC_BKP
;;;173      if (RTC_ReadBackupRegister(RTC_BKP_DR0) != USE_RTC_BKP) {
00004e  2000              MOVS     r0,#0
000050  f7fffffe          BL       RTC_ReadBackupRegister
000054  4c05              LDR      r4,|L8.108|
000056  42a0              CMP      r0,r4
000058  d006              BEQ      |L8.104|
;;;174        /* set it to 12:20:30 08/04/2013 monday */
;;;175        platform_rtc_set_time(&default_rtc_time);
00005a  4805              LDR      r0,|L8.112|
00005c  f7fffffe          BL       platform_rtc_set_time
;;;176        RTC_WriteBackupRegister(RTC_BKP_DR0, USE_RTC_BKP);
000060  4621              MOV      r1,r4
000062  2000              MOVS     r0,#0
000064  f7fffffe          BL       RTC_WriteBackupRegister
                  |L8.104|
;;;177      }
;;;178    #else
;;;179      //#ifdef RTC_ENABLED
;;;180      /* application must have mico_application_default_time structure declared somewhere, otherwise it wont compile */
;;;181      /* write default application time inside rtc */
;;;182      platform_rtc_set_time(&mico_default_time);
;;;183      //#endif /* RTC_ENABLED */
;;;184    #endif
;;;185      return kNoErr;
000068  2000              MOVS     r0,#0
;;;186    #else
;;;187      return kUnsupportedErr;
;;;188    #endif
;;;189    }
00006a  bd3e              POP      {r1-r5,pc}
;;;190    
                          ENDP

                  |L8.108|
                          DCD      0x00bb32f2
                  |L8.112|
                          DCD      ||.data||+0x8

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

                  platform_rtc_set_time PROC
;;;234    */
;;;235    OSStatus platform_rtc_set_time( const platform_rtc_time_t* time )
000000  b51c              PUSH     {r2-r4,lr}
;;;236    {
;;;237    #ifdef MICO_ENABLE_MCU_RTC
;;;238      RTC_TimeTypeDef rtc_write_time;
;;;239      RTC_DateTypeDef rtc_write_date;
;;;240      bool    valid = false;
;;;241        
;;;242      MICO_VERIFY_TIME(time, valid);
000002  7801              LDRB     r1,[r0,#0]
000004  293c              CMP      r1,#0x3c
000006  d80b              BHI      |L9.32|
000008  7841              LDRB     r1,[r0,#1]
00000a  293c              CMP      r1,#0x3c
00000c  d808              BHI      |L9.32|
00000e  7881              LDRB     r1,[r0,#2]
000010  2918              CMP      r1,#0x18
000012  d805              BHI      |L9.32|
000014  7901              LDRB     r1,[r0,#4]
000016  291f              CMP      r1,#0x1f
000018  d802              BHI      |L9.32|
00001a  7941              LDRB     r1,[r0,#5]
00001c  290c              CMP      r1,#0xc
00001e  d901              BLS      |L9.36|
                  |L9.32|
;;;243      if( valid == false )
;;;244      {
;;;245        return kParamErr;
000020  4811              LDR      r0,|L9.104|
;;;246      }
;;;247    
;;;248      rtc_write_time.RTC_H12     = 0;
;;;249      rtc_write_time.RTC_Seconds = time->sec;
;;;250      rtc_write_time.RTC_Minutes = time->min;
;;;251      rtc_write_time.RTC_Hours   = time->hr;
;;;252      rtc_write_date.RTC_WeekDay = time->weekday;
;;;253      rtc_write_date.RTC_Date    = time->date;
;;;254      rtc_write_date.RTC_Month   = time->month;
;;;255      rtc_write_date.RTC_Year    = time->year;
;;;256      
;;;257      
;;;258      RTC_SetTime( RTC_Format_BIN, &rtc_write_time );
;;;259      RTC_SetDate( RTC_Format_BIN, &rtc_write_date );
;;;260      
;;;261      return kNoErr;
;;;262    #else /* #ifdef MICO_ENABLE_MCU_RTC */
;;;263      UNUSED_PARAMETER(time);
;;;264      return kUnsupportedErr;
;;;265    #endif /* #ifdef MICO_ENABLE_MCU_RTC */
;;;266    }
000022  bd1c              POP      {r2-r4,pc}
                  |L9.36|
000024  2100              MOVS     r1,#0                 ;248
000026  f88d1003          STRB     r1,[sp,#3]            ;248
00002a  7801              LDRB     r1,[r0,#0]            ;249
00002c  f88d1002          STRB     r1,[sp,#2]            ;249
000030  7841              LDRB     r1,[r0,#1]            ;250
000032  f88d1001          STRB     r1,[sp,#1]            ;250
000036  7881              LDRB     r1,[r0,#2]            ;251
000038  f88d1000          STRB     r1,[sp,#0]            ;251
00003c  78c1              LDRB     r1,[r0,#3]            ;252
00003e  f88d1004          STRB     r1,[sp,#4]            ;252
000042  7901              LDRB     r1,[r0,#4]            ;253
000044  f88d1006          STRB     r1,[sp,#6]            ;253
000048  7941              LDRB     r1,[r0,#5]            ;254
00004a  f88d1005          STRB     r1,[sp,#5]            ;254
00004e  7980              LDRB     r0,[r0,#6]            ;255
000050  f88d0007          STRB     r0,[sp,#7]            ;255
000054  4669              MOV      r1,sp                 ;258
000056  2000              MOVS     r0,#0                 ;258
000058  f7fffffe          BL       RTC_SetTime
00005c  a901              ADD      r1,sp,#4              ;259
00005e  2000              MOVS     r0,#0                 ;259
000060  f7fffffe          BL       RTC_SetDate
000064  2000              MOVS     r0,#0                 ;261
000066  bd1c              POP      {r2-r4,pc}
;;;267    
                          ENDP

                  |L9.104|
                          DCD      0xffffe5cf

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

                  reset_rtc_values PROC
;;;422    
;;;423    static void reset_rtc_values( void )
000000  b510              PUSH     {r4,lr}
;;;424    {
;;;425        ErrorStatus status;
;;;426        int retry = 3;
000002  2403              MOVS     r4,#3
                  |L10.4|
;;;427    
;;;428        /* Disable write protection of rtc registers */
;;;429        do{
;;;430          RTC_WriteProtectionCmd(DISABLE);
000004  2000              MOVS     r0,#0
000006  f7fffffe          BL       RTC_WriteProtectionCmd
;;;431          status = RTC_EnterInitMode();
00000a  f7fffffe          BL       RTC_EnterInitMode
00000e  1e64              SUBS     r4,r4,#1
;;;432          REFERENCE_DEBUG_ONLY_VARIABLE(status);
;;;433          retry--;
;;;434        }while( retry && (status!=SUCCESS) );
000010  d002              BEQ      |L10.24|
000012  2801              CMP      r0,#1
000014  d1f6              BNE      |L10.4|
000016  e002              B        |L10.30|
                  |L10.24|
;;;435    
;;;436        check_string( status==SUCCESS, "Rtc can not enter intialisation mode");  
000018  2801              CMP      r0,#1
00001a  d000              BEQ      |L10.30|
00001c  be00              BKPT     #0
                  |L10.30|
;;;437    
;;;438        /* Reset calendar date registers */
;;;439        RTC->TR = 0;
00001e  4813              LDR      r0,|L10.108|
000020  2400              MOVS     r4,#0
000022  6004              STR      r4,[r0,#0]
;;;440        RTC_ExitInitMode();
000024  f7fffffe          BL       RTC_ExitInitMode
;;;441        status = RTC_WaitForSynchro();
000028  f7fffffe          BL       RTC_WaitForSynchro
;;;442        check_string(  status==SUCCESS, "Rtc can not synchronize" );
00002c  2801              CMP      r0,#1
00002e  d000              BEQ      |L10.50|
000030  be00              BKPT     #0
                  |L10.50|
;;;443    
;;;444    
;;;445        /* Enable write protection of rtc registers */
;;;446        RTC_WriteProtectionCmd(ENABLE);
000032  2001              MOVS     r0,#1
000034  f7fffffe          BL       RTC_WriteProtectionCmd
;;;447    
;;;448        /* Disable write protection of the rtc registers */
;;;449        RTC_WriteProtectionCmd(DISABLE);
000038  2000              MOVS     r0,#0
00003a  f7fffffe          BL       RTC_WriteProtectionCmd
;;;450        status = RTC_EnterInitMode();
00003e  f7fffffe          BL       RTC_EnterInitMode
;;;451        check_string(  status==SUCCESS, "Rtc can not enter intialisation mode" );
000042  2801              CMP      r0,#1
000044  d000              BEQ      |L10.72|
000046  be00              BKPT     #0
                  |L10.72|
;;;452    
;;;453        /* 2000 year 01/01 */
;;;454        RTC->DR= 0;
000048  4808              LDR      r0,|L10.108|
00004a  1d00              ADDS     r0,r0,#4
00004c  6004              STR      r4,[r0,#0]
;;;455        RTC->DR= ( 1<<13 ) | ( 1<<8 ) | ( 1<<0 );
00004e  f2421101          MOV      r1,#0x2101
000052  6001              STR      r1,[r0,#0]
;;;456        RTC_ExitInitMode();
000054  f7fffffe          BL       RTC_ExitInitMode
;;;457        status = RTC_WaitForSynchro();
000058  f7fffffe          BL       RTC_WaitForSynchro
;;;458        check_string(status==SUCCESS, "Rtc can not synchronize");
00005c  2801              CMP      r0,#1
00005e  d000              BEQ      |L10.98|
000060  be00              BKPT     #0
                  |L10.98|
;;;459    
;;;460        /* Enable write protection of rtc registers */
;;;461        RTC_WriteProtectionCmd(ENABLE);
000062  e8bd4010          POP      {r4,lr}
000066  2001              MOVS     r0,#1
000068  f7ffbffe          B.W      RTC_WriteProtectionCmd
;;;462    }
;;;463    
                          ENDP

                  |L10.108|
                          DCD      0x40002800

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

                  stm32f2_rtc_change_clock PROC
;;;349    
;;;350    static OSStatus stm32f2_rtc_change_clock( rtc_clock_state_t* current, rtc_clock_state_t target )
000000  b570              PUSH     {r4-r6,lr}
;;;351    {
000002  4604              MOV      r4,r0
;;;352        uint8_t sync_div;
;;;353        uint8_t async_div;
;;;354        ErrorStatus status;
;;;355    
;;;356        /* Changing the synchronous and asynchronous prescalers according to the current clocking state and target_clock_state */
;;;357        /* of the RTC */
;;;358        if( *current == CLOCKING_EVERY_SEC )
000004  7800              LDRB     r0,[r0,#0]
;;;359        {
;;;360            if( target == CLOCKING_EVERY_1p25MSEC )
;;;361            {
;;;362                sync_div = 0;
;;;363                async_div= 40;
;;;364    
;;;365                /* Disable write protection of rtc registers, now we will be able to update RTC register values */
;;;366                RTC_WriteProtectionCmd(DISABLE);
;;;367    
;;;368                /* Enable initialisation mode */
;;;369                status = RTC_EnterInitMode();
;;;370                REFERENCE_DEBUG_ONLY_VARIABLE(status);
;;;371                check_string( status==SUCCESS, "Rtc can not enter intialisation mode");
;;;372    
;;;373                /* Update RTC prescaler */
;;;374                RTC->PRER = (uint32_t)( sync_div );
000006  4d1a              LDR      r5,|L11.112|
000008  b110              CBZ      r0,|L11.16|
;;;375                RTC->PRER |= (uint32_t)(async_div << 16);
;;;376                RTC_ExitInitMode();
;;;377    
;;;378                /* Enable write proteciton of rtc registers back */
;;;379                RTC_WriteProtectionCmd(ENABLE);
;;;380                *current = CLOCKING_EVERY_1p25MSEC;
;;;381                return kNoErr;
;;;382            }
;;;383            else
;;;384            {
;;;385                return kNoErr;
;;;386            }
;;;387        }
;;;388        else if( *current == CLOCKING_EVERY_1p25MSEC )
00000a  2801              CMP      r0,#1
00000c  d017              BEQ      |L11.62|
00000e  e02c              B        |L11.106|
                  |L11.16|
000010  2901              CMP      r1,#1                 ;360
000012  d12a              BNE      |L11.106|
000014  2600              MOVS     r6,#0                 ;362
000016  4630              MOV      r0,r6                 ;366
000018  f7fffffe          BL       RTC_WriteProtectionCmd
00001c  f7fffffe          BL       RTC_EnterInitMode
000020  2801              CMP      r0,#1                 ;371
000022  d000              BEQ      |L11.38|
000024  be00              BKPT     #0                    ;371
                  |L11.38|
000026  602e              STR      r6,[r5,#0]            ;374
000028  6828              LDR      r0,[r5,#0]            ;375
00002a  f4401020          ORR      r0,r0,#0x280000       ;375
00002e  6028              STR      r0,[r5,#0]            ;375
000030  f7fffffe          BL       RTC_ExitInitMode
000034  2001              MOVS     r0,#1                 ;379
000036  f7fffffe          BL       RTC_WriteProtectionCmd
00003a  2001              MOVS     r0,#1                 ;380
00003c  e014              B        |L11.104|
                  |L11.62|
;;;389        {
;;;390            if( target == CLOCKING_EVERY_SEC )
00003e  b9a1              CBNZ     r1,|L11.106|
;;;391            {
;;;392                /* We will get approximately 800Hz clock, 1 tick will correspond to 1.25ms(0,00125s), by addind 8 together we will get 1ms  */
;;;393                /* the closest division factor which is 40.96( 32768/800 ), we will take 41, the error will be very very tiny */
;;;394                async_div = 127;
;;;395                sync_div = 255;
000040  26ff              MOVS     r6,#0xff
;;;396    
;;;397                /* Disable write protection of rtc registers */
;;;398                RTC_WriteProtectionCmd(DISABLE);
000042  2000              MOVS     r0,#0
000044  f7fffffe          BL       RTC_WriteProtectionCmd
;;;399    
;;;400                /* Enable initialisation mode */
;;;401                status = RTC_EnterInitMode();
000048  f7fffffe          BL       RTC_EnterInitMode
;;;402                check_string( status==SUCCESS, "Rtc can not enter intialisation mode");
00004c  2801              CMP      r0,#1
00004e  d000              BEQ      |L11.82|
000050  be00              BKPT     #0
                  |L11.82|
;;;403    
;;;404                /* Update RTC prescaler */
;;;405                RTC->PRER = (uint32_t)( sync_div );
000052  602e              STR      r6,[r5,#0]
;;;406                RTC->PRER |= (uint32_t)(async_div << 16);
000054  6828              LDR      r0,[r5,#0]
000056  f44000fe          ORR      r0,r0,#0x7f0000
00005a  6028              STR      r0,[r5,#0]
;;;407    
;;;408                RTC_ExitInitMode();
00005c  f7fffffe          BL       RTC_ExitInitMode
;;;409    
;;;410                /* Enable write proteciton of rtc registers back */
;;;411                RTC_WriteProtectionCmd(ENABLE);
000060  2001              MOVS     r0,#1
000062  f7fffffe          BL       RTC_WriteProtectionCmd
;;;412                *current = CLOCKING_EVERY_SEC;
000066  2000              MOVS     r0,#0
                  |L11.104|
000068  7020              STRB     r0,[r4,#0]            ;380
                  |L11.106|
;;;413                return kNoErr;
;;;414            }
;;;415            else
;;;416            {
;;;417                return kNoErr;
;;;418            }
;;;419        }
;;;420        return kNoErr;
00006a  2000              MOVS     r0,#0
;;;421    }
00006c  bd70              POP      {r4-r6,pc}
;;;422    
                          ENDP

00006e  0000              DCW      0x0000
                  |L11.112|
                          DCD      0x40002810

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

                  subtract_second_from_time PROC
;;;600    
;;;601    static void subtract_second_from_time( platform_rtc_time_t* time )
000000  b5f0              PUSH     {r4-r7,lr}
;;;602    {
;;;603        if ( time->sec == 0 )
000002  7801              LDRB     r1,[r0,#0]
000004  b109              CBZ      r1,|L12.10|
000006  1e49              SUBS     r1,r1,#1              ;602
;;;604        {
;;;605            if ( time->min == 0 )
;;;606            {
;;;607                if ( time->hr == 0 )
;;;608                {
;;;609                    if( time->date == 1 )
;;;610                    {
;;;611                        if( time->month == 1 )
;;;612                        {
;;;613                            /* Subtracting one second leads to year decrement */
;;;614                            time->year--;
;;;615                            time->month=12;
;;;616                            time->date=(uint8_t)( LEAP_YEAR_OR_NOT(time->year) ? leap_days[time->month] :not_leap_days[time->month] );
;;;617                            time->hr=23;
;;;618                            time->min=59;
;;;619                            time->sec=59;
;;;620                            if(time->weekday == 1)
;;;621                            {
;;;622                                time->weekday=7;
;;;623                            }
;;;624                            else
;;;625                            {
;;;626                                time->weekday--;
;;;627                            }
;;;628                        }
;;;629                        else
;;;630                        {
;;;631                            /* Subtracting one second leads to month decrement */
;;;632                            time->month--;
;;;633                            time->date=(uint8_t)( LEAP_YEAR_OR_NOT(time->year) ? leap_days[time->month] :not_leap_days[time->month] );
;;;634                            time->hr=23;
;;;635                            time->min=59;
;;;636                            time->sec=59;
;;;637                            if(time->weekday == 1)
;;;638                            {
;;;639                                time->weekday=7;
;;;640                            }
;;;641                            else
;;;642                            {
;;;643                                time->weekday--;
;;;644                            }
;;;645                        }
;;;646                    }
;;;647                    else
;;;648                    {
;;;649                        /* Subtracting one second leads to date decrement */
;;;650                        if ( time->weekday == 1 )
;;;651                        {
;;;652                            time->weekday=7;
;;;653                        }
;;;654                        else
;;;655                        {
;;;656                            time->weekday--;
;;;657                        }
;;;658                        time->date--;
;;;659                        time->hr=23;
;;;660                        time->min=59;
;;;661                        time->sec=59;
;;;662                    }
;;;663                }
;;;664                else
;;;665                {
;;;666                    /* Subtracting one second leads to hour decrement */
;;;667                    time->hr--; /*  */
;;;668                    time->min=59;
;;;669                    time->sec=59;
;;;670                }
;;;671            }
;;;672            else
;;;673            {
;;;674                /* Subtracting one second leads to minute decrement */
;;;675                time->min--;
;;;676                time->sec=59;
;;;677            }
;;;678        }
;;;679        else
;;;680        {
;;;681            time->sec--;
000008  e018              B        |L12.60|
                  |L12.10|
00000a  7842              LDRB     r2,[r0,#1]            ;605
00000c  213b              MOVS     r1,#0x3b              ;618
00000e  b112              CBZ      r2,|L12.22|
000010  1e52              SUBS     r2,r2,#1              ;605
000012  7042              STRB     r2,[r0,#1]            ;675
000014  e012              B        |L12.60|
                  |L12.22|
000016  7882              LDRB     r2,[r0,#2]            ;607
000018  b112              CBZ      r2,|L12.32|
00001a  1e52              SUBS     r2,r2,#1              ;607
00001c  7082              STRB     r2,[r0,#2]            ;667
00001e  e00c              B        |L12.58|
                  |L12.32|
000020  7902              LDRB     r2,[r0,#4]            ;609
000022  2517              MOVS     r5,#0x17              ;617
000024  2407              MOVS     r4,#7                 ;622
000026  2a01              CMP      r2,#1                 ;609
000028  d00a              BEQ      |L12.64|
00002a  78c3              LDRB     r3,[r0,#3]            ;650
00002c  2b01              CMP      r3,#1                 ;650
00002e  d02d              BEQ      |L12.140|
000030  1e5b              SUBS     r3,r3,#1              ;650
000032  70c3              STRB     r3,[r0,#3]            ;656
                  |L12.52|
000034  1e52              SUBS     r2,r2,#1              ;656
000036  7102              STRB     r2,[r0,#4]            ;658
000038  7085              STRB     r5,[r0,#2]            ;659
                  |L12.58|
00003a  7041              STRB     r1,[r0,#1]            ;660
                  |L12.60|
00003c  7001              STRB     r1,[r0,#0]
;;;682        }
;;;683    }
00003e  bdf0              POP      {r4-r7,pc}
                  |L12.64|
000040  7942              LDRB     r2,[r0,#5]            ;611
000042  4b13              LDR      r3,|L12.144|
000044  2a01              CMP      r2,#1                 ;611
000046  f1a3060d          SUB      r6,r3,#0xd            ;616
00004a  d007              BEQ      |L12.92|
00004c  1e52              SUBS     r2,r2,#1              ;611
00004e  b2d2              UXTB     r2,r2                 ;632
000050  7142              STRB     r2,[r0,#5]            ;632
000052  7987              LDRB     r7,[r0,#6]            ;633
000054  07bf              LSLS     r7,r7,#30             ;633
000056  d015              BEQ      |L12.132|
000058  5cb2              LDRB     r2,[r6,r2]            ;633
00005a  e007              B        |L12.108|
                  |L12.92|
00005c  7982              LDRB     r2,[r0,#6]            ;614
00005e  270c              MOVS     r7,#0xc               ;615
000060  1e52              SUBS     r2,r2,#1              ;614
000062  7182              STRB     r2,[r0,#6]            ;614
000064  7147              STRB     r7,[r0,#5]            ;615
000066  0792              LSLS     r2,r2,#30             ;616
000068  d00a              BEQ      |L12.128|
00006a  7b32              LDRB     r2,[r6,#0xc]          ;616
                  |L12.108|
00006c  7102              STRB     r2,[r0,#4]            ;616
00006e  7085              STRB     r5,[r0,#2]            ;617
000070  7041              STRB     r1,[r0,#1]            ;618
000072  7001              STRB     r1,[r0,#0]            ;619
000074  78c1              LDRB     r1,[r0,#3]            ;620
000076  2901              CMP      r1,#1                 ;620
000078  d006              BEQ      |L12.136|
00007a  1e49              SUBS     r1,r1,#1              ;620
00007c  70c1              STRB     r1,[r0,#3]            ;643
00007e  bdf0              POP      {r4-r7,pc}
                  |L12.128|
000080  7b1a              LDRB     r2,[r3,#0xc]          ;616
000082  e7f3              B        |L12.108|
                  |L12.132|
000084  5c9a              LDRB     r2,[r3,r2]            ;633
000086  e7f1              B        |L12.108|
                  |L12.136|
000088  70c4              STRB     r4,[r0,#3]            ;639
00008a  bdf0              POP      {r4-r7,pc}
                  |L12.140|
00008c  70c4              STRB     r4,[r0,#3]            ;652
00008e  e7d1              B        |L12.52|
;;;684    
                          ENDP

                  |L12.144|
                          DCD      ||.constdata||+0xd

                          AREA ||.constdata||, DATA, READONLY, ALIGN=0

                  not_leap_days
000000  001f1c1f          DCB      0x00,0x1f,0x1c,0x1f
000004  1e1f1e1f          DCB      0x1e,0x1f,0x1e,0x1f
000008  1f1e1f1e          DCB      0x1f,0x1e,0x1f,0x1e
00000c  1f                DCB      0x1f
                  leap_days
00000d  001f1d            DCB      0x00,0x1f,0x1d
000010  1f1e1f1e          DCB      0x1f,0x1e,0x1f,0x1e
000014  1f1f1e1f          DCB      0x1f,0x1f,0x1e,0x1f
000018  1e1f              DCB      0x1e,0x1f

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

                  current_clock_state
000000  00000000          DCB      0x00,0x00,0x00,0x00
                  leftover
                          DCD      0x00000000
                  default_rtc_time
000008  1e140c01          DCB      0x1e,0x14,0x0c,0x01
00000c  08040d            DCB      0x08,0x04,0x0d
                  saved_rtc_time
00000f  00                DCB      0x00
                          DCD      0x00000000
000014  0000              DCB      0x00,0x00

;*** Start embedded assembler ***

#line 1 "..\\..\\..\\..\\Platform\\MCU\\STM32F4xx\\peripherals\\paltform_rtc.c"
	AREA ||.rev16_text||, CODE
	THUMB
	EXPORT |__asm___14_paltform_rtc_c_efc7ef45____REV16|
#line 114 "..\\..\\..\\..\\Platform\\Cortex-M4\\CMSIS\\core_cmInstr.h"
|__asm___14_paltform_rtc_c_efc7ef45____REV16| PROC
#line 115

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE
	THUMB
	EXPORT |__asm___14_paltform_rtc_c_efc7ef45____REVSH|
#line 128
|__asm___14_paltform_rtc_c_efc7ef45____REVSH| PROC
#line 129

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
