Skip to content

asm::delay with inline-asm feature is broken on latest nightly #272

Closed
@Piroro-hs

Description

@Piroro-hs

asm::delay hangs up on rustc 1.49.0-nightly (8dae8cdcc 2020-10-12). Target is thumbv7em-none-eabihf.

The compiler produces following binary. It looks like the operand of subs is screwed up.

objdump
0800023c <_ZN8cortex_m3asm5delay17h6801139b6c4b4672E>:
 800023c: 80 b5         push    {r7, lr}
 800023e: 6f 46         mov     r7, sp
 8000240: 84 b0         sub     sp, #16
 8000242: 03 90         str     r0, [sp, #12]
 8000244: 01 21         movs    r1, #1
 8000246: 01 eb 90 00   add.w   r0, r1, r0, lsr #2
 800024a: 00 21         movs    r1, #0
 800024c: 00 29         cmp     r1, #0
 800024e: 01 90         str     r0, [sp, #4]
 8000250: 09 d1         bne     #18 <_ZN8cortex_m3asm5delay17h6801139b6c4b4672E+0x2e>
 8000252: ff e7         b       #-2 <_ZN8cortex_m3asm5delay17h6801139b6c4b4672E+0x1c>
 8000254: 01 98         ldr     r0, [sp, #4]
 8000256: 02 90         str     r0, [sp, #8]
 8000258: 02 99         ldr     r1, [sp, #8]

 800025a: 00 bf         nop
 800025c: b1 39         subs    r1, #177 <---- !?
 800025e: fc d1         bne     #-8 <_ZN8cortex_m3asm5delay17h6801139b6c4b4672E+0x22>

 8000260: 02 91         str     r1, [sp, #8]
 8000262: 04 b0         add     sp, #16
 8000264: 80 bd         pop     {r7, pc}
 8000266: 41 f2 b0 30   movw    r0, #5040
 800026a: c0 f6 00 00   movt    r0, #2048
 800026e: 41 f2 94 32   movw    r2, #5012
 8000272: c0 f6 00 02   movt    r2, #2048
 8000276: 1c 21         movs    r1, #28
 8000278: 00 f0 1f fd   bl      #2622
 800027c: fe de         trap

Please publish v0.6.4 (or 0.7?) with #262 included, if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nominatedIssue nominated as discussion topic for the Embedded WG meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions