|
| 1 | +# `hexagon-unknown-none-elf` |
| 2 | + |
| 3 | +**Tier: 3** |
| 4 | + |
| 5 | +Rust for baremetal Hexagon DSPs. |
| 6 | + |
| 7 | +| Target | Descriptions | |
| 8 | +| ------------------------ | ----------------------------------------- | |
| 9 | +| hexagon-unknown-none-elf | Hexagon v60 or later, HVX | |
| 10 | + |
| 11 | +## Target maintainers |
| 12 | + |
| 13 | +- Brian Cain, `[email protected]`, https://github.com/androm3da |
| 14 | + |
| 15 | +## Requirements |
| 16 | + |
| 17 | +This target is cross-compiled. There is no support for `std`. There is no |
| 18 | +default allocator, but it's possible to use `alloc` by supplying an allocator. |
| 19 | + |
| 20 | +By default, code generated with this target should run on Hexagon DSP |
| 21 | +hardware, v60 or later. |
| 22 | + |
| 23 | +- `-Ctarget-cpu=hexagonv73` adds support for instructions defined up to Hexagon V73. |
| 24 | + |
| 25 | +Functions marked `extern "C"` use the |
| 26 | +[Hexagon architecture calling convention](https://lists.llvm.org/pipermail/llvm-dev/attachments/20190916/21516a52/attachment-0001.pdf). |
| 27 | + |
| 28 | +This target generates PIC ELF binaries. |
| 29 | + |
| 30 | +## Building the target |
| 31 | + |
| 32 | +You can build Rust with support for the target by adding it to the `target` |
| 33 | +list in `config.toml`: |
| 34 | + |
| 35 | +```toml |
| 36 | +[build] |
| 37 | +build-stage = 1 |
| 38 | +host = ["<target for your host>"] |
| 39 | +target = ["<target for your host>", "hexagon-unknown-none-elf"] |
| 40 | + |
| 41 | +[target.hexagon-unknown-none-elf] |
| 42 | + |
| 43 | +cc = "hexagon-unknown-none-elf-clang" |
| 44 | +cxx = "hexagon-unknown-none-elf-clang++" |
| 45 | +linker = "hexagon-unknown-none-elf-clang" |
| 46 | +llvm-libunwind = 'in-tree' |
| 47 | +``` |
| 48 | + |
| 49 | +Replace `<target for your host>` with `x86_64-unknown-linux-gnu` or whatever |
| 50 | +else is appropriate for your host machine. |
| 51 | + |
| 52 | +## Building Rust programs |
| 53 | + |
| 54 | +Rust does not yet ship pre-compiled artifacts for this target. To compile for |
| 55 | +this target, you will either need to build Rust with the target enabled (see |
| 56 | +"Building the target" above), or build your own copy of `core` by using |
| 57 | +`build-std` or similar. |
| 58 | + |
| 59 | +## Testing |
| 60 | + |
| 61 | +Since `hexagon-unknown-none-elf` supports a variety of different environments |
| 62 | +and does not support `std`, this target does not support running the Rust |
| 63 | +test suite. |
| 64 | + |
| 65 | +## Cross-compilation toolchains and C code |
| 66 | + |
| 67 | +This target has been tested using `hexagon-sim` from the Hexagon SDK. |
| 68 | + |
| 69 | +`.cargo/config.toml`: |
| 70 | +```toml |
| 71 | +[target.hexagon-unknown-none-elf] |
| 72 | + |
| 73 | +cc = "hexagon-unknown-none-elf-clang" |
| 74 | +cxx = "hexagon-unknown-none-elf-clang++" |
| 75 | +linker = "hexagon-unknown-none-elf-clang" |
| 76 | +runner = "hexagon-sim FIXME TBD details" |
| 77 | + |
| 78 | +[build] |
| 79 | +target = ["hexagon-unknown-none-elf"] |
| 80 | +rustflags = "-Ctarget-cpu=hexagonv73" |
| 81 | +``` |
| 82 | + |
| 83 | +FIXME TBD details |
0 commit comments