aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2018-08-25 18:00:58 +0200
committerGravatar Jorge Aparicio <jorge@japaric.io> 2018-08-26 23:47:02 +0200
commitc33d890dcb5a03649f07dd6c46729e7873468b40 (patch)
tree40a91c43353de645b5ca3a132f7aa061220ca9ff
parentdfd0349772763e07b16bcaa13f536bfa381044b8 (diff)
downloadcortex-m-c33d890dcb5a03649f07dd6c46729e7873468b40.tar.gz
cortex-m-c33d890dcb5a03649f07dd6c46729e7873468b40.tar.zst
cortex-m-c33d890dcb5a03649f07dd6c46729e7873468b40.zip
remove build dependency on arm-none-eabi-gcc
by shipping pre-assembled object files. This is the same approach as the one used in rust-embedded/cortex-m#95
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml42
-rw-r--r--Cargo.toml3
-rw-r--r--asm-cm7-r0p1.s27
-rw-r--r--asm-v7.s27
-rw-r--r--asm.s120
-rw-r--r--asm/basepri_max-cm7-r0p1.s12
-rw-r--r--asm/basepri_max.s5
-rw-r--r--asm/basepri_r.s5
-rw-r--r--asm/basepri_w-cm7-r0p1.s12
-rw-r--r--asm/basepri_w.s5
-rw-r--r--asm/bkpt.s5
-rw-r--r--asm/control.s5
-rw-r--r--asm/cpsid.s5
-rw-r--r--asm/cpsie.s5
-rw-r--r--asm/delay.s8
-rw-r--r--asm/dmb.s5
-rw-r--r--asm/dsb.s5
-rw-r--r--asm/faultmask.s5
-rw-r--r--asm/isb.s5
-rw-r--r--asm/msp_r.s5
-rw-r--r--asm/msp_w.s5
-rw-r--r--asm/nop.s4
-rw-r--r--asm/primask.s5
-rw-r--r--asm/psp_r.s5
-rw-r--r--asm/psp_w.s5
-rw-r--r--asm/sev.s5
-rw-r--r--asm/wfe.s5
-rw-r--r--asm/wfi.s5
-rwxr-xr-xassemble.sh24
-rw-r--r--bin/thumbv6m-none-eabi.abin0 -> 3924 bytes
-rw-r--r--bin/thumbv7em-none-eabi.abin0 -> 6096 bytes
-rw-r--r--bin/thumbv7em-none-eabihf.abin0 -> 6096 bytes
-rw-r--r--bin/thumbv7m-none-eabi.abin0 -> 5098 bytes
-rw-r--r--build.rs49
-rwxr-xr-xcheck-blobs.sh21
-rw-r--r--ci/install.sh4
-rw-r--r--ci/script.sh4
-rw-r--r--src/register/basepri.rs21
-rw-r--r--src/register/basepri_max.rs21
40 files changed, 279 insertions, 218 deletions
diff --git a/.gitignore b/.gitignore
index 1839608..9c3fcb4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,7 @@
*.rs.bk
.#*
Cargo.lock
+bin/*.after
+bin/*.before
+bin/*.o
target
diff --git a/.travis.yml b/.travis.yml
index 3086616..846370a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,76 +3,46 @@ language: rust
matrix:
include:
- env: TARGET=x86_64-unknown-linux-gnu
+ rust: stable
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv6m-none-eabi
- rust: beta
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
+ rust: stable
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv7m-none-eabi
- rust: beta
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
+ rust: stable
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv7em-none-eabi
- rust: beta
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
+ rust: stable
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv7em-none-eabihf
- rust: beta
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
+ rust: stable
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv6m-none-eabi
rust: nightly
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv7m-none-eabi
rust: nightly
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv7em-none-eabi
rust: nightly
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
- env: TARGET=thumbv7em-none-eabihf
rust: nightly
- addons:
- apt:
- packages:
- - gcc-arm-none-eabi
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
before_install: set -e
install:
- bash ci/install.sh
+ - export PATH="$PATH:$PWD/gcc/bin"
script:
- bash ci/script.sh
diff --git a/Cargo.toml b/Cargo.toml
index 9bd3c92..32d0342 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,9 +9,6 @@ name = "cortex-m"
repository = "https://github.com/japaric/cortex-m"
version = "0.5.4"
-[build-dependencies]
-cc = "1.0.10"
-
[dependencies]
aligned = "0.2.0"
bare-metal = "0.2.0"
diff --git a/asm-cm7-r0p1.s b/asm-cm7-r0p1.s
new file mode 100644
index 0000000..a9ebf4a
--- /dev/null
+++ b/asm-cm7-r0p1.s
@@ -0,0 +1,27 @@
+ .section .text.__basepri_max_cm7_r0p1
+ .global __basepri_max_cm7_r0p1
+ .syntax unified
+ .thumb_func
+__basepri_max_cm7_r0p1:
+ mrs r1, PRIMASK
+ cpsid i
+ tst.w r1, #1
+ msr BASEPRI_MAX, r0
+ it ne
+ bxne lr
+ cpsie i
+ bx lr
+
+ .section .text.__basepri_w_cm7_r0p1
+ .global __basepri_w_cm7_r0p1
+ .syntax unified
+ .thumb_func
+__basepri_w_cm7_r0p1:
+ mrs r1, PRIMASK
+ cpsid i
+ tst.w r1, #1
+ msr BASEPRI, r0
+ it ne
+ bxne lr
+ cpsie i
+ bx lr
diff --git a/asm-v7.s b/asm-v7.s
new file mode 100644
index 0000000..c4c6dfb
--- /dev/null
+++ b/asm-v7.s
@@ -0,0 +1,27 @@
+ .section .text.__basepri_max
+ .global __basepri_max
+ .thumb_func
+__basepri_max:
+ msr BASEPRI_MAX, r0
+ bx lr
+
+ .section .text.__basepri_r
+ .global __basepri_r
+ .thumb_func
+__basepri_r:
+ mrs r0, BASEPRI
+ bx lr
+
+ .section .text.__basepri_w
+ .global __basepri_w
+ .thumb_func
+__basepri_w:
+ msr BASEPRI, r0
+ bx lr
+
+ .section .text.__faultmask
+ .global __faultmask
+ .thumb_func
+__faultmask:
+ mrs r0, FAULTMASK
+ bx lr
diff --git a/asm.s b/asm.s
new file mode 100644
index 0000000..bf2fd46
--- /dev/null
+++ b/asm.s
@@ -0,0 +1,120 @@
+ .section .text.__bkpt
+ .global __bkpt
+ .thumb_func
+__bkpt:
+ bkpt
+ bx lr
+
+ .section .text.__control
+ .global __control
+ .thumb_func
+__control:
+ mrs r0, CONTROL
+ bx lr
+
+ .section .text.__cpsid
+ .global __cpsid
+ .thumb_func
+__cpsid:
+ cpsid i
+ bx lr
+
+ .section .text.__cpsie
+ .global __cpsie
+ .thumb_func
+__cpsie:
+ cpsie i
+ bx lr
+
+ .section .text.__delay
+ .global __delay
+ .syntax unified
+ .thumb_func
+__delay:
+ nop
+ subs r0, #1
+ bne __delay
+ bx lr
+
+ .section .text.__dmb
+ .global __dmb
+ .thumb_func
+__dmb:
+ dmb 0xF
+ bx lr
+
+ .section .text.__dsb
+ .global __dsb
+ .thumb_func
+__dsb:
+ dsb 0xF
+ bx lr
+
+ .section .text.__isb
+ .global __isb
+ .thumb_func
+__isb:
+ isb 0xF
+ bx lr
+
+ .section .text.__msp_r
+ .global __msp_r
+ .thumb_func
+__msp_r:
+ mrs r0, MSP
+ bx lr
+
+ .section .text.__msp_w
+ .global __msp_w
+ .thumb_func
+__msp_w:
+ msr MSP, r0
+ bx lr
+
+ .section .text.__nop
+ .global __nop
+ .thumb_func
+__nop:
+ bx lr
+
+ .section .text.__primask
+ .global __primask
+ .thumb_func
+__primask:
+ mrs r0, PRIMASK
+ bx lr
+
+ .section .text.__psp_r
+ .global __psp_r
+ .thumb_func
+__psp_r:
+ mrs r0, PSP
+ bx lr
+
+ .section .text.__psp_w
+ .global __psp_w
+ .thumb_func
+__psp_w:
+ msr PSP, r0
+ bx lr
+
+ .section .text.__sev
+ .global __sev
+ .thumb_func
+__sev:
+ sev
+ bx lr
+
+ .section .text.__wfe
+ .global __wfe
+ .thumb_func
+__wfe:
+ wfe
+ bx lr
+
+ .section .text.__wfi
+ .global __wfi
+ .thumb_func
+__wfi:
+ wfi
+ bx lr
diff --git a/asm/basepri_max-cm7-r0p1.s b/asm/basepri_max-cm7-r0p1.s
deleted file mode 100644
index 57cbe0c..0000000
--- a/asm/basepri_max-cm7-r0p1.s
+++ /dev/null
@@ -1,12 +0,0 @@
- .global __basepri_max
- .syntax unified
- .thumb_func
-__basepri_max:
- mrs r1, PRIMASK
- cpsid i
- tst.w r1, #1
- msr BASEPRI_MAX, r0
- it ne
- bxne lr
- cpsie i
- bx lr
diff --git a/asm/basepri_max.s b/asm/basepri_max.s
deleted file mode 100644
index 32bef7c..0000000
--- a/asm/basepri_max.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __basepri_max
- .thumb_func
-__basepri_max:
- msr BASEPRI_MAX, r0
- bx lr
diff --git a/asm/basepri_r.s b/asm/basepri_r.s
deleted file mode 100644
index 971b152..0000000
--- a/asm/basepri_r.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __basepri_r
- .thumb_func
-__basepri_r:
- mrs r0, BASEPRI
- bx lr
diff --git a/asm/basepri_w-cm7-r0p1.s b/asm/basepri_w-cm7-r0p1.s
deleted file mode 100644
index 4f74f57..0000000
--- a/asm/basepri_w-cm7-r0p1.s
+++ /dev/null
@@ -1,12 +0,0 @@
- .global __basepri_w
- .syntax unified
- .thumb_func
-__basepri_w:
- mrs r1, PRIMASK
- cpsid i
- tst.w r1, #1
- msr BASEPRI, r0
- it ne
- bxne lr
- cpsie i
- bx lr
diff --git a/asm/basepri_w.s b/asm/basepri_w.s
deleted file mode 100644
index 323d42d..0000000
--- a/asm/basepri_w.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __basepri_w
- .thumb_func
-__basepri_w:
- msr BASEPRI, r0
- bx lr
diff --git a/asm/bkpt.s b/asm/bkpt.s
deleted file mode 100644
index 5789899..0000000
--- a/asm/bkpt.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __bkpt
- .thumb_func
-__bkpt:
- bkpt
- bx lr
diff --git a/asm/control.s b/asm/control.s
deleted file mode 100644
index ae1ac7e..0000000
--- a/asm/control.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __control
- .thumb_func
-__control:
- mrs r0, CONTROL
- bx lr
diff --git a/asm/cpsid.s b/asm/cpsid.s
deleted file mode 100644
index c52408a..0000000
--- a/asm/cpsid.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __cpsid
- .thumb_func
-__cpsid:
- cpsid i
- bx lr
diff --git a/asm/cpsie.s b/asm/cpsie.s
deleted file mode 100644
index 22556ff..0000000
--- a/asm/cpsie.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __cpsie
- .thumb_func
-__cpsie:
- cpsie i
- bx lr
diff --git a/asm/delay.s b/asm/delay.s
deleted file mode 100644
index 2bf92f1..0000000
--- a/asm/delay.s
+++ /dev/null
@@ -1,8 +0,0 @@
- .global __delay
- .syntax unified
- .thumb_func
-__delay:
- nop
- subs r0, #1
- bne __delay
- bx lr
diff --git a/asm/dmb.s b/asm/dmb.s
deleted file mode 100644
index c8cc6af..0000000
--- a/asm/dmb.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __dmb
- .thumb_func
-__dmb:
- dmb 0xF
- bx lr
diff --git a/asm/dsb.s b/asm/dsb.s
deleted file mode 100644
index f4578e9..0000000
--- a/asm/dsb.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __dsb
- .thumb_func
-__dsb:
- dsb 0xF
- bx lr
diff --git a/asm/faultmask.s b/asm/faultmask.s
deleted file mode 100644
index 1db599f..0000000
--- a/asm/faultmask.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __faultmask
- .thumb_func
-__faultmask:
- mrs r0, FAULTMASK
- bx lr
diff --git a/asm/isb.s b/asm/isb.s
deleted file mode 100644
index f48eb86..0000000
--- a/asm/isb.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __isb
- .thumb_func
-__isb:
- isb 0xF
- bx lr
diff --git a/asm/msp_r.s b/asm/msp_r.s
deleted file mode 100644
index 920bac2..0000000
--- a/asm/msp_r.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __msp_r
- .thumb_func
-__msp_r:
- mrs r0, MSP
- bx lr
diff --git a/asm/msp_w.s b/asm/msp_w.s
deleted file mode 100644
index b4b6c3e..0000000
--- a/asm/msp_w.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __msp_w
- .thumb_func
-__msp_w:
- msr MSP, r0
- bx lr
diff --git a/asm/nop.s b/asm/nop.s
deleted file mode 100644
index 36e8273..0000000
--- a/asm/nop.s
+++ /dev/null
@@ -1,4 +0,0 @@
- .global __nop
- .thumb_func
-__nop:
- bx lr
diff --git a/asm/primask.s b/asm/primask.s
deleted file mode 100644
index 9735008..0000000
--- a/asm/primask.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __primask
- .thumb_func
-__primask:
- mrs r0, PRIMASK
- bx lr
diff --git a/asm/psp_r.s b/asm/psp_r.s
deleted file mode 100644
index ea093b3..0000000
--- a/asm/psp_r.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __psp_r
- .thumb_func
-__psp_r:
- mrs r0, PSP
- bx lr
diff --git a/asm/psp_w.s b/asm/psp_w.s
deleted file mode 100644
index dee5a79..0000000
--- a/asm/psp_w.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __psp_w
- .thumb_func
-__psp_w:
- msr PSP, r0
- bx lr
diff --git a/asm/sev.s b/asm/sev.s
deleted file mode 100644
index d924c6e..0000000
--- a/asm/sev.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __sev
- .thumb_func
-__sev:
- sev
- bx lr
diff --git a/asm/wfe.s b/asm/wfe.s
deleted file mode 100644
index 35eb1ed..0000000
--- a/asm/wfe.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __wfe
- .thumb_func
-__wfe:
- wfe
- bx lr
diff --git a/asm/wfi.s b/asm/wfi.s
deleted file mode 100644
index d7c2152..0000000
--- a/asm/wfi.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global __wfi
- .thumb_func
-__wfi:
- wfi
- bx lr
diff --git a/assemble.sh b/assemble.sh
new file mode 100755
index 0000000..b0a4b3e
--- /dev/null
+++ b/assemble.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -euxo pipefail
+
+# cflags taken from cc 1.0.22
+
+crate=cortex-m
+
+arm-none-eabi-as -march=armv6s-m asm.s -o bin/$crate.o
+ar crs bin/thumbv6m-none-eabi.a bin/$crate.o
+
+arm-none-eabi-as -march=armv7-m asm.s -o bin/$crate.o
+arm-none-eabi-as -march=armv7-m asm-v7.s -o bin/$crate-v7.o
+ar crs bin/thumbv7m-none-eabi.a bin/$crate.o bin/$crate-v7.o
+
+arm-none-eabi-as -march=armv7e-m asm.s -o bin/$crate.o
+arm-none-eabi-as -march=armv7e-m asm-v7.s -o bin/$crate-v7.o
+arm-none-eabi-as -march=armv7e-m asm-cm7-r0p1.s -o bin/$crate-cm7-r0p1.o
+ar crs bin/thumbv7em-none-eabi.a bin/$crate.o bin/$crate-v7.o bin/$crate-cm7-r0p1.o
+ar crs bin/thumbv7em-none-eabihf.a bin/$crate.o bin/$crate-v7.o bin/$crate-cm7-r0p1.o
+
+rm bin/$crate.o
+rm bin/$crate-v7.o
+rm bin/$crate-cm7-r0p1.o
diff --git a/bin/thumbv6m-none-eabi.a b/bin/thumbv6m-none-eabi.a
new file mode 100644
index 0000000..0aa131e
--- /dev/null
+++ b/bin/thumbv6m-none-eabi.a
Binary files differ
diff --git a/bin/thumbv7em-none-eabi.a b/bin/thumbv7em-none-eabi.a
new file mode 100644
index 0000000..91bd58a
--- /dev/null
+++ b/bin/thumbv7em-none-eabi.a
Binary files differ
diff --git a/bin/thumbv7em-none-eabihf.a b/bin/thumbv7em-none-eabihf.a
new file mode 100644
index 0000000..91bd58a
--- /dev/null
+++ b/bin/thumbv7em-none-eabihf.a
Binary files differ
diff --git a/bin/thumbv7m-none-eabi.a b/bin/thumbv7m-none-eabi.a
new file mode 100644
index 0000000..5396940
--- /dev/null
+++ b/bin/thumbv7m-none-eabi.a
Binary files differ
diff --git a/build.rs b/build.rs
index e3797a7..6d08ba9 100644
--- a/build.rs
+++ b/build.rs
@@ -1,48 +1,19 @@
-extern crate cc;
-
-use std::env;
+use std::path::PathBuf;
+use std::{env, fs};
fn main() {
let target = env::var("TARGET").unwrap();
-
- let is_v6 = target.starts_with("thumbv6m-");
+ let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
+ let name = env::var("CARGO_PKG_NAME").unwrap();
if target.starts_with("thumb") && env::var_os("CARGO_FEATURE_INLINE_ASM").is_none() {
- // NOTE we need to place each routine in a separate assembly file or the linker won't be
- // able to discard the unused routines
- let mut build = cc::Build::new();
- build
- .file("asm/bkpt.s")
- .file("asm/control.s")
- .file("asm/cpsid.s")
- .file("asm/cpsie.s")
- .file("asm/delay.s")
- .file("asm/dmb.s")
- .file("asm/dsb.s")
- .file("asm/isb.s")
- .file("asm/msp_r.s")
- .file("asm/msp_w.s")
- .file("asm/nop.s")
- .file("asm/primask.s")
- .file("asm/psp_r.s")
- .file("asm/psp_w.s")
- .file("asm/sev.s")
- .file("asm/wfe.s")
- .file("asm/wfi.s");
-
- if !is_v6 {
- build.file("asm/basepri_r.s").file("asm/faultmask.s");
-
- if env::var_os("CARGO_FEATURE_CM7_R0P1").is_some() {
- build.file("asm/basepri_max-cm7-r0p1.s");
- build.file("asm/basepri_w-cm7-r0p1.s");
- } else {
- build.file("asm/basepri_max.s");
- build.file("asm/basepri_w.s");
- }
- }
+ fs::copy(
+ format!("bin/{}.a", target),
+ out_dir.join(format!("lib{}.a", name)),
+ ).unwrap();
- build.compile("asm");
+ println!("cargo:rustc-link-lib=static={}", name);
+ println!("cargo:rustc-link-search={}", out_dir.display());
}
if target.starts_with("thumbv6m-") {
diff --git a/check-blobs.sh b/check-blobs.sh
new file mode 100755
index 0000000..94fde42
--- /dev/null
+++ b/check-blobs.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Checks that the blobs are up to date with the committed assembly files
+
+set -euxo pipefail
+
+for lib in $(ls bin/*.a); do
+ filename=$(basename $lib)
+ arm-none-eabi-objdump -Cd $lib > bin/${filename%.a}.before
+done
+
+./assemble.sh
+
+for lib in $(ls bin/*.a); do
+ filename=$(basename $lib)
+ arm-none-eabi-objdump -Cd $lib > bin/${filename%.a}.after
+done
+
+for cksum in $(ls bin/*.after); do
+ diff -u $cksum ${cksum%.after}.before
+done
diff --git a/ci/install.sh b/ci/install.sh
index a0cbf43..495e51d 100644
--- a/ci/install.sh
+++ b/ci/install.sh
@@ -6,6 +6,10 @@ main() {
rustup target add $TARGET
;;
esac
+
+ mkdir gcc
+
+ curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update | tar --strip-components=1 -C gcc -xj
}
# NOTE(TRAVIS_BRANCH) Travis is configured to only build *pushes* (not PRs)
diff --git a/ci/script.sh b/ci/script.sh
index 9fd46a3..b088d95 100644
--- a/ci/script.sh
+++ b/ci/script.sh
@@ -23,6 +23,10 @@ main() {
cargo test --target $TARGET
;;
esac
+
+ if [ $TARGET = x86_64-unknown-linux-gnu ]; then
+ ./check-blobs.sh
+ fi
}
# NOTE See the NOTE in `install.sh`
diff --git a/src/register/basepri.rs b/src/register/basepri.rs
index c9f09cc..a9cd6ef 100644
--- a/src/register/basepri.rs
+++ b/src/register/basepri.rs
@@ -45,13 +45,24 @@ pub unsafe fn write(_basepri: u8) {
},
#[cfg(all(cortex_m, not(feature = "inline-asm")))]
- () => {
- extern "C" {
- fn __basepri_w(_: u8);
+ () => match () {
+ #[cfg(not(feature = "cm7-r0p1"))]
+ () => {
+ extern "C" {
+ fn __basepri_w(_: u8);
+ }
+
+ __basepri_w(_basepri);
}
+ #[cfg(feature = "cm7-r0p1")]
+ () => {
+ extern "C" {
+ fn __basepri_w_cm7_r0p1(_: u8);
+ }
- __basepri_w(_basepri);
- }
+ __basepri_w_cm7_r0p1(_basepri);
+ }
+ },
#[cfg(not(cortex_m))]
() => unimplemented!(),
diff --git a/src/register/basepri_max.rs b/src/register/basepri_max.rs
index 91698b6..59ddb44 100644
--- a/src/register/basepri_max.rs
+++ b/src/register/basepri_max.rs
@@ -24,11 +24,24 @@ pub fn write(_basepri: u8) {
#[cfg(all(cortex_m, not(feature = "inline-asm")))]
() => unsafe {
- extern "C" {
- fn __basepri_max(_: u8);
- }
+ match () {
+ #[cfg(not(feature = "cm7-r0p1"))]
+ () => {
+ extern "C" {
+ fn __basepri_max(_: u8);
+ }
- __basepri_max(_basepri)
+ __basepri_max(_basepri)
+ }
+ #[cfg(feature = "cm7-r0p1")]
+ () => {
+ extern "C" {
+ fn __basepri_max_cm7_r0p1(_: u8);
+ }
+
+ __basepri_max_cm7_r0p1(_basepri)
+ }
+ }
},
#[cfg(not(cortex_m))]