re-org of boot sequence to 'draft final' sequence

boot0, boot1 targets added to xtask, image creation setup
to relocate the start points of each image to these locations.
This commit is contained in:
bunnie 2025-09-29 13:27:11 +08:00
parent 003af0295a
commit 3928240081
3 changed files with 76 additions and 23 deletions

View file

@ -20,3 +20,4 @@ ureq = { version = "2.9.0", features = ["json"] }
svd2utra = "0.1.23"
lazy_static = "1.4.0"
# toml_edit = "0.14.4" # would be used to verify Cargo.toml files, but it's too hard to do this right now.
bao1x-api = { path = "../libs/bao1x-api" }

View file

@ -1023,7 +1023,12 @@ impl Builder {
loader_bin.to_str().unwrap(),
"--min-xous-ver",
&self.min_ver,
"--sig-length",
&self.sigblock_size.to_string(),
"--with-jump", // bao1x target has a jump inserted in the loader sig block
"--bao1x",
"--function-code",
"loader",
])
.status()?
} else {
@ -1054,26 +1059,55 @@ impl Builder {
let mut xous_img_path = output_bundle.parent().unwrap().to_owned();
xous_img_path.push("xous.img");
let status = Command::new(cargo())
.current_dir(project_root())
.args([
"run",
"--package",
"tools",
"--bin",
"sign-image",
"--",
"--kernel-image",
output_bundle.to_str().unwrap(),
"--kernel-key",
&self.kernel_key,
"--kernel-output",
xous_img_path.to_str().unwrap(),
"--min-xous-ver",
&self.min_ver,
// "--defile",
])
.status()?;
let status = if self.utra_target.contains("bao1x") {
Command::new(cargo())
.current_dir(project_root())
.args([
"run",
"--package",
"tools",
"--bin",
"sign-image",
"--",
"--kernel-image",
output_bundle.to_str().unwrap(),
"--kernel-key",
&self.kernel_key,
"--kernel-output",
xous_img_path.to_str().unwrap(),
"--min-xous-ver",
&self.min_ver,
"--sig-length",
&self.sigblock_size.to_string(),
"--with-jump", // bao1x target has a jump inserted in the sig block
"--bao1x",
"--function-code",
"kernel",
// "--defile",
])
.status()?
} else {
Command::new(cargo())
.current_dir(project_root())
.args([
"run",
"--package",
"tools",
"--bin",
"sign-image",
"--",
"--kernel-image",
output_bundle.to_str().unwrap(),
"--kernel-key",
&self.kernel_key,
"--kernel-output",
xous_img_path.to_str().unwrap(),
"--min-xous-ver",
&self.min_ver,
// "--defile",
])
.status()?
};
if !status.success() {
return Err("kernel image sign failed".into());
}

View file

@ -605,7 +605,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let sigblock_size = 0x300;
update_flash_origin(
"baremetal/src/platform/bao1x/link.x",
(0x6000_0000 + sigblock_size + STATICS_LEN) as u32,
(bao1x_api::BAREMETAL_START + sigblock_size + STATICS_LEN) as u32,
)?;
builder.set_baremetal(true).target_baremetal_bao1x("baremetal").set_sigblock_size(sigblock_size);
}
@ -625,8 +625,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Some("bao1x-boot0") => {
let sigblock_size = 0x300;
update_flash_origin(
"baremetal/src/platform/bao1x/link.x",
(0x6000_0000 + sigblock_size + STATICS_LEN) as u32,
"bao1x-boot/boot0/link.x",
(bao1x_api::BOOT0_START + sigblock_size + STATICS_LEN) as u32,
)?;
builder
.set_baremetal(true)
@ -634,12 +634,30 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.set_sigblock_size(sigblock_size);
}
Some("bao1x-boot1") => {
let sigblock_size = 0x300;
update_flash_origin(
"bao1x-boot/boot1/src/platform/bao1x/link.x",
(bao1x_api::BOOT1_START + sigblock_size + STATICS_LEN) as u32,
)?;
builder
.set_baremetal(true)
.target_baremetal_bao1x("bao1x-boot1")
.set_sigblock_size(sigblock_size);
}
Some("baosec") => {
let board = "board-baosec";
let sigblock_size = 0x300;
update_flash_origin(
"loader/src/platform/bao1x/link.x",
(bao1x_api::LOADER_START + sigblock_size + STATICS_LEN) as u32,
)?;
// select the board
builder.add_feature(board);
builder.add_loader_feature(board);
builder.add_kernel_feature(board);
builder.set_sigblock_size(sigblock_size);
// placement in flash is a tension between dev convenience and RAM usage. Things in flash
// are resident, non-swapable, but end up making the slow kernel burn process take longer.