From bf17ee7422d4ebf55b6eeafea6f6a74cabe2441a Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 14 Apr 2017 00:15:49 -0500 Subject: [PATCH] pass P0 to init, derive GreaterThanOrEqual for U0 --- build.rs | 4 ++-- src/lib.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index 2879705f80..d31301f5af 100644 --- a/build.rs +++ b/build.rs @@ -76,8 +76,8 @@ fn main() { } // GreaterThanOrEqual - for i in 1..(1 << bits) + 1 { - for j in 1..(i + 1) { + for i in 0..(1 << bits) + 1 { + for j in 0..(i + 1) { let i = Ident::new(format!("U{}", i)); let j = Ident::new(format!("U{}", j)); diff --git a/src/lib.rs b/src/lib.rs index 4c94019a6b..39144740a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -364,12 +364,14 @@ macro_rules! tasks { }) => { fn main() { $crate::critical(|cmax| { - init(cmax); + let p0 = unsafe { ::core::ptr::read(0x0 as *const P0) }; + init(p0, cmax); set_priorities(); enable_tasks(); }); - idle(unsafe { ::core::ptr::read(0x0 as *const P0) }); + let p0 = unsafe { ::core::ptr::read(0x0 as *const P0) }; + idle(p0); fn set_priorities() { // NOTE(safe) this function runs in an interrupt free context