You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I've been trying to following code example for atmega328p:
#![no_std]#![no_main]#![feature(proc_macro_hygiene)]use arduino_leonardo::prelude::*;#[panic_handler]fnpanic(info:&core::panic::PanicInfo) -> ! {letmut serial: arduino_leonardo::Serial<arduino_leonardo::hal::port::mode::Floating> = unsafe{
core::mem::uninitialized()};
ufmt::uwriteln!(&mut serial,"Firmware panic!\r");ifletSome(loc) = info.location(){
ufmt::uwriteln!(&mut serial," At {}:{}:{}\r",
loc.file(),
loc.line(),
loc.column(),);}loop{}}#[no_mangle]pubexternfnmain() -> ! {let dp = arduino_leonardo::Peripherals::take().unwrap();letmut pins = arduino_leonardo::Pins::new(
dp.PORTB,
dp.PORTC,
dp.PORTD,
dp.PORTE,);letmut serial = arduino_leonardo::Serial::new(
dp.USART1,
pins.d0,
pins.d1.into_output(&mut pins.ddr),57600,);
ufmt::uwriteln!(&mut serial,"Hello from Arduino!\r").unwrap();// Panic messages cannot yet be captured because they rely on core::fmt// which is way too big for AVRpanic!();}
My Cargo.toml is the following
[package]
name = "sensor"
version = "0.1.0"
authors = ["Jérémie Drouet <jeremie.drouet@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html[dependencies]
panic-halt = "0.2.0"[dependencies.arduino-leonardo]
path = ".../avr-hal/boards/arduino-leonardo"[profile.dev]
panic = "abort"
codegen-units = 1
incremental = false
lto = true[profile.release]
panic = "abort"
codegen-units = 1
debug = false
lto = true
But when I try to use avr-hal, I get the following error.
error: the legacy LLVM-style asm! syntax is no longer supported
--> /home/jdrouet/.cargo/git/checkouts/avr-device-86e4c21e2d4dc300/67d2554/src/interrupt.rs:17:9
|
17 | asm!(
| ^---
| |
| _________help: replace with: `llvm_asm!`
| |
18 | | "cli" :::: "volatile"
19 | | );
| |__________^
|
= note: consider migrating to the new asm! syntax specified in RFC 2873
= note: alternatively, switch to llvm_asm! to keep your code working as it is
error: the legacy LLVM-style asm! syntax is no longer supported
--> /home/jdrouet/.cargo/git/checkouts/avr-device-86e4c21e2d4dc300/67d2554/src/interrupt.rs:31:9
|
31 | asm!(
| ^---
| |
| _________help: replace with: `llvm_asm!`
| |
32 | | "sei" :::: "volatile"
33 | | );
| |__________^
|
= note: consider migrating to the new asm! syntax specified in RFC 2873
= note: alternatively, switch to llvm_asm! to keep your code working as it is
error: the legacy LLVM-style asm! syntax is no longer supported
--> /home/jdrouet/.cargo/git/checkouts/avr-device-86e4c21e2d4dc300/67d2554/src/interrupt.rs:48:9
|
48 | asm!(
| ^---
| |
| _________help: replace with: `llvm_asm!`
| |
49 | | "in $0,0x35"
50 | | : "=r"(sreg)
51 | | :
52 | | :
53 | | : "volatile"
54 | | );
| |__________^
|
= note: consider migrating to the new asm! syntax specified in RFC 2873
= note: alternatively, switch to llvm_asm! to keep your code working as it is
error: aborting due to 3 previous errors
error: could not compile `avr-device`
Do you have any idea on how I could fix that?
The text was updated successfully, but these errors were encountered:
Yeah, I'm aware of this change and have actually already prepared a patch locally. I just held off from pushing it here because I am waiting for upstream nightly rust to be able to compile libcore. Once that works (looks like the PR you mentioned will archieve this?), I'll update!
A different topic: The files you showed reference arduino-leonardo which uses an ATmega32U4, not an ATmega328P. So you'll probably want to switch to the arduino-uno crate instead ...
Hi!
I've been trying to following code example for
atmega328p
:My
Cargo.toml
is the followingI'm using rust sources from this PR and the blink example compiles well.
But when I try to use
avr-hal
, I get the following error.Do you have any idea on how I could fix that?
The text was updated successfully, but these errors were encountered: