diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 4250bdde9019b4f73b6dff0107eccaf44a24a2f8..c81d405dcde19a226273819fc97ae1fc8e6b1f17 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -28,9 +28,21 @@ ] }, { - "label": "xargo build --example nested --features wcet_bkpt", + "label": "xargo build --release --example nested", "type": "shell", - "command": "xargo build --features \"wcet_bkpt\" --example nested ", + "command": "xargo build --release --example nested", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [ + "$rustc" + ] + }, + { + "label": "xargo build --release --example nested --features wcet_nop", + "type": "shell", + "command": "xargo build --release --features \"wcet_nop\" --example nested ", "group": { "kind": "build", "isDefault": true diff --git a/Cargo.toml b/Cargo.toml index 0184c0eb5da833e9198caa3831835c37c9f4415c..0853def083cf88c0e1d15e85856d77ac2700ead8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ version = "0.1.0" [features] wcet_bkpt = [] +wcet_nop = [] [profile.release] lto = true diff --git a/src/lib.rs b/src/lib.rs index b62bac37b21c77df15804aedcd6d714bd042779f..abc2557aa69c59028f9e3c81991c206568f3d753 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -140,11 +140,13 @@ where let old = basepri::read(); let hw = (max_priority - ceiling) << (8 - _nvic_prio_bits); basepri::write(hw); - if cfg!(feature = "wcet_bkpt") {bkpt();} else {nop();} - + if cfg!(feature = "wcet_bkpt") { bkpt(); } + if cfg!(feature = "wcet_nop") { nop(); } let ret = f(data, &mut Threshold::new(ceiling)); - if cfg!(feature = "wcet_bkpt") {bkpt();} else {nop();} + + if cfg!(feature = "wcet_bkpt") { bkpt(); } + if cfg!(feature = "wcet_nop") { nop(); } basepri::write(old); ret }