no_std support (#232)

- Disable default features in dependencies
- Use anyhow::Error::msg to map errors. Note: anyhow will itself be removed later.
- lazy_static/spin_no_std used in no_std environments
- ensure_no_std binary is built to target  thumbv7m-none-eabi to ensure that
  there are no std dependencies.  thumbv7m-none-eabi target has no std support.
- The opa-no-std feature enables only those Regorus features that work with no_std.
- Enable tests with no_std
- Update sizes of regorus binary in  README.md
- Ensure that regorus example can be built with only std
- Ensure that regorus example can be built with no_std

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2024-05-13 09:42:35 -04:00
committed by GitHub
parent 01fc234a33
commit e86b590f91
25 changed files with 343 additions and 173 deletions
+2 -3
View File
@@ -47,7 +47,6 @@ pub fn schedule<Str: Clone + cmp::Ord + fmt::Debug>(
empty: &Str,
) -> Result<SortResult> {
let num_statements = infos.len();
let orig_infos: Vec<&StmtInfo<Str>> = infos.iter().collect();
// Mapping from each var to the list of statements that define it.
let mut defining_stmts: BTreeMap<Str, Vec<usize>> = BTreeMap::new();
@@ -198,7 +197,7 @@ pub fn schedule<Str: Clone + cmp::Ord + fmt::Debug>(
if order.len() != num_statements {
#[cfg(feature = "std")]
std::eprintln!("could not schedule all statements {order:?} {orig_infos:?}");
std::eprintln!("could not schedule all statements {order:?}");
return Ok(SortResult::Order(
(0..num_statements).map(|i| i as u16).collect(),
));
@@ -633,8 +632,8 @@ impl Analyzer {
) -> Result<(Vec<SourceStr>, Vec<Ref<Expr>>)> {
let mut used_vars = vec![];
let mut comprs = vec![];
#[cfg(feature = "deprecated")]
let full_expr = expr;
core::convert::identity(&full_expr);
traverse(expr, &mut |e| match e.as_ref() {
Var(v) if !matches!(v.0.text(), "_" | "input" | "data") => {
let name = v.0.source_str();