diff --git a/arm-targets/CHANGELOG.md b/arm-targets/CHANGELOG.md index 979a46a..b842230 100644 --- a/arm-targets/CHANGELOG.md +++ b/arm-targets/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -No changes +### Added + +- Added support for legacy Arm targets: Armv5TE and Armv4T, including proper arch, isa, and profile handling. ## [v0.2.0] diff --git a/arm-targets/src/lib.rs b/arm-targets/src/lib.rs index 39743b7..ae39508 100644 --- a/arm-targets/src/lib.rs +++ b/arm-targets/src/lib.rs @@ -77,6 +77,7 @@ impl Isa { pub fn get(target: &str) -> Option { let arch = Arch::get(target)?; Some(match arch { + Arch::Armv4T | Arch::Armv5TE => Isa::A32, Arch::Armv6M => Isa::T32, Arch::Armv7M => Isa::T32, Arch::Armv7EM => Isa::T32, @@ -118,6 +119,10 @@ impl core::fmt::Display for Isa { /// As defined by a particular revision of the Arm Architecture Reference Manual (ARM). #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Arch { + /// Armv4T (legacy, also known as ARMv4T) + Armv4T, + /// Armv5TE (also known as ARMv5TE) + Armv5TE, /// Armv6-M (also known as ARMv6-M) Armv6M, /// Armv7-M (also known as ARMv7-M) @@ -141,7 +146,11 @@ pub enum Arch { impl Arch { /// Decode a target string pub fn get(target: &str) -> Option { - if target.starts_with("thumbv6m-") { + if target.starts_with("armv4t-") { + Some(Arch::Armv4T) + } else if target.starts_with("armv5te-") { + Some(Arch::Armv5TE) + } else if target.starts_with("thumbv6m-") { Some(Arch::Armv6M) } else if target.starts_with("thumbv7m-") { Some(Arch::Armv7M) @@ -170,6 +179,7 @@ impl Arch { Arch::Armv6M | Arch::Armv7M | Arch::Armv7EM | Arch::Armv8MBase | Arch::Armv8MMain => { Profile::M } + Arch::Armv4T | Arch::Armv5TE => Profile::Legacy, Arch::Armv7R | Arch::Armv8R => Profile::R, Arch::Armv7A | Arch::Armv8A => Profile::A, } @@ -178,6 +188,8 @@ impl Arch { /// Get a comma-separated list of values, suitable for cfg-check pub fn values() -> String { let string_versions: Vec = [ + Arch::Armv4T, + Arch::Armv5TE, Arch::Armv6M, Arch::Armv7M, Arch::Armv7EM, @@ -201,6 +213,8 @@ impl core::fmt::Display for Arch { f, "{}", match self { + Arch::Armv4T => "v4t", + Arch::Armv5TE => "v5te", Arch::Armv6M => "v6-m", Arch::Armv7M => "v7-m", Arch::Armv7EM => "v7e-m", @@ -224,6 +238,8 @@ pub enum Profile { R, /// Applications A, + /// Legacy + Legacy, } impl Profile { @@ -235,7 +251,7 @@ impl Profile { /// Get a comma-separated list of values, suitable for cfg-check pub fn values() -> String { - let string_versions: Vec = [Profile::A, Profile::R, Profile::M] + let string_versions: Vec = [Profile::A, Profile::R, Profile::M, Profile::Legacy] .iter() .map(|i| format!(r#""{i}""#)) .collect(); @@ -252,6 +268,7 @@ impl core::fmt::Display for Profile { Profile::M => "m", Profile::R => "r", Profile::A => "a", + Profile::Legacy => "legacy", } ) }