Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Piroro-hs opened this issue Oct 15, 2020 · 1 comment
Closed

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

Piroro-hs opened this issue Oct 15, 2020 · 1 comment
Labels
nominated Issue nominated as discussion topic for the Embedded WG meeting

Comments

@Piroro-hs
Copy link

Piroro-hs commented Oct 15, 2020

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.

@thalesfragoso thalesfragoso added the nominated Issue nominated as discussion topic for the Embedded WG meeting label Oct 16, 2020
bors bot added a commit that referenced this issue Oct 20, 2020
274: Drop AT&T syntax from inline asm r=jonas-schievink a=thalesfragoso

This was breaking compilation on thumbv6 targets and miscompiling on thumbv7.

Fixes #272 
Fixes #267 

Co-authored-by: Thales Fragoso <thales.fragosoz@gmail.com>
bors bot added a commit that referenced this issue Oct 26, 2020
274: Drop AT&T syntax from inline asm r=therealprof a=thalesfragoso

This was breaking compilation on thumbv6 targets and miscompiling on thumbv7.

Fixes #272 
Fixes #267 

Co-authored-by: Thales Fragoso <thales.fragosoz@gmail.com>
@adamgreig
Copy link
Member

This should now by fixed by the new release of cortex-m 0.6.4, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nominated Issue nominated as discussion topic for the Embedded WG meeting
Projects
None yet
Development

No branches or pull requests

3 participants