16 个版本
0.5.4 | 2021 年 12 月 29 日 |
---|---|
0.5.3 | 2021 年 4 月 26 日 |
0.5.1 | 2021 年 1 月 30 日 |
0.4.2 | 2020 年 11 月 17 日 |
0.0.3 | 2019 年 7 月 29 日 |
#2 in #multi-core
97 每月下载量
在 ruspiro-sdk 中使用
39KB
423 行
RusPiRo 内核的引导程序包
该包提供基本的引导代码,当将其构建到内核包中时,Raspberry Pi 启动时会执行。构建并最终将此包链接到内核映像取决于几个链接器符号的存在。因此,建议在构建内核时使用提供的链接器脚本。
提示
当构建 Raspberry Pi 3 的裸机内核时,此包的使用才有意义。此包提供的裸机引导可构建为 Aarch32 或 Aarch64 目标架构。已验证从 Windows 主机机器成功交叉编译这两个架构,并在 Raspberry Pi 3 B+ 上进行了执行测试。
特性
特性 | 目的 |
---|---|
multicore |
编译 crate 的多核版本,启动 Raspberry Pi 的所有 4 个核心。 |
panic |
启用默认的 panic 处理器。此功能默认启用。 |
使用方法
要使用此 crate,只需将以下行添加到您的 Cargo.toml
文件中
[dependencies]
ruspiro-boot = "0.5.4"
在主 rust 文件中,使用以下方式引用此 crate
#[macro_use]
extern crate ruspiro_boot;
使用 extern crate
是强制性的,以确保引导正确链接到最终二进制文件。
要使用此 crate 为引导部分成功构建裸机二进制文件,强烈建议使用此 crate 提供的链接器脚本 link64.ld。为了方便地引用此 crate 中包含的链接器脚本,建议在您的项目中使用特定的构建脚本,该脚本将所需的文件复制到当前项目文件夹中,然后可以使用 RUSTFLAG
-C link-arg=-T./link64.ld
引用。该构建脚本是在项目根目录中的一个简单的 build.rs
rust 文件,其内容如下
use std::{env, fs, path::Path};
fn main() {
// copy the linker script from the boot crate to the current directory
// so it will be invoked by the linker
let ld_source = env::var_os("DEP_RUSPIRO_BOOT_LINKERSCRIPT")
.expect("error in ruspiro build, `ruspiro-boot` not a dependency?")
.to_str()
.unwrap()
.replace("\\", "/");
let src_file = Path::new(&ld_source);
let trg_file = format!(
"{}/{}",
env::current_dir().unwrap().display(),
src_file.file_name().unwrap().to_str().unwrap()
);
println!("Copy linker script from {:?}, to {:?}", src_file, trg_file);
fs::copy(src_file, trg_file).unwrap();
}
要开始,您可能想查看这里提供的模板项目:这里
许可证
许可协议为Apache License,版本2.0(LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)或MIT(LICENSE-MIT 或 http://opensource.org/licenses/MIT),您可根据自己的选择。
依赖关系
~140–365KB