Compilation error with RISC-V assembly?

First try to add RISC-V assembly code to rust.

#![no_std]
#![no_main]
#![allow(dead_code)]

use core::panic::PanicInfo;

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

#[no_mangle]
pub extern "C" fn _start() -> ! {
    
unsafe {
    asm!("nop");
}

 loop{ }

}

rustc --target=riscv32imac-unknown-none-elf -o main.o main.rs

error[E0658]: use of unstable library feature 'asm': inline assembly is not stable enough for use and is subject to change
--> main.rs:39:5
|
39 | asm!("nop");

Can someone tell me what is wrong and how to fix? The code compiles without the assembly code.

Updating the rustc compiler and importing core asm resolved the issue.

use core::arch::asm;

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.