Advertisement
Guest User

stm32f030 division

a guest
May 10th, 2019
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. cmsis_blinky.elf:     file format elf32-littlearm
  3.  
  4.  
  5. Disassembly of section .text:
  6.  
  7. 080000c4 <__udivsi3-0x14>:
  8.  80000c4:   080005e8    .word   0x080005e8
  9.  80000c8:   20000000    .word   0x20000000
  10.  80000cc:   20000014    .word   0x20000014
  11.  80000d0:   20000014    .word   0x20000014
  12.  80000d4:   20000014    .word   0x20000014
  13.  
  14. 080000d8 <__udivsi3>:
  15.  80000d8:   e2512001    subs    r2, r1, #1
  16.  80000dc:   012fff1e    bxeq    lr
  17.  80000e0:   3a000036    bcc 80001c0 <__udivsi3+0xe8>
  18.  80000e4:   e1500001    cmp r0, r1
  19.  80000e8:   9a000022    bls 8000178 <__udivsi3+0xa0>
  20.  80000ec:   e1110002    tst r1, r2
  21.  80000f0:   0a000023    beq 8000184 <__udivsi3+0xac>
  22.  80000f4:   e311020e    tst r1, #-536870912 ; 0xe0000000
  23.  80000f8:   01a01181    lsleq   r1, r1, #3
  24.  80000fc:   03a03008    moveq   r3, #8
  25.  8000100:   13a03001    movne   r3, #1
  26.  8000104:   e3510201    cmp r1, #268435456  ; 0x10000000
  27.  8000108:   31510000    cmpcc   r1, r0
  28.  800010c:   31a01201    lslcc   r1, r1, #4
  29.  8000110:   31a03203    lslcc   r3, r3, #4
  30.  8000114:   3afffffa    bcc 8000104 <__udivsi3+0x2c>
  31.  8000118:   e3510102    cmp r1, #-2147483648    ; 0x80000000
  32.  800011c:   31510000    cmpcc   r1, r0
  33.  8000120:   31a01081    lslcc   r1, r1, #1
  34.  8000124:   31a03083    lslcc   r3, r3, #1
  35.  8000128:   3afffffa    bcc 8000118 <__udivsi3+0x40>
  36.  800012c:   e3a02000    mov r2, #0
  37.  8000130:   e1500001    cmp r0, r1
  38.  8000134:   20400001    subcs   r0, r0, r1
  39.  8000138:   21822003    orrcs   r2, r2, r3
  40.  800013c:   e15000a1    cmp r0, r1, lsr #1
  41.  8000140:   204000a1    subcs   r0, r0, r1, lsr #1
  42.  8000144:   218220a3    orrcs   r2, r2, r3, lsr #1
  43.  8000148:   e1500121    cmp r0, r1, lsr #2
  44.  800014c:   20400121    subcs   r0, r0, r1, lsr #2
  45.  8000150:   21822123    orrcs   r2, r2, r3, lsr #2
  46.  8000154:   e15001a1    cmp r0, r1, lsr #3
  47.  8000158:   204001a1    subcs   r0, r0, r1, lsr #3
  48.  800015c:   218221a3    orrcs   r2, r2, r3, lsr #3
  49.  8000160:   e3500000    cmp r0, #0
  50.  8000164:   11b03223    lsrsne  r3, r3, #4
  51.  8000168:   11a01221    lsrne   r1, r1, #4
  52.  800016c:   1affffef    bne 8000130 <__udivsi3+0x58>
  53.  8000170:   e1a00002    mov r0, r2
  54.  8000174:   e12fff1e    bx  lr
  55.  8000178:   03a00001    moveq   r0, #1
  56.  800017c:   13a00000    movne   r0, #0
  57.  8000180:   e12fff1e    bx  lr
  58.  8000184:   e3510801    cmp r1, #65536  ; 0x10000
  59.  8000188:   21a01821    lsrcs   r1, r1, #16
  60.  800018c:   23a02010    movcs   r2, #16
  61.  8000190:   33a02000    movcc   r2, #0
  62.  8000194:   e3510c01    cmp r1, #256    ; 0x100
  63.  8000198:   21a01421    lsrcs   r1, r1, #8
  64.  800019c:   22822008    addcs   r2, r2, #8
  65.  80001a0:   e3510010    cmp r1, #16
  66.  80001a4:   21a01221    lsrcs   r1, r1, #4
  67.  80001a8:   22822004    addcs   r2, r2, #4
  68.  80001ac:   e3510004    cmp r1, #4
  69.  80001b0:   82822003    addhi   r2, r2, #3
  70.  80001b4:   908220a1    addls   r2, r2, r1, lsr #1
  71.  80001b8:   e1a00230    lsr r0, r0, r2
  72.  80001bc:   e12fff1e    bx  lr
  73.  80001c0:   e3500000    cmp r0, #0
  74.  80001c4:   13e00000    mvnne   r0, #0
  75.  80001c8:   ea000059    b   8000334 <__aeabi_idiv0>
  76.  
  77. 080001cc <__aeabi_uidivmod>:
  78.  80001cc:   e3510000    cmp r1, #0
  79.  80001d0:   0afffffa    beq 80001c0 <__udivsi3+0xe8>
  80.  80001d4:   e92d4003    push    {r0, r1, lr}
  81.  80001d8:   ebffffbe    bl  80000d8 <__udivsi3>
  82.  80001dc:   e8bd4006    pop {r1, r2, lr}
  83.  80001e0:   e0030092    mul r3, r2, r0
  84.  80001e4:   e0411003    sub r1, r1, r3
  85.  80001e8:   e12fff1e    bx  lr
  86.  
  87. 080001ec <__divsi3>:
  88.  80001ec:   e3510000    cmp r1, #0
  89.  80001f0:   0a000043    beq 8000304 <.divsi3_skip_div0_test+0x110>
  90.  
  91. 080001f4 <.divsi3_skip_div0_test>:
  92.  80001f4:   e020c001    eor ip, r0, r1
  93.  80001f8:   42611000    rsbmi   r1, r1, #0
  94.  80001fc:   e2512001    subs    r2, r1, #1
  95.  8000200:   0a000027    beq 80002a4 <.divsi3_skip_div0_test+0xb0>
  96.  8000204:   e1b03000    movs    r3, r0
  97.  8000208:   42603000    rsbmi   r3, r0, #0
  98.  800020c:   e1530001    cmp r3, r1
  99.  8000210:   9a000026    bls 80002b0 <.divsi3_skip_div0_test+0xbc>
  100.  8000214:   e1110002    tst r1, r2
  101.  8000218:   0a000028    beq 80002c0 <.divsi3_skip_div0_test+0xcc>
  102.  800021c:   e311020e    tst r1, #-536870912 ; 0xe0000000
  103.  8000220:   01a01181    lsleq   r1, r1, #3
  104.  8000224:   03a02008    moveq   r2, #8
  105.  8000228:   13a02001    movne   r2, #1
  106.  800022c:   e3510201    cmp r1, #268435456  ; 0x10000000
  107.  8000230:   31510003    cmpcc   r1, r3
  108.  8000234:   31a01201    lslcc   r1, r1, #4
  109.  8000238:   31a02202    lslcc   r2, r2, #4
  110.  800023c:   3afffffa    bcc 800022c <.divsi3_skip_div0_test+0x38>
  111.  8000240:   e3510102    cmp r1, #-2147483648    ; 0x80000000
  112.  8000244:   31510003    cmpcc   r1, r3
  113.  8000248:   31a01081    lslcc   r1, r1, #1
  114.  800024c:   31a02082    lslcc   r2, r2, #1
  115.  8000250:   3afffffa    bcc 8000240 <.divsi3_skip_div0_test+0x4c>
  116.  8000254:   e3a00000    mov r0, #0
  117.  8000258:   e1530001    cmp r3, r1
  118.  800025c:   20433001    subcs   r3, r3, r1
  119.  8000260:   21800002    orrcs   r0, r0, r2
  120.  8000264:   e15300a1    cmp r3, r1, lsr #1
  121.  8000268:   204330a1    subcs   r3, r3, r1, lsr #1
  122.  800026c:   218000a2    orrcs   r0, r0, r2, lsr #1
  123.  8000270:   e1530121    cmp r3, r1, lsr #2
  124.  8000274:   20433121    subcs   r3, r3, r1, lsr #2
  125.  8000278:   21800122    orrcs   r0, r0, r2, lsr #2
  126.  800027c:   e15301a1    cmp r3, r1, lsr #3
  127.  8000280:   204331a1    subcs   r3, r3, r1, lsr #3
  128.  8000284:   218001a2    orrcs   r0, r0, r2, lsr #3
  129.  8000288:   e3530000    cmp r3, #0
  130.  800028c:   11b02222    lsrsne  r2, r2, #4
  131.  8000290:   11a01221    lsrne   r1, r1, #4
  132.  8000294:   1affffef    bne 8000258 <.divsi3_skip_div0_test+0x64>
  133.  8000298:   e35c0000    cmp ip, #0
  134.  800029c:   42600000    rsbmi   r0, r0, #0
  135.  80002a0:   e12fff1e    bx  lr
  136.  80002a4:   e13c0000    teq ip, r0
  137.  80002a8:   42600000    rsbmi   r0, r0, #0
  138.  80002ac:   e12fff1e    bx  lr
  139.  80002b0:   33a00000    movcc   r0, #0
  140.  80002b4:   01a00fcc    asreq   r0, ip, #31
  141.  80002b8:   03800001    orreq   r0, r0, #1
  142.  80002bc:   e12fff1e    bx  lr
  143.  80002c0:   e3510801    cmp r1, #65536  ; 0x10000
  144.  80002c4:   21a01821    lsrcs   r1, r1, #16
  145.  80002c8:   23a02010    movcs   r2, #16
  146.  80002cc:   33a02000    movcc   r2, #0
  147.  80002d0:   e3510c01    cmp r1, #256    ; 0x100
  148.  80002d4:   21a01421    lsrcs   r1, r1, #8
  149.  80002d8:   22822008    addcs   r2, r2, #8
  150.  80002dc:   e3510010    cmp r1, #16
  151.  80002e0:   21a01221    lsrcs   r1, r1, #4
  152.  80002e4:   22822004    addcs   r2, r2, #4
  153.  80002e8:   e3510004    cmp r1, #4
  154.  80002ec:   82822003    addhi   r2, r2, #3
  155.  80002f0:   908220a1    addls   r2, r2, r1, lsr #1
  156.  80002f4:   e35c0000    cmp ip, #0
  157.  80002f8:   e1a00233    lsr r0, r3, r2
  158.  80002fc:   42600000    rsbmi   r0, r0, #0
  159.  8000300:   e12fff1e    bx  lr
  160.  8000304:   e3500000    cmp r0, #0
  161.  8000308:   c3e00102    mvngt   r0, #-2147483648    ; 0x80000000
  162.  800030c:   b3a00102    movlt   r0, #-2147483648    ; 0x80000000
  163.  8000310:   ea000007    b   8000334 <__aeabi_idiv0>
  164.  
  165. 08000314 <__aeabi_idivmod>:
  166.  8000314:   e3510000    cmp r1, #0
  167.  8000318:   0afffff9    beq 8000304 <.divsi3_skip_div0_test+0x110>
  168.  800031c:   e92d4003    push    {r0, r1, lr}
  169.  8000320:   ebffffb3    bl  80001f4 <.divsi3_skip_div0_test>
  170.  8000324:   e8bd4006    pop {r1, r2, lr}
  171.  8000328:   e0030092    mul r3, r2, r0
  172.  800032c:   e0411003    sub r1, r1, r3
  173.  8000330:   e12fff1e    bx  lr
  174.  
  175. 08000334 <__aeabi_idiv0>:
  176.  8000334:   e12fff1e    bx  lr
  177.  
  178. 08000338 <main>:
  179. //      return 1;
  180. //  }
  181. //  return ticks;
  182. //}
  183.  
  184. int main(void) {
  185.  8000338:   b580        push    {r7, lr}
  186.  800033a:   b082        sub sp, #8
  187.  800033c:   af00        add r7, sp, #0
  188.     int x  = 100;
  189.  800033e:   2364        movs    r3, #100    ; 0x64
  190.  8000340:   607b        str r3, [r7, #4]
  191.     int y = x / 10;
  192.  8000342:   687b        ldr r3, [r7, #4]
  193.  8000344:   210a        movs    r1, #10
  194.  8000346:   0018        movs    r0, r3
  195.  8000348:   f7ff ff50   bl  80001ec <__divsi3>
  196.  800034c:   0003        movs    r3, r0
  197.  800034e:   603b        str r3, [r7, #0]
  198.     //int x = SystemCoreClock / 10;
  199.     //int x = 8000000 / 10;
  200.     //setup_gpio();
  201.     //setup_systick(x);
  202.  
  203.     while (1) {
  204.  8000350:   e7fe        b.n 8000350 <main+0x18>
  205.     ...
  206.  
  207. 08000354 <SystemInit>:
  208.   *         SystemCoreClock variable.
  209.   * @param  None
  210.   * @retval None
  211.   */
  212. void SystemInit (void)
  213. {    
  214.  8000354:   b580        push    {r7, lr}
  215.  8000356:   af00        add r7, sp, #0
  216.   /* Set HSION bit */
  217.   RCC->CR |= (uint32_t)0x00000001;
  218.  8000358:   4b1b        ldr r3, [pc, #108]  ; (80003c8 <SystemInit+0x74>)
  219.  800035a:   681a        ldr r2, [r3, #0]
  220.  800035c:   4b1a        ldr r3, [pc, #104]  ; (80003c8 <SystemInit+0x74>)
  221.  800035e:   2101        movs    r1, #1
  222.  8000360:   430a        orrs    r2, r1
  223.  8000362:   601a        str r2, [r3, #0]
  224.  
  225.   /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
  226.   RCC->CFGR &= (uint32_t)0xF8FFB80C;
  227.  8000364:   4b18        ldr r3, [pc, #96]   ; (80003c8 <SystemInit+0x74>)
  228.  8000366:   685a        ldr r2, [r3, #4]
  229.  8000368:   4b17        ldr r3, [pc, #92]   ; (80003c8 <SystemInit+0x74>)
  230.  800036a:   4918        ldr r1, [pc, #96]   ; (80003cc <SystemInit+0x78>)
  231.  800036c:   400a        ands    r2, r1
  232.  800036e:   605a        str r2, [r3, #4]
  233.  
  234.   /* Reset HSEON, CSSON and PLLON bits */
  235.   RCC->CR &= (uint32_t)0xFEF6FFFF;
  236.  8000370:   4b15        ldr r3, [pc, #84]   ; (80003c8 <SystemInit+0x74>)
  237.  8000372:   681a        ldr r2, [r3, #0]
  238.  8000374:   4b14        ldr r3, [pc, #80]   ; (80003c8 <SystemInit+0x74>)
  239.  8000376:   4916        ldr r1, [pc, #88]   ; (80003d0 <SystemInit+0x7c>)
  240.  8000378:   400a        ands    r2, r1
  241.  800037a:   601a        str r2, [r3, #0]
  242.  
  243.   /* Reset HSEBYP bit */
  244.   RCC->CR &= (uint32_t)0xFFFBFFFF;
  245.  800037c:   4b12        ldr r3, [pc, #72]   ; (80003c8 <SystemInit+0x74>)
  246.  800037e:   681a        ldr r2, [r3, #0]
  247.  8000380:   4b11        ldr r3, [pc, #68]   ; (80003c8 <SystemInit+0x74>)
  248.  8000382:   4914        ldr r1, [pc, #80]   ; (80003d4 <SystemInit+0x80>)
  249.  8000384:   400a        ands    r2, r1
  250.  8000386:   601a        str r2, [r3, #0]
  251.  
  252.   /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
  253.   RCC->CFGR &= (uint32_t)0xFFC0FFFF;
  254.  8000388:   4b0f        ldr r3, [pc, #60]   ; (80003c8 <SystemInit+0x74>)
  255.  800038a:   685a        ldr r2, [r3, #4]
  256.  800038c:   4b0e        ldr r3, [pc, #56]   ; (80003c8 <SystemInit+0x74>)
  257.  800038e:   4912        ldr r1, [pc, #72]   ; (80003d8 <SystemInit+0x84>)
  258.  8000390:   400a        ands    r2, r1
  259.  8000392:   605a        str r2, [r3, #4]
  260.  
  261.   /* Reset PREDIV1[3:0] bits */
  262.   RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
  263.  8000394:   4b0c        ldr r3, [pc, #48]   ; (80003c8 <SystemInit+0x74>)
  264.  8000396:   6ada        ldr r2, [r3, #44]   ; 0x2c
  265.  8000398:   4b0b        ldr r3, [pc, #44]   ; (80003c8 <SystemInit+0x74>)
  266.  800039a:   210f        movs    r1, #15
  267.  800039c:   438a        bics    r2, r1
  268.  800039e:   62da        str r2, [r3, #44]   ; 0x2c
  269.  
  270.   /* Reset USARTSW[1:0], I2CSW, CECSW and ADCSW bits */
  271.   RCC->CFGR3 &= (uint32_t)0xFFFFFEAC;
  272.  80003a0:   4b09        ldr r3, [pc, #36]   ; (80003c8 <SystemInit+0x74>)
  273.  80003a2:   6b1a        ldr r2, [r3, #48]   ; 0x30
  274.  80003a4:   4b08        ldr r3, [pc, #32]   ; (80003c8 <SystemInit+0x74>)
  275.  80003a6:   490d        ldr r1, [pc, #52]   ; (80003dc <SystemInit+0x88>)
  276.  80003a8:   400a        ands    r2, r1
  277.  80003aa:   631a        str r2, [r3, #48]   ; 0x30
  278.  
  279.   /* Reset HSI14 bit */
  280.   RCC->CR2 &= (uint32_t)0xFFFFFFFE;
  281.  80003ac:   4b06        ldr r3, [pc, #24]   ; (80003c8 <SystemInit+0x74>)
  282.  80003ae:   6b5a        ldr r2, [r3, #52]   ; 0x34
  283.  80003b0:   4b05        ldr r3, [pc, #20]   ; (80003c8 <SystemInit+0x74>)
  284.  80003b2:   2101        movs    r1, #1
  285.  80003b4:   438a        bics    r2, r1
  286.  80003b6:   635a        str r2, [r3, #52]   ; 0x34
  287.  
  288.   /* Disable all interrupts */
  289.   RCC->CIR = 0x00000000;
  290.  80003b8:   4b03        ldr r3, [pc, #12]   ; (80003c8 <SystemInit+0x74>)
  291.  80003ba:   2200        movs    r2, #0
  292.  80003bc:   609a        str r2, [r3, #8]
  293.  
  294.   /* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
  295.   SetSysClock();
  296.  80003be:   f000 f87f   bl  80004c0 <SetSysClock>
  297. }
  298.  80003c2:   46c0        nop         ; (mov r8, r8)
  299.  80003c4:   46bd        mov sp, r7
  300.  80003c6:   bd80        pop {r7, pc}
  301.  80003c8:   40021000    .word   0x40021000
  302.  80003cc:   f8ffb80c    .word   0xf8ffb80c
  303.  80003d0:   fef6ffff    .word   0xfef6ffff
  304.  80003d4:   fffbffff    .word   0xfffbffff
  305.  80003d8:   ffc0ffff    .word   0xffc0ffff
  306.  80003dc:   fffffeac    .word   0xfffffeac
  307.  
  308. 080003e0 <SystemCoreClockUpdate>:
  309.   *           value for HSE crystal.
  310.   * @param  None
  311.   * @retval None
  312.   */
  313. void SystemCoreClockUpdate (void)
  314. {
  315.  80003e0:   b580        push    {r7, lr}
  316.  80003e2:   b084        sub sp, #16
  317.  80003e4:   af00        add r7, sp, #0
  318.   uint32_t tmp = 0, pllmull = 0, pllsource = 0, prediv1factor = 0;
  319.  80003e6:   2300        movs    r3, #0
  320.  80003e8:   60fb        str r3, [r7, #12]
  321.  80003ea:   2300        movs    r3, #0
  322.  80003ec:   60bb        str r3, [r7, #8]
  323.  80003ee:   2300        movs    r3, #0
  324.  80003f0:   607b        str r3, [r7, #4]
  325.  80003f2:   2300        movs    r3, #0
  326.  80003f4:   603b        str r3, [r7, #0]
  327.  
  328.   /* Get SYSCLK source -------------------------------------------------------*/
  329.   tmp = RCC->CFGR & RCC_CFGR_SWS;
  330.  80003f6:   4b2e        ldr r3, [pc, #184]  ; (80004b0 <SystemCoreClockUpdate+0xd0>)
  331.  80003f8:   685b        ldr r3, [r3, #4]
  332.  80003fa:   220c        movs    r2, #12
  333.  80003fc:   4013        ands    r3, r2
  334.  80003fe:   60fb        str r3, [r7, #12]
  335.  
  336.   switch (tmp)
  337.  8000400:   68fb        ldr r3, [r7, #12]
  338.  8000402:   2b04        cmp r3, #4
  339.  8000404:   d007        beq.n   8000416 <SystemCoreClockUpdate+0x36>
  340.  8000406:   2b08        cmp r3, #8
  341.  8000408:   d009        beq.n   800041e <SystemCoreClockUpdate+0x3e>
  342.  800040a:   2b00        cmp r3, #0
  343.  800040c:   d138        bne.n   8000480 <SystemCoreClockUpdate+0xa0>
  344.   {
  345.     case 0x00:  /* HSI used as system clock */
  346.       SystemCoreClock = HSI_VALUE;
  347.  800040e:   4b29        ldr r3, [pc, #164]  ; (80004b4 <SystemCoreClockUpdate+0xd4>)
  348.  8000410:   4a29        ldr r2, [pc, #164]  ; (80004b8 <SystemCoreClockUpdate+0xd8>)
  349.  8000412:   601a        str r2, [r3, #0]
  350.       break;
  351.  8000414:   e038        b.n 8000488 <SystemCoreClockUpdate+0xa8>
  352.     case 0x04:  /* HSE used as system clock */
  353.       SystemCoreClock = HSE_VALUE;
  354.  8000416:   4b27        ldr r3, [pc, #156]  ; (80004b4 <SystemCoreClockUpdate+0xd4>)
  355.  8000418:   4a27        ldr r2, [pc, #156]  ; (80004b8 <SystemCoreClockUpdate+0xd8>)
  356.  800041a:   601a        str r2, [r3, #0]
  357.       break;
  358.  800041c:   e034        b.n 8000488 <SystemCoreClockUpdate+0xa8>
  359.     case 0x08:  /* PLL used as system clock */
  360.       /* Get PLL clock source and multiplication factor ----------------------*/
  361.       pllmull = RCC->CFGR & RCC_CFGR_PLLMULL;
  362.  800041e:   4b24        ldr r3, [pc, #144]  ; (80004b0 <SystemCoreClockUpdate+0xd0>)
  363.  8000420:   685a        ldr r2, [r3, #4]
  364.  8000422:   23f0        movs    r3, #240    ; 0xf0
  365.  8000424:   039b        lsls    r3, r3, #14
  366.  8000426:   4013        ands    r3, r2
  367.  8000428:   60bb        str r3, [r7, #8]
  368.       pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
  369.  800042a:   4b21        ldr r3, [pc, #132]  ; (80004b0 <SystemCoreClockUpdate+0xd0>)
  370.  800042c:   685a        ldr r2, [r3, #4]
  371.  800042e:   23c0        movs    r3, #192    ; 0xc0
  372.  8000430:   025b        lsls    r3, r3, #9
  373.  8000432:   4013        ands    r3, r2
  374.  8000434:   607b        str r3, [r7, #4]
  375.       pllmull = ( pllmull >> 18) + 2;
  376.  8000436:   68bb        ldr r3, [r7, #8]
  377.  8000438:   0c9b        lsrs    r3, r3, #18
  378.  800043a:   3302        adds    r3, #2
  379.  800043c:   60bb        str r3, [r7, #8]
  380.      
  381.       if (pllsource == 0x00)
  382.  800043e:   687b        ldr r3, [r7, #4]
  383.  8000440:   2b00        cmp r3, #0
  384.  8000442:   d10c        bne.n   800045e <SystemCoreClockUpdate+0x7e>
  385.       {
  386.         /* HSI oscillator clock divided by 2 selected as PLL clock entry */
  387.         SystemCoreClock = (HSI_VALUE >> 1) * pllmull;
  388.  8000444:   68b9        ldr r1, [r7, #8]
  389.  8000446:   000a        movs    r2, r1
  390.  8000448:   0152        lsls    r2, r2, #5
  391.  800044a:   1a52        subs    r2, r2, r1
  392.  800044c:   0193        lsls    r3, r2, #6
  393.  800044e:   1a9b        subs    r3, r3, r2
  394.  8000450:   00db        lsls    r3, r3, #3
  395.  8000452:   185b        adds    r3, r3, r1
  396.  8000454:   021b        lsls    r3, r3, #8
  397.  8000456:   001a        movs    r2, r3
  398.  8000458:   4b16        ldr r3, [pc, #88]   ; (80004b4 <SystemCoreClockUpdate+0xd4>)
  399.  800045a:   601a        str r2, [r3, #0]
  400.       {
  401.         prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1;
  402.         /* HSE oscillator clock selected as PREDIV1 clock entry */
  403.         SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
  404.       }      
  405.       break;
  406.  800045c:   e014        b.n 8000488 <SystemCoreClockUpdate+0xa8>
  407.         prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1;
  408.  800045e:   4b14        ldr r3, [pc, #80]   ; (80004b0 <SystemCoreClockUpdate+0xd0>)
  409.  8000460:   6adb        ldr r3, [r3, #44]   ; 0x2c
  410.  8000462:   220f        movs    r2, #15
  411.  8000464:   4013        ands    r3, r2
  412.  8000466:   3301        adds    r3, #1
  413.  8000468:   603b        str r3, [r7, #0]
  414.         SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
  415.  800046a:   6839        ldr r1, [r7, #0]
  416.  800046c:   4812        ldr r0, [pc, #72]   ; (80004b8 <SystemCoreClockUpdate+0xd8>)
  417.  800046e:   f7ff fe33   bl  80000d8 <__udivsi3>
  418.  8000472:   0003        movs    r3, r0
  419.  8000474:   001a        movs    r2, r3
  420.  8000476:   68bb        ldr r3, [r7, #8]
  421.  8000478:   435a        muls    r2, r3
  422.  800047a:   4b0e        ldr r3, [pc, #56]   ; (80004b4 <SystemCoreClockUpdate+0xd4>)
  423.  800047c:   601a        str r2, [r3, #0]
  424.       break;
  425.  800047e:   e003        b.n 8000488 <SystemCoreClockUpdate+0xa8>
  426.     default: /* HSI used as system clock */
  427.       SystemCoreClock = HSI_VALUE;
  428.  8000480:   4b0c        ldr r3, [pc, #48]   ; (80004b4 <SystemCoreClockUpdate+0xd4>)
  429.  8000482:   4a0d        ldr r2, [pc, #52]   ; (80004b8 <SystemCoreClockUpdate+0xd8>)
  430.  8000484:   601a        str r2, [r3, #0]
  431.       break;
  432.  8000486:   46c0        nop         ; (mov r8, r8)
  433.   }
  434.   /* Compute HCLK clock frequency ----------------*/
  435.   /* Get HCLK prescaler */
  436.   tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
  437.  8000488:   4b09        ldr r3, [pc, #36]   ; (80004b0 <SystemCoreClockUpdate+0xd0>)
  438.  800048a:   685b        ldr r3, [r3, #4]
  439.  800048c:   091b        lsrs    r3, r3, #4
  440.  800048e:   220f        movs    r2, #15
  441.  8000490:   4013        ands    r3, r2
  442.  8000492:   4a0a        ldr r2, [pc, #40]   ; (80004bc <SystemCoreClockUpdate+0xdc>)
  443.  8000494:   5cd3        ldrb    r3, [r2, r3]
  444.  8000496:   b2db        uxtb    r3, r3
  445.  8000498:   60fb        str r3, [r7, #12]
  446.   /* HCLK clock frequency */
  447.   SystemCoreClock >>= tmp;  
  448.  800049a:   4b06        ldr r3, [pc, #24]   ; (80004b4 <SystemCoreClockUpdate+0xd4>)
  449.  800049c:   681a        ldr r2, [r3, #0]
  450.  800049e:   68fb        ldr r3, [r7, #12]
  451.  80004a0:   40da        lsrs    r2, r3
  452.  80004a2:   4b04        ldr r3, [pc, #16]   ; (80004b4 <SystemCoreClockUpdate+0xd4>)
  453.  80004a4:   601a        str r2, [r3, #0]
  454. }
  455.  80004a6:   46c0        nop         ; (mov r8, r8)
  456.  80004a8:   46bd        mov sp, r7
  457.  80004aa:   b004        add sp, #16
  458.  80004ac:   bd80        pop {r7, pc}
  459.  80004ae:   46c0        nop         ; (mov r8, r8)
  460.  80004b0:   40021000    .word   0x40021000
  461.  80004b4:   20000000    .word   0x20000000
  462.  80004b8:   007a1200    .word   0x007a1200
  463.  80004bc:   20000004    .word   0x20000004
  464.  
  465. 080004c0 <SetSysClock>:
  466.   *         is reset to the default reset state (done in SystemInit() function).
  467.   * @param  None
  468.   * @retval None
  469.   */
  470. static void SetSysClock(void)
  471. {
  472.  80004c0:   b580        push    {r7, lr}
  473.  80004c2:   b082        sub sp, #8
  474.  80004c4:   af00        add r7, sp, #0
  475.   __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
  476.  80004c6:   2300        movs    r3, #0
  477.  80004c8:   607b        str r3, [r7, #4]
  478.  80004ca:   2300        movs    r3, #0
  479.  80004cc:   603b        str r3, [r7, #0]
  480. /*                        HSE used as System clock source                     */
  481. /******************************************************************************/
  482.  
  483.   /* SYSCLK, HCLK, PCLK configuration ----------------------------------------*/
  484.   /* Enable HSE */    
  485.   RCC->CR |= ((uint32_t)RCC_CR_HSEON);
  486.  80004ce:   4b24        ldr r3, [pc, #144]  ; (8000560 <SetSysClock+0xa0>)
  487.  80004d0:   681a        ldr r2, [r3, #0]
  488.  80004d2:   4b23        ldr r3, [pc, #140]  ; (8000560 <SetSysClock+0xa0>)
  489.  80004d4:   2180        movs    r1, #128    ; 0x80
  490.  80004d6:   0249        lsls    r1, r1, #9
  491.  80004d8:   430a        orrs    r2, r1
  492.  80004da:   601a        str r2, [r3, #0]
  493.  
  494.   /* Wait till HSE is ready and if Time out is reached exit */
  495.   do
  496.   {
  497.     HSEStatus = RCC->CR & RCC_CR_HSERDY;
  498.  80004dc:   4b20        ldr r3, [pc, #128]  ; (8000560 <SetSysClock+0xa0>)
  499.  80004de:   681a        ldr r2, [r3, #0]
  500.  80004e0:   2380        movs    r3, #128    ; 0x80
  501.  80004e2:   029b        lsls    r3, r3, #10
  502.  80004e4:   4013        ands    r3, r2
  503.  80004e6:   603b        str r3, [r7, #0]
  504.     StartUpCounter++;  
  505.  80004e8:   687b        ldr r3, [r7, #4]
  506.  80004ea:   3301        adds    r3, #1
  507.  80004ec:   607b        str r3, [r7, #4]
  508.   } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
  509.  80004ee:   683b        ldr r3, [r7, #0]
  510.  80004f0:   2b00        cmp r3, #0
  511.  80004f2:   d104        bne.n   80004fe <SetSysClock+0x3e>
  512.  80004f4:   687a        ldr r2, [r7, #4]
  513.  80004f6:   23a0        movs    r3, #160    ; 0xa0
  514.  80004f8:   01db        lsls    r3, r3, #7
  515.  80004fa:   429a        cmp r2, r3
  516.  80004fc:   d1ee        bne.n   80004dc <SetSysClock+0x1c>
  517.  
  518.   if ((RCC->CR & RCC_CR_HSERDY) != RESET)
  519.  80004fe:   4b18        ldr r3, [pc, #96]   ; (8000560 <SetSysClock+0xa0>)
  520.  8000500:   681a        ldr r2, [r3, #0]
  521.  8000502:   2380        movs    r3, #128    ; 0x80
  522.  8000504:   029b        lsls    r3, r3, #10
  523.  8000506:   4013        ands    r3, r2
  524.  8000508:   d002        beq.n   8000510 <SetSysClock+0x50>
  525.   {
  526.     HSEStatus = (uint32_t)0x01;
  527.  800050a:   2301        movs    r3, #1
  528.  800050c:   603b        str r3, [r7, #0]
  529.  800050e:   e001        b.n 8000514 <SetSysClock+0x54>
  530.   }
  531.   else
  532.   {
  533.     HSEStatus = (uint32_t)0x00;
  534.  8000510:   2300        movs    r3, #0
  535.  8000512:   603b        str r3, [r7, #0]
  536.   }  
  537.  
  538.   if (HSEStatus == (uint32_t)0x01)
  539.  8000514:   683b        ldr r3, [r7, #0]
  540.  8000516:   2b01        cmp r3, #1
  541.  8000518:   d11d        bne.n   8000556 <SetSysClock+0x96>
  542.   {
  543.     /* Enable Prefetch Buffer and Flash 0 wait state */
  544.     FLASH->ACR = FLASH_ACR_PRFTBE;
  545.  800051a:   4b12        ldr r3, [pc, #72]   ; (8000564 <SetSysClock+0xa4>)
  546.  800051c:   2210        movs    r2, #16
  547.  800051e:   601a        str r2, [r3, #0]
  548.  
  549.      /* HCLK = SYSCLK / 1 */
  550.      RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;
  551.  8000520:   4a0f        ldr r2, [pc, #60]   ; (8000560 <SetSysClock+0xa0>)
  552.  8000522:   4b0f        ldr r3, [pc, #60]   ; (8000560 <SetSysClock+0xa0>)
  553.  8000524:   6852        ldr r2, [r2, #4]
  554.  8000526:   605a        str r2, [r3, #4]
  555.        
  556.      /* PCLK = HCLK / 1 */
  557.      RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE_DIV1;
  558.  8000528:   4a0d        ldr r2, [pc, #52]   ; (8000560 <SetSysClock+0xa0>)
  559.  800052a:   4b0d        ldr r3, [pc, #52]   ; (8000560 <SetSysClock+0xa0>)
  560.  800052c:   6852        ldr r2, [r2, #4]
  561.  800052e:   605a        str r2, [r3, #4]
  562.  
  563.     /* Select HSE as system clock source */
  564.     RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
  565.  8000530:   4b0b        ldr r3, [pc, #44]   ; (8000560 <SetSysClock+0xa0>)
  566.  8000532:   685a        ldr r2, [r3, #4]
  567.  8000534:   4b0a        ldr r3, [pc, #40]   ; (8000560 <SetSysClock+0xa0>)
  568.  8000536:   2103        movs    r1, #3
  569.  8000538:   438a        bics    r2, r1
  570.  800053a:   605a        str r2, [r3, #4]
  571.     RCC->CFGR |= (uint32_t)RCC_CFGR_SW_HSE;    
  572.  800053c:   4b08        ldr r3, [pc, #32]   ; (8000560 <SetSysClock+0xa0>)
  573.  800053e:   685a        ldr r2, [r3, #4]
  574.  8000540:   4b07        ldr r3, [pc, #28]   ; (8000560 <SetSysClock+0xa0>)
  575.  8000542:   2101        movs    r1, #1
  576.  8000544:   430a        orrs    r2, r1
  577.  8000546:   605a        str r2, [r3, #4]
  578.  
  579.     /* Wait till HSE is used as system clock source */
  580.     while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_HSE)
  581.  8000548:   46c0        nop         ; (mov r8, r8)
  582.  800054a:   4b05        ldr r3, [pc, #20]   ; (8000560 <SetSysClock+0xa0>)
  583.  800054c:   685b        ldr r3, [r3, #4]
  584.  800054e:   220c        movs    r2, #12
  585.  8000550:   4013        ands    r3, r2
  586.  8000552:   2b04        cmp r3, #4
  587.  8000554:   d1f9        bne.n   800054a <SetSysClock+0x8a>
  588.   }
  589.   else
  590.   { /* If HSE fails to start-up, the application will have wrong clock
  591.          configuration. User can add here some code to deal with this error */
  592.   }
  593. }
  594.  8000556:   46c0        nop         ; (mov r8, r8)
  595.  8000558:   46bd        mov sp, r7
  596.  800055a:   b002        add sp, #8
  597.  800055c:   bd80        pop {r7, pc}
  598.  800055e:   46c0        nop         ; (mov r8, r8)
  599.  8000560:   40021000    .word   0x40021000
  600.  8000564:   40022000    .word   0x40022000
  601.  
  602. 08000568 <Reset_Handler>:
  603.  
  604.   .section .text.Reset_Handler
  605.   .weak Reset_Handler
  606.   .type Reset_Handler, %function
  607. Reset_Handler:
  608.   ldr   r0, =_estack
  609.  8000568:   4812        ldr r0, [pc, #72]   ; (80005b4 <LoopForever+0x2>)
  610.   mov   sp, r0          /* set stack pointer */
  611.  800056a:   4685        mov sp, r0
  612.  
  613. /*Check if boot space corresponds to test memory*/
  614.  
  615.     LDR R0,=0x00000004
  616.  800056c:   4812        ldr r0, [pc, #72]   ; (80005b8 <LoopForever+0x6>)
  617.     LDR R1, [R0]
  618.  800056e:   6801        ldr r1, [r0, #0]
  619.     LSRS R1, R1, #24
  620.  8000570:   0e09        lsrs    r1, r1, #24
  621.     LDR R2,=0x1F
  622.  8000572:   4a12        ldr r2, [pc, #72]   ; (80005bc <LoopForever+0xa>)
  623.     CMP R1, R2
  624.  8000574:   4291        cmp r1, r2
  625.     BNE ApplicationStart
  626.  8000576:   d105        bne.n   8000584 <ApplicationStart>
  627.  
  628.  /*SYSCFG clock enable*/
  629.  
  630.     LDR R0,=0x40021018
  631.  8000578:   4811        ldr r0, [pc, #68]   ; (80005c0 <LoopForever+0xe>)
  632.     LDR R1,=0x00000001
  633.  800057a:   4912        ldr r1, [pc, #72]   ; (80005c4 <LoopForever+0x12>)
  634.     STR R1, [R0]
  635.  800057c:   6001        str r1, [r0, #0]
  636.  
  637. /*Set CFGR1 register with flash memory remap at address 0*/
  638.     LDR R0,=0x40010000
  639.  800057e:   4812        ldr r0, [pc, #72]   ; (80005c8 <LoopForever+0x16>)
  640.     LDR R1,=0x00000000
  641.  8000580:   4912        ldr r1, [pc, #72]   ; (80005cc <LoopForever+0x1a>)
  642.     STR R1, [R0]
  643.  8000582:   6001        str r1, [r0, #0]
  644.  
  645. 08000584 <ApplicationStart>:
  646.  
  647. ApplicationStart:
  648. /* Copy the data segment initializers from flash to SRAM */
  649.   movs r1, #0
  650.  8000584:   2100        movs    r1, #0
  651.   b LoopCopyDataInit
  652.  8000586:   e003        b.n 8000590 <LoopCopyDataInit>
  653.  
  654. 08000588 <CopyDataInit>:
  655.  
  656. CopyDataInit:
  657.   ldr r3, =_sidata
  658.  8000588:   4b11        ldr r3, [pc, #68]   ; (80005d0 <LoopForever+0x1e>)
  659.   ldr r3, [r3, r1]
  660.  800058a:   585b        ldr r3, [r3, r1]
  661.   str r3, [r0, r1]
  662.  800058c:   5043        str r3, [r0, r1]
  663.   adds r1, r1, #4
  664.  800058e:   3104        adds    r1, #4
  665.  
  666. 08000590 <LoopCopyDataInit>:
  667.  
  668. LoopCopyDataInit:
  669.   ldr r0, =_sdata
  670.  8000590:   4810        ldr r0, [pc, #64]   ; (80005d4 <LoopForever+0x22>)
  671.   ldr r3, =_edata
  672.  8000592:   4b11        ldr r3, [pc, #68]   ; (80005d8 <LoopForever+0x26>)
  673.   adds r2, r0, r1
  674.  8000594:   1842        adds    r2, r0, r1
  675.   cmp r2, r3
  676.  8000596:   429a        cmp r2, r3
  677.   bcc CopyDataInit
  678.  8000598:   d3f6        bcc.n   8000588 <CopyDataInit>
  679.   ldr r2, =_sbss
  680.  800059a:   4a10        ldr r2, [pc, #64]   ; (80005dc <LoopForever+0x2a>)
  681.   b LoopFillZerobss
  682.  800059c:   e002        b.n 80005a4 <LoopFillZerobss>
  683.  
  684. 0800059e <FillZerobss>:
  685. /* Zero fill the bss segment. */
  686. FillZerobss:
  687.   movs r3, #0
  688.  800059e:   2300        movs    r3, #0
  689.   str  r3, [r2]
  690.  80005a0:   6013        str r3, [r2, #0]
  691.   adds r2, r2, #4
  692.  80005a2:   3204        adds    r2, #4
  693.  
  694. 080005a4 <LoopFillZerobss>:
  695.  
  696.  
  697. LoopFillZerobss:
  698.   ldr r3, = _ebss
  699.  80005a4:   4b0e        ldr r3, [pc, #56]   ; (80005e0 <LoopForever+0x2e>)
  700.   cmp r2, r3
  701.  80005a6:   429a        cmp r2, r3
  702.   bcc FillZerobss
  703.  80005a8:   d3f9        bcc.n   800059e <FillZerobss>
  704.  
  705. /* Call the clock system intitialization function.*/
  706.     bl  SystemInit
  707.  80005aa:   f7ff fed3   bl  8000354 <SystemInit>
  708.    
  709. /* Call the application's entry point.*/
  710.  bl main
  711.  80005ae:   f7ff fec3   bl  8000338 <main>
  712.  
  713. 080005b2 <LoopForever>:
  714.  
  715. LoopForever:
  716.    b LoopForever
  717.  80005b2:   e7fe        b.n 80005b2 <LoopForever>
  718.  ldr   r0, =_estack
  719.  80005b4:   20001000    .word   0x20001000
  720.    LDR R0,=0x00000004
  721.  80005b8:   00000004    .word   0x00000004
  722.    LDR R2,=0x1F
  723.  80005bc:   0000001f    .word   0x0000001f
  724.    LDR R0,=0x40021018
  725.  80005c0:   40021018    .word   0x40021018
  726.    LDR R1,=0x00000001
  727.  80005c4:   00000001    .word   0x00000001
  728.    LDR R0,=0x40010000
  729.  80005c8:   40010000    .word   0x40010000
  730.    LDR R1,=0x00000000
  731.  80005cc:   00000000    .word   0x00000000
  732.  ldr r3, =_sidata
  733.  80005d0:   080005e8    .word   0x080005e8
  734.  ldr r0, =_sdata
  735.  80005d4:   20000000    .word   0x20000000
  736.  ldr r3, =_edata
  737.  80005d8:   20000014    .word   0x20000014
  738.  ldr r2, =_sbss
  739.  80005dc:   20000014    .word   0x20000014
  740.  ldr r3, = _ebss
  741.  80005e0:   20000014    .word   0x20000014
  742.  
  743. 080005e4 <ADC1_IRQHandler>:
  744. * @retval : None
  745. */
  746.    .section .text.Default_Handler,"ax",%progbits
  747. Default_Handler:
  748. Infinite_Loop:
  749.  b Infinite_Loop
  750.  80005e4:   e7fe        b.n 80005e4 <ADC1_IRQHandler>
  751.  
  752. Disassembly of section .data:
  753.  
  754. 20000000 <SystemCoreClock>:
  755. 20000000:   1200 007a                                   ..z.
  756.  
  757. 20000004 <AHBPrescTable>:
  758.     ...
  759. 2000000c:   0201 0403 0706 0908                         ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement