csky-unknown-linux-gnuabiv2
Tier: 3
This target supports C-SKY CPUs with abi
v2 and glibc
.
target | std | host | notes |
---|---|---|---|
csky-unknown-linux-gnuabiv2 | ✓ | C-SKY abiv2 Linux (little endian) | |
csky-unknown-linux-gnuabiv2hf | ✓ | C-SKY abiv2 Linux, hardfloat (little endian) |
Reference:
other links:
Compiling rust for this target has been tested on x86_64
linux hosts. Other host types have not been tested, but may work, if you can find a suitable cross compilation toolchain for them.
If you don't already have a suitable toolchain, you can download from here, and unpack it into a directory.
The target can be built by enabling it for a rustc
build, by placing the following in config.toml
:
[build] target = ["x86_64-unknown-linux-gnu", "csky-unknown-linux-gnuabiv2", "csky-unknown-linux-gnuabiv2hf"] stage = 2 [target.csky-unknown-linux-gnuabiv2] # ADJUST THIS PATH TO POINT AT YOUR TOOLCHAIN cc = "${TOOLCHAIN_PATH}/bin/csky-linux-gnuabiv2-gcc" [target.csky-unknown-linux-gnuabiv2hf] # ADJUST THIS PATH TO POINT AT YOUR TOOLCHAIN cc = "${TOOLCHAIN_PATH}/bin/csky-linux-gnuabiv2-gcc" ### Build ```sh # in rust dir ./x.py build --stage 2
To test cross-compiled binaries on a x86_64
system, you can use the qemu-cskyv2
. This avoids having a full emulated ARM system by doing dynamic binary translation and dynamic system call translation. It lets you run CSKY programs directly on your x86_64
kernel. It's very convenient!
To use:
qemu-cskyv2
(If you don't already have a qemu, you can download from here, and unpack it into a directory.)rustup toolchain link stage2 ${RUST}/build/x86_64-unknown-linux-gnu/stage2
cargo new hello_world
cd hello_world
CARGO_TARGET_CSKY_UNKNOWN_LINUX_GNUABIV2_RUNNER=${QEMU_PATH}/bin/qemu-cskyv2 -L ${TOOLCHAIN_PATH}/csky-linux-gnuabiv2/libc \ CARGO_TARGET_CSKY_UNKNOWN_LINUX_GNUABIV2_LINKER=${TOOLCHAIN_PATH}/bin/csky-linux-gnuabiv2-gcc \ RUSTFLAGS="-C target-features=+crt-static" \ cargo +stage2 run --target csky-unknown-linux-gnuabiv2
Attention: The dynamic-linked program may nor be run by qemu-cskyv2
but can be run on the target.