From 2bbfd8c976fed21e24865618b0a9975d9ab542c4 Mon Sep 17 00:00:00 2001 From: Hugues de Valon Date: Tue, 14 Jan 2020 11:38:34 +0000 Subject: Initial Rust CMSE support Armv8-M and Armv8.1-M architecture profiles have an optional Security Extension which provides a set of Security features. This patch adds initial support of the Cortex-M Security Extensions but providing support for the TT intrinsics and helper functions on top of it in the newly added cmse module of this crate. The code is a Rust idiomatic implementation of the C requirements described in this document: https://developer.arm.com/docs/ecm0359818/latest Signed-off-by: Hugues de Valon --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index f8b5606..beaecd2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,6 +57,8 @@ extern crate volatile_register; mod macros; pub mod asm; +#[cfg(armv8m)] +pub mod cmse; pub mod interrupt; #[cfg(not(armv6m))] pub mod itm; -- cgit v1.2.3 From 2433d85190dad9e4cbaa4086eba796ab59bf0adb Mon Sep 17 00:00:00 2001 From: Hugues de Valon Date: Sat, 14 Mar 2020 10:57:52 +0000 Subject: Allow clippy::match_single_binding Clippy complains that the match expressions used for cfg gating could be rewritten as a let statement, this is a false positive. Also adds inline on two functions. Signed-off-by: Hugues de Valon --- src/lib.rs | 2 ++ src/peripheral/scb.rs | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index beaecd2..276551c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,6 +34,8 @@ #![no_std] #![allow(clippy::identity_op)] #![allow(clippy::missing_safety_doc)] +// Prevent clippy from complaining about empty match expression that are used for cfg gating. +#![allow(clippy::match_single_binding)] // This makes clippy warn about public functions which are not #[inline]. // diff --git a/src/peripheral/scb.rs b/src/peripheral/scb.rs index dc82dc7..dfcc729 100644 --- a/src/peripheral/scb.rs +++ b/src/peripheral/scb.rs @@ -713,6 +713,7 @@ impl SCB { /// /// Cleaning the cache causes whatever data is present in the cache to be immediately written /// to main memory, overwriting whatever was in main memory. + #[inline] pub fn clean_dcache_by_ref(&mut self, obj: &T) { self.clean_dcache_by_address(obj as *const T as usize, core::mem::size_of::()); } @@ -729,6 +730,7 @@ impl SCB { /// /// Cleaning the cache causes whatever data is present in the cache to be immediately written /// to main memory, overwriting whatever was in main memory. + #[inline] pub fn clean_dcache_by_slice(&mut self, slice: &[T]) { self.clean_dcache_by_address(slice.as_ptr() as usize, slice.len() * core::mem::size_of::()); -- cgit v1.2.3