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

Add support for asm!() #261

Merged
merged 1 commit into from
Apr 26, 2022
Merged

Add support for asm!() #261

merged 1 commit into from
Apr 26, 2022

Conversation

Patryk27
Copy link
Contributor

Closes #254.
Closes #229.

Abstract & rest the same as for Rahix/avr-device#97 🙂

As for the LLVM IR, there's a small change in delay():

older rustc:
  %7 = tail call addrspace(0) i16 asm sideeffect "1: sbiw $0,1\0A\09brne 1b", "=w,0"(i16 %6) #10, !srcloc !6

newer rustc:
  tail call addrspace(0) void asm sideeffect alignstack "1:\0Asbiw ${0}, 1\0Abrne 1b", "w,~{sreg},~{memory}"(i16 %5) #14, !srcloc !7

... but I think it looks alright (& the code works fine on an Atmega328p).

Copy link
Owner

@Rahix Rahix left a comment

Choose a reason for hiding this comment

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

Here as well: thanks a lot for this change!

@Rahix Rahix merged commit 5d75769 into Rahix:main Apr 26, 2022
@Patryk27 Patryk27 deleted the asm branch April 26, 2022 19:41
@piegamesde
Copy link

Thanks for the work. I still have the problem that embedded-hal v0.2.7 does not support the new asm macro though, and avr-hal-generic seems to be depending on it. I tried one of the 1.0.0-alpha.X versions of embedded-hal and they seem to work, however I can't locally override the dependency because of semver.

@Rahix
Copy link
Owner

Rahix commented Apr 26, 2022

Hm, that's odd, where does embedded-hal need inline assembly?

@piegamesde
Copy link

My bad, I read the compiler error wrong. It is avr-device which needs to be bumped

@Rahix
Copy link
Owner

Rahix commented Apr 27, 2022

Ah, yeah, that is true indeed. As soon as I have released a new version of avr-device, I will bump the dependencies here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cannot find macro llvm_asm in this scope
3 participants