Skip to content

Commit 2fda3af

Browse files
committed
Adds ARMv6 targets.
Targets added in rust-lang/rust#150138. Tested with local build of rustc. Will fail with the versions of nightly rust specified in the CI config. Need to wait for 2025-01-26 to come out.
1 parent 15d2330 commit 2fda3af

43 files changed

Lines changed: 1046 additions & 12 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ runner = "qemu-system-arm -machine versatileab -cpu cortex-a8 -semihosting -nogr
3434
[target.thumbv7a-none-eabi]
3535
runner = "qemu-system-arm -machine versatileab -cpu cortex-a8 -semihosting -nographic -audio none -kernel"
3636

37+
[target.armv6-none-eabihf]
38+
runner = "qemu-system-arm -machine versatileab -cpu arm1176 -semihosting -nographic -audio none -kernel"
39+
40+
[target.armv6-none-eabi]
41+
runner = "qemu-system-arm -machine versatileab -cpu arm1176 -semihosting -nographic -audio none -kernel"
42+
43+
[target.thumbv6-none-eabi]
44+
runner = "qemu-system-arm -machine versatileab -cpu arm1176 -semihosting -nographic -audio none -kernel"
45+
3746
[target.armv5te-none-eabi]
3847
runner = "qemu-system-arm -machine versatileab -cpu arm926 -semihosting -nographic -audio none -kernel"
3948

aarch32-cpu/src/register/cpsr.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ impl Cpsr {
7575
/// `thumb*` targets, as Thumb-1 cannot do an MRS.
7676
#[cfg_attr(not(feature = "check-asm"), inline)]
7777
#[cfg_attr(
78-
any(arm_architecture = "v4t", arm_architecture = "v5te"),
78+
any(
79+
arm_architecture = "v4t",
80+
arm_architecture = "v5te",
81+
arm_architecture = "v6"
82+
),
7983
instruction_set(arm::a32)
8084
)]
8185
pub fn read() -> Self {
@@ -108,7 +112,11 @@ impl Cpsr {
108112
/// `thumb*` targets, as Thumb-1 cannot do an MSR.
109113
#[cfg_attr(not(feature = "check-asm"), inline)]
110114
#[cfg_attr(
111-
any(arm_architecture = "v4t", arm_architecture = "v5te"),
115+
any(
116+
arm_architecture = "v4t",
117+
arm_architecture = "v5te",
118+
arm_architecture = "v6"
119+
),
112120
instruction_set(arm::a32)
113121
)]
114122
pub unsafe fn write(_value: Self) {

aarch32-cpu/src/register/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ pub trait SysRegRead: SysReg {
225225
/// may have side-effects.
226226
#[cfg_attr(not(feature = "check-asm"), inline)]
227227
#[cfg_attr(
228-
any(arm_architecture = "v4t", arm_architecture = "v5te"),
228+
any(
229+
arm_architecture = "v4t",
230+
arm_architecture = "v5te",
231+
arm_architecture = "v6"
232+
),
229233
instruction_set(arm::a32)
230234
)]
231235
unsafe fn read_raw() -> u32 {
@@ -261,7 +265,11 @@ pub trait SysRegWrite: SysReg {
261265
/// writing valid data here.
262266
#[cfg_attr(not(feature = "check-asm"), inline)]
263267
#[cfg_attr(
264-
any(arm_architecture = "v4t", arm_architecture = "v5te"),
268+
any(
269+
arm_architecture = "v4t",
270+
arm_architecture = "v5te",
271+
arm_architecture = "v6"
272+
),
265273
instruction_set(arm::a32)
266274
)]
267275
unsafe fn write_raw(_value: u32) {

arm-targets/src/lib.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ impl Arch {
227227
Some(Arch::Armv7A)
228228
} else if target.starts_with("aarch64-") || target.starts_with("aarch64be-") {
229229
Some(Arch::Armv8A)
230-
} else if target.starts_with("arm-") {
230+
} else if target.starts_with("arm-")
231+
|| target.starts_with("armv6-")
232+
|| target.starts_with("thumbv6-")
233+
{
231234
// If not specified, assume Armv6
232235
Some(Arch::Armv6)
233236
} else {
@@ -407,6 +410,26 @@ mod test {
407410
assert_eq!(target_info.abi(), Some(Abi::Eabi));
408411
}
409412

413+
#[test]
414+
fn armv6_none_eabi() {
415+
let target = "armv6-none-eabi";
416+
let target_info = process_target(target);
417+
assert_eq!(target_info.isa(), Some(Isa::A32));
418+
assert_eq!(target_info.arch(), Some(Arch::Armv6));
419+
assert_eq!(target_info.profile(), Some(Profile::Legacy));
420+
assert_eq!(target_info.abi(), Some(Abi::Eabi));
421+
}
422+
423+
#[test]
424+
fn armv6_none_eabihf() {
425+
let target = "armv6-none-eabihf";
426+
let target_info = process_target(target);
427+
assert_eq!(target_info.isa(), Some(Isa::A32));
428+
assert_eq!(target_info.arch(), Some(Arch::Armv6));
429+
assert_eq!(target_info.profile(), Some(Profile::Legacy));
430+
assert_eq!(target_info.abi(), Some(Abi::EabiHf));
431+
}
432+
410433
#[test]
411434
fn arm_unknown_linux_gnueabi() {
412435
let target = "arm-unknown-linux-gnueabi";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hello, this is an data abort exception example
2+
data abort occurred
3+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
4+
DFSR Status: Ok(AlignmentFault)
5+
caught unaligned_from_a32
6+
caught fault on COUNTER
7+
Doing it again
8+
data abort occurred
9+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
10+
DFSR Status: Ok(AlignmentFault)
11+
caught unaligned_from_a32
12+
caught fault on COUNTER
13+
Skipping instruction
14+
Recovered from fault OK!
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hello, this is an data abort exception example
2+
data abort occurred
3+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
4+
DFSR Status: Ok(AlignmentFault)
5+
caught unaligned_from_a32
6+
caught fault on COUNTER
7+
Doing it again
8+
data abort occurred
9+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
10+
DFSR Status: Ok(AlignmentFault)
11+
caught unaligned_from_a32
12+
caught fault on COUNTER
13+
Skipping instruction
14+
Recovered from fault OK!
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hello, this is an data abort exception example
2+
data abort occurred
3+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
4+
DFSR Status: Ok(AlignmentFault)
5+
caught unaligned_from_a32
6+
caught fault on COUNTER
7+
Doing it again
8+
data abort occurred
9+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
10+
DFSR Status: Ok(AlignmentFault)
11+
caught unaligned_from_a32
12+
caught fault on COUNTER
13+
Skipping instruction
14+
Recovered from fault OK!
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hello, this is an data abort exception example
2+
data abort occurred
3+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
4+
DFSR Status: Ok(AlignmentFault)
5+
caught unaligned_from_t32
6+
caught fault on COUNTER
7+
Doing it again
8+
data abort occurred
9+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
10+
DFSR Status: Ok(AlignmentFault)
11+
caught unaligned_from_t32
12+
caught fault on COUNTER
13+
Skipping instruction
14+
Recovered from fault OK!
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hello, this is an data abort exception example
2+
data abort occurred
3+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
4+
DFSR Status: Ok(AlignmentFault)
5+
caught unaligned_from_t32
6+
caught fault on COUNTER
7+
Doing it again
8+
data abort occurred
9+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
10+
DFSR Status: Ok(AlignmentFault)
11+
caught unaligned_from_t32
12+
caught fault on COUNTER
13+
Skipping instruction
14+
Recovered from fault OK!
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hello, this is an data abort exception example
2+
data abort occurred
3+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
4+
DFSR Status: Ok(AlignmentFault)
5+
caught unaligned_from_t32
6+
caught fault on COUNTER
7+
Doing it again
8+
data abort occurred
9+
DFSR (Fault Status Register): DFSR { ext=false wnr=false Domain=0b0000 Status=0b00001 }
10+
DFSR Status: Ok(AlignmentFault)
11+
caught unaligned_from_t32
12+
caught fault on COUNTER
13+
Skipping instruction
14+
Recovered from fault OK!

0 commit comments

Comments
 (0)