; 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\demo\mico-fire_f429\obj_rvmdk\paltform_rtc.o --asm_dir=..\..\..\..\Build\demo\MICO-Fire_F429\list_RVMDK\ --list_dir=..\..\..\..\Build\demo\MICO-Fire_F429\list_RVMDK\ --depend=..\..\..\..\build\demo\mico-fire_f429\obj_rvmdk\paltform_rtc.d --cpu=Cortex-M4.fp --apcs=interwork -O0 --diag_suppress=9931,1,1293 -I..\..\..\..\Board\fire_F429 -I..\..\..\..\Demos\fire\ov2640 -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 -I..\..\..\..\libraries\daemons\homekit_server -I..\..\..\..\libraries\daemons\http_server -I..\..\..\..\Platform\Drivers\malloc -I..\..\..\..\Platform\Drivers\SDRAM -I..\..\..\..\Platform\Drivers\ov5640 -IG:\GIT_OSC\STM32_develop\F429-V2\develop\6-WIFI\STM32-WiFi\3.wifi_ov5640\Projects\STM32F429\demo\RVMDK\RTE -IC:\Keil_v5\ARM\PACK\Keil\STM32F4xx_DFP\2.5.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -IC:\Keil_v5\ARM\CMSIS\Include -IC:\Keil_v5\ARM\PACK\Keil\STM32F4xx_DFP\2.5.0 -D__UVISION_VERSION=515 -DSTM32F429xx -DUSE_STDPERIPH_DRIVER -DDEBUG -DHSE_VALUE=25000000 -DOV5640 --omf_browse=..\..\..\..\build\demo\mico-fire_f429\obj_rvmdk\paltform_rtc.crf ..\..\..\..\Platform\MCU\STM32F4xx\peripherals\paltform_rtc.c]
                          THUMB

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

                  add_1p25ms_contribution PROC
;;;705    
;;;706    static int add_1p25ms_contribution( uint32_t units_1p25ms, uint32_t* seconds_contribution )
000000  b570              PUSH     {r4-r6,lr}
;;;707    {
000002  ed2d8b02          VPUSH    {d8}
000006  4604              MOV      r4,r0
000008  460d              MOV      r5,r1
;;;708        float temp;
;;;709        temp = (float)units_1p25ms*(float)1.25;
00000a  ee004a10          VMOV     s0,r4
00000e  eeb80a40          VCVT.F32.U32 s0,s0
000012  eef70a04          VMOV.F32 s1,#1.25000000
000016  ee200a20          VMUL.F32 s0,s0,s1
00001a  eeb08a40          VMOV.F32 s16,s0
;;;710    
;;;711        /* Get number of ticks converts them to seconds and returns, number of seconds that were contributed to the */
;;;712        /* current time value. This value will be required by compensation algorithms */
;;;713        *seconds_contribution = (uint32_t)temp / 1000;
00001e  eebc0ac8          VCVT.U32.F32 s0,s16
000022  ee100a10          VMOV     r0,s0
000026  f44f717a          MOV      r1,#0x3e8
00002a  fbb0f0f1          UDIV     r0,r0,r1
00002e  6028              STR      r0,[r5,#0]
;;;714        if(*seconds_contribution)
000030  6828              LDR      r0,[r5,#0]
000032  b118              CBZ      r0,|L1.60|
;;;715        {
;;;716            compensate_time_error(*seconds_contribution, false);
000034  2100              MOVS     r1,#0
000036  6828              LDR      r0,[r5,#0]
000038  f7fffffe          BL       compensate_time_error
                  |L1.60|
;;;717        }
;;;718    
;;;719    
;;;720        /* Returns leftover of 1.25 ms units, that are still remaining to contribute to a second */
;;;721        return (int)(units_1p25ms % NUM_1P25MS_IN_SEC);
00003c  f44f7048          MOV      r0,#0x320
000040  fbb4f1f0          UDIV     r1,r4,r0
000044  fb004011          MLS      r0,r0,r1,r4
;;;722    }
000048  ecbd8b02          VPOP     {d8}
00004c  bd70              POP      {r4-r6,pc}
;;;723    
                          ENDP


                          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  b510              PUSH     {r4,lr}
;;;518    {
;;;519        if ( time->sec == 59 )
000002  7801              LDRB     r1,[r0,#0]
000004  293b              CMP      r1,#0x3b
000006  d163              BNE      |L2.208|
;;;520        {
;;;521            if ( time->min == 59 )
000008  7841              LDRB     r1,[r0,#1]
00000a  293b              CMP      r1,#0x3b
00000c  d15a              BNE      |L2.196|
;;;522            {
;;;523                if ( time->hr == 23 )
00000e  7881              LDRB     r1,[r0,#2]
000010  2917              CMP      r1,#0x17
000012  d150              BNE      |L2.182|
;;;524                {
;;;525                    if( time->date == ( LEAP_YEAR_OR_NOT(time->year) ? leap_days[time->month] :not_leap_days[time->month] ) )
000014  7981              LDRB     r1,[r0,#6]
000016  7903              LDRB     r3,[r0,#4]
000018  17ca              ASRS     r2,r1,#31
00001a  eb017292          ADD      r2,r1,r2,LSR #30
00001e  1092              ASRS     r2,r2,#2
000020  eba10282          SUB      r2,r1,r2,LSL #2
000024  b90a              CBNZ     r2,|L2.42|
000026  2201              MOVS     r2,#1
000028  e000              B        |L2.44|
                  |L2.42|
00002a  2200              MOVS     r2,#0
                  |L2.44|
00002c  b11a              CBZ      r2,|L2.54|
00002e  7942              LDRB     r2,[r0,#5]
000030  4c29              LDR      r4,|L2.216|
000032  5ca2              LDRB     r2,[r4,r2]
000034  e002              B        |L2.60|
                  |L2.54|
000036  7942              LDRB     r2,[r0,#5]
000038  4c28              LDR      r4,|L2.220|
00003a  5ca2              LDRB     r2,[r4,r2]
                  |L2.60|
00003c  4293              CMP      r3,r2
00003e  d129              BNE      |L2.148|
;;;526                    {
;;;527                        if( time->month == 12 )
000040  7941              LDRB     r1,[r0,#5]
000042  290c              CMP      r1,#0xc
000044  d113              BNE      |L2.110|
;;;528                        {
;;;529                            /* Adding one second leads to year increment */
;;;530                            time->year++;
000046  7981              LDRB     r1,[r0,#6]
000048  1c49              ADDS     r1,r1,#1
00004a  7181              STRB     r1,[r0,#6]
;;;531                            time->month=1;
00004c  2101              MOVS     r1,#1
00004e  7141              STRB     r1,[r0,#5]
;;;532                            time->date=1;
000050  7101              STRB     r1,[r0,#4]
;;;533                            time->hr=0;
000052  2100              MOVS     r1,#0
000054  7081              STRB     r1,[r0,#2]
;;;534                            time->min=0;
000056  7041              STRB     r1,[r0,#1]
;;;535                            time->sec=0;
000058  7001              STRB     r1,[r0,#0]
;;;536                            if( time->weekday == 7 )
00005a  78c1              LDRB     r1,[r0,#3]
00005c  2907              CMP      r1,#7
00005e  d102              BNE      |L2.102|
;;;537                            {
;;;538                                time->weekday=1;
000060  2101              MOVS     r1,#1
000062  70c1              STRB     r1,[r0,#3]
000064  e037              B        |L2.214|
                  |L2.102|
;;;539                            }
;;;540                            else
;;;541                            {
;;;542                                time->weekday++;
000066  78c1              LDRB     r1,[r0,#3]
000068  1c49              ADDS     r1,r1,#1
00006a  70c1              STRB     r1,[r0,#3]
00006c  e033              B        |L2.214|
                  |L2.110|
;;;543                            }
;;;544                        }
;;;545                        else
;;;546                        {
;;;547                            /* Adding one seconds leads to month increment */
;;;548                            time->month++;
00006e  7941              LDRB     r1,[r0,#5]
000070  1c49              ADDS     r1,r1,#1
000072  7141              STRB     r1,[r0,#5]
;;;549                            time->date=1;
000074  2101              MOVS     r1,#1
000076  7101              STRB     r1,[r0,#4]
;;;550                            time->hr=0;
000078  2100              MOVS     r1,#0
00007a  7081              STRB     r1,[r0,#2]
;;;551                            time->min=0;
00007c  7041              STRB     r1,[r0,#1]
;;;552                            time->sec=0;
00007e  7001              STRB     r1,[r0,#0]
;;;553                            if( time->weekday == 7 )
000080  78c1              LDRB     r1,[r0,#3]
000082  2907              CMP      r1,#7
000084  d102              BNE      |L2.140|
;;;554                            {
;;;555                                time->weekday=1;
000086  2101              MOVS     r1,#1
000088  70c1              STRB     r1,[r0,#3]
00008a  e024              B        |L2.214|
                  |L2.140|
;;;556                            }
;;;557                            else
;;;558                            {
;;;559                                time->weekday++;
00008c  78c1              LDRB     r1,[r0,#3]
00008e  1c49              ADDS     r1,r1,#1
000090  70c1              STRB     r1,[r0,#3]
000092  e020              B        |L2.214|
                  |L2.148|
;;;560                            }
;;;561                        }
;;;562                    }
;;;563                    else
;;;564                    {
;;;565                        /* Adding one seconds leads to data increment */
;;;566                        if ( time->weekday == 7 )
000094  78c1              LDRB     r1,[r0,#3]
000096  2907              CMP      r1,#7
000098  d102              BNE      |L2.160|
;;;567                        {
;;;568                            time->weekday=1;
00009a  2101              MOVS     r1,#1
00009c  70c1              STRB     r1,[r0,#3]
00009e  e002              B        |L2.166|
                  |L2.160|
;;;569                        }
;;;570                        else
;;;571                        {
;;;572                            time->weekday++;
0000a0  78c1              LDRB     r1,[r0,#3]
0000a2  1c49              ADDS     r1,r1,#1
0000a4  70c1              STRB     r1,[r0,#3]
                  |L2.166|
;;;573                        }
;;;574                        time->date++;
0000a6  7901              LDRB     r1,[r0,#4]
0000a8  1c49              ADDS     r1,r1,#1
0000aa  7101              STRB     r1,[r0,#4]
;;;575                        time->hr=0;
0000ac  2100              MOVS     r1,#0
0000ae  7081              STRB     r1,[r0,#2]
;;;576                        time->min=0;
0000b0  7041              STRB     r1,[r0,#1]
;;;577                        time->sec=0;
0000b2  7001              STRB     r1,[r0,#0]
0000b4  e00f              B        |L2.214|
                  |L2.182|
;;;578                    }
;;;579                }
;;;580                else
;;;581                {
;;;582                    /* Adding one seconds leads to hour increment */
;;;583                    time->hr++;
0000b6  7881              LDRB     r1,[r0,#2]
0000b8  1c49              ADDS     r1,r1,#1
0000ba  7081              STRB     r1,[r0,#2]
;;;584                    time->min=0;
0000bc  2100              MOVS     r1,#0
0000be  7041              STRB     r1,[r0,#1]
;;;585                    time->sec=0;
0000c0  7001              STRB     r1,[r0,#0]
0000c2  e008              B        |L2.214|
                  |L2.196|
;;;586                }
;;;587            }
;;;588            else
;;;589            {
;;;590                /* Adding one seconds leads to minute increment */
;;;591                time->min++;
0000c4  7841              LDRB     r1,[r0,#1]
0000c6  1c49              ADDS     r1,r1,#1
0000c8  7041              STRB     r1,[r0,#1]
;;;592                time->sec=0;
0000ca  2100              MOVS     r1,#0
0000cc  7001              STRB     r1,[r0,#0]
0000ce  e002              B        |L2.214|
                  |L2.208|
;;;593            }
;;;594        }
;;;595        else
;;;596        {
;;;597            time->sec++;
0000d0  7801              LDRB     r1,[r0,#0]
0000d2  1c49              ADDS     r1,r1,#1
0000d4  7001              STRB     r1,[r0,#0]
                  |L2.214|
;;;598        }
;;;599    }
0000d6  bd10              POP      {r4,pc}
;;;600    
                          ENDP

                  |L2.216|
                          DCD      leap_days
                  |L2.220|
                          DCD      not_leap_days

                          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  b570              PUSH     {r4-r6,lr}
;;;686    {
000002  4604              MOV      r4,r0
000004  460d              MOV      r5,r1
;;;687        if( subtract == false )
000006  b945              CBNZ     r5,|L3.26|
;;;688        {
;;;689            /* Adding seconds to time */
;;;690            for( sec=sec ; sec > 0; sec--)
000008  bf00              NOP      
00000a  e003              B        |L3.20|
                  |L3.12|
;;;691            {
;;;692                add_second_to_time(&saved_rtc_time);
00000c  4808              LDR      r0,|L3.48|
00000e  f7fffffe          BL       add_second_to_time
000012  1e64              SUBS     r4,r4,#1              ;690
                  |L3.20|
000014  2c00              CMP      r4,#0                 ;690
000016  d1f9              BNE      |L3.12|
000018  e007              B        |L3.42|
                  |L3.26|
;;;693            }
;;;694        }
;;;695        else
;;;696        {
;;;697            /* Subtracting seconds from time */
;;;698            for( sec=sec ; sec > 0; sec-- )
00001a  bf00              NOP      
00001c  e003              B        |L3.38|
                  |L3.30|
;;;699            {
;;;700                subtract_second_from_time(&saved_rtc_time);
00001e  4804              LDR      r0,|L3.48|
000020  f7fffffe          BL       subtract_second_from_time
000024  1e64              SUBS     r4,r4,#1              ;698
                  |L3.38|
000026  2c00              CMP      r4,#0                 ;698
000028  d1f9              BNE      |L3.30|
                  |L3.42|
;;;701            }
;;;702        }
;;;703        return kNoErr;
00002a  2000              MOVS     r0,#0
;;;704    }
00002c  bd70              POP      {r4-r6,pc}
;;;705    
                          ENDP

00002e  0000              DCW      0x0000
                  |L3.48|
                          DCD      saved_rtc_time

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

                          REQUIRE _printf_pre_padding
                          REQUIRE _printf_percent
                          REQUIRE _printf_widthprec
                          REQUIRE _printf_d
                          REQUIRE _printf_s
                          REQUIRE _printf_int_dec
                          REQUIRE _printf_str
                          REQUIRE _printf_str
                  convert_rtc_calendar_values_to_units_passed PROC
;;;463    
;;;464    static uint32_t convert_rtc_calendar_values_to_units_passed( void )
000000  e92d47ff          PUSH     {r0-r10,lr}
;;;465    {
;;;466        long int        temp1=0;
000004  bf00              NOP      
;;;467        long int        temp2=0;
000006  f04f0800          MOV      r8,#0
;;;468        int             temp=0;
00000a  2400              MOVS     r4,#0
;;;469        long int        temp_days=0;
00000c  2600              MOVS     r6,#0
;;;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 );
00000e  a903              ADD      r1,sp,#0xc
000010  2000              MOVS     r0,#0
000012  f7fffffe          BL       RTC_GetTime
;;;477        RTC_GetDate( RTC_Format_BIN, &rtc_read_date );
000016  a902              ADD      r1,sp,#8
000018  2000              MOVS     r0,#0
00001a  f7fffffe          BL       RTC_GetDate
;;;478    
;;;479        /* Calculate number of days in the previous years */
;;;480        if( rtc_read_date.RTC_Year != 0 )
00001e  f89d000b          LDRB     r0,[sp,#0xb]
000022  b1c0              CBZ      r0,|L4.86|
;;;481        {
;;;482            for( temp = (int)( rtc_read_date.RTC_Year - 1 ); temp >= 0; temp-- )
000024  f89d000b          LDRB     r0,[sp,#0xb]
000028  1e44              SUBS     r4,r0,#1
00002a  e012              B        |L4.82|
                  |L4.44|
;;;483            {
;;;484                temp_days += (LEAP_YEAR_OR_NOT(temp)) ? (LEAP_YEAR_DAY_COUNT): (NOT_LEAP_YEAR_DAY_COUNT);
00002c  4620              MOV      r0,r4
00002e  17e1              ASRS     r1,r4,#31
000030  eb047191          ADD      r1,r4,r1,LSR #30
000034  1089              ASRS     r1,r1,#2
000036  eba40181          SUB      r1,r4,r1,LSL #2
00003a  b909              CBNZ     r1,|L4.64|
00003c  2101              MOVS     r1,#1
00003e  e000              B        |L4.66|
                  |L4.64|
000040  2100              MOVS     r1,#0
                  |L4.66|
000042  b111              CBZ      r1,|L4.74|
000044  f44f71b7          MOV      r1,#0x16e
000048  e001              B        |L4.78|
                  |L4.74|
00004a  f240116d          MOV      r1,#0x16d
                  |L4.78|
00004e  440e              ADD      r6,r6,r1
000050  1e64              SUBS     r4,r4,#1              ;482
                  |L4.82|
000052  2c00              CMP      r4,#0                 ;482
000054  daea              BGE      |L4.44|
                  |L4.86|
;;;485            }
;;;486        }
;;;487    
;;;488        current_year = rtc_read_date.RTC_Year;
000056  f89d500b          LDRB     r5,[sp,#0xb]
;;;489        check_string( (rtc_read_date.RTC_Month != 0), "Inappropriate month value in RTC");
00005a  bf00              NOP      
00005c  f89d0009          LDRB     r0,[sp,#9]
000060  2800              CMP      r0,#0
000062  d12c              BNE      |L4.190|
000064  bf00              NOP      
000066  484f              LDR      r0,|L4.420|
000068  6800              LDR      r0,[r0,#0]  ; mico_debug_enabled
00006a  b900              CBNZ     r0,|L4.110|
00006c  e025              B        |L4.186|
                  |L4.110|
00006e  484e              LDR      r0,|L4.424|
000070  f7fffffe          BL       mico_rtos_lock_mutex
000074  215c              MOVS     r1,#0x5c
000076  a04d              ADR      r0,|L4.428|
000078  f7fffffe          BL       strrchr
00007c  b128              CBZ      r0,|L4.138|
00007e  215c              MOVS     r1,#0x5c
000080  a04a              ADR      r0,|L4.428|
000082  f7fffffe          BL       strrchr
000086  1c40              ADDS     r0,r0,#1
000088  e000              B        |L4.140|
                  |L4.138|
00008a  a048              ADR      r0,|L4.428|
                  |L4.140|
00008c  4681              MOV      r9,r0
00008e  f7fffffe          BL       mico_get_time
000092  4682              MOV      r10,r0
000094  a055              ADR      r0,|L4.492|
000096  b108              CBZ      r0,|L4.156|
000098  a054              ADR      r0,|L4.492|
00009a  e000              B        |L4.158|
                  |L4.156|
00009c  a05b              ADR      r0,|L4.524|
                  |L4.158|
00009e  f24011e9          MOV      r1,#0x1e9
0000a2  4b5b              LDR      r3,|L4.528|
0000a4  464a              MOV      r2,r9
0000a6  e9cd1000          STRD     r1,r0,[sp,#0]
0000aa  4651              MOV      r1,r10
0000ac  a059              ADR      r0,|L4.532|
0000ae  f7fffffe          BL       __2printf
0000b2  483d              LDR      r0,|L4.424|
0000b4  f7fffffe          BL       mico_rtos_unlock_mutex
0000b8  bf00              NOP      
                  |L4.186|
0000ba  bf00              NOP      
0000bc  be00              BKPT     #0
                  |L4.190|
0000be  bf00              NOP      
;;;490        if( rtc_read_date.RTC_Month != 0 )
0000c0  f89d0009          LDRB     r0,[sp,#9]
0000c4  b1c0              CBZ      r0,|L4.248|
;;;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-- )
0000c6  f89d0009          LDRB     r0,[sp,#9]
0000ca  1e44              SUBS     r4,r0,#1
0000cc  e012              B        |L4.244|
                  |L4.206|
;;;494            {
;;;495                temp_days += LEAP_YEAR_OR_NOT(current_year)?(leap_days[temp]):(not_leap_days[temp]);
0000ce  4628              MOV      r0,r5
0000d0  17e9              ASRS     r1,r5,#31
0000d2  eb057191          ADD      r1,r5,r1,LSR #30
0000d6  1089              ASRS     r1,r1,#2
0000d8  eba50181          SUB      r1,r5,r1,LSL #2
0000dc  b909              CBNZ     r1,|L4.226|
0000de  2101              MOVS     r1,#1
0000e0  e000              B        |L4.228|
                  |L4.226|
0000e2  2100              MOVS     r1,#0
                  |L4.228|
0000e4  b111              CBZ      r1,|L4.236|
0000e6  4955              LDR      r1,|L4.572|
0000e8  5d09              LDRB     r1,[r1,r4]
0000ea  e001              B        |L4.240|
                  |L4.236|
0000ec  4954              LDR      r1,|L4.576|
0000ee  5d09              LDRB     r1,[r1,r4]
                  |L4.240|
0000f0  440e              ADD      r6,r6,r1
0000f2  1e64              SUBS     r4,r4,#1              ;493
                  |L4.244|
0000f4  2c00              CMP      r4,#0                 ;493
0000f6  dcea              BGT      |L4.206|
                  |L4.248|
;;;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;
0000f8  f89d000e          LDRB     r0,[sp,#0xe]
0000fc  f89d100d          LDRB     r1,[sp,#0xd]
000100  ebc11101          RSB      r1,r1,r1,LSL #4
000104  eb000081          ADD      r0,r0,r1,LSL #2
000108  f89d100c          LDRB     r1,[sp,#0xc]
00010c  ebc11241          RSB      r2,r1,r1,LSL #5
000110  ebc22101          RSB      r1,r2,r1,LSL #8
000114  eb001701          ADD      r7,r0,r1,LSL #4
;;;501    
;;;502        check_string(( rtc_read_date.RTC_Date != 0 ), "Inappropriate date value in RTC");
000118  bf00              NOP      
00011a  f89d000a          LDRB     r0,[sp,#0xa]
00011e  2800              CMP      r0,#0
000120  d12c              BNE      |L4.380|
000122  bf00              NOP      
000124  481f              LDR      r0,|L4.420|
000126  6800              LDR      r0,[r0,#0]  ; mico_debug_enabled
000128  b900              CBNZ     r0,|L4.300|
00012a  e025              B        |L4.376|
                  |L4.300|
00012c  481e              LDR      r0,|L4.424|
00012e  f7fffffe          BL       mico_rtos_lock_mutex
000132  215c              MOVS     r1,#0x5c
000134  a01d              ADR      r0,|L4.428|
000136  f7fffffe          BL       strrchr
00013a  b128              CBZ      r0,|L4.328|
00013c  215c              MOVS     r1,#0x5c
00013e  a01b              ADR      r0,|L4.428|
000140  f7fffffe          BL       strrchr
000144  1c40              ADDS     r0,r0,#1
000146  e000              B        |L4.330|
                  |L4.328|
000148  a018              ADR      r0,|L4.428|
                  |L4.330|
00014a  4681              MOV      r9,r0
00014c  f7fffffe          BL       mico_get_time
000150  4682              MOV      r10,r0
000152  a03c              ADR      r0,|L4.580|
000154  b108              CBZ      r0,|L4.346|
000156  a03b              ADR      r0,|L4.580|
000158  e000              B        |L4.348|
                  |L4.346|
00015a  a02c              ADR      r0,|L4.524|
                  |L4.348|
00015c  f44f71fb          MOV      r1,#0x1f6
000160  4b2b              LDR      r3,|L4.528|
000162  464a              MOV      r2,r9
000164  e9cd1000          STRD     r1,r0,[sp,#0]
000168  4651              MOV      r1,r10
00016a  a02a              ADR      r0,|L4.532|
00016c  f7fffffe          BL       __2printf
000170  480d              LDR      r0,|L4.424|
000172  f7fffffe          BL       mico_rtos_unlock_mutex
000176  bf00              NOP      
                  |L4.376|
000178  bf00              NOP      
00017a  be00              BKPT     #0
                  |L4.380|
00017c  bf00              NOP      
;;;503    
;;;504        /* Convert passed days to seconds */
;;;505        if( rtc_read_date.RTC_Date != 0 )
00017e  f89d000a          LDRB     r0,[sp,#0xa]
000182  b150              CBZ      r0,|L4.410|
;;;506        {
;;;507            temp2 = ( ( rtc_read_date.RTC_Date - 1 ) + temp_days ) * NUM_SECONDS_IN_HOUR * 24;
000184  f89d000a          LDRB     r0,[sp,#0xa]
000188  1e40              SUBS     r0,r0,#1
00018a  4430              ADD      r0,r0,r6
00018c  f44f6161          MOV      r1,#0xe10
000190  4348              MULS     r0,r1,r0
000192  eb000040          ADD      r0,r0,r0,LSL #1
000196  ea4f08c0          LSL      r8,r0,#3
                  |L4.410|
;;;508        }
;;;509    
;;;510        /* Return total number of seconds passed  */
;;;511        return (uint32_t)( temp1 + temp2 );
00019a  eb070008          ADD      r0,r7,r8
;;;512    
;;;513    }
00019e  b004              ADD      sp,sp,#0x10
0001a0  e8bd87f0          POP      {r4-r10,pc}
;;;514    
                          ENDP

                  |L4.420|
                          DCD      mico_debug_enabled
                  |L4.424|
                          DCD      stdio_tx_mutex
                  |L4.428|
0001ac  2e2e5c2e          DCB      "..\\..\\..\\..\\Platform\\MCU\\STM32F4xx\\peripherals\\"
0001b0  2e5c2e2e
0001b4  5c2e2e5c
0001b8  506c6174
0001bc  666f726d
0001c0  5c4d4355
0001c4  5c53544d
0001c8  33324634
0001cc  78785c70
0001d0  65726970
0001d4  68657261
0001d8  6c735c  
0001db  70616c74          DCB      "paltform_rtc.c",0
0001df  666f726d
0001e3  5f727463
0001e7  2e6300  
0001ea  00                DCB      0
0001eb  00                DCB      0
                  |L4.492|
0001ec  496e6170          DCB      "Inappropriate month value in RTC"
0001f0  70726f70
0001f4  72696174
0001f8  65206d6f
0001fc  6e746820
000200  76616c75
000204  6520696e
000208  20525443
                  |L4.524|
00020c  00                DCB      0
00020d  00                DCB      0
00020e  00                DCB      0
00020f  00                DCB      0
                  |L4.528|
                          DCD      |symbol_number.47|
                  |L4.532|
000214  5b25645d          DCB      "[%d][MICO:%s:%s:%4d] **ASSERT** %s\r\n",0
000218  5b4d4943
00021c  4f3a2573
000220  3a25733a
000224  2534645d
000228  202a2a41
00022c  53534552
000230  542a2a20
000234  25730d0a
000238  00      
000239  00                DCB      0
00023a  00                DCB      0
00023b  00                DCB      0
                  |L4.572|
                          DCD      leap_days
                  |L4.576|
                          DCD      not_leap_days
                  |L4.580|
000244  496e6170          DCB      "Inappropriate date value in RTC",0
000248  70726f70
00024c  72696174
000250  65206461
000254  74652076
000258  616c7565
00025c  20696e20
000260  52544300

                          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  4803              LDR      r0,|L5.20|
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,|L5.24|
00000c  f7fffffe          BL       platform_rtc_set_time
;;;294    //#endif /* #ifdef RTC_ENABLED */
;;;295        return kNoErr;
000010  2000              MOVS     r0,#0
;;;296    }
000012  bd10              POP      {r4,pc}
;;;297    
                          ENDP

                  |L5.20|
                          DCD      current_clock_state
                  |L5.24|
                          DCD      saved_rtc_time

                          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  4805              LDR      r0,|L6.24|
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  2101              MOVS     r1,#1
00000e  4803              LDR      r0,|L6.28|
000010  f7fffffe          BL       stm32f2_rtc_change_clock
;;;281    
;;;282        return kNoErr;
000014  2000              MOVS     r0,#0
;;;283    }
000016  bd10              POP      {r4,pc}
;;;284    
                          ENDP

                  |L6.24|
                          DCD      saved_rtc_time
                  |L6.28|
                          DCD      current_clock_state

                          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  b570              PUSH     {r4-r6,lr}
;;;299    {
000002  ed2d8b02          VPUSH    {d8}
000006  b082              SUB      sp,sp,#8
000008  4606              MOV      r6,r0
00000a  460c              MOV      r4,r1
;;;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  4605              MOV      r5,r0
;;;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 );
000012  a901              ADD      r1,sp,#4
000014  4628              MOV      r0,r5
000016  f7fffffe          BL       add_1p25ms_contribution
00001a  4918              LDR      r1,|L7.124|
00001c  6809              LDR      r1,[r1,#0]  ; leftover
00001e  4408              ADD      r0,r0,r1
000020  4916              LDR      r1,|L7.124|
000022  6008              STR      r0,[r1,#0]  ; leftover
;;;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 )
000024  4608              MOV      r0,r1
000026  6800              LDR      r0,[r0,#0]  ; leftover
000028  f5b07f48          CMP      r0,#0x320
00002c  dd09              BLE      |L7.66|
;;;316        {
;;;317            compensate_time_error(1, false);
00002e  2100              MOVS     r1,#0
000030  2001              MOVS     r0,#1
000032  f7fffffe          BL       compensate_time_error
;;;318            leftover -= NUM_1P25MS_IN_SEC;
000036  4811              LDR      r0,|L7.124|
000038  6800              LDR      r0,[r0,#0]  ; leftover
00003a  f5a07048          SUB      r0,r0,#0x320
00003e  490f              LDR      r1,|L7.124|
000040  6008              STR      r0,[r1,#0]  ; leftover
                  |L7.66|
;;;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);
000042  480f              LDR      r0,|L7.128|
000044  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 );
000048  2100              MOVS     r1,#0
00004a  480e              LDR      r0,|L7.132|
00004c  f7fffffe          BL       stm32f2_rtc_change_clock
;;;332        temp = (float)time_units_passed_since_powersave_enter * (float)1.25;
000050  ee005a10          VMOV     s0,r5
000054  eeb80a40          VCVT.F32.U32 s0,s0
000058  eef70a04          VMOV.F32 s1,#1.25000000
00005c  ee208a20          VMUL.F32 s16,s0,s1
;;;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 )
000060  2e01              CMP      r6,#1
000062  d904              BLS      |L7.110|
;;;336        {
;;;337            *cpu_sleep_time = (uint32_t)temp;
000064  eebc0ac8          VCVT.U32.F32 s0,s16
000068  ed840a00          VSTR     s0,[r4,#0]
00006c  e001              B        |L7.114|
                  |L7.110|
;;;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;
00006e  2001              MOVS     r0,#1
000070  6020              STR      r0,[r4,#0]
                  |L7.114|
;;;345        }
;;;346    
;;;347        return kNoErr;
000072  2000              MOVS     r0,#0
;;;348    }
000074  b002              ADD      sp,sp,#8
000076  ecbd8b02          VPOP     {d8}
00007a  bd70              POP      {r4-r6,pc}
;;;349    
                          ENDP

                  |L7.124|
                          DCD      leftover
                  |L7.128|
                          DCD      saved_rtc_time
                  |L7.132|
                          DCD      current_clock_state

                          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  4604              MOV      r4,r0
;;;200    #ifdef MICO_ENABLE_MCU_RTC
;;;201      RTC_TimeTypeDef rtc_read_time;
;;;202      RTC_DateTypeDef rtc_read_date;
;;;203      
;;;204      if( time == 0 )
000004  b90c              CBNZ     r4,|L8.10|
;;;205      {
;;;206        return kParamErr;
000006  4810              LDR      r0,|L8.72|
                  |L8.8|
;;;207      }
;;;208      
;;;209      /* save current rtc time */
;;;210      RTC_GetTime( RTC_Format_BIN, &rtc_read_time );
;;;211      RTC_GetDate( RTC_Format_BIN, &rtc_read_date );
;;;212      
;;;213      /* fill structure */
;;;214      time->sec     = rtc_read_time.RTC_Seconds;
;;;215      time->min     = rtc_read_time.RTC_Minutes;
;;;216      time->hr      = rtc_read_time.RTC_Hours;
;;;217      time->weekday = rtc_read_date.RTC_WeekDay;
;;;218      time->date    = rtc_read_date.RTC_Date;
;;;219      time->month   = rtc_read_date.RTC_Month;
;;;220      time->year    = rtc_read_date.RTC_Year;
;;;221      
;;;222      return kNoErr;
;;;223    #else /* #ifdef MICO_ENABLE_MCU_RTC */
;;;224      UNUSED_PARAMETER(time);
;;;225      return kUnsupportedErr;
;;;226    #endif /* #ifdef MICO_ENABLE_MCU_RTC */
;;;227    }
000008  bd1c              POP      {r2-r4,pc}
                  |L8.10|
00000a  a901              ADD      r1,sp,#4              ;210
00000c  2000              MOVS     r0,#0                 ;210
00000e  f7fffffe          BL       RTC_GetTime
000012  4669              MOV      r1,sp                 ;211
000014  2000              MOVS     r0,#0                 ;211
000016  f7fffffe          BL       RTC_GetDate
00001a  f89d0006          LDRB     r0,[sp,#6]            ;214
00001e  7020              STRB     r0,[r4,#0]            ;214
000020  f89d0005          LDRB     r0,[sp,#5]            ;215
000024  7060              STRB     r0,[r4,#1]            ;215
000026  f89d0004          LDRB     r0,[sp,#4]            ;216
00002a  70a0              STRB     r0,[r4,#2]            ;216
00002c  f89d0000          LDRB     r0,[sp,#0]            ;217
000030  70e0              STRB     r0,[r4,#3]            ;217
000032  f89d0002          LDRB     r0,[sp,#2]            ;218
000036  7120              STRB     r0,[r4,#4]            ;218
000038  f89d0001          LDRB     r0,[sp,#1]            ;219
00003c  7160              STRB     r0,[r4,#5]            ;219
00003e  f89d0003          LDRB     r0,[sp,#3]            ;220
000042  71a0              STRB     r0,[r4,#6]            ;220
000044  2000              MOVS     r0,#0                 ;222
000046  e7df              B        |L8.8|
;;;228    
                          ENDP

                  |L8.72|
                          DCD      0xffffe5cf

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

                  platform_rtc_init PROC
;;;132    
;;;133    OSStatus platform_rtc_init(void)
000000  b50e              PUSH     {r1-r3,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
000008  9000              STR      r0,[sp,#0]
;;;141      
;;;142      /* RTC ticks every second */
;;;143      RTC_InitStruct.RTC_AsynchPrediv = 0x7F;
00000a  207f              MOVS     r0,#0x7f
00000c  9001              STR      r0,[sp,#4]
;;;144      RTC_InitStruct.RTC_SynchPrediv = 0xFF;
00000e  20ff              MOVS     r0,#0xff
000010  9002              STR      r0,[sp,#8]
;;;145      
;;;146      RTC_Init( &RTC_InitStruct );
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
;;;158      /* Wait till LSE is ready */
;;;159      while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
000032  bf00              NOP      
                  |L9.52|
000034  2041              MOVS     r0,#0x41
000036  f7fffffe          BL       RCC_GetFlagStatus
00003a  2800              CMP      r0,#0
00003c  d0fa              BEQ      |L9.52|
;;;160      {
;;;161      }
;;;162      /* Select the RTC Clock Source */
;;;163      RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
00003e  f44f7080          MOV      r0,#0x100
000042  f7fffffe          BL       RCC_RTCCLKConfig
;;;164      
;;;165      /* Enable the RTC Clock */
;;;166      RCC_RTCCLKCmd(ENABLE);
000046  2001              MOVS     r0,#1
000048  f7fffffe          BL       RCC_RTCCLKCmd
;;;167      
;;;168      /* RTC configuration -------------------------------------------------------*/
;;;169      /* Wait for RTC APB registers synchronisation */
;;;170      RTC_WaitForSynchro();
00004c  f7fffffe          BL       RTC_WaitForSynchro
;;;171      
;;;172    #ifdef USE_RTC_BKP
;;;173      if (RTC_ReadBackupRegister(RTC_BKP_DR0) != USE_RTC_BKP) {
000050  2000              MOVS     r0,#0
000052  f7fffffe          BL       RTC_ReadBackupRegister
000056  4906              LDR      r1,|L9.112|
000058  4288              CMP      r0,r1
00005a  d006              BEQ      |L9.106|
;;;174        /* set it to 12:20:30 08/04/2013 monday */
;;;175        platform_rtc_set_time(&default_rtc_time);
00005c  4805              LDR      r0,|L9.116|
00005e  f7fffffe          BL       platform_rtc_set_time
;;;176        RTC_WriteBackupRegister(RTC_BKP_DR0, USE_RTC_BKP);
000062  4903              LDR      r1,|L9.112|
000064  2000              MOVS     r0,#0
000066  f7fffffe          BL       RTC_WriteBackupRegister
                  |L9.106|
;;;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;
00006a  2000              MOVS     r0,#0
;;;186    #else
;;;187      return kUnsupportedErr;
;;;188    #endif
;;;189    }
00006c  bd0e              POP      {r1-r3,pc}
;;;190    
                          ENDP

00006e  0000              DCW      0x0000
                  |L9.112|
                          DCD      0x00bb32f2
                  |L9.116|
                          DCD      default_rtc_time

                          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  b57c              PUSH     {r2-r6,lr}
;;;236    {
000002  4604              MOV      r4,r0
;;;237    #ifdef MICO_ENABLE_MCU_RTC
;;;238      RTC_TimeTypeDef rtc_write_time;
;;;239      RTC_DateTypeDef rtc_write_date;
;;;240      bool    valid = false;
000004  2500              MOVS     r5,#0
;;;241        
;;;242      MICO_VERIFY_TIME(time, valid);
000006  7820              LDRB     r0,[r4,#0]
000008  283c              CMP      r0,#0x3c
00000a  dc0b              BGT      |L10.36|
00000c  7860              LDRB     r0,[r4,#1]
00000e  283c              CMP      r0,#0x3c
000010  dc08              BGT      |L10.36|
000012  78a0              LDRB     r0,[r4,#2]
000014  2818              CMP      r0,#0x18
000016  dc05              BGT      |L10.36|
000018  7920              LDRB     r0,[r4,#4]
00001a  281f              CMP      r0,#0x1f
00001c  dc02              BGT      |L10.36|
00001e  7960              LDRB     r0,[r4,#5]
000020  280c              CMP      r0,#0xc
000022  dd01              BLE      |L10.40|
                  |L10.36|
000024  2500              MOVS     r5,#0
000026  e000              B        |L10.42|
                  |L10.40|
000028  2501              MOVS     r5,#1
                  |L10.42|
;;;243      if( valid == false )
00002a  b90d              CBNZ     r5,|L10.48|
;;;244      {
;;;245        return kParamErr;
00002c  4811              LDR      r0,|L10.116|
                  |L10.46|
;;;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    }
00002e  bd7c              POP      {r2-r6,pc}
                  |L10.48|
000030  2000              MOVS     r0,#0                 ;248
000032  f88d0007          STRB     r0,[sp,#7]            ;248
000036  7820              LDRB     r0,[r4,#0]            ;249
000038  f88d0006          STRB     r0,[sp,#6]            ;249
00003c  7860              LDRB     r0,[r4,#1]            ;250
00003e  f88d0005          STRB     r0,[sp,#5]            ;250
000042  78a0              LDRB     r0,[r4,#2]            ;251
000044  f88d0004          STRB     r0,[sp,#4]            ;251
000048  78e0              LDRB     r0,[r4,#3]            ;252
00004a  f88d0000          STRB     r0,[sp,#0]            ;252
00004e  7920              LDRB     r0,[r4,#4]            ;253
000050  f88d0002          STRB     r0,[sp,#2]            ;253
000054  7960              LDRB     r0,[r4,#5]            ;254
000056  f88d0001          STRB     r0,[sp,#1]            ;254
00005a  79a0              LDRB     r0,[r4,#6]            ;255
00005c  f88d0003          STRB     r0,[sp,#3]            ;255
000060  a901              ADD      r1,sp,#4              ;258
000062  2000              MOVS     r0,#0                 ;258
000064  f7fffffe          BL       RTC_SetTime
000068  4669              MOV      r1,sp                 ;259
00006a  2000              MOVS     r0,#0                 ;259
00006c  f7fffffe          BL       RTC_SetDate
000070  2000              MOVS     r0,#0                 ;261
000072  e7dc              B        |L10.46|
;;;267    
                          ENDP

                  |L10.116|
                          DCD      0xffffe5cf

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

                          REQUIRE _printf_pre_padding
                          REQUIRE _printf_percent
                          REQUIRE _printf_widthprec
                          REQUIRE _printf_d
                          REQUIRE _printf_s
                          REQUIRE _printf_int_dec
                          REQUIRE _printf_str
                          REQUIRE _printf_str
                          REQUIRE _printf_str
                          REQUIRE _printf_str
                  reset_rtc_values PROC
;;;422    
;;;423    static void reset_rtc_values( void )
000000  e92d41fc          PUSH     {r2-r8,lr}
;;;424    {
;;;425        ErrorStatus status;
;;;426        int retry = 3;
000004  2503              MOVS     r5,#3
;;;427    
;;;428        /* Disable write protection of rtc registers */
;;;429        do{
000006  bf00              NOP      
                  |L11.8|
;;;430          RTC_WriteProtectionCmd(DISABLE);
000008  2000              MOVS     r0,#0
00000a  f7fffffe          BL       RTC_WriteProtectionCmd
;;;431          status = RTC_EnterInitMode();
00000e  f7fffffe          BL       RTC_EnterInitMode
000012  4604              MOV      r4,r0
;;;432          REFERENCE_DEBUG_ONLY_VARIABLE(status);
;;;433          retry--;
000014  1e6d              SUBS     r5,r5,#1
;;;434        }while( retry && (status!=SUCCESS) );
000016  b10d              CBZ      r5,|L11.28|
000018  2c01              CMP      r4,#1
00001a  d1f5              BNE      |L11.8|
                  |L11.28|
;;;435    
;;;436        check_string( status==SUCCESS, "Rtc can not enter intialisation mode");  
00001c  bf00              NOP      
00001e  2c01              CMP      r4,#1
000020  d02c              BEQ      |L11.124|
000022  bf00              NOP      
000024  4870              LDR      r0,|L11.488|
000026  6800              LDR      r0,[r0,#0]  ; mico_debug_enabled
000028  b900              CBNZ     r0,|L11.44|
00002a  e025              B        |L11.120|
                  |L11.44|
00002c  486f              LDR      r0,|L11.492|
00002e  f7fffffe          BL       mico_rtos_lock_mutex
000032  215c              MOVS     r1,#0x5c
000034  a06e              ADR      r0,|L11.496|
000036  f7fffffe          BL       strrchr
00003a  b128              CBZ      r0,|L11.72|
00003c  215c              MOVS     r1,#0x5c
00003e  a06c              ADR      r0,|L11.496|
000040  f7fffffe          BL       strrchr
000044  1c40              ADDS     r0,r0,#1
000046  e000              B        |L11.74|
                  |L11.72|
000048  a069              ADR      r0,|L11.496|
                  |L11.74|
00004a  4606              MOV      r6,r0
00004c  f7fffffe          BL       mico_get_time
000050  4607              MOV      r7,r0
000052  a077              ADR      r0,|L11.560|
000054  b108              CBZ      r0,|L11.90|
000056  a076              ADR      r0,|L11.560|
000058  e000              B        |L11.92|
                  |L11.90|
00005a  a07e              ADR      r0,|L11.596|
                  |L11.92|
00005c  f44f71da          MOV      r1,#0x1b4
000060  4b7d              LDR      r3,|L11.600|
000062  4632              MOV      r2,r6
000064  e9cd1000          STRD     r1,r0,[sp,#0]
000068  4639              MOV      r1,r7
00006a  a07c              ADR      r0,|L11.604|
00006c  f7fffffe          BL       __2printf
000070  485e              LDR      r0,|L11.492|
000072  f7fffffe          BL       mico_rtos_unlock_mutex
000076  bf00              NOP      
                  |L11.120|
000078  bf00              NOP      
00007a  be00              BKPT     #0
                  |L11.124|
00007c  bf00              NOP      
;;;437    
;;;438        /* Reset calendar date registers */
;;;439        RTC->TR = 0;
00007e  2000              MOVS     r0,#0
000080  4980              LDR      r1,|L11.644|
000082  6008              STR      r0,[r1,#0]
;;;440        RTC_ExitInitMode();
000084  f7fffffe          BL       RTC_ExitInitMode
;;;441        status = RTC_WaitForSynchro();
000088  f7fffffe          BL       RTC_WaitForSynchro
00008c  4604              MOV      r4,r0
;;;442        check_string(  status==SUCCESS, "Rtc can not synchronize" );
00008e  bf00              NOP      
000090  2c01              CMP      r4,#1
000092  d02c              BEQ      |L11.238|
000094  bf00              NOP      
000096  4854              LDR      r0,|L11.488|
000098  6800              LDR      r0,[r0,#0]  ; mico_debug_enabled
00009a  b900              CBNZ     r0,|L11.158|
00009c  e025              B        |L11.234|
                  |L11.158|
00009e  4853              LDR      r0,|L11.492|
0000a0  f7fffffe          BL       mico_rtos_lock_mutex
0000a4  215c              MOVS     r1,#0x5c
0000a6  a052              ADR      r0,|L11.496|
0000a8  f7fffffe          BL       strrchr
0000ac  b128              CBZ      r0,|L11.186|
0000ae  215c              MOVS     r1,#0x5c
0000b0  a04f              ADR      r0,|L11.496|
0000b2  f7fffffe          BL       strrchr
0000b6  1c40              ADDS     r0,r0,#1
0000b8  e000              B        |L11.188|
                  |L11.186|
0000ba  a04d              ADR      r0,|L11.496|
                  |L11.188|
0000bc  4606              MOV      r6,r0
0000be  f7fffffe          BL       mico_get_time
0000c2  4607              MOV      r7,r0
0000c4  a070              ADR      r0,|L11.648|
0000c6  b108              CBZ      r0,|L11.204|
0000c8  a06f              ADR      r0,|L11.648|
0000ca  e000              B        |L11.206|
                  |L11.204|
0000cc  a061              ADR      r0,|L11.596|
                  |L11.206|
0000ce  f44f71dd          MOV      r1,#0x1ba
0000d2  4b61              LDR      r3,|L11.600|
0000d4  4632              MOV      r2,r6
0000d6  e9cd1000          STRD     r1,r0,[sp,#0]
0000da  4639              MOV      r1,r7
0000dc  a05f              ADR      r0,|L11.604|
0000de  f7fffffe          BL       __2printf
0000e2  4842              LDR      r0,|L11.492|
0000e4  f7fffffe          BL       mico_rtos_unlock_mutex
0000e8  bf00              NOP      
                  |L11.234|
0000ea  bf00              NOP      
0000ec  be00              BKPT     #0
                  |L11.238|
0000ee  bf00              NOP      
;;;443    
;;;444    
;;;445        /* Enable write protection of rtc registers */
;;;446        RTC_WriteProtectionCmd(ENABLE);
0000f0  2001              MOVS     r0,#1
0000f2  f7fffffe          BL       RTC_WriteProtectionCmd
;;;447    
;;;448        /* Disable write protection of the rtc registers */
;;;449        RTC_WriteProtectionCmd(DISABLE);
0000f6  2000              MOVS     r0,#0
0000f8  f7fffffe          BL       RTC_WriteProtectionCmd
;;;450        status = RTC_EnterInitMode();
0000fc  f7fffffe          BL       RTC_EnterInitMode
000100  4604              MOV      r4,r0
;;;451        check_string(  status==SUCCESS, "Rtc can not enter intialisation mode" );
000102  bf00              NOP      
000104  2c01              CMP      r4,#1
000106  d02c              BEQ      |L11.354|
000108  bf00              NOP      
00010a  4837              LDR      r0,|L11.488|
00010c  6800              LDR      r0,[r0,#0]  ; mico_debug_enabled
00010e  b900              CBNZ     r0,|L11.274|
000110  e025              B        |L11.350|
                  |L11.274|
000112  4836              LDR      r0,|L11.492|
000114  f7fffffe          BL       mico_rtos_lock_mutex
000118  215c              MOVS     r1,#0x5c
00011a  a035              ADR      r0,|L11.496|
00011c  f7fffffe          BL       strrchr
000120  b128              CBZ      r0,|L11.302|
000122  215c              MOVS     r1,#0x5c
000124  a032              ADR      r0,|L11.496|
000126  f7fffffe          BL       strrchr
00012a  1c40              ADDS     r0,r0,#1
00012c  e000              B        |L11.304|
                  |L11.302|
00012e  a030              ADR      r0,|L11.496|
                  |L11.304|
000130  4606              MOV      r6,r0
000132  f7fffffe          BL       mico_get_time
000136  4607              MOV      r7,r0
000138  a03d              ADR      r0,|L11.560|
00013a  b108              CBZ      r0,|L11.320|
00013c  a03c              ADR      r0,|L11.560|
00013e  e000              B        |L11.322|
                  |L11.320|
000140  a044              ADR      r0,|L11.596|
                  |L11.322|
000142  f24011c3          MOV      r1,#0x1c3
000146  4b44              LDR      r3,|L11.600|
000148  4632              MOV      r2,r6
00014a  e9cd1000          STRD     r1,r0,[sp,#0]
00014e  4639              MOV      r1,r7
000150  a042              ADR      r0,|L11.604|
000152  f7fffffe          BL       __2printf
000156  4825              LDR      r0,|L11.492|
000158  f7fffffe          BL       mico_rtos_unlock_mutex
00015c  bf00              NOP      
                  |L11.350|
00015e  bf00              NOP      
000160  be00              BKPT     #0
                  |L11.354|
000162  bf00              NOP      
;;;452    
;;;453        /* 2000 year 01/01 */
;;;454        RTC->DR= 0;
000164  2000              MOVS     r0,#0
000166  4947              LDR      r1,|L11.644|
000168  1d09              ADDS     r1,r1,#4
00016a  6008              STR      r0,[r1,#0]
;;;455        RTC->DR= ( 1<<13 ) | ( 1<<8 ) | ( 1<<0 );
00016c  f2421001          MOV      r0,#0x2101
000170  6008              STR      r0,[r1,#0]
;;;456        RTC_ExitInitMode();
000172  f7fffffe          BL       RTC_ExitInitMode
;;;457        status = RTC_WaitForSynchro();
000176  f7fffffe          BL       RTC_WaitForSynchro
00017a  4604              MOV      r4,r0
;;;458        check_string(status==SUCCESS, "Rtc can not synchronize");
00017c  bf00              NOP      
00017e  2c01              CMP      r4,#1
000180  d02c              BEQ      |L11.476|
000182  bf00              NOP      
000184  4818              LDR      r0,|L11.488|
000186  6800              LDR      r0,[r0,#0]  ; mico_debug_enabled
000188  b900              CBNZ     r0,|L11.396|
00018a  e025              B        |L11.472|
                  |L11.396|
00018c  4817              LDR      r0,|L11.492|
00018e  f7fffffe          BL       mico_rtos_lock_mutex
000192  215c              MOVS     r1,#0x5c
000194  a016              ADR      r0,|L11.496|
000196  f7fffffe          BL       strrchr
00019a  b128              CBZ      r0,|L11.424|
00019c  215c              MOVS     r1,#0x5c
00019e  a014              ADR      r0,|L11.496|
0001a0  f7fffffe          BL       strrchr
0001a4  1c40              ADDS     r0,r0,#1
0001a6  e000              B        |L11.426|
                  |L11.424|
0001a8  a011              ADR      r0,|L11.496|
                  |L11.426|
0001aa  4606              MOV      r6,r0
0001ac  f7fffffe          BL       mico_get_time
0001b0  4607              MOV      r7,r0
0001b2  a035              ADR      r0,|L11.648|
0001b4  b108              CBZ      r0,|L11.442|
0001b6  a034              ADR      r0,|L11.648|
0001b8  e000              B        |L11.444|
                  |L11.442|
0001ba  a026              ADR      r0,|L11.596|
                  |L11.444|
0001bc  f44f71e5          MOV      r1,#0x1ca
0001c0  4b25              LDR      r3,|L11.600|
0001c2  4632              MOV      r2,r6
0001c4  e9cd1000          STRD     r1,r0,[sp,#0]
0001c8  4639              MOV      r1,r7
0001ca  a024              ADR      r0,|L11.604|
0001cc  f7fffffe          BL       __2printf
0001d0  4806              LDR      r0,|L11.492|
0001d2  f7fffffe          BL       mico_rtos_unlock_mutex
0001d6  bf00              NOP      
                  |L11.472|
0001d8  bf00              NOP      
0001da  be00              BKPT     #0
                  |L11.476|
0001dc  bf00              NOP      
;;;459    
;;;460        /* Enable write protection of rtc registers */
;;;461        RTC_WriteProtectionCmd(ENABLE);
0001de  2001              MOVS     r0,#1
0001e0  f7fffffe          BL       RTC_WriteProtectionCmd
;;;462    }
0001e4  e8bd81fc          POP      {r2-r8,pc}
;;;463    
                          ENDP

                  |L11.488|
                          DCD      mico_debug_enabled
                  |L11.492|
                          DCD      stdio_tx_mutex
                  |L11.496|
0001f0  2e2e5c2e          DCB      "..\\..\\..\\..\\Platform\\MCU\\STM32F4xx\\peripherals\\"
0001f4  2e5c2e2e
0001f8  5c2e2e5c
0001fc  506c6174
000200  666f726d
000204  5c4d4355
000208  5c53544d
00020c  33324634
000210  78785c70
000214  65726970
000218  68657261
00021c  6c735c  
00021f  70616c74          DCB      "paltform_rtc.c",0
000223  666f726d
000227  5f727463
00022b  2e6300  
00022e  00                DCB      0
00022f  00                DCB      0
                  |L11.560|
000230  52746320          DCB      "Rtc can not enter intialisation mode"
000234  63616e20
000238  6e6f7420
00023c  656e7465
000240  7220696e
000244  7469616c
000248  69736174
00024c  696f6e20
000250  6d6f6465
                  |L11.596|
000254  00                DCB      0
000255  00                DCB      0
000256  00                DCB      0
000257  00                DCB      0
                  |L11.600|
                          DCD      |symbol_number.46|
                  |L11.604|
00025c  5b25645d          DCB      "[%d][MICO:%s:%s:%4d] **ASSERT** %s\r\n",0
000260  5b4d4943
000264  4f3a2573
000268  3a25733a
00026c  2534645d
000270  202a2a41
000274  53534552
000278  542a2a20
00027c  25730d0a
000280  00      
000281  00                DCB      0
000282  00                DCB      0
000283  00                DCB      0
                  |L11.644|
                          DCD      0x40002800
                  |L11.648|
000288  52746320          DCB      "Rtc can not synchronize",0
00028c  63616e20
000290  6e6f7420
000294  73796e63
000298  68726f6e
00029c  697a6500

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

                          REQUIRE _printf_pre_padding
                          REQUIRE _printf_percent
                          REQUIRE _printf_widthprec
                          REQUIRE _printf_d
                          REQUIRE _printf_s
                          REQUIRE _printf_int_dec
                          REQUIRE _printf_str
                          REQUIRE _printf_str
                  stm32f2_rtc_change_clock PROC
;;;349    
;;;350    static OSStatus stm32f2_rtc_change_clock( rtc_clock_state_t* current, rtc_clock_state_t target )
000000  e92d47fc          PUSH     {r2-r10,lr}
;;;351    {
000004  4604              MOV      r4,r0
000006  4688              MOV      r8,r1
;;;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 )
000008  7820              LDRB     r0,[r4,#0]
00000a  2800              CMP      r0,#0
00000c  d14d              BNE      |L12.170|
;;;359        {
;;;360            if( target == CLOCKING_EVERY_1p25MSEC )
00000e  f1b80f01          CMP      r8,#1
000012  d148              BNE      |L12.166|
;;;361            {
;;;362                sync_div = 0;
000014  2600              MOVS     r6,#0
;;;363                async_div= 40;
000016  2728              MOVS     r7,#0x28
;;;364    
;;;365                /* Disable write protection of rtc registers, now we will be able to update RTC register values */
;;;366                RTC_WriteProtectionCmd(DISABLE);
000018  f7fffffe          BL       RTC_WriteProtectionCmd
;;;367    
;;;368                /* Enable initialisation mode */
;;;369                status = RTC_EnterInitMode();
00001c  f7fffffe          BL       RTC_EnterInitMode
000020  4605              MOV      r5,r0
;;;370                REFERENCE_DEBUG_ONLY_VARIABLE(status);
;;;371                check_string( status==SUCCESS, "Rtc can not enter intialisation mode");
000022  bf00              NOP      
000024  2d01              CMP      r5,#1
000026  d02c              BEQ      |L12.130|
000028  bf00              NOP      
00002a  4849              LDR      r0,|L12.336|
00002c  6800              LDR      r0,[r0,#0]  ; mico_debug_enabled
00002e  b900              CBNZ     r0,|L12.50|
000030  e025              B        |L12.126|
                  |L12.50|
000032  4848              LDR      r0,|L12.340|
000034  f7fffffe          BL       mico_rtos_lock_mutex
000038  215c              MOVS     r1,#0x5c
00003a  a047              ADR      r0,|L12.344|
00003c  f7fffffe          BL       strrchr
000040  b128              CBZ      r0,|L12.78|
000042  215c              MOVS     r1,#0x5c
000044  a044              ADR      r0,|L12.344|
000046  f7fffffe          BL       strrchr
00004a  1c40              ADDS     r0,r0,#1
00004c  e000              B        |L12.80|
                  |L12.78|
00004e  a042              ADR      r0,|L12.344|
                  |L12.80|
000050  4681              MOV      r9,r0
000052  f7fffffe          BL       mico_get_time
000056  4682              MOV      r10,r0
000058  a04f              ADR      r0,|L12.408|
00005a  b108              CBZ      r0,|L12.96|
00005c  a04e              ADR      r0,|L12.408|
00005e  e000              B        |L12.98|
                  |L12.96|
000060  a056              ADR      r0,|L12.444|
                  |L12.98|
000062  f2401173          MOV      r1,#0x173
000066  4b56              LDR      r3,|L12.448|
000068  464a              MOV      r2,r9
00006a  e9cd1000          STRD     r1,r0,[sp,#0]
00006e  4651              MOV      r1,r10
000070  a054              ADR      r0,|L12.452|
000072  f7fffffe          BL       __2printf
000076  4837              LDR      r0,|L12.340|
000078  f7fffffe          BL       mico_rtos_unlock_mutex
00007c  bf00              NOP      
                  |L12.126|
00007e  bf00              NOP      
000080  be00              BKPT     #0
                  |L12.130|
000082  bf00              NOP      
;;;372    
;;;373                /* Update RTC prescaler */
;;;374                RTC->PRER = (uint32_t)( sync_div );
000084  4859              LDR      r0,|L12.492|
000086  6006              STR      r6,[r0,#0]
;;;375                RTC->PRER |= (uint32_t)(async_div << 16);
000088  6800              LDR      r0,[r0,#0]
00008a  ea404007          ORR      r0,r0,r7,LSL #16
00008e  4957              LDR      r1,|L12.492|
000090  6008              STR      r0,[r1,#0]
;;;376                RTC_ExitInitMode();
000092  f7fffffe          BL       RTC_ExitInitMode
;;;377    
;;;378                /* Enable write proteciton of rtc registers back */
;;;379                RTC_WriteProtectionCmd(ENABLE);
000096  2001              MOVS     r0,#1
000098  f7fffffe          BL       RTC_WriteProtectionCmd
;;;380                *current = CLOCKING_EVERY_1p25MSEC;
00009c  2001              MOVS     r0,#1
00009e  7020              STRB     r0,[r4,#0]
;;;381                return kNoErr;
0000a0  2000              MOVS     r0,#0
                  |L12.162|
;;;382            }
;;;383            else
;;;384            {
;;;385                return kNoErr;
;;;386            }
;;;387        }
;;;388        else if( *current == CLOCKING_EVERY_1p25MSEC )
;;;389        {
;;;390            if( target == CLOCKING_EVERY_SEC )
;;;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;
;;;396    
;;;397                /* Disable write protection of rtc registers */
;;;398                RTC_WriteProtectionCmd(DISABLE);
;;;399    
;;;400                /* Enable initialisation mode */
;;;401                status = RTC_EnterInitMode();
;;;402                check_string( status==SUCCESS, "Rtc can not enter intialisation mode");
;;;403    
;;;404                /* Update RTC prescaler */
;;;405                RTC->PRER = (uint32_t)( sync_div );
;;;406                RTC->PRER |= (uint32_t)(async_div << 16);
;;;407    
;;;408                RTC_ExitInitMode();
;;;409    
;;;410                /* Enable write proteciton of rtc registers back */
;;;411                RTC_WriteProtectionCmd(ENABLE);
;;;412                *current = CLOCKING_EVERY_SEC;
;;;413                return kNoErr;
;;;414            }
;;;415            else
;;;416            {
;;;417                return kNoErr;
;;;418            }
;;;419        }
;;;420        return kNoErr;
;;;421    }
0000a2  e8bd87fc          POP      {r2-r10,pc}
                  |L12.166|
0000a6  2000              MOVS     r0,#0                 ;385
0000a8  e7fb              B        |L12.162|
                  |L12.170|
0000aa  7820              LDRB     r0,[r4,#0]            ;388
0000ac  2801              CMP      r0,#1                 ;388
0000ae  d14c              BNE      |L12.330|
0000b0  f1b80f00          CMP      r8,#0                 ;390
0000b4  d147              BNE      |L12.326|
0000b6  277f              MOVS     r7,#0x7f              ;394
0000b8  26ff              MOVS     r6,#0xff              ;395
0000ba  2000              MOVS     r0,#0                 ;398
0000bc  f7fffffe          BL       RTC_WriteProtectionCmd
0000c0  f7fffffe          BL       RTC_EnterInitMode
0000c4  4605              MOV      r5,r0                 ;401
0000c6  bf00              NOP                            ;402
0000c8  2d01              CMP      r5,#1                 ;402
0000ca  d02c              BEQ      |L12.294|
0000cc  bf00              NOP                            ;402
0000ce  4820              LDR      r0,|L12.336|
0000d0  6800              LDR      r0,[r0,#0]            ;402  ; mico_debug_enabled
0000d2  b900              CBNZ     r0,|L12.214|
0000d4  e025              B        |L12.290|
                  |L12.214|
0000d6  481f              LDR      r0,|L12.340|
0000d8  f7fffffe          BL       mico_rtos_lock_mutex
0000dc  215c              MOVS     r1,#0x5c              ;402
0000de  a01e              ADR      r0,|L12.344|
0000e0  f7fffffe          BL       strrchr
0000e4  b128              CBZ      r0,|L12.242|
0000e6  215c              MOVS     r1,#0x5c              ;402
0000e8  a01b              ADR      r0,|L12.344|
0000ea  f7fffffe          BL       strrchr
0000ee  1c40              ADDS     r0,r0,#1              ;402
0000f0  e000              B        |L12.244|
                  |L12.242|
0000f2  a019              ADR      r0,|L12.344|
                  |L12.244|
0000f4  4681              MOV      r9,r0                 ;402
0000f6  f7fffffe          BL       mico_get_time
0000fa  4682              MOV      r10,r0                ;402
0000fc  a026              ADR      r0,|L12.408|
0000fe  b108              CBZ      r0,|L12.260|
000100  a025              ADR      r0,|L12.408|
000102  e000              B        |L12.262|
                  |L12.260|
000104  a02d              ADR      r0,|L12.444|
                  |L12.262|
000106  f44f71c9          MOV      r1,#0x192             ;402
00010a  4b2d              LDR      r3,|L12.448|
00010c  464a              MOV      r2,r9                 ;402
00010e  e9cd1000          STRD     r1,r0,[sp,#0]         ;402
000112  4651              MOV      r1,r10                ;402
000114  a02b              ADR      r0,|L12.452|
000116  f7fffffe          BL       __2printf
00011a  480e              LDR      r0,|L12.340|
00011c  f7fffffe          BL       mico_rtos_unlock_mutex
000120  bf00              NOP                            ;402
                  |L12.290|
000122  bf00              NOP                            ;402
000124  be00              BKPT     #0                    ;402
                  |L12.294|
000126  bf00              NOP                            ;402
000128  4830              LDR      r0,|L12.492|
00012a  6006              STR      r6,[r0,#0]            ;405
00012c  6800              LDR      r0,[r0,#0]            ;406
00012e  ea404007          ORR      r0,r0,r7,LSL #16      ;406
000132  492e              LDR      r1,|L12.492|
000134  6008              STR      r0,[r1,#0]            ;406
000136  f7fffffe          BL       RTC_ExitInitMode
00013a  2001              MOVS     r0,#1                 ;411
00013c  f7fffffe          BL       RTC_WriteProtectionCmd
000140  2000              MOVS     r0,#0                 ;412
000142  7020              STRB     r0,[r4,#0]            ;412
000144  e7ad              B        |L12.162|
                  |L12.326|
000146  2000              MOVS     r0,#0                 ;417
000148  e7ab              B        |L12.162|
                  |L12.330|
00014a  2000              MOVS     r0,#0                 ;420
00014c  e7a9              B        |L12.162|
;;;422    
                          ENDP

00014e  0000              DCW      0x0000
                  |L12.336|
                          DCD      mico_debug_enabled
                  |L12.340|
                          DCD      stdio_tx_mutex
                  |L12.344|
000158  2e2e5c2e          DCB      "..\\..\\..\\..\\Platform\\MCU\\STM32F4xx\\peripherals\\"
00015c  2e5c2e2e
000160  5c2e2e5c
000164  506c6174
000168  666f726d
00016c  5c4d4355
000170  5c53544d
000174  33324634
000178  78785c70
00017c  65726970
000180  68657261
000184  6c735c  
000187  70616c74          DCB      "paltform_rtc.c",0
00018b  666f726d
00018f  5f727463
000193  2e6300  
000196  00                DCB      0
000197  00                DCB      0
                  |L12.408|
000198  52746320          DCB      "Rtc can not enter intialisation mode"
00019c  63616e20
0001a0  6e6f7420
0001a4  656e7465
0001a8  7220696e
0001ac  7469616c
0001b0  69736174
0001b4  696f6e20
0001b8  6d6f6465
                  |L12.444|
0001bc  00                DCB      0
0001bd  00                DCB      0
0001be  00                DCB      0
0001bf  00                DCB      0
                  |L12.448|
                          DCD      __PRETTY_FUNCTION__
                  |L12.452|
0001c4  5b25645d          DCB      "[%d][MICO:%s:%s:%4d] **ASSERT** %s\r\n",0
0001c8  5b4d4943
0001cc  4f3a2573
0001d0  3a25733a
0001d4  2534645d
0001d8  202a2a41
0001dc  53534552
0001e0  542a2a20
0001e4  25730d0a
0001e8  00      
0001e9  00                DCB      0
0001ea  00                DCB      0
0001eb  00                DCB      0
                  |L12.492|
                          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  7801              LDRB     r1,[r0,#0]
;;;602    {
;;;603        if ( time->sec == 0 )
000002  2900              CMP      r1,#0
000004  d17a              BNE      |L13.252|
;;;604        {
;;;605            if ( time->min == 0 )
000006  7841              LDRB     r1,[r0,#1]
000008  2900              CMP      r1,#0
00000a  d171              BNE      |L13.240|
;;;606            {
;;;607                if ( time->hr == 0 )
00000c  7881              LDRB     r1,[r0,#2]
00000e  2900              CMP      r1,#0
000010  d165              BNE      |L13.222|
;;;608                {
;;;609                    if( time->date == 1 )
000012  7901              LDRB     r1,[r0,#4]
000014  2901              CMP      r1,#1
000016  d150              BNE      |L13.186|
;;;610                    {
;;;611                        if( time->month == 1 )
000018  7941              LDRB     r1,[r0,#5]
00001a  2901              CMP      r1,#1
00001c  d127              BNE      |L13.110|
;;;612                        {
;;;613                            /* Subtracting one second leads to year decrement */
;;;614                            time->year--;
00001e  7981              LDRB     r1,[r0,#6]
000020  1e49              SUBS     r1,r1,#1
000022  7181              STRB     r1,[r0,#6]
;;;615                            time->month=12;
000024  210c              MOVS     r1,#0xc
000026  7141              STRB     r1,[r0,#5]
;;;616                            time->date=(uint8_t)( LEAP_YEAR_OR_NOT(time->year) ? leap_days[time->month] :not_leap_days[time->month] );
000028  7981              LDRB     r1,[r0,#6]
00002a  17ca              ASRS     r2,r1,#31
00002c  eb017292          ADD      r2,r1,r2,LSR #30
000030  1092              ASRS     r2,r2,#2
000032  eba10282          SUB      r2,r1,r2,LSL #2
000036  b90a              CBNZ     r2,|L13.60|
000038  2201              MOVS     r2,#1
00003a  e000              B        |L13.62|
                  |L13.60|
00003c  2200              MOVS     r2,#0
                  |L13.62|
00003e  b11a              CBZ      r2,|L13.72|
000040  7942              LDRB     r2,[r0,#5]
000042  4b30              LDR      r3,|L13.260|
000044  5c9a              LDRB     r2,[r3,r2]
000046  e002              B        |L13.78|
                  |L13.72|
000048  7942              LDRB     r2,[r0,#5]
00004a  4b2f              LDR      r3,|L13.264|
00004c  5c9a              LDRB     r2,[r3,r2]
                  |L13.78|
00004e  7102              STRB     r2,[r0,#4]
;;;617                            time->hr=23;
000050  2117              MOVS     r1,#0x17
000052  7081              STRB     r1,[r0,#2]
;;;618                            time->min=59;
000054  213b              MOVS     r1,#0x3b
000056  7041              STRB     r1,[r0,#1]
;;;619                            time->sec=59;
000058  7001              STRB     r1,[r0,#0]
;;;620                            if(time->weekday == 1)
00005a  78c1              LDRB     r1,[r0,#3]
00005c  2901              CMP      r1,#1
00005e  d102              BNE      |L13.102|
;;;621                            {
;;;622                                time->weekday=7;
000060  2107              MOVS     r1,#7
000062  70c1              STRB     r1,[r0,#3]
000064  e04d              B        |L13.258|
                  |L13.102|
;;;623                            }
;;;624                            else
;;;625                            {
;;;626                                time->weekday--;
000066  78c1              LDRB     r1,[r0,#3]
000068  1e49              SUBS     r1,r1,#1
00006a  70c1              STRB     r1,[r0,#3]
00006c  e049              B        |L13.258|
                  |L13.110|
;;;627                            }
;;;628                        }
;;;629                        else
;;;630                        {
;;;631                            /* Subtracting one second leads to month decrement */
;;;632                            time->month--;
00006e  7941              LDRB     r1,[r0,#5]
000070  1e49              SUBS     r1,r1,#1
000072  7141              STRB     r1,[r0,#5]
;;;633                            time->date=(uint8_t)( LEAP_YEAR_OR_NOT(time->year) ? leap_days[time->month] :not_leap_days[time->month] );
000074  7981              LDRB     r1,[r0,#6]
000076  17ca              ASRS     r2,r1,#31
000078  eb017292          ADD      r2,r1,r2,LSR #30
00007c  1092              ASRS     r2,r2,#2
00007e  eba10282          SUB      r2,r1,r2,LSL #2
000082  b90a              CBNZ     r2,|L13.136|
000084  2201              MOVS     r2,#1
000086  e000              B        |L13.138|
                  |L13.136|
000088  2200              MOVS     r2,#0
                  |L13.138|
00008a  b11a              CBZ      r2,|L13.148|
00008c  7942              LDRB     r2,[r0,#5]
00008e  4b1d              LDR      r3,|L13.260|
000090  5c9a              LDRB     r2,[r3,r2]
000092  e002              B        |L13.154|
                  |L13.148|
000094  7942              LDRB     r2,[r0,#5]
000096  4b1c              LDR      r3,|L13.264|
000098  5c9a              LDRB     r2,[r3,r2]
                  |L13.154|
00009a  7102              STRB     r2,[r0,#4]
;;;634                            time->hr=23;
00009c  2117              MOVS     r1,#0x17
00009e  7081              STRB     r1,[r0,#2]
;;;635                            time->min=59;
0000a0  213b              MOVS     r1,#0x3b
0000a2  7041              STRB     r1,[r0,#1]
;;;636                            time->sec=59;
0000a4  7001              STRB     r1,[r0,#0]
;;;637                            if(time->weekday == 1)
0000a6  78c1              LDRB     r1,[r0,#3]
0000a8  2901              CMP      r1,#1
0000aa  d102              BNE      |L13.178|
;;;638                            {
;;;639                                time->weekday=7;
0000ac  2107              MOVS     r1,#7
0000ae  70c1              STRB     r1,[r0,#3]
0000b0  e027              B        |L13.258|
                  |L13.178|
;;;640                            }
;;;641                            else
;;;642                            {
;;;643                                time->weekday--;
0000b2  78c1              LDRB     r1,[r0,#3]
0000b4  1e49              SUBS     r1,r1,#1
0000b6  70c1              STRB     r1,[r0,#3]
0000b8  e023              B        |L13.258|
                  |L13.186|
;;;644                            }
;;;645                        }
;;;646                    }
;;;647                    else
;;;648                    {
;;;649                        /* Subtracting one second leads to date decrement */
;;;650                        if ( time->weekday == 1 )
0000ba  78c1              LDRB     r1,[r0,#3]
0000bc  2901              CMP      r1,#1
0000be  d102              BNE      |L13.198|
;;;651                        {
;;;652                            time->weekday=7;
0000c0  2107              MOVS     r1,#7
0000c2  70c1              STRB     r1,[r0,#3]
0000c4  e002              B        |L13.204|
                  |L13.198|
;;;653                        }
;;;654                        else
;;;655                        {
;;;656                            time->weekday--;
0000c6  78c1              LDRB     r1,[r0,#3]
0000c8  1e49              SUBS     r1,r1,#1
0000ca  70c1              STRB     r1,[r0,#3]
                  |L13.204|
;;;657                        }
;;;658                        time->date--;
0000cc  7901              LDRB     r1,[r0,#4]
0000ce  1e49              SUBS     r1,r1,#1
0000d0  7101              STRB     r1,[r0,#4]
;;;659                        time->hr=23;
0000d2  2117              MOVS     r1,#0x17
0000d4  7081              STRB     r1,[r0,#2]
;;;660                        time->min=59;
0000d6  213b              MOVS     r1,#0x3b
0000d8  7041              STRB     r1,[r0,#1]
;;;661                        time->sec=59;
0000da  7001              STRB     r1,[r0,#0]
0000dc  e011              B        |L13.258|
                  |L13.222|
;;;662                    }
;;;663                }
;;;664                else
;;;665                {
;;;666                    /* Subtracting one second leads to hour decrement */
;;;667                    time->hr--; /*  */
0000de  7881              LDRB     r1,[r0,#2]
0000e0  1e49              SUBS     r1,r1,#1
0000e2  7081              STRB     r1,[r0,#2]
;;;668                    time->min=59;
0000e4  213b              MOVS     r1,#0x3b
0000e6  7041              STRB     r1,[r0,#1]
;;;669                    time->sec=59;
0000e8  7001              STRB     r1,[r0,#0]
0000ea  e00a              B        |L13.258|
0000ec  e006              B        |L13.252|
0000ee  e7ff              B        |L13.240|
                  |L13.240|
;;;670                }
;;;671            }
;;;672            else
;;;673            {
;;;674                /* Subtracting one second leads to minute decrement */
;;;675                time->min--;
0000f0  7841              LDRB     r1,[r0,#1]
0000f2  1e49              SUBS     r1,r1,#1
0000f4  7041              STRB     r1,[r0,#1]
;;;676                time->sec=59;
0000f6  213b              MOVS     r1,#0x3b
0000f8  7001              STRB     r1,[r0,#0]
0000fa  e002              B        |L13.258|
                  |L13.252|
;;;677            }
;;;678        }
;;;679        else
;;;680        {
;;;681            time->sec--;
0000fc  7801              LDRB     r1,[r0,#0]
0000fe  1e49              SUBS     r1,r1,#1
000100  7001              STRB     r1,[r0,#0]
                  |L13.258|
;;;682        }
;;;683    }
000102  4770              BX       lr
;;;684    
                          ENDP

                  |L13.260|
                          DCD      leap_days
                  |L13.264|
                          DCD      not_leap_days

                          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
                  __PRETTY_FUNCTION__
00001a  7369              DCB      0x73,0x69
00001c  676e6564          DCB      0x67,0x6e,0x65,0x64
000020  20696e74          DCB      0x20,0x69,0x6e,0x74
000024  2073746d          DCB      0x20,0x73,0x74,0x6d
000028  33326632          DCB      0x33,0x32,0x66,0x32
00002c  5f727463          DCB      0x5f,0x72,0x74,0x63
000030  5f636861          DCB      0x5f,0x63,0x68,0x61
000034  6e67655f          DCB      0x6e,0x67,0x65,0x5f
000038  636c6f63          DCB      0x63,0x6c,0x6f,0x63
00003c  6b28656e          DCB      0x6b,0x28,0x65,0x6e
000040  756d203c          DCB      0x75,0x6d,0x20,0x3c
000044  756e6e61          DCB      0x75,0x6e,0x6e,0x61
000048  6d65643e          DCB      0x6d,0x65,0x64,0x3e
00004c  202a2c20          DCB      0x20,0x2a,0x2c,0x20
000050  656e756d          DCB      0x65,0x6e,0x75,0x6d
000054  203c756e          DCB      0x20,0x3c,0x75,0x6e
000058  6e616d65          DCB      0x6e,0x61,0x6d,0x65
00005c  643e2900          DCB      0x64,0x3e,0x29,0x00
                  |symbol_number.46|
000060  766f6964          DCB      0x76,0x6f,0x69,0x64
000064  20726573          DCB      0x20,0x72,0x65,0x73
000068  65745f72          DCB      0x65,0x74,0x5f,0x72
00006c  74635f76          DCB      0x74,0x63,0x5f,0x76
000070  616c7565          DCB      0x61,0x6c,0x75,0x65
000074  7328766f          DCB      0x73,0x28,0x76,0x6f
000078  69642900          DCB      0x69,0x64,0x29,0x00
                  |symbol_number.47|
00007c  756e7369          DCB      0x75,0x6e,0x73,0x69
000080  676e6564          DCB      0x67,0x6e,0x65,0x64
000084  20696e74          DCB      0x20,0x69,0x6e,0x74
000088  20636f6e          DCB      0x20,0x63,0x6f,0x6e
00008c  76657274          DCB      0x76,0x65,0x72,0x74
000090  5f727463          DCB      0x5f,0x72,0x74,0x63
000094  5f63616c          DCB      0x5f,0x63,0x61,0x6c
000098  656e6461          DCB      0x65,0x6e,0x64,0x61
00009c  725f7661          DCB      0x72,0x5f,0x76,0x61
0000a0  6c756573          DCB      0x6c,0x75,0x65,0x73
0000a4  5f746f5f          DCB      0x5f,0x74,0x6f,0x5f
0000a8  756e6974          DCB      0x75,0x6e,0x69,0x74
0000ac  735f7061          DCB      0x73,0x5f,0x70,0x61
0000b0  73736564          DCB      0x73,0x73,0x65,0x64
0000b4  28766f69          DCB      0x28,0x76,0x6f,0x69
0000b8  642900            DCB      0x64,0x29,0x00

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

                  default_rtc_time
000000  1e140c01          DCB      0x1e,0x14,0x0c,0x01
000004  08040d            DCB      0x08,0x04,0x0d
                  saved_rtc_time
000007  00                DCB      0x00
                          DCD      0x00000000
00000c  0000              DCB      0x00,0x00
                  current_clock_state
00000e  0000              DCB      0x00,0x00
                  leftover
                          DCD      0x00000000

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