Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Rust have support for embedded PowerPC targets?

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.

like image 204
Rock Boynton Avatar asked Feb 07 '26 21:02

Rock Boynton


1 Answers

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"
}
like image 187
KooShnoo Avatar answered Feb 09 '26 11:02

KooShnoo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!