Update format of link_user.S

This commit is contained in:
Yifan Wu 2021-01-02 10:17:52 +08:00
parent 3ebfddf925
commit b3a3ac58b1

View File

@ -2,7 +2,8 @@ use std::io::{Result, Write};
use std::fs::{File, read_dir};
fn main() {
println!("cargo:rerun-if-changed=../user/src/bin/");
println!("cargo:rerun-if-changed=../user/src/");
println!("cargo:rerun-if-changed={}", TARGET_PATH);
insert_app_data().unwrap();
}
@ -26,17 +27,12 @@ fn insert_app_data() -> Result<()> {
.section .data
.global _num_app
_num_app:
.quad {}
"#, apps.len())?;
.quad {}"#, apps.len())?;
for i in 0..apps.len() {
writeln!(f, r#"
.quad app_{}_start
"#, i)?;
writeln!(f, r#" .quad app_{}_start"#, i)?;
}
writeln!(f, r#"
.quad app_{}_end
"#, apps.len() - 1)?;
writeln!(f, r#" .quad app_{}_end"#, apps.len() - 1)?;
for (idx, app) in apps.iter().enumerate() {
println!("app_{}: {}", idx, app);
@ -46,8 +42,7 @@ _num_app:
.global app_{0}_end
app_{0}_start:
.incbin "{2}{1}.bin"
app_{0}_end:
"#, idx, app, TARGET_PATH)?;
app_{0}_end:"#, idx, app, TARGET_PATH)?;
}
Ok(())
}