You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/07 01:55:12 UTC

[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #7530: Fix warning found by https://github.com/apache/incubator-nuttx/pull/7391

masayuki2009 commented on PR #7530:
URL: https://github.com/apache/incubator-nuttx/pull/7530#issuecomment-1304982375

   @xiaoxiang781216 
   Hmm, I noticed that 'lc823450-xgevk:nsh` can not boot now.
   
   With this PR,
   
   ```
   $ arm-none-eabi-objdump -Sx  arch/arm/src/lc823450_cpustart.o  | less
   ...
   Disassembly of section .text.up_cpu_start:
   
   00000000 <up_cpu_start>:
     struct tcb_s *tcb = current_task(cpu);
     uint32_t backup[2];
   
     DPRINTF("cpu=%d\n", cpu);
   
     if (cpu != 1)
      0:   2801            cmp     r0, #1
      2:   d104            bne.n   e <up_cpu_start+0xe>
         return -1;
       }
   
     /* create initial vectors for CPU1 */
   
     putreg32(0x1, REMAP); /* remap enable */
      4:   4b03            ldr     r3, [pc, #12]   ; (14 <up_cpu_start+0x14>)
      6:   6098            str     r0, [r3, #8]
     backup[0] = getreg32(CPU1_VECTOR_ISTACK);
      8:   2300            movs    r3, #0
      a:   681b            ldr     r3, [r3, #0]
      c:   deff            udf     #255    ; 0xff
     putreg32(0x0, REMAP); /* remap disable */
   
     spin_unlock(&g_cpu_wait[0]);
   
     return 0;
   }
   ...
   ```
   
   Without this PR
   
   ```
   Disassembly of section .text.up_cpu_start:
   
   00000000 <up_cpu_start>:
    *   Zero on success; a negated errno value on failure.
    *
    ****************************************************************************/
   
   int up_cpu_start(int cpu)
   {
      0:   b580            push    {r7, lr}
      2:   b086            sub     sp, #24
      4:   af00            add     r7, sp, #0
      6:   6078            str     r0, [r7, #4]
     struct tcb_s *tcb = current_task(cpu);
      8:   4a23            ldr     r2, [pc, #140]  ; (98 <up_cpu_start+0x98>)
      a:   687b            ldr     r3, [r7, #4]
      c:   f852 3033       ldr.w   r3, [r2, r3, lsl #3]
     10:   617b            str     r3, [r7, #20]
     uint32_t backup[2];
   
     DPRINTF("cpu=%d\n", cpu);
   
     if (cpu != 1)
     12:   687b            ldr     r3, [r7, #4]
     14:   2b01            cmp     r3, #1
     16:   d002            beq.n   1e <up_cpu_start+0x1e>
       {
         return -1;
     18:   f04f 33ff       mov.w   r3, #4294967295 ; 0xffffffff
     1c:   e038            b.n     90 <up_cpu_start+0x90>
       }
   
     /* create initial vectors for CPU1 */
   
     putreg32(0x1, REMAP); /* remap enable */
     1e:   4b1f            ldr     r3, [pc, #124]  ; (9c <up_cpu_start+0x9c>)
     20:   2201            movs    r2, #1
     22:   601a            str     r2, [r3, #0]
     backup[0] = getreg32(CPU1_VECTOR_ISTACK);
     24:   2300            movs    r3, #0
     26:   681b            ldr     r3, [r3, #0]
     28:   60fb            str     r3, [r7, #12]
     backup[1] = getreg32(CPU1_VECTOR_RESETV);
     2a:   2304            movs    r3, #4
     2c:   681b            ldr     r3, [r3, #0]
     2e:   613b            str     r3, [r7, #16]
     putreg32((uint32_t)tcb->stack_base_ptr +
     30:   697b            ldr     r3, [r7, #20]
     32:   6c9b            ldr     r3, [r3, #72]   ; 0x48
     34:   4619            mov     r1, r3
     36:   697b            ldr     r3, [r7, #20]
     38:   6c1b            ldr     r3, [r3, #64]   ; 0x40
     3a:   2200            movs    r2, #0
     3c:   440b            add     r3, r1
     3e:   6013            str     r3, [r2, #0]
              tcb->adj_stack_size, CPU1_VECTOR_ISTACK);
     putreg32((uint32_t)cpu1_boot, CPU1_VECTOR_RESETV);
     40:   2304            movs    r3, #4
     42:   4a17            ldr     r2, [pc, #92]   ; (a0 <up_cpu_start+0xa0>)
     44:   601a            str     r2, [r3, #0]
   
     spin_lock(&g_cpu_wait[0]);
     46:   4817            ldr     r0, [pc, #92]   ; (a4 <up_cpu_start+0xa4>)
     48:   f7ff fffe       bl      0 <spin_lock>
                           48: R_ARM_THM_CALL      spin_lock
     sched_note_cpu_start(this_task(), cpu);
   #endif
   
     /* enable clock core #1 */
   
     modifyreg32(CORECNT, 0, CORECNT_C1CLKEN);
     4c:   2201            movs    r2, #1
     4e:   2100            movs    r1, #0
     50:   4815            ldr     r0, [pc, #84]   ; (a8 <up_cpu_start+0xa8>)
     52:   f7ff fffe       bl      0 <modifyreg32>
                           52: R_ARM_THM_CALL      modifyreg32
   
     /* unreset core #1 */
   
     modifyreg32(CORECNT, 0, CORECNT_C1RSTN);
     56:   2202            movs    r2, #2
     58:   2100            movs    r1, #0
     5a:   4813            ldr     r0, [pc, #76]   ; (a8 <up_cpu_start+0xa8>)
     5c:   f7ff fffe       bl      0 <modifyreg32>
                           5c: R_ARM_THM_CALL      modifyreg32
   
     /* IRQ setup CPU1->CPU0 */
   
     irq_attach(LC823450_IRQ_CTXM3_11, lc823450_pause_handler, NULL);
     60:   2200            movs    r2, #0
     62:   4912            ldr     r1, [pc, #72]   ; (ac <up_cpu_start+0xac>)
     64:   2015            movs    r0, #21
     66:   f7ff fffe       bl      0 <irq_attach>
                           66: R_ARM_THM_CALL      irq_attach
     up_enable_irq(LC823450_IRQ_CTXM3_11);
     6a:   2015            movs    r0, #21
     6c:   f7ff fffe       bl      0 <up_enable_irq>
                           6c: R_ARM_THM_CALL      up_enable_irq
   
     spin_lock(&g_cpu_wait[0]);
     70:   480c            ldr     r0, [pc, #48]   ; (a4 <up_cpu_start+0xa4>)
     72:   f7ff fffe       bl      0 <spin_lock>
                           72: R_ARM_THM_CALL      spin_lock
   
     /* CPU1 boot done */
   
     /* restore : after CPU1 boot, CPU1 use normal vectors table. */
   
     putreg32(backup[0], CPU1_VECTOR_ISTACK);
     76:   2200            movs    r2, #0
     78:   68fb            ldr     r3, [r7, #12]
     7a:   6013            str     r3, [r2, #0]
     putreg32(backup[1], CPU1_VECTOR_RESETV);
     7c:   2204            movs    r2, #4
     7e:   693b            ldr     r3, [r7, #16]
     80:   6013            str     r3, [r2, #0]
     putreg32(0x0, REMAP); /* remap disable */
     82:   4b06            ldr     r3, [pc, #24]   ; (9c <up_cpu_start+0x9c>)
     84:   2200            movs    r2, #0
     86:   601a            str     r2, [r3, #0]
   
     spin_unlock(&g_cpu_wait[0]);
     88:   4806            ldr     r0, [pc, #24]   ; (a4 <up_cpu_start+0xa4>)
     8a:   f7ff fffe       bl      0 <spin_unlock>
                           8a: R_ARM_THM_CALL      spin_unlock
   
     return 0;
     8e:   2300            movs    r3, #0
   }
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org