Want to use Rust in Xilinx (armv7) platform

I hope my rust code can run on the zynq platform.
I need use https://github.com/filecoin-project/mapr to exchange data with c++ code in memory.

But after directly compiling with armv7-unknown-linux-gnueabihf,
the target platform reports a bin/bash : not found error.
The compiled result can only be run on the Raspberry Pi (2b and 4b)

Later I learned that the target platform was compiled with a special compiler,
but I did not find a match in the rustc --print target-list result list.

I have tried to use the xilinx-2016.2-toolchain to compile Rust to get the results I want, but in the end I found that this is not what I want (at the same time, Rust requires the version of cmake to be greater than 3.4, and the version included in the xilinx tool chain is only 3.3. The compilation result failed).In fact, I want to compile under the x86_64 platform and run under the xilinx platform.

Noob in Rust, i have learned and implemented driving sensors in Raspberry Pi, but the above problem is too complicated for me, I hope to get expert guidance.

1 Like

What do you mean by that? I can find that target in rustc support list:

% rustc --print target-list |rg armv7-unknown-linux-gnueabihf

Rust itself doesn't require on cmake, but some individual Rust libraries use it as part of their build process. Many of them can be configured to use some other method of building. Do you know which of your dependencies requires cmake?

1 Like

yes, but this is for standard arm platform(like rasp pi),not for xilinx fpga

I used

serialport = "4.0.0"

for drive the serialport on the xilinx fpga dev board.
But this not my main question, i want to know how i can run my code on xilinx fpga board.

This previous thread might help: Xilinx Zynq 7030 + Petalinux (Poky): Executable won't run - #7 by plinnie

Yes, I am trying to follow the content of this article.
But I think this is very likely to be unsuccessful. The vivado SDK version I am using is 2016.2.
And the linux on the board commands inside his system are concise and weird.

I run Rust code on a PicoZed (Zynq 7010), but after having fought a long and annoying battle with PetaLinux I instead built everything from scratch myself (including cross compilation toolchain). I basically have an ARM linux-from-scratch system.

I can both cross-compile from my x86-64 to ARM and also use rustup to install a native rust toolchain to a booted development system (though it's quite limited in what it can compile, due to its memory constraints).

To cross-compile the only things I do is to install the appropriate rustup target, make sure that I have the cross-compilation toolchain in PATH, and put the following in my ~/.cargo/config:

linker = "arm-linux-gnueabihf-gcc"

And then finally pass the target parameter to cargo. The resulting binary output can be copied over to the ARM system and runs fine.

Just out of curiosity: Have you run file on your build output? What does it say?

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.