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