diff options
author | 2020-07-12 15:36:23 -0300 | |
---|---|---|
committer | 2020-07-12 15:37:52 -0300 | |
commit | cdc02c64d92bb7fdc8efb5e66c67f90c1dc8ec94 (patch) | |
tree | 3ac62820ab4ee3d0c27078351670165f140e6e71 | |
parent | fbcfff1a47cdba9c137d8b752f127f8efbfe7373 (diff) | |
download | cortex-m-cdc02c64d92bb7fdc8efb5e66c67f90c1dc8ec94.tar.gz cortex-m-cdc02c64d92bb7fdc8efb5e66c67f90c1dc8ec94.tar.zst cortex-m-cdc02c64d92bb7fdc8efb5e66c67f90c1dc8ec94.zip |
Add barriers after FPU enabling
Diffstat (limited to '')
-rw-r--r-- | cortex-m-rt/Cargo.toml | 2 | ||||
-rw-r--r-- | cortex-m-rt/src/lib.rs | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml index f8f8342..1a62ab6 100644 --- a/cortex-m-rt/Cargo.toml +++ b/cortex-m-rt/Cargo.toml @@ -19,9 +19,9 @@ links = "cortex-m-rt" # Prevent multiple versions of cortex-m-rt being linked [dependencies] r0 = "1.0" cortex-m-rt-macros = { path = "macros", version = "=0.6.11" } +cortex-m = "0.6" [dev-dependencies] -cortex-m = "0.6" panic-halt = "0.2.0" cortex-m-semihosting = "0.3" diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index ba50572..47bc1f7 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -916,12 +916,12 @@ pub unsafe extern "C" fn Reset() -> ! { r0::zero_bss(&mut __sbss, &mut __ebss); r0::init_data(&mut __sdata, &mut __edata, &__sidata); + #[allow(clippy::match_single_binding)] match () { #[cfg(not(has_fpu))] () => main(), #[cfg(has_fpu)] () => { - // We redefine these here to avoid pulling the `cortex-m` crate as a dependency const SCB_CPACR: *mut u32 = 0xE000_ED88 as *mut u32; const SCB_CPACR_FPU_ENABLE: u32 = 0b01_01 << 20; const SCB_CPACR_FPU_USER: u32 = 0b10_10 << 20; @@ -932,6 +932,9 @@ pub unsafe extern "C" fn Reset() -> ! { *SCB_CPACR | SCB_CPACR_FPU_ENABLE | SCB_CPACR_FPU_USER, ); + cortex_m::asm::dsb(); + cortex_m::asm::isb(); + // this is used to prevent the compiler from inlining the user `main` into the reset // handler. Inlining can cause the FPU instructions in the user `main` to be executed // before enabling the FPU, and that would produce a hard to diagnose hard fault at |