Skip to content

Commit

Permalink
Make rust emitted code compatible with Rev A Playdate hardware
Browse files Browse the repository at this point in the history
The FPU settings above are `-mfpu=fpv5-sp-d16`, the `-sp-` part means that double precision floating point is unsupported. The [rust docs](https://doc.rust-lang.org/nightly/rustc/platform-support/thumbv7em-none-eabi.html#table-of-supported-cpus-for-thumbv7em-none-eabihf) show that getting this same effect from rustc-emitted code requires this additional target feature.

Without this, I was getting "undefined instruction" errors for f64 instructions on the original Playdate hardware, with this change it seems to be resolved.
  • Loading branch information
jder authored Jun 12, 2024
1 parent f46cda4 commit cc5d5fa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ impl Build {
"RUSTFLAGS",
[
"-Ctarget-cpu=cortex-m7",
"-Ctarget-feature=-fp64", // Rev A hardware seems to not have 64-bit floating point support
"-Clink-args=--emit-relocs",
"-Crelocation-model=pic",
"-Cpanic=abort",
Expand Down

0 comments on commit cc5d5fa

Please sign in to comment.