Add {thumb,arm}v5te-none-eabi targets

This commit is contained in:
Quinn Painter 2022-09-02 14:16:02 +01:00
parent e21d771b9c
commit e7b62be96b
6 changed files with 171 additions and 0 deletions

View file

@ -19,6 +19,7 @@
- [\*-apple-watchos\*](platform-support/apple-watchos.md)
- [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
- [armv4t-none-eabi](platform-support/armv4t-none-eabi.md)
- [armv5te-none-eabi](platform-support/armv5te-none-eabi.md)
- [armv6k-nintendo-3ds](platform-support/armv6k-nintendo-3ds.md)
- [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md)
- [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md)

View file

@ -225,6 +225,7 @@ target | std | host | notes
[`arm64_32-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM Apple WatchOS 64-bit with 32-bit pointers
`armv4t-none-eabi` | * | | ARMv4T A32
`armv4t-unknown-linux-gnueabi` | ? | |
[`armv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | ARMv5TE A32
`armv5te-unknown-linux-uclibceabi` | ? | | ARMv5TE Linux with uClibc
`armv6-unknown-freebsd` | ✓ | ✓ | ARMv6 FreeBSD
`armv6-unknown-netbsd-eabihf` | ? | |
@ -291,6 +292,7 @@ target | std | host | notes
`sparc64-unknown-netbsd` | ✓ | ✓ | NetBSD/sparc64
[`sparc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/sparc64
`thumbv4t-none-eabi` | * | | ARMv4T T32
[`thumbv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | ARMv5TE T32
`thumbv7a-pc-windows-msvc` | ? | |
`thumbv7a-uwp-windows-msvc` | ✓ | |
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode ARMv7a Linux with NEON, MUSL

View file

@ -0,0 +1,75 @@
# `armv5te-none-eabi`
**Tier: 3**
Bare-metal target for any cpu in the ARMv5TE architecture family, supporting
ARM/Thumb code interworking (aka `a32`/`t32`), with ARM code as the default code
generation.
The `thumbv5te-none-eabi` target is the same as this one, but with THUMB code as the default.
In particular this supports the main CPU of the Nintendo DS, but there's nothing DS
specific with this target, so any ARMv5TE device should work fine.
## Target Maintainers
* [@QuinnPainter](https://github.com/QuinnPainter)
## Requirements
The target is cross-compiled, and uses static linking.
By default, the `lld` linker included with Rust will be used.
However, you may want to use the `arm-none-eabi-ld` linker instead. This can be obtained for Windows/Mac/Linux from the [ARM
Developer Website][arm-dev], or possibly from your OS's package manager. To use it, add the following to your `.cargo/config.toml`:
```toml
[target.armv5te-none-eabi]
linker = "arm-none-eabi-ld"
```
[arm-dev]: https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain
This target doesn't provide a linker script, you'll need to bring your own
according to the specific device you want to target. Pass
`-Clink-arg=-Tyour_script.ld` as a rustc argument to make the linker use
`your_script.ld` during linking.
## Building Rust Programs
Because it is Tier 3, rust does not yet ship pre-compiled artifacts for this target.
Just use the `build-std` nightly cargo feature to build the `core` library. You
can pass this as a command line argument to cargo, or your `.cargo/config.toml`
file might include the following lines:
```toml
[unstable]
build-std = ["core"]
```
Most of `core` should work as expected, with the following notes:
* the target is "soft float", so `f32` and `f64` operations are emulated in
software.
* integer division is also emulated in software.
* the target is old enough that it doesn't have atomic instructions.
`alloc` is also supported, as long as you provide your own global allocator.
Rust programs are output as ELF files.
For running on DS hardware, you'll need to use an external tool to bundle this ELF file into an NDS binary. The `ndstool` utility included with devkitARM is one such tool that can do this for you:
```shell
ndstool -c [out_nds] -9 [in_elf]
```
## Testing
This is a cross-compiled target that you will need to emulate during testing.
Because this is a device-agnostic target, and the exact emulator that you'll
need depends on the specific device you want to run your code on.
For example, when programming for the DS, you can use one of the several available DS emulators, such as [melonDS](https://melonds.kuribo64.net/).