[riot-notifications] [RIOT-OS/RIOT] stm32l152re: hard-fault unless power-cycled after flash, or depending on optimization (#11820)

Francisco notifications at github.com
Wed Jul 10 10:24:56 CEST 2019


> did you compare the generated low level code to find the difference ?

So far I've been looking only at the assembler code for pm_set. When comparing current code output in master with fixes 1 & 2 (I numbered the fixes) the code is pretty much the same, the only difference (bedsides the one introduced by the change in 1 &2) is that a `nop` is sometimes added at the end of the function disassemble, just after the last instruction.

When comparing the base case with 3 there is indeed some re-ordering but functionally the code seems to be the same.

Master:
```
080006a4 <pm_set>:
 80006a4:       b510            push    {r4, lr}
 80006a6:       b1a0            cbz     r0, 80006d2 <pm_set+0x2e>
 80006a8:       2801            cmp     r0, #1
 80006aa:       d028            beq.n   80006fe <pm_set+0x5a>
 80006ac:       2400            movs    r4, #0
 80006ae:       4a1b            ldr     r2, [pc, #108]  ; (800071c <pm_set+0x78>)
 80006b0:       6913            ldr     r3, [r2, #16]
 80006b2:       f023 0304       bic.w   r3, r3, #4
 80006b6:       6113            str     r3, [r2, #16]
 80006b8:       f7ff ffc6       bl      8000648 <irq_disable>
 80006bc:       f3bf 8f4f       dsb     sy
 80006c0:       bf30            wfi
 80006c2:       bf00            nop
 80006c4:       f7ff ffc8       bl      8000658 <irq_restore>
 80006c8:       b33c            cbz     r4, 800071a <pm_set+0x76>
 80006ca:       e8bd 4010       ldmia.w sp!, {r4, lr}
 80006ce:       f000 bc8b       b.w     8000fe8 <stmclk_init_sysclk>
 80006d2:       4b13            ldr     r3, [pc, #76]   ; (8000720 <pm_set+0x7c>)
 80006d4:       681a            ldr     r2, [r3, #0]
 80006d6:       f422 7203       bic.w   r2, r2, #524    ; 0x20c
 80006da:       f022 0203       bic.w   r2, r2, #3
 80006de:       601a            str     r2, [r3, #0]
 80006e0:       681a            ldr     r2, [r3, #0]
 80006e2:       f442 7203       orr.w   r2, r2, #524    ; 0x20c
 80006e6:       f042 0202       orr.w   r2, r2, #2
 80006ea:       601a            str     r2, [r3, #0]
 80006ec:       685a            ldr     r2, [r3, #4]
 80006ee:       605a            str     r2, [r3, #4]
 80006f0:       4a0a            ldr     r2, [pc, #40]   ; (800071c <pm_set+0x78>)
 80006f2:       2401            movs    r4, #1
 80006f4:       6913            ldr     r3, [r2, #16]
 80006f6:       f043 0304       orr.w   r3, r3, #4
 80006fa:       6113            str     r3, [r2, #16]
 80006fc:       e7dc            b.n     80006b8 <pm_set+0x14>
 80006fe:       4a08            ldr     r2, [pc, #32]   ; (8000720 <pm_set+0x7c>)
 8000700:       6813            ldr     r3, [r2, #0]
 8000702:       f423 7303       bic.w   r3, r3, #524    ; 0x20c
 8000706:       f023 0303       bic.w   r3, r3, #3
 800070a:       6013            str     r3, [r2, #0]
 800070c:       6813            ldr     r3, [r2, #0]
 800070e:       f443 7301       orr.w   r3, r3, #516    ; 0x204
 8000712:       f043 0301       orr.w   r3, r3, #1
 8000716:       6013            str     r3, [r2, #0]
 8000718:       e7ea            b.n     80006f0 <pm_set+0x4c>
 800071a:       bd10            pop     {r4, pc}
 800071c:       e000ed00        .word   0xe000ed00
 8000720:       40007000        .word   0x40007000
```

-O2:

```
08000704 <pm_set>:
 8000704:       b508            push    {r3, lr}
 8000706:       b370            cbz     r0, 8000766 <pm_set+0x62>
 8000708:       2801            cmp     r0, #1
 800070a:       d11d            bne.n   8000748 <pm_set+0x44>
 800070c:       4a1e            ldr     r2, [pc, #120]  ; (8000788 <pm_set+0x84>)
 800070e:       6813            ldr     r3, [r2, #0]
 8000710:       f423 7303       bic.w   r3, r3, #524    ; 0x20c
 8000714:       f023 0303       bic.w   r3, r3, #3
 8000718:       6013            str     r3, [r2, #0]
 800071a:       6813            ldr     r3, [r2, #0]
 800071c:       f443 7301       orr.w   r3, r3, #516    ; 0x204
 8000720:       f043 0301       orr.w   r3, r3, #1
 8000724:       6013            str     r3, [r2, #0]
 8000726:       4a19            ldr     r2, [pc, #100]  ; (800078c <pm_set+0x88>)
 8000728:       6913            ldr     r3, [r2, #16]
 800072a:       f043 0304       orr.w   r3, r3, #4
 800072e:       6113            str     r3, [r2, #16]
 8000730:       f7ff ffba       bl      80006a8 <irq_disable>
 8000734:       f3bf 8f4f       dsb     sy
 8000738:       bf30            wfi
 800073a:       bf00            nop
 800073c:       f7ff ffbc       bl      80006b8 <irq_restore>
 8000740:       e8bd 4008       ldmia.w sp!, {r3, lr}
 8000744:       f000 bd54       b.w     80011f0 <stmclk_init_sysclk>
 8000748:       4a10            ldr     r2, [pc, #64]   ; (800078c <pm_set+0x88>)
 800074a:       6913            ldr     r3, [r2, #16]
 800074c:       f023 0304       bic.w   r3, r3, #4
 8000750:       6113            str     r3, [r2, #16]
 8000752:       f7ff ffa9       bl      80006a8 <irq_disable>
 8000756:       f3bf 8f4f       dsb     sy
 800075a:       bf30            wfi
 800075c:       bf00            nop
 800075e:       e8bd 4008       ldmia.w sp!, {r3, lr}
 8000762:       f7ff bfa9       b.w     80006b8 <irq_restore>
 8000766:       4b08            ldr     r3, [pc, #32]   ; (8000788 <pm_set+0x84>)
 8000768:       681a            ldr     r2, [r3, #0]
 800076a:       f422 7203       bic.w   r2, r2, #524    ; 0x20c
 800076e:       f022 0203       bic.w   r2, r2, #3
 8000772:       601a            str     r2, [r3, #0]
 8000774:       681a            ldr     r2, [r3, #0]
 8000776:       f442 7203       orr.w   r2, r2, #524    ; 0x20c
 800077a:       f042 0202       orr.w   r2, r2, #2
 800077e:       601a            str     r2, [r3, #0]
 8000780:       685a            ldr     r2, [r3, #4]
 8000782:       605a            str     r2, [r3, #4]
 8000784:       e7cf            b.n     8000726 <pm_set+0x22>
 8000786:       bf00            nop
 8000788:       40007000        .word   0x40007000
 800078c:       e000ed00        .word   0xe000ed00
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11820#issuecomment-509963128
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190710/f1e2464d/attachment.html>


More information about the notifications mailing list