Hard floating point support on ZYNQ7000 bare-metal

Hello all,

I used to run bare-metal C/C++ application on Xilinx ZYNQ7000 chip. Now I want to try it also with rust. As the first step, I just want to create a static library (for a sum function) in rust language.
I can crate the library, but when I try to call the library in the C/C++ project, it reports some error related to Hard floating points. In my current Xilinx compiler settings, it is as follow
-mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard

while in rust, I can only find the the tool chain "armv7a-none-eabi", not a hf version.

Is there any suggestion on how to generate a hf version of rust library?

Thank you in advance!

The platform support documentation seems to indicate armv7a-none-eabihf exists and is a tier 3 target. Have you tried it?

1 Like

Hi BradleyHarden,

Thank you for the information. I tried to use rustup target add armv7a-none-eabihf command to add the toolchain. But the error happened. Could give further suggestion on how to use it?

Thank you in advance!

It looks like the standard library doesn't come pre-compiled for your target. I've never had to deal with this myself, but some quick searching suggests that running

cargo +nightly build -Z build-std --release --lib --target armv7a-none-eabihf

might work.

It looks like people encountered this error when trying to build for ARM-based Macs (e.g. here), so you might have luck searching for those cases and trying to adapt for your case.


Hi Bradleyharden,

Thank you for the hint! Now it works on my setup, I have not try on my board but at least it can pass the compiling stage and generate the binary file.

Below are the steps I followed (In case others may also need this)

rustup install nightly

rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc

cd project_Folder_name

cargo +nightly build -Z build-std --release --lib --target armv7a-none-eabihf

@bradleyharden Thank you so much again!


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.