From 1183f0960913326f1f54aed6464e6f63e22a1a4b Mon Sep 17 00:00:00 2001 From: Per <Per Lindgren> Date: Fri, 17 Nov 2017 22:20:57 +0100 Subject: [PATCH] wcet_nop --- .vscode/tasks.json | 16 ++++++++++++++-- Cargo.toml | 1 + src/lib.rs | 8 +++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 4250bdd..c81d405 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 0184c0e..0853def 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 b62bac3..abc2557 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 } -- GitLab