https://github.com/xiaguangbo/custom_rv32_rust Error代码:
program_picorv32ec/project/src/main.rs
#[picorv32asm::entry]
fn main() -> ! {
loop {}
}
$ cargo build
Compiling picorv32asm v0.1.0 (/home/xiaguangbo/linux/project/custom_rv32_rust/program_picorv32ec/picorv32asm)
Compiling project v0.1.0 (/home/xiaguangbo/linux/project/custom_rv32_rust/program_picorv32ec/project)
Compiling picorv32entrymacro v0.1.0 (/home/xiaguangbo/linux/project/custom_rv32_rust/program_picorv32ec/picorv32asm/picorv32entrymacro)
error: unsafe attribute used without unsafe
--> src/main.rs:6:1
|
6 | #[picorv32asm::entry]
| ^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute
|
= note: this error originates in the attribute macro `picorv32asm::entry` (in Nightly builds, run with -Z macro-backtrace for more info)
help: wrap the attribute in `unsafe(...)`
|
6 | unsafe(#[picorv32asm::entry])
| +++++++ +
error: could not compile `project` (bin "project") due to 1 previous error
如果您遵循编译器的提示,它也无效。
我认为其他项目也可以像这样编写,例如
wch rust
项目。
delete`depen = 2024` for Program_picorv32ec/picorv32ASM/picorv32entrymacro/cargo.toml