<div dir="ltr"><div dir="ltr"><div dir="ltr">arm-rtems4.11-objdump -dS hello.exe | grep idle --color=auto -n -B 5 -A 12</div><div dir="ltr"><br></div><div>there is no idle function which calls wfi command<br></div><div>// log</div><div>508-        <br>509-        <br>510-                <br>511-    }<br>512-    <br>513:    if((*USART2_SR) & (1<<4))  // idle<br>514-     3aa:    4b13          ldr    r3, [pc, #76]    ; (3f8 <USART2_handler+0x94>)<br>515-     3ac:    681b          ldr    r3, [r3, #0]<br>516-     3ae:    681b          ldr    r3, [r3, #0]<br>517-     3b0:    f003 0310     and.w    r3, r3, #16<br>518-     3b4:    2b00          cmp    r3, #0<br>519-     3b6:    d00a          beq.n    3ce <USART2_handler+0x6a><br>520-    {<br>521:        //printk("idle ");<br>522-        <br>523-        temp = (*USART2_SR);<br>524-     3b8:    4b0f          ldr    r3, [pc, #60]    ; (3f8 <USART2_handler+0x94>)<br>525-     3ba:    681b          ldr    r3, [r3, #0]<br>526-     3bc:    681b          ldr    r3, [r3, #0]<br>527-     3be:    60fb          str    r3, [r7, #12]<br>528-        temp = (*USART2_DR);<br>529-     3c0:    4b0f          ldr    r3, [pc, #60]    ; (400 <USART2_handler+0x9c>)<br>530-     3c2:    681b          ldr    r3, [r3, #0]<br>531-     3c4:    681b          ldr    r3, [r3, #0]<br>532-     3c6:    60fb          str    r3, [r7, #12]<br>533-        //temp = temp;<br>--<br>627-        <br>628-        <br>629-                <br>630-    }<br>631-    <br>632:    if((*USART3_SR) & (1<<4))  // idle<br>633-     44c:    4b12          ldr    r3, [pc, #72]    ; (498 <USART3_handler+0x8c>)<br>634-     44e:    681b          ldr    r3, [r3, #0]<br>635-     450:    681b          ldr    r3, [r3, #0]<br>636-     452:    f003 0310     and.w    r3, r3, #16<br>637-     456:    2b00          cmp    r3, #0<br>638-     458:    d00a          beq.n    470 <USART3_handler+0x64><br>639-    {<br>640:        //printk("idle ");<br>641-        <br>642-        temp = (*USART3_SR);<br>643-     45a:    4b0f          ldr    r3, [pc, #60]    ; (498 <USART3_handler+0x8c>)<br>644-     45c:    681b          ldr    r3, [r3, #0]<br>645-     45e:    681b          ldr    r3, [r3, #0]<br>646-     460:    60fb          str    r3, [r7, #12]<br>647-        temp = (*USART3_DR);<br>648-     462:    4b0f          ldr    r3, [pc, #60]    ; (4a0 <USART3_handler+0x94>)<br>649-     464:    681b          ldr    r3, [r3, #0]<br>650-     466:    681b          ldr    r3, [r3, #0]<br>651-     468:    60fb          str    r3, [r7, #12]<br>652-        <br>--<br>26329-<br>26330-    if (newTail == tty->rawOutBuf.Head) {<br>26331-      /*<br>26332-       * Buffer has become empty<br>26333-       */<br>26334:      tty->rawOutBufState = rob_idle;<br>26335-    69a0:    f880 5094     strb.w    r5, [r0, #148]    ; 0x94<br>26336-      (*tty->handler.write) (ctx, NULL, 0);<br>26337-    69a4:    f8d4 30c4     ldr.w    r3, [r4, #196]    ; 0xc4<br>26338-    69a8:    4670          mov    r0, lr<br>26339-    69aa:    4629          mov    r1, r5<br>26340-    69ac:    462a          mov    r2, r5<br>26341-    69ae:    4798          blx    r3<br>26342-      nToSend = 0;<br>26343-<br>26344-      /*<br>26345-       * check to see if snd wakeup callback was set<br>26346-       */<br>--<br>26443-    6a12:    2600          movs    r6, #0<br>26444-    6a14:    e7ac          b.n    6970 <rtems_termios_refill_transmitter+0x7c><br>26445-      /*<br>26446-       * Buffer has become empty<br>26447-       */<br>26448:      tty->rawOutBufState = rob_idle;<br>26449-      (*tty->handler.write) (ctx, NULL, 0);<br>26450-      nToSend = 0;<br>26451-    6a16:    461d          mov    r5, r3<br>26452-    6a18:    e7aa          b.n    6970 <rtems_termios_refill_transmitter+0x7c><br>26453-    6a1a:    bf00          nop<br>26454-<br>26455-00006a1c <rtems_termios_txdaemon>:<br>26456-<br>26457-/*<br>26458- * this task actually processes any transmit events<br>26459- */<br>26460-static rtems_task rtems_termios_txdaemon(rtems_task_argument argument)<br>--<br>27083-      RTEMS_NO_PRIORITY,<br>27084-      &tty->rawOutBuf.Semaphore);<br>27085-    if (sc != RTEMS_SUCCESSFUL)<br>27086-    6cc0:    2800          cmp    r0, #0<br>27087-    6cc2:    f040 80d6     bne.w    6e72 <rtems_termios_open_tty+0x2de><br>27088:    tty->rawOutBufState = rob_idle;<br>27089-<br>27090-    /*<br>27091-     * Set callbacks<br>27092-     */<br>27093-    if (device_node != NULL) {<br>27094-    6cc6:    9b0e          ldr    r3, [sp, #56]    ; 0x38<br>27095-      RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,<br>27096-      RTEMS_NO_PRIORITY,<br>27097-      &tty->rawOutBuf.Semaphore);<br>27098-    if (sc != RTEMS_SUCCESSFUL)<br>27099-      rtems_fatal_error_occurred (sc);<br>27100:    tty->rawOutBufState = rob_idle;<br>27101-    6cc8:    f884 0094     strb.w    r0, [r4, #148]    ; 0x94<br>27102-<br>27103-    /*<br>27104-     * Set callbacks<br>27105-     */<br>27106-    if (device_node != NULL) {<br>27107-    6ccc:    2b00          cmp    r3, #0<br>27108-    6cce:    f000 80e9     beq.w    6ea4 <rtems_termios_open_tty+0x310><br>27109-      device_node->tty = tty;<br>27110-      tty->handler = *device_node->handler;<br>27111-    6cd2:    f104 0cb8     add.w    ip, r4, #184    ; 0xb8<br>27112-    6cd6:    4666          mov    r6, ip<br>--<br>29226-      /* disable interrupts    */<br>29227-      rtems_termios_device_lock_acquire (ctx, &lock_context);<br>29228-      tty->flow_ctrl &= ~FL_OSTOP;<br>29229-    7442:    f8d4 30d8     ldr.w    r3, [r4, #216]    ; 0xd8<br>29230-      /* check for chars in output buffer (or rob_state?) */<br>29231:      if (tty->rawOutBufState != rob_idle) {<br>29232-    7446:    f894 2094     ldrb.w    r2, [r4, #148]    ; 0x94<br>29233-<br>29234-    /* has output been stopped due to received XOFF? */<br>29235-    if (tty->flow_ctrl & FL_OSTOP) {<br>29236-      /* disable interrupts    */<br>29237-      rtems_termios_device_lock_acquire (ctx, &lock_context);<br>29238-      tty->flow_ctrl &= ~FL_OSTOP;<br>29239-    744a:    f023 0320     bic.w    r3, r3, #32<br>29240-    744e:    f8c4 30d8     str.w    r3, [r4, #216]    ; 0xd8<br>29241-      /* check for chars in output buffer (or rob_state?) */<br>29242:      if (tty->rawOutBufState != rob_idle) {<br>29243-    7452:    2a00          cmp    r2, #0<br>29244-    7454:    f040 80cf     bne.w    75f6 <rtems_termios_ioctl+0x306><br>29245-    ARM_SWITCH_BACK<br>29246-    : ARM_SWITCH_OUTPUT<br>29247-    : [level] "r" (level)<br>29248-  );<br>29249-#elif defined(ARM_MULTILIB_ARCH_V7M)<br>29250-  __asm__ volatile (<br>29251-    7458:    f387 8811     msr    BASEPRI, r7<br>29252-      /* reenable interrupts */<br>29253-      rtems_termios_device_lock_release (ctx, &lock_context);<br>29254-    }<br>--<br>29492-<br>29493-  rtems_termios_device_lock_acquire (ctx, &lock_context);<br>29494-  tty->rawOutBuf.Tail = 0;<br>29495-    7572:    f8c4 0084     str.w    r0, [r4, #132]    ; 0x84<br>29496-  tty->rawOutBuf.Head = 0;<br>29497:  tty->rawOutBufState = rob_idle;<br>29498-    7576:    f884 0094     strb.w    r0, [r4, #148]    ; 0x94<br>29499-  rtems_termios_device_context *ctx = tty->device_context;<br>29500-  rtems_interrupt_lock_context lock_context;<br>29501-<br>29502-  rtems_termios_device_lock_acquire (ctx, &lock_context);<br>29503-  tty->rawOutBuf.Tail = 0;<br>29504-  tty->rawOutBuf.Head = 0;<br>29505-    757a:    f8c4 0080     str.w    r0, [r4, #128]    ; 0x80<br>29506-    ARM_SWITCH_BACK<br>29507-    : ARM_SWITCH_OUTPUT<br>29508-    : [level] "r" (level)<br>29509-  );<br>--<br>29562-<br>29563-  rtems_termios_device_lock_acquire (ctx, &lock_context);<br>29564-  tty->rawOutBuf.Tail = 0;<br>29565-    75b0:    f8c4 0084     str.w    r0, [r4, #132]    ; 0x84<br>29566-  tty->rawOutBuf.Head = 0;<br>29567:  tty->rawOutBufState = rob_idle;<br>29568-    75b4:    f884 0094     strb.w    r0, [r4, #148]    ; 0x94<br>29569-  rtems_termios_device_context *ctx = tty->device_context;<br>29570-  rtems_interrupt_lock_context lock_context;<br>29571-<br>29572-  rtems_termios_device_lock_acquire (ctx, &lock_context);<br>29573-  tty->rawOutBuf.Tail = 0;<br>29574-  tty->rawOutBuf.Head = 0;<br>29575-    75b8:    f8c4 0080     str.w    r0, [r4, #128]    ; 0x80<br>29576-    ARM_SWITCH_BACK<br>29577-    : ARM_SWITCH_OUTPUT<br>29578-    : [level] "r" (level)<br>29579-  );<br>--<br>29629-    75f0:    2301          movs    r3, #1<br>29630-    75f2:    66e3          str    r3, [r4, #108]    ; 0x6c<br>29631-    75f4:    e77e          b.n    74f4 <rtems_termios_ioctl+0x204><br>29632-      tty->flow_ctrl &= ~FL_OSTOP;<br>29633-      /* check for chars in output buffer (or rob_state?) */<br>29634:      if (tty->rawOutBufState != rob_idle) {<br>29635-        /* if chars available, call write function... */<br>29636-        (*tty->handler.write)(<br>29637-          ctx, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail],1);<br>29638-    75f6:    f8d4 2084     ldr.w    r2, [r4, #132]    ; 0x84<br>29639-      rtems_termios_device_lock_acquire (ctx, &lock_context);<br>29640-      tty->flow_ctrl &= ~FL_OSTOP;<br>29641-      /* check for chars in output buffer (or rob_state?) */<br>29642:      if (tty->rawOutBufState != rob_idle) {<br>29643-        /* if chars available, call write function... */<br>29644-        (*tty->handler.write)(<br>29645-    75fa:    6fe1          ldr    r1, [r4, #124]    ; 0x7c<br>29646-    75fc:    f8d4 30c4     ldr.w    r3, [r4, #196]    ; 0xc4<br>29647-    7600:    4411          add    r1, r2<br>29648-    7602:    4628          mov    r0, r5<br>29649-    7604:    2201          movs    r2, #1<br>29650-    7606:    4798          blx    r3<br>29651-    7608:    e726          b.n    7458 <rtems_termios_ioctl+0x168><br>29652-    760a:    bf00          nop<br>29653-<br>29654-0000760c <rtems_termios_puts>:<br>--<br>29815-    76b2:    bf24          itt    cs<br>29816-    76b4:    f8d4 2088     ldrcs.w    r2, [r4, #136]    ; 0x88<br>29817-    76b8:    1a9b          subcs    r3, r3, r2<br>29818-    tty->rawOutBuf.Head = newHead;<br>29819-<br>29820:    if (tty->rawOutBufState == rob_idle) {<br>29821-    76ba:    f894 2094     ldrb.w    r2, [r4, #148]    ; 0x94<br>29822-    memcpy(&tty->rawOutBuf.theBuf[tty->rawOutBuf.Head], buf, nToCopy);<br>29823-<br>29824-    newHead = tty->rawOutBuf.Head + nToCopy;<br>29825-    if (newHead >= tty->rawOutBuf.Size)<br>29826-      newHead -= tty->rawOutBuf.Size;<br>29827-    tty->rawOutBuf.Head = newHead;<br>29828-    76be:    f8c4 3080     str.w    r3, [r4, #128]    ; 0x80<br>29829-<br>29830:    if (tty->rawOutBufState == rob_idle) {<br>29831-    76c2:    b192          cbz    r2, 76ea <rtems_termios_puts+0xde><br>29832-    ARM_SWITCH_BACK<br>29833-    : ARM_SWITCH_OUTPUT<br>29834-    : [level] "r" (level)<br>29835-  );<br>29836-#elif defined(ARM_MULTILIB_ARCH_V7M)<br>29837-  __asm__ volatile (<br>29838-    76c4:    f385 8811     msr    BASEPRI, r5<br>29839-  if (tty->handler.mode == TERMIOS_POLLED) {<br>29840-    (*tty->handler.write)(ctx, buf, len);<br>29841-    return;<br>29842-  }<br>--<br>29885-    76e8:    e7d2          b.n    7690 <rtems_termios_puts+0x84><br>29886-    if (newHead >= tty->rawOutBuf.Size)<br>29887-      newHead -= tty->rawOutBuf.Size;<br>29888-    tty->rawOutBuf.Head = newHead;<br>29889-<br>29890:    if (tty->rawOutBufState == rob_idle) {<br>29891-      startXmit (tty, tty->rawOutBuf.Tail, false);<br>29892-    76ea:    f8d4 1084     ldr.w    r1, [r4, #132]    ; 0x84<br>29893-    76ee:    4620          mov    r0, r4<br>29894-    76f0:    f7ff f8ca     bl    6888 <startXmit><br>29895-    76f4:    e7e6          b.n    76c4 <rtems_termios_puts+0xb8><br>29896-  rtems_termios_device_context *ctx = tty->device_context;<br>29897-  rtems_interrupt_lock_context lock_context;<br>29898-  rtems_status_code sc;<br>29899-<br>29900-  if (tty->handler.mode == TERMIOS_POLLED) {<br>29901-    (*tty->handler.write)(ctx, buf, len);<br>29902-    76f6:    f8d2 30c4     ldr.w    r3, [r2, #196]    ; 0xc4<br>--<br>31283-    while ((tty->rawInBuf.Head != tty->rawInBuf.Tail) &&<br>31284-    7be4:    428a          cmp    r2, r1<br>31285-    7be6:    f04f 0501     mov.w    r5, #1<br>31286-    7bea:    d968          bls.n    7cbe <rtems_termios_read+0x1a6><br>31287-             ==                (FL_MDXON | FL_ISNTXOF))<br>31288:            && ((tty->rawOutBufState == rob_idle)<br>31289-          || (tty->flow_ctrl & FL_OSTOP))) {<br>31290-          /* XON should be sent now... */<br>31291-          (*tty->handler.write)(<br>31292-            tty->device_context, (void *)&(tty->termios.c_cc[VSTART]), 1);<br>31293-    7bec:    f104 0849     add.w    r8, r4, #73    ; 0x49<br>31294-    7bf0:    e012          b.n    7c18 <rtems_termios_read+0x100><br>31295-<br>31296-      rtems_termios_device_lock_release (ctx, &lock_context);<br>31297-<br>31298-      /* continue processing new character */<br>31299-      if (tty->termios.c_lflag & ICANON) {<br>31300-        if (siproc (c, tty))<br>--<br>31401-        if (((tty->flow_ctrl & (FL_MDXON | FL_ISNTXOF))<br>31402-    7c56:    f8d4 20d8     ldr.w    r2, [r4, #216]    ; 0xd8<br>31403-    7c5a:    4013          ands    r3, r2<br>31404-    7c5c:    4553          cmp    r3, sl<br>31405-    7c5e:    d01e          beq.n    7c9e <rtems_termios_read+0x186><br>31406:            && ((tty->rawOutBufState == rob_idle)<br>31407-          || (tty->flow_ctrl & FL_OSTOP))) {<br>31408-          /* XON should be sent now... */<br>31409-          (*tty->handler.write)(<br>31410-            tty->device_context, (void *)&(tty->termios.c_cc[VSTART]), 1);<br>31411-        } else if (tty->flow_ctrl & FL_MDRTS) {<br>31412-    7c60:    f8d4 30d8     ldr.w    r3, [r4, #216]    ; 0xd8<br>31413-    7c64:    05da          lsls    r2, r3, #23<br>31414-    7c66:    d50b          bpl.n    7c80 <rtems_termios_read+0x168><br>31415-          tty->flow_ctrl &= ~FL_IRTSOFF;<br>31416-    7c68:    f8d4 30d8     ldr.w    r3, [r4, #216]    ; 0xd8<br>31417-          /* activate RTS line */<br>31418-          if (tty->flow.start_remote_tx != NULL) {<br>--<br>31477-         < tty->lowwater) {<br>31478-        tty->flow_ctrl &= ~FL_IREQXOF;<br>31479-        /* if tx stopped and XON should be sent... */<br>31480-        if (((tty->flow_ctrl & (FL_MDXON | FL_ISNTXOF))<br>31481-             ==                (FL_MDXON | FL_ISNTXOF))<br>31482:            && ((tty->rawOutBufState == rob_idle)<br>31483-    7c9e:    f894 3094     ldrb.w    r3, [r4, #148]    ; 0x94<br>31484-    7ca2:    b11b          cbz    r3, 7cac <rtems_termios_read+0x194><br>31485-          || (tty->flow_ctrl & FL_OSTOP))) {<br>31486-    7ca4:    f8d4 30d8     ldr.w    r3, [r4, #216]    ; 0xd8<br>31487-    7ca8:    0699          lsls    r1, r3, #26<br>31488-    7caa:    d5d9          bpl.n    7c60 <rtems_termios_read+0x148><br>31489-          /* XON should be sent now... */<br>31490-          (*tty->handler.write)(<br>31491-    7cac:    f8d4 30c4     ldr.w    r3, [r4, #196]    ; 0xc4<br>31492-    7cb0:    f8d4 010c     ldr.w    r0, [r4, #268]    ; 0x10c<br>31493-    7cb4:    4641          mov    r1, r8<br>31494-    7cb6:    2201          movs    r2, #1<br>--<br>32101-        /* disable interrupts    */<br>32102-        rtems_termios_device_lock_acquire (ctx, &lock_context);<br>32103-        tty->flow_ctrl &= ~FL_OSTOP;<br>32104-    7f34:    f8d4 30d8     ldr.w    r3, [r4, #216]    ; 0xd8<br>32105-        /* check for chars in output buffer (or rob_state?) */<br>32106:        if (tty->rawOutBufState != rob_idle) {<br>32107-    7f38:    f894 2094     ldrb.w    r2, [r4, #148]    ; 0x94<br>32108-    if (flow_rcv) {<br>32109-      /* restart output according to FL_ORCVXOF flag */<br>32110-      if ((tty->flow_ctrl & (FL_ORCVXOF | FL_OSTOP)) == FL_OSTOP) {<br>32111-        /* disable interrupts    */<br>32112-        rtems_termios_device_lock_acquire (ctx, &lock_context);<br>32113-        tty->flow_ctrl &= ~FL_OSTOP;<br>32114-    7f3c:    f023 0320     bic.w    r3, r3, #32<br>32115-    7f40:    f8c4 30d8     str.w    r3, [r4, #216]    ; 0xd8<br>32116-        /* check for chars in output buffer (or rob_state?) */<br>32117:        if (tty->rawOutBufState != rob_idle) {<br>32118-    7f44:    b94a          cbnz    r2, 7f5a <rtems_termios_enqueue_raw_characters+0x1ca><br>32119-    ARM_SWITCH_BACK<br>32120-    : ARM_SWITCH_OUTPUT<br>32121-    : [level] "r" (level)<br>32122-  );<br>32123-#elif defined(ARM_MULTILIB_ARCH_V7M)<br>32124-  __asm__ volatile (<br>32125-    7f46:    f386 8811     msr    BASEPRI, r6<br>32126-    7f4a:    2601          movs    r6, #1<br>32127-    7f4c:    e760          b.n    7e10 <rtems_termios_enqueue_raw_characters+0x80><br>32128-        if (( !tty->tty_rcvwakeup ) && ( tty->tty_rcv.sw_pfn != NULL )) {<br>32129-          (*tty->tty_rcv.sw_pfn)(&tty->termios, tty->tty_rcv.sw_arg);<br>--<br>32136-    7f52:    9300          str    r3, [sp, #0]<br>32137-    7f54:    f38a 8811     msr    BASEPRI, sl<br>32138-    7f58:    e75a          b.n    7e10 <rtems_termios_enqueue_raw_characters+0x80><br>32139-        tty->flow_ctrl &= ~FL_OSTOP;<br>32140-        /* check for chars in output buffer (or rob_state?) */<br>32141:        if (tty->rawOutBufState != rob_idle) {<br>32142-          /* if chars available, call write function... */<br>32143-          (*tty->handler.write)(<br>32144-            ctx, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail], 1);<br>32145-    7f5a:    f8d4 2084     ldr.w    r2, [r4, #132]    ; 0x84<br>32146-        rtems_termios_device_lock_acquire (ctx, &lock_context);<br>32147-        tty->flow_ctrl &= ~FL_OSTOP;<br>32148-        /* check for chars in output buffer (or rob_state?) */<br>32149:        if (tty->rawOutBufState != rob_idle) {<br>32150-          /* if chars available, call write function... */<br>32151-          (*tty->handler.write)(<br>32152-    7f5e:    6fe1          ldr    r1, [r4, #124]    ; 0x7c<br>32153-    7f60:    f8d4 30c4     ldr.w    r3, [r4, #196]    ; 0xc4<br>32154-    7f64:    4411          add    r1, r2<br>32155-    7f66:    4658          mov    r0, fp<br>32156-    7f68:    2201          movs    r2, #1<br>32157-    7f6a:    f8cd c004     str.w    ip, [sp, #4]<br>32158-    7f6e:    4798          blx    r3<br>32159-    7f70:    f8dd c004     ldr.w    ip, [sp, #4]<br>32160-    7f74:    e7e7          b.n    7f46 <rtems_termios_enqueue_raw_characters+0x1b6><br>32161-          + tty->rawInBuf.Size) % tty->rawInBuf.Size) > tty->highwater)) {<br>--<br>32167-    7f76:    0692          lsls    r2, r2, #26<br>32168-    7f78:    d403          bmi.n    7f82 <rtems_termios_enqueue_raw_characters+0x1f2><br>32169-    7f7a:    f894 2094     ldrb.w    r2, [r4, #148]    ; 0x94<br>32170-    7f7e:    2a00          cmp    r2, #0<br>32171-    7f80:    d18c          bne.n    7e9c <rtems_termios_enqueue_raw_characters+0x10c><br>32172:              (tty->rawOutBufState == rob_idle)) {<br>32173-            /* if tx is stopped due to XOFF or out of data */<br>32174-            /*    call write function here                 */<br>32175-            tty->flow_ctrl |= FL_ISNTXOF;<br>32176-    7f82:    f8d4 20d8     ldr.w    r2, [r4, #216]    ; 0xd8<br>32177-    7f86:    9301          str    r3, [sp, #4]<br>32178-    7f88:    f042 0202     orr.w    r2, r2, #2<br>32179-    7f8c:    f8c4 20d8     str.w    r2, [r4, #216]    ; 0xd8<br>32180-            (*tty->handler.write)(ctx,<br>32181-    7f90:    f8d4 30c4     ldr.w    r3, [r4, #196]    ; 0xc4<br>32182-    7f94:    4658          mov    r0, fp<br>32183-    7f96:    f104 014a     add.w    r1, r4, #74    ; 0x4a<br>32184-    7f9a:    2201          movs    r2, #1<br>--<br>38521-    9512:    f000 f825     bl    9560 <_Extension_Manager_initialization><br>38522-<br>38523-  _POSIX_API_Initialize();<br>38524-    9516:    f000 f863     bl    95e0 <_POSIX_API_Initialize><br>38525-    951a:    7025          strb    r5, [r4, #0]<br>38526:  _Thread_Create_idle();<br>38527-<br>38528-  /*<br>38529-   *  Scheduling can properly occur now as long as we avoid dispatching.<br>38530-   */<br>38531-}<br>38532-    951c:    e8bd 4038     ldmia.w    sp!, {r3, r4, r5, lr}<br>38533-   *  _Thread_Executing and _Thread_Heir are not set.<br>38534-   *<br>38535-   *  At this point all API extensions are in place.  After the call to<br>38536:   *  _Thread_Create_idle() _Thread_Executing and _Thread_Heir will be set.<br>38537-   */<br>38538:  _Thread_Create_idle();<br>38539:    9520:    f002 ba3a     b.w    b998 <_Thread_Create_idle><br>38540-    9524:    20004618     .word    0x20004618<br>38541-    9528:    20004640     .word    0x20004640<br>38542-    952c:    200041d0     .word    0x200041d0<br>38543-    9530:    200041e0     .word    0x200041e0<br>38544-    9534:    2000429c     .word    0x2000429c<br>38545-    9538:    20004298     .word    0x20004298<br>38546-<br>38547-0000953c <rtems_initialize_before_drivers>:<br>38548-   *  Scheduling can properly occur now as long as we avoid dispatching.<br>38549-   */<br>38550-}<br>38551-<br>--<br>48137-)<br>48138-{<br>48139-    b3c4:    4770          bx    lr<br>48140-    b3c6:    bf00          nop<br>48141-<br>48142:0000b3c8 <_Scheduler_default_Start_idle>:<br>48143-#if defined(RTEMS_SMP)<br>48144-  Thread_Control *needs_help;<br>48145-<br>48146-  needs_help =<br>48147-#endif<br>48148-  ( *scheduler->Operations.unblock )( scheduler, the_thread );<br>48149:    b3c8:    4801          ldr    r0, [pc, #4]    ; (b3d0 <_Scheduler_default_Start_idle+0x8>)<br>48150-    b3ca:    6943          ldr    r3, [r0, #20]<br>48151-    b3cc:    4718          bx    r3<br>48152-    b3ce:    bf00          nop<br>48153-    b3d0:    0001847c     .word    0x0001847c<br>48154-<br>48155-0000b3d4 <_Scheduler_default_Tick>:<br>48156-  /*<br>48157-   *  If the thread is not preemptible or is not ready, then<br>48158-   *  just return.<br>48159-   */<br>48160-<br>48161-  if ( !executing->is_preemptible )<br>--<br>49735-    b988:    0001847c     .word    0x0001847c<br>49736-    b98c:    0001d828     .word    0x0001d828<br>49737-    b990:    0001d814     .word    0x0001d814<br>49738-    b994:    0001d878     .word    0x0001d878<br>49739-<br>49740:0000b998 <_Thread_Create_idle>:<br>49741-    cpu<br>49742-  );<br>49743-}<br>49744-<br>49745:void _Thread_Create_idle( void )<br>49746-{<br>49747-    b998:    b5f0          push    {r4, r5, r6, r7, lr}<br>49748-  return maximum_internal_threads;<br>49749-}<br>49750-<br>49751-RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void )<br>49752-{<br>49753-  return (Thread_Control *)<br>49754:    b99a:    4f17          ldr    r7, [pc, #92]    ; (b9f8 <_Thread_Create_idle+0x60>)<br>49755-    b99c:    b089          sub    sp, #36    ; 0x24<br>49756-    b99e:    4638          mov    r0, r7<br>49757-    b9a0:    f7fe ff74     bl    a88c <_Objects_Allocate_unprotected><br>49758-  _Thread_Initialize(<br>49759-    &_Thread_Internal_information,<br>49760:    idle,<br>49761-    _Scheduler_Get_by_CPU( cpu ),<br>49762-    NULL,        /* allocate the stack */<br>49763:    _Stack_Ensure_minimum( rtems_configuration_get_idle_task_stack_size() ),<br>49764:    b9a4:    4e15          ldr    r6, [pc, #84]    ; (b9fc <_Thread_Create_idle+0x64>)<br>49765- *<br>49766- * @return This method returns the minimum stack size;<br>49767- */<br>49768-RTEMS_INLINE_ROUTINE uint32_t _Stack_Minimum (void)<br>49769-{<br>49770-  return rtems_minimum_stack_size;<br>49771:    b9a6:    4a16          ldr    r2, [pc, #88]    ; (ba00 <_Thread_Create_idle+0x68>)<br>49772-    b9a8:    6a73          ldr    r3, [r6, #36]    ; 0x24<br>49773-    b9aa:    6811          ldr    r1, [r2, #0]<br>49774-    b9ac:    4605          mov    r5, r0<br>49775-    b9ae:    428b          cmp    r3, r1<br>49776-    b9b0:    bf38          it    cc<br>49777-    b9b2:    460b          movcc    r3, r1<br>49778-   *  fields not explicitly assigned were explicitly zeroed by<br>49779-   *  _Workspace_Initialization.<br>49780-   */<br>49781:  idle = _Thread_Internal_allocate();<br>49782-<br>49783-  _Thread_Initialize(<br>49784:    b9b4:    4a13          ldr    r2, [pc, #76]    ; (ba04 <_Thread_Create_idle+0x6c>)<br>49785:static void _Thread_Create_idle_for_cpu( Per_CPU_Control *cpu )<br>49786-{<br>49787-  Objects_Name    name;<br>49788:  Thread_Control *idle;<br>49789-<br>49790-  name.name_u32 = _Objects_Build_name( 'I', 'D', 'L', 'E' );<br>49791:    b9b6:    f8df e058     ldr.w    lr, [pc, #88]    ; ba10 <_Thread_Create_idle+0x78><br>49792-   *  fields not explicitly assigned were explicitly zeroed by<br>49793-   *  _Workspace_Initialization.<br>49794-   */<br>49795:  idle = _Thread_Internal_allocate();<br>49796-<br>49797-  _Thread_Initialize(<br>49798-    b9ba:    7811          ldrb    r1, [r2, #0]<br>49799-    b9bc:    2400          movs    r4, #0<br>49800-    b9be:    2201          movs    r2, #1<br>49801-    b9c0:    9300          str    r3, [sp, #0]<br>49802-    b9c2:    9102          str    r1, [sp, #8]<br>49803-    b9c4:    f8cd e01c     str.w    lr, [sp, #28]<br>49804-    b9c8:    4629          mov    r1, r5<br>49805-    b9ca:    4623          mov    r3, r4<br>49806-    b9cc:    9203          str    r2, [sp, #12]<br>49807-    b9ce:    4638          mov    r0, r7<br>49808-    b9d0:    9401          str    r4, [sp, #4]<br>49809-    b9d2:    9404          str    r4, [sp, #16]<br>49810-    b9d4:    9405          str    r4, [sp, #20]<br>49811-    b9d6:    9406          str    r4, [sp, #24]<br>49812:    b9d8:    4a0b          ldr    r2, [pc, #44]    ; (ba08 <_Thread_Create_idle+0x70>)<br>49813-    b9da:    f000 f96d     bl    bcb8 <_Thread_Initialize><br>49814-   *             MUST be done before _Thread_Start is invoked.<br>49815-   */<br>49816-  cpu->heir      =<br>49817:  cpu->executing = idle;<br>49818-<br>49819-  _Thread_Start(<br>49820-    b9de:    6a32          ldr    r2, [r6, #32]<br>49821-  /*<br>49822-   *  WARNING!!! This is necessary to "kick" start the system and<br>49823-   *             MUST be done before _Thread_Start is invoked.<br>49824-   */<br>49825-  cpu->heir      =<br>49826:  cpu->executing = idle;<br>49827:    b9e0:    4e0a          ldr    r6, [pc, #40]    ; (ba0c <_Thread_Create_idle+0x74>)<br>49828-<br>49829-  _Thread_Start(<br>49830-    b9e2:    9400          str    r4, [sp, #0]<br>49831-    b9e4:    9601          str    r6, [sp, #4]<br>49832-    b9e6:    4628          mov    r0, r5<br>49833-    b9e8:    4621          mov    r1, r4<br>49834-    b9ea:    4623          mov    r3, r4<br>49835-  /*<br>49836-   *  WARNING!!! This is necessary to "kick" start the system and<br>49837-   *             MUST be done before _Thread_Start is invoked.<br>49838-   */<br>49839-  cpu->heir      =<br>49840:  cpu->executing = idle;<br>49841-    b9ec:    60b5          str    r5, [r6, #8]<br>49842-<br>49843-  /*<br>49844-   *  WARNING!!! This is necessary to "kick" start the system and<br>49845-   *             MUST be done before _Thread_Start is invoked.<br>49846-   */<br>49847-  cpu->heir      =<br>49848-    b9ee:    60f5          str    r5, [r6, #12]<br>49849:  cpu->executing = idle;<br>49850-<br>49851-  _Thread_Start(<br>49852-    b9f0:    f000 fee0     bl    c7b4 <_Thread_Start><br>49853-<br>49854-    if ( _Per_CPU_Is_processor_started( cpu ) ) {<br>49855:      _Thread_Create_idle_for_cpu( cpu );<br>49856-    }<br>49857-  }<br>49858-}<br>49859-    b9f4:    b009          add    sp, #36    ; 0x24<br>49860-    b9f6:    bdf0          pop    {r4, r5, r6, r7, pc}<br>49861-    b9f8:    200042c0     .word    0x200042c0<br>49862-    b9fc:    000183c0     .word    0x000183c0<br>49863-    ba00:    200011c0     .word    0x200011c0<br>49864-    ba04:    200011bc     .word    0x200011bc<br>49865-    ba08:    0001847c     .word    0x0001847c<br>49866-    ba0c:    20004640     .word    0x20004640<br>49867-    ba10:    49444c45     .word    0x49444c45<br>--<br>54093-  const Scheduler_Control *scheduler,<br>54094-  Thread_Control          *the_thread,<br>54095-  Per_CPU_Control         *cpu<br>54096-)<br>54097-{<br>54098:  ( *scheduler->Operations.start_idle )( scheduler, the_thread, cpu );<br>54099-    c7de:    4809          ldr    r0, [pc, #36]    ; (c804 <_Thread_Start+0x50>)<br>54100-      _Thread_Ready( the_thread );<br>54101-    } else {<br>54102-      const Scheduler_Control *scheduler = _Scheduler_Get_by_CPU( cpu );<br>54103-<br>54104-      if ( scheduler != NULL ) {<br>54105-        the_thread->current_state = STATES_READY;<br>54106-    c7e0:    2200          movs    r2, #0<br>54107-    c7e2:    612a          str    r2, [r5, #16]<br>54108-    c7e4:    6b43          ldr    r3, [r0, #52]    ; 0x34<br>54109-    c7e6:    4629          mov    r1, r5<br>54110-    c7e8:    9a05          ldr    r2, [sp, #20]<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 24, 2019 at 2:59 PM Christian Mauderer <<a href="mailto:christian.mauderer@embedded-brains.de">christian.mauderer@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 24.04.19 um 02:35 schrieb Jython:<br>
> yes, I need to do low power for stm32f4<br>
> will this line work __asm__ volatile ("wfi");?<br>
<br>
That line should be correct. Please note that the instruction is already<br>
used in the armv7 idle thread:<br>
<br>
<a href="https://git.rtems.org/rtems/tree/cpukit/score/cpu/arm/armv7-thread-idle.c#n32" rel="noreferrer" target="_blank">https://git.rtems.org/rtems/tree/cpukit/score/cpu/arm/armv7-thread-idle.c#n32</a><br>
<br>
The stm32f4 is a Cortex-M4 so it's quite likely that this routine is<br>
used. You can check by doing an "arm-rtems5-objdump -dS" on your file<br>
and search for the idle body.<br>
<br>
With kind regards<br>
<br>
Christian<br>
<br>
> <br>
> <br>
> On Tue, Apr 23, 2019 at 10:28 PM Christian Mauderer<br>
> <<a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a><br>
> <mailto:<a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a>>> wrote:<br>
> <br>
>     Am 22.04.19 um 09:47 schrieb Jython:<br>
>     > HI, ALL!<br>
>     > wfi<br>
>     <a href="http://www.keil.com/support/man/docs/armcc/armcc_chr1359125004400.htm" rel="noreferrer" target="_blank">http://www.keil.com/support/man/docs/armcc/armcc_chr1359125004400.htm</a><br>
>     > how can i call the arm __wfi?<br>
>     ><br>
>     > _______________________________________________<br>
>     > users mailing list<br>
>     > <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a> <mailto:<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a>><br>
>     > <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
>     ><br>
> <br>
>     Hello Jython,<br>
> <br>
>     WFI is an assembler instruction. The Keil wrapper isn't available in<br>
>     gcc. I know of no direct replacement. Most likely you need a gcc inline<br>
>     assembly for that.<br>
> <br>
>     May I ask why you would need "wfi"? If you use a operating system, the<br>
>     system typically handles such low level stuff for you. The only<br>
>     application that springs to mind for that instruction is overwriting the<br>
>     idle loop to save energy.<br>
> <br>
>     Best regards<br>
> <br>
>     Christian<br>
> <br>
>     -- <br>
>     --------------------------------------------<br>
>     embedded brains GmbH<br>
>     Herr Christian Mauderer<br>
>     Dornierstr. 4<br>
>     D-82178 Puchheim<br>
>     Germany<br>
>     email: <a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a><br>
>     <mailto:<a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a>><br>
>     Phone: +49-89-18 94 741 - 18<br>
>     Fax:   +49-89-18 94 741 - 08<br>
>     PGP: Public key available on request.<br>
> <br>
>     Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
> <br>
<br>
-- <br>
--------------------------------------------<br>
embedded brains GmbH<br>
Herr Christian Mauderer<br>
Dornierstr. 4<br>
D-82178 Puchheim<br>
Germany<br>
email: <a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a><br>
Phone: +49-89-18 94 741 - 18<br>
Fax:   +49-89-18 94 741 - 08<br>
PGP: Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
</blockquote></div>