I've so far only seen PowerPC in the target lists in the rustc book for operating systems such as Linux, but not for embedded.
From the LLVM documentation, it implies they support embedded PowerPC, so in theory, Rust should be able to compile with a custom target, right?
One problem I have seen though is it doesn't seem LLVM supports variable-length encoding (VLE), which means programs may be significantly larger in flash.
From the LLVM docs, it implies they support embedded PowerPC, so in theory, Rust should be able to compile with a custom target right?
Yes.
LLVM does indeed support embedded PowerPC. For any target that llvm supports, you can define a corresponding custom target for rust using a json file. Just tweak the settings to match your specific processor.
Here's an example for the Nintendo Wii's PowerPC 750CL-based cpu:
{
"arch": "powerpc",
"cpu": "750",
"data-layout": "E-m:e-p:32:32-i64:64-n32",
"dynamic-linking": false,
"env": "newlib",
"executables": true,
"has-rpath": true,
"llvm-target": "powerpc-unknown-eabi",
"linker": "powerpc-eabi-gcc",
"linker-flavor": "gcc",
"linker-is-gnu": true,
"os": "rvl-ios",
"pre-link-args": {
"gcc": [
"-mrvl",
"-meabi",
"-mhard-float"
]
},
"panic-strategy": "abort",
"relocation-model": "static",
"target-endian": "big",
"target-family": "none",
"target-mcount": "_mcount",
"target-c-int-width": "32",
"target-pointer-width": "32",
"vendor": "nintendo"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With