Skip to content

Fix __delay asm function for the thumbv6m-none-eabi target #152

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

Merged
merged 2 commits into from
Jul 4, 2019
Merged

Conversation

Disasm
Copy link
Member

@Disasm Disasm commented Jul 4, 2019

Before:

00000000 <__delay>:
   0:	46c0      	nop			; (mov r8, r8)
   2:	3801      	subs	r0, #1
   4:	d1fe      	bne.n	0 <__delay>
			4: R_ARM_THM_JUMP8	__delay
   6:	4770      	bx	lr

After:

00000000 <__delay>:
   0:	46c0      	nop			; (mov r8, r8)
   2:	3801      	subs	r0, #1
   4:	d1fc      	bne.n	0 <__delay>
   6:	4770      	bx	lr

Closes #125

@Disasm Disasm requested a review from a team as a code owner July 4, 2019 20:28
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @thejpster (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cortex-m labels Jul 4, 2019
@therealprof
Copy link
Contributor

@Disasm The file sizes of the binaries are weird. Can you show a before/after objdump of thumbv7m and thumbv8m.main?

@Disasm
Copy link
Member Author

Disasm commented Jul 4, 2019

diff -c thumbv7m-none-eabi.before thumbv7m-none-eabi.after:

*** thumbv7m-none-eabi.before	2019-07-05 00:53:44.912959913 +0300
--- thumbv7m-none-eabi.after	2019-07-05 00:54:32.731009376 +0300
***************
*** 32,39 ****
  00000000 <__delay>:
     0:	bf00      	nop
     2:	3801      	subs	r0, #1
!    4:	f47f affe 	bne.w	0 <__delay>
!    8:	4770      	bx	lr
  
  Disassembly of section .text.__dmb:
  
--- 32,39 ----
  00000000 <__delay>:
     0:	bf00      	nop
     2:	3801      	subs	r0, #1
!    4:	d1fc      	bne.n	0 <__delay>
!    6:	4770      	bx	lr
  
  Disassembly of section .text.__dmb:

diff -c thumbv8m.main-none-eabi.before thumbv8m.main-none-eabi.after:

*** thumbv8m.main-none-eabi.before	2019-07-05 00:53:44.919626307 +0300
--- thumbv8m.main-none-eabi.after	2019-07-05 00:54:32.737675770 +0300
***************
*** 32,39 ****
  00000000 <__delay>:
     0:	bf00      	nop
     2:	3801      	subs	r0, #1
!    4:	f47f affe 	bne.w	0 <__delay>
!    8:	4770      	bx	lr
  
  Disassembly of section .text.__dmb:
  
--- 32,39 ----
  00000000 <__delay>:
     0:	bf00      	nop
     2:	3801      	subs	r0, #1
!    4:	d1fc      	bne.n	0 <__delay>
!    6:	4770      	bx	lr
  
  Disassembly of section .text.__dmb:

".before" files were created on the master branch and ".after" - on this PR branch.

@Disasm
Copy link
Member Author

Disasm commented Jul 4, 2019

Also just regenerating the binaries on master increases thumbv8m.main-none-eabi.a archive size by 150 bytes.

@therealprof
Copy link
Contributor

Okay then.

Copy link
Contributor

@therealprof therealprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@therealprof
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Jul 4, 2019
152:  Fix __delay asm function for the thumbv6m-none-eabi target  r=therealprof a=Disasm

Before:
```
00000000 <__delay>:
   0:	46c0      	nop			; (mov r8, r8)
   2:	3801      	subs	r0, #1
   4:	d1fe      	bne.n	0 <__delay>
			4: R_ARM_THM_JUMP8	__delay
   6:	4770      	bx	lr
```

After:
```
00000000 <__delay>:
   0:	46c0      	nop			; (mov r8, r8)
   2:	3801      	subs	r0, #1
   4:	d1fc      	bne.n	0 <__delay>
   6:	4770      	bx	lr
```

Closes #125

Co-authored-by: Vadim Kaushan <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 4, 2019

Build succeeded

@bors bors bot merged commit 5154004 into master Jul 4, 2019
@bors bors bot deleted the fix-asm branch July 4, 2019 22:15
adamgreig pushed a commit that referenced this pull request Jan 12, 2022
152: doc related changes r=adamgreig a=japaric

see individual commit messages for details

Co-authored-by: Jorge Aparicio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cortex-m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cortex_m::asm::delay() doesn't seem to work on thumbv6m
4 participants