forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#100245 - matthiaskrgr:rollup-tfoo650, r=matth…
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#100019 (Revive suggestions for boxed trait objects instead of impl Trait) - rust-lang#100038 (Document the `no-std` target option in config.toml.example) - rust-lang#100194 (Remove even more box syntax uses from src/test) - rust-lang#100206 (test: skip terminfo parsing in Miri) - rust-lang#100230 (Use start_point instead of next_point to point to elided lifetime amp…) - rust-lang#100244 (Add armv4t-none-eabi take2) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
89 changed files
with
555 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//! Targets the ARMv4T, with code as `a32` code by default. | ||
//! | ||
//! Primarily of use for the GBA, but usable with other devices too. | ||
//! | ||
//! Please ping @Lokathor if changes are needed. | ||
//! | ||
//! This target profile assumes that you have the ARM binutils in your path | ||
//! (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free | ||
//! for all major OSes from the ARM developer's website, and they may also be | ||
//! available in your system's package manager. Unfortunately, the standard | ||
//! linker that Rust uses (`lld`) only supports as far back as `ARMv5TE`, so we | ||
//! must use the GNU `ld` linker. | ||
//! | ||
//! **Important:** This target profile **does not** specify a linker script. You | ||
//! just get the default link script when you build a binary for this target. | ||
//! The default link script is very likely wrong, so you should use | ||
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script. | ||
use crate::spec::{cvs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; | ||
|
||
pub fn target() -> Target { | ||
Target { | ||
llvm_target: "armv4t-none-eabi".into(), | ||
pointer_width: 32, | ||
arch: "arm".into(), | ||
/* Data layout args are '-' separated: | ||
* little endian | ||
* stack is 64-bit aligned (EABI) | ||
* pointers are 32-bit | ||
* i64 must be 64-bit aligned (EABI) | ||
* mangle names with ELF style | ||
* native integers are 32-bit | ||
* All other elements are default | ||
*/ | ||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), | ||
options: TargetOptions { | ||
abi: "eabi".into(), | ||
linker_flavor: LinkerFlavor::Ld, | ||
linker: Some("arm-none-eabi-ld".into()), | ||
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",], | ||
features: "+soft-float,+strict-align".into(), | ||
main_needs_argc_argv: false, | ||
atomic_cas: false, | ||
has_thumb_interworking: true, | ||
relocation_model: RelocModel::Static, | ||
panic_strategy: PanicStrategy::Abort, | ||
// from thumb_base, rust-lang/rust#44993. | ||
emit_debug_gdb_scripts: false, | ||
// from thumb_base, apparently gcc/clang give enums a minimum of 8 bits on no-os targets | ||
c_enum_min_bits: 8, | ||
..Default::default() | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# armv4t-none-eabi | ||
|
||
Tier 3 | ||
|
||
Bare-metal target for any cpu in the ARMv4T architecture family, supporting | ||
ARM/Thumb code interworking (aka `a32`/`t32`), with ARM code as the default code | ||
generation. | ||
|
||
In particular this supports the Gameboy Advance (GBA), but there's nothing GBA | ||
specific with this target, so any ARMv4T device should work fine. | ||
|
||
## Target Maintainers | ||
|
||
* [@Lokathor](https://github.com/lokathor) | ||
|
||
## Requirements | ||
|
||
The target is cross-compiled, and uses static linking. | ||
|
||
The linker that comes with rustc cannot link for this platform (the platform is | ||
too old). You will need the `arm-none-eabi-ld` linker from a GNU Binutils | ||
targeting ARM. This can be obtained for Windows/Mac/Linux from the [ARM | ||
Developer Website][arm-dev], or possibly from your OS's package manager. | ||
|
||
[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. | ||
|
||
Rust programs are output as ELF files. | ||
|
||
For running on hardware, you'll generally need to extract the "raw" program code | ||
out of the ELF and into a file of its own. The `objcopy` program provided as | ||
part of the GNU Binutils can do this: | ||
|
||
```shell | ||
arm-none-eabi-objcopy --output-target binary [in_file] [out_file] | ||
``` | ||
|
||
## 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 Gameboy Advance, the | ||
[mgba-test-runner](https://github.com/agbrs/agb) program could be used to make a | ||
normal set of rust tests be run within the `mgba` emulator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// unit-test: SimplifyLocals | ||
|
||
#![feature(box_syntax)] | ||
|
||
#![feature(thread_local)] | ||
|
||
#[derive(Copy, Clone)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.