aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/build.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2021-11-23 15:40:29 +0000
committerGravatar GitHub <noreply@github.com> 2021-11-23 15:40:29 +0000
commitecf840b80bcc52b426afe93dba9b6d563adbbfce (patch)
treea9a74e96193739b331c5e6778a407abbe210b64c /cortex-m-rt/build.rs
parent008fd73a1bb8e3d6f635b8aeeb96c57621e52c54 (diff)
parentb38af9d1b6ddd90e2d9a427179bd54e19095d8f6 (diff)
downloadcortex-m-ecf840b80bcc52b426afe93dba9b6d563adbbfce.tar.gz
cortex-m-ecf840b80bcc52b426afe93dba9b6d563adbbfce.tar.zst
cortex-m-ecf840b80bcc52b426afe93dba9b6d563adbbfce.zip
Merge #337
337: Fix unwinding through `Reset` r=thejpster a=jonas-schievink Unwinders may detect the end of the program by seeing `0xFFFFFFFF` in `lr`, which is why code to ensure that it has that value was added in https://github.com/rust-embedded/cortex-m-rt/pull/293. However, the `bl main` overwrites that value with the current program counter. This PR saves the old `lr` value on the stack, and adds debuginfo entries to allow an external unwinder to restore the value. This fixes https://github.com/knurling-rs/probe-run/issues/277 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Diffstat (limited to 'cortex-m-rt/build.rs')
-rw-r--r--cortex-m-rt/build.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/cortex-m-rt/build.rs b/cortex-m-rt/build.rs
index 6758d9e..96a8560 100644
--- a/cortex-m-rt/build.rs
+++ b/cortex-m-rt/build.rs
@@ -19,12 +19,10 @@ fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
if target.starts_with("thumbv") {
- fs::copy(
- format!("bin/{}.a", target),
- out_dir.join("libcortex-m-rt.a"),
- )
- .unwrap();
+ let lib_path = format!("bin/{}.a", target);
+ fs::copy(&lib_path, out_dir.join("libcortex-m-rt.a")).unwrap();
println!("cargo:rustc-link-lib=static=cortex-m-rt");
+ println!("cargo:rerun-if-changed={}", lib_path);
}
// Put the linker script somewhere the linker can find it