forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Add armv7a-vex-v5 tier 3 target.
#1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
b27aee9
stabilize `ci_rustc_if_unchanged_logic` test
onur-ozkan de744ea
update `rustc_borrowck::places_conflict` doc-comment
onur-ozkan 249df9e
Auto merge of #131444 - onur-ozkan:hotfix-ci, r=Kobzol
bors 26f472d
add armv7a-vex-v5 target
max-niederman e517385
add (shimmed) std support for armv7a-vex-v5
max-niederman c165bed
add panic, stdio, and alloc support to armv7a-vex-v5
max-niederman 7919692
fix linker script and call main
max-niederman dcfa3bd
zero out bss section in _start
max-niederman 8095ebd
use static TLS implementation on vexos
max-niederman 1780a6a
make minor improvements to linker script
max-niederman 31c0e19
enable stdio and fix stdout flushing
max-niederman 9b51015
add: `Instant` implementation
Gavin-Niederman b1cbee0
remove broken cleanup
max-niederman 651a267
fix `.code_signature` section error
tropicaaal 48155eb
move `.code_signature` section into `.text`
tropicaaal e1b6923
adjust `armv7a-vex-v5` target features for more aggressive hardware o…
tropicaaal 3295fed
switch `llvm_target` to use ARM hard-float abi
tropicaaal bffb60d
add `env` implementation for `vexos` PAL
tropicaaal 4981de1
feat: experimental fs support
Gavin-Niederman 72111c5
add support for more missing file operations
tropicaaal dc8dff0
feat: file writes vectored writes and vectored reads
Gavin-Niederman ed9640f
add helper for mapping FRESULT values
tropicaaal 3886ee9
add: try_file_exists and stat
Gavin-Niederman c5ec31f
add: fileattr functions
Gavin-Niederman 99ef1ae
fix: check current position in file when getting size
Gavin-Niederman cf0224e
refactor: pseudorandom hashmap keys
Gavin-Niederman e3d3956
fix: support File::file_attr and dissalow read and write mode at the …
Gavin-Niederman e54eb6d
feat: seek implementation
Gavin-Niederman 477aeeb
feat: almost working directory reading
Gavin-Niederman 51a85f8
fix: remove trailing slashes sooner
Gavin-Niederman 871058a
remove test code and document filesystem quirks
tropicaaal 5723946
add default code signature, ensure stdout flush
tropicaaal fd35bda
add platform docs
tropicaaal 1274213
adjust wording and fix typos in target documentation
tropicaaal c65cfdb
update PAL and add `check-cfg` override for `target_os`
tropicaaal 876be73
add additional information to target spec and supporting docs
tropicaaal 23508ab
fix `EXE_SUFFFIX` to use dot
tropicaaal 3ec93ea
fix: use correct code signature default values
tropicaaal 8ddc5f1
don't compile with `+thumb-mode` feature for now
tropicaaal 834ab12
properly flush serial on abort
tropicaaal 3a23f09
clarify documentation regarding cargo-v5, adjust `SystemTime` panic m…
tropicaaal 08998e9
use aapcs as system abi
max-niederman 23704a8
fix stack corruptions in startup routine
max-niederman 9e466b6
fix thread locals
max-niederman a200a23
implement (shimmed) std::random
max-niederman 8632a35
fix allocation
max-niederman ee08567
update linkerscript to include unwinding-related sections
tropicaaal a86a069
format target doc and reorder maintainer list
max-niederman bc40dcd
bump vex-sdk version and allow vex-sdk to be a stdlib dep
max-niederman 64c05d2
add assembly test for armv7a-vex-v5
max-niederman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,37 @@ | ||
| use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; | ||
|
|
||
| const LINK_SCRIPT: &str = include_str!("./armv7a_vex_v5_linker_script.ld"); | ||
|
|
||
| pub(crate) fn target() -> Target { | ||
| Target { | ||
| llvm_target: "armv7a-none-eabihf".into(), | ||
| metadata: crate::spec::TargetMetadata { | ||
| description: Some("Armv7-A Cortex-A9 VEX V5 Brain, VEXos".into()), | ||
| tier: Some(3), | ||
| host_tools: Some(false), | ||
| std: Some(true), | ||
| }, | ||
| pointer_width: 32, | ||
| data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), | ||
| arch: "arm".into(), | ||
| options: TargetOptions { | ||
| os: "vexos".into(), | ||
| is_like_vexos: true, | ||
| vendor: "vex".into(), | ||
| cpu: "cortex-a9".into(), | ||
| abi: "eabihf".into(), | ||
| features: "+v7,+neon,+vfp3,+thumb2".into(), | ||
| linker: Some("rust-lld".into()), | ||
| linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), | ||
| link_script: Some(LINK_SCRIPT.into()), | ||
| panic_strategy: PanicStrategy::Abort, | ||
| relocation_model: RelocModel::Static, | ||
| c_enum_min_bits: Some(8), | ||
| max_atomic_width: Some(64), | ||
| disable_redzone: true, | ||
| emit_debug_gdb_scripts: false, | ||
| has_thumb_interworking: true, | ||
| ..Default::default() | ||
| }, | ||
| } | ||
| } |
84 changes: 84 additions & 0 deletions
84
compiler/rustc_target/src/spec/targets/armv7a_vex_v5_linker_script.ld
This file contains hidden or 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,84 @@ | ||
| OUTPUT_FORMAT("elf32-littlearm") | ||
|
|
||
| ENTRY(_boot) | ||
|
|
||
| __user_ram_start = 0x03800000; | ||
| __user_ram_length = 0x04800000; | ||
| __user_ram_end = __user_ram_start + __user_ram_length; | ||
|
|
||
| __code_signature_length = 0x20; | ||
|
|
||
| __stack_length = 0x400000; | ||
| __heap_end = __user_ram_end - __stack_length; | ||
|
|
||
| __eh_frame_hdr_start = SIZEOF(.eh_frame_hdr) > 0 ? ADDR(.eh_frame_hdr) : 0; | ||
| __eh_frame_hdr_end = SIZEOF(.eh_frame_hdr) > 0 ? . : 0; | ||
|
|
||
| MEMORY { | ||
| USER_RAM : ORIGIN = __user_ram_start, LENGTH = __user_ram_length | ||
| } | ||
|
|
||
| SECTIONS { | ||
| .code_signature : { | ||
| KEEP(*(.code_signature)) | ||
| . = __user_ram_start + __code_signature_length; | ||
| } > USER_RAM | ||
|
|
||
| .text : { | ||
| *(.boot) | ||
| *(.text .text.*) | ||
| } > USER_RAM | ||
|
|
||
| .rodata : { | ||
| *(.rodata .rodata.*) | ||
| } > USER_RAM | ||
|
|
||
| .data : { | ||
| *(.data .data.*) | ||
| } > USER_RAM | ||
|
|
||
| .bss : { | ||
| __bss_start = .; | ||
| *(.bss .bss.*) | ||
| __bss_end = .; | ||
| } > USER_RAM | ||
|
|
||
| /* The unwind tables enabled by "default-uwtable" in the target file live here. */ | ||
| /* __eh_frame_start and similar symbols are used by libunwind. */ | ||
| .eh_frame_hdr : { | ||
| KEEP(*(.eh_frame_hdr)) | ||
| } > USER_RAM | ||
|
|
||
| .eh_frame : { | ||
| __eh_frame_start = .; | ||
| KEEP(*(.eh_frame)) | ||
| __eh_frame_end = .; | ||
| } > USER_RAM | ||
|
|
||
| .ARM.exidx : { | ||
| __exidx_start = .; | ||
| *(.ARM.exidx*) | ||
| __exidx_end = .; | ||
| } > USER_RAM | ||
|
|
||
| .ARM.extab : { | ||
| __extab_start = .; | ||
| *(.ARM.extab*) | ||
| __extab_end = .; | ||
| } > USER_RAM | ||
|
|
||
| .heap (NOLOAD) : ALIGN(4) { | ||
| __heap_start = .; | ||
| . = __heap_end; | ||
| } > USER_RAM | ||
|
|
||
| .stack (NOLOAD) : ALIGN(8) { | ||
| __stack_bottom = .; | ||
| . += __stack_length; | ||
| __stack_top = .; | ||
| } > USER_RAM | ||
|
|
||
| /DISCARD/ : { | ||
| *(.ARM.attributes*) | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,98 @@ | ||
| // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint | ||
| #![allow(static_mut_refs)] | ||
|
|
||
| use crate::alloc::{GlobalAlloc, Layout, System}; | ||
| use crate::ptr; | ||
| use crate::sync::atomic::{AtomicBool, Ordering}; | ||
|
|
||
| static mut DLMALLOC: dlmalloc::Dlmalloc<Vexos> = dlmalloc::Dlmalloc::new_with_allocator(Vexos); | ||
|
|
||
| extern "C" { | ||
| static mut __heap_start: u8; | ||
| static mut __heap_end: u8; | ||
| } | ||
|
|
||
| struct Vexos; | ||
|
|
||
| unsafe impl dlmalloc::Allocator for Vexos { | ||
| /// Allocs system resources | ||
| fn alloc(&self, _size: usize) -> (*mut u8, usize, u32) { | ||
| static INIT: AtomicBool = AtomicBool::new(false); | ||
|
|
||
| if !INIT.swap(true, Ordering::Relaxed) { | ||
| unsafe { | ||
| ( | ||
| ptr::addr_of_mut!(__heap_start).cast(), | ||
| ptr::addr_of!(__heap_end).byte_offset_from(ptr::addr_of!(__heap_start)) as _, | ||
| 0, | ||
| ) | ||
| } | ||
| } else { | ||
| (ptr::null_mut(), 0, 0) | ||
| } | ||
| } | ||
|
|
||
| fn remap(&self, _ptr: *mut u8, _oldsize: usize, _newsize: usize, _can_move: bool) -> *mut u8 { | ||
| ptr::null_mut() | ||
| } | ||
|
|
||
| fn free_part(&self, _ptr: *mut u8, _oldsize: usize, _newsize: usize) -> bool { | ||
| false | ||
| } | ||
|
|
||
| fn free(&self, _ptr: *mut u8, _size: usize) -> bool { | ||
| false | ||
| } | ||
|
|
||
| fn can_release_part(&self, _flags: u32) -> bool { | ||
| false | ||
| } | ||
|
|
||
| fn allocates_zeros(&self) -> bool { | ||
| false | ||
| } | ||
|
|
||
| fn page_size(&self) -> usize { | ||
| 0x1000 | ||
| } | ||
| } | ||
|
|
||
| #[stable(feature = "alloc_system_type", since = "1.28.0")] | ||
| unsafe impl GlobalAlloc for System { | ||
| #[inline] | ||
| unsafe fn alloc(&self, layout: Layout) -> *mut u8 { | ||
| // SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access. | ||
| // Calling malloc() is safe because preconditions on this function match the trait method preconditions. | ||
| let _lock = lock::lock(); | ||
| unsafe { DLMALLOC.malloc(layout.size(), layout.align()) } | ||
| } | ||
|
|
||
| #[inline] | ||
| unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { | ||
| // SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access. | ||
| // Calling calloc() is safe because preconditions on this function match the trait method preconditions. | ||
| let _lock = lock::lock(); | ||
| unsafe { DLMALLOC.calloc(layout.size(), layout.align()) } | ||
| } | ||
|
|
||
| #[inline] | ||
| unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { | ||
| // SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access. | ||
| // Calling free() is safe because preconditions on this function match the trait method preconditions. | ||
| let _lock = lock::lock(); | ||
| unsafe { DLMALLOC.free(ptr, layout.size(), layout.align()) } | ||
| } | ||
|
|
||
| #[inline] | ||
| unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { | ||
| // SAFETY: DLMALLOC access is guaranteed to be safe because the lock gives us unique and non-reentrant access. | ||
| // Calling realloc() is safe because preconditions on this function match the trait method preconditions. | ||
| let _lock = lock::lock(); | ||
| unsafe { DLMALLOC.realloc(ptr, layout.size(), layout.align(), new_size) } | ||
| } | ||
| } | ||
|
|
||
| mod lock { | ||
| #[inline] | ||
| pub fn lock() {} // we don't have threads, which makes this real easy | ||
| } |
This file contains hidden or 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 hidden or 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,9 @@ | ||
| pub mod os { | ||
| pub const FAMILY: &str = ""; | ||
| pub const OS: &str = "vexos"; | ||
| pub const DLL_PREFIX: &str = ""; | ||
| pub const DLL_SUFFIX: &str = ""; | ||
| pub const DLL_EXTENSION: &str = ""; | ||
| pub const EXE_SUFFIX: &str = ".bin"; | ||
| pub const EXE_EXTENSION: &str = "bin"; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.