A Freestanding Rust Binary (zh-CN) #1184
Replies: 10 comments 7 replies
-
great job! |
Beta Was this translation helpful? Give feedback.
-
I also recommend reading the Chapter "Rust without the standard library" in Rust for Rustaceans by Jon as a complement |
Beta Was this translation helpful? Give feedback.
-
It looks promising! |
Beta Was this translation helpful? Give feedback.
-
good job!! |
Beta Was this translation helpful? Give feedback.
-
thank you 👍 |
Beta Was this translation helpful? Give feedback.
-
looks good. |
Beta Was this translation helpful? Give feedback.
-
There is a Tier 2 compilation target triple: "x86_64-unknown-none" Looks like it is the perfect use case for this example. https://doc.rust-lang.org/nightly/rustc/platform-support/x86_64-unknown-none.html |
Beta Was this translation helpful? Give feedback.
-
Thank you for the tutorial. My panic! handler was not working though. The rust compiler would break the entire code when I call panic!. That To see how to get your panic handler working refer to this discussion: https://users.rust-lang.org/t/bare-metal-panic-generates-undefined-instructions/94992/9 |
Beta Was this translation helpful? Give feedback.
-
nb。 It's too strong |
Beta Was this translation helpful? Give feedback.
-
Windows平台上项目目录不要太长,否则编译过程中链接器(rust-lld)会报错:
我原来的目录就是因为太长所以报错,直接把项目目录剪切桌面上就好了,文件目录里有空格和特殊字符(我用了英文 ’ 字符),目前没有什么问题。 用Vs code可能会在main.rs中 #![no_std] 那一行提示 can't find crate for test ,但只要你自己确定创建包的时候时bin而不是lib (默认不加参数是bin),就不用管这个报错,不影响编译。 |
Beta Was this translation helpful? Give feedback.
-
A Freestanding Rust Binary (zh-CN)
创建一个不链接标准库的 Rust 可执行文件,将是我们迈出的第一步。无需底层操作系统的支撑,这样才能在裸机(bare metal)上运行 Rust 代码。
https://os.phil-opp.com/zh-CN/freestanding-rust-binary/
Beta Was this translation helpful? Give feedback.
All reactions