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

Baremetal rpi target fails to build on new rust versions #143

Closed
alloncm opened this issue Oct 9, 2024 · 5 comments · Fixed by #150
Closed

Baremetal rpi target fails to build on new rust versions #143

alloncm opened this issue Oct 9, 2024 · 5 comments · Fixed by #150
Labels
bug Something isn't working

Comments

@alloncm
Copy link
Owner

alloncm commented Oct 9, 2024

Example from rust 1.77.2:

error: <inline asm>:83:13: invalid operand for instruction
    msr     ELR_hyp, r0             // save the address in ELR_hyp
@alloncm alloncm changed the title Barematal rpi target fails to build on new rust versions Baremetal rpi target fails to build on new rust versions Oct 9, 2024
@alloncm alloncm added the bug Something isn't working label Oct 9, 2024
@alloncm
Copy link
Owner Author

alloncm commented Dec 14, 2024

It seems to break in version 1.77 (in 1.77.0 and 1.77.1 it does not build some dep and in 1.77.2 outputs the error above) meaning version 1.76.0 (nightly 2024.02.08) should work

@alloncm
Copy link
Owner Author

alloncm commented Dec 14, 2024

Trying to create a minimal reproduce-able example, this is still working though:

# rust-toolchain.toml
[toolchain]
channel = "nightly-2024-05-02" # first nightly version to now work
profile = "minimal"
# .cargo/config.toml
[target.armv7a-none-eabihf]
rustflags = [
    "-Ctarget-feature=+virtualization"
]
// main.rs
#![no_std]
#![no_main]

use core::{arch::global_asm, panic::PanicInfo};

global_asm!("
    msr     ELR_hyp, r0             // save the address in ELR_hyp
    eret                            // apply the mode change (Exception return)                            
");

#[panic_handler]
fn panic_handler(_:&PanicInfo)->!{
    loop {
        
    }
}

build command: cargo b --target armv7a-none-eabihf -Z build-std=core

@alloncm
Copy link
Owner Author

alloncm commented Dec 14, 2024

This command builds the asm code without rustc arm-none-eabi-as -mcpu=cortex-a72 -mfpu=vfpv2 boot_armv7a.s

@alloncm
Copy link
Owner Author

alloncm commented Dec 17, 2024

It looks like with or without hard floats (eabi vs eabihf) both magenboy and the code above compiles on debug mode and fails to compile on release mode (after version 1.76 of course).

@alloncm
Copy link
Owner Author

alloncm commented Dec 18, 2024

rust-lang/rust#127269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant