diff --git a/Cargo.lock b/Cargo.lock index 7374bd3cb9..1ff08cfdf1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4299,6 +4299,7 @@ dependencies = [ "build-util", "cfg-if", "cortex-m", + "counters", "hubpack", "hubris-num-tasks", "humpty", diff --git a/app/demo-stm32g0-nucleo/app-g031.toml b/app/demo-stm32g0-nucleo/app-g031.toml index 26e3e54f5b..3b7909158d 100644 --- a/app/demo-stm32g0-nucleo/app-g031.toml +++ b/app/demo-stm32g0-nucleo/app-g031.toml @@ -6,14 +6,14 @@ board = "stm32g031-nucleo" [kernel] name = "demo-stm32g0-nucleo" -requires = {flash = 10752, ram = 1296} +requires = {flash = 10852, ram = 1296} features = ["g031"] stacksize = 640 [tasks.jefe] name = "task-jefe" priority = 0 -max-sizes = {flash = 4096, ram = 512} +max-sizes = {flash = 4128, ram = 512} start = true stacksize = 368 notifications = ["fault", "timer"] diff --git a/app/demo-stm32g0-nucleo/app-g070-mini.toml b/app/demo-stm32g0-nucleo/app-g070-mini.toml index 537061df86..bbeac76209 100644 --- a/app/demo-stm32g0-nucleo/app-g070-mini.toml +++ b/app/demo-stm32g0-nucleo/app-g070-mini.toml @@ -19,7 +19,7 @@ size = 256 [tasks.jefe] name = "task-jefe" priority = 0 -max-sizes = {flash = 4096, ram = 512} +max-sizes = {flash = 4128, ram = 512} start = true stacksize = 352 notifications = ["fault", "timer"] diff --git a/app/demo-stm32g0-nucleo/app-g070.toml b/app/demo-stm32g0-nucleo/app-g070.toml index 19db4f661e..7e25e9be9a 100644 --- a/app/demo-stm32g0-nucleo/app-g070.toml +++ b/app/demo-stm32g0-nucleo/app-g070.toml @@ -14,7 +14,7 @@ stacksize = 640 [tasks.jefe] name = "task-jefe" priority = 0 -max-sizes = {flash = 4096, ram = 512} +max-sizes = {flash = 4128, ram = 512} start = true stacksize = 352 notifications = ["fault", "timer"] diff --git a/app/donglet/app-g031-i2c.toml b/app/donglet/app-g031-i2c.toml index f8ada12456..2a1eb4b15d 100644 --- a/app/donglet/app-g031-i2c.toml +++ b/app/donglet/app-g031-i2c.toml @@ -13,7 +13,7 @@ stacksize = 936 [tasks.jefe] name = "task-jefe" priority = 0 -max-sizes = {flash = 4096, ram = 512} +max-sizes = {flash = 4128, ram = 512} start = true stacksize = 368 notifications = ["fault", "timer"] @@ -111,4 +111,3 @@ device = "tmp117" description = "TempSense" sensors = { temperature = 1 } removable = true - diff --git a/app/donglet/app-g031.toml b/app/donglet/app-g031.toml index d0e902dbca..e98f8af5c0 100644 --- a/app/donglet/app-g031.toml +++ b/app/donglet/app-g031.toml @@ -13,7 +13,7 @@ stacksize = 936 [tasks.jefe] name = "task-jefe" priority = 0 -max-sizes = {flash = 4096, ram = 512} +max-sizes = {flash = 4128, ram = 512} start = true stacksize = 368 notifications = ["fault", "timer"] @@ -129,4 +129,3 @@ device = "tmp117" description = "TempSense" sensors = { temperature = 1 } removable = true - diff --git a/task/jefe/Cargo.toml b/task/jefe/Cargo.toml index 58adf36ae7..1cd2ae8f5f 100644 --- a/task/jefe/Cargo.toml +++ b/task/jefe/Cargo.toml @@ -16,6 +16,7 @@ cfg-if = { workspace = true } abi = { path = "../../sys/abi" } armv6m-atomic-hack = { path = "../../lib/armv6m-atomic-hack" } +counters = { path = "../../lib/counters" } hubris-num-tasks = { path = "../../sys/num-tasks", features = ["task-enum"] } ringbuf = { path = "../../lib/ringbuf" } task-jefe-api = { path = "../jefe-api" } diff --git a/task/jefe/src/dump.rs b/task/jefe/src/dump.rs index e39d40183b..7649a8c4fe 100644 --- a/task/jefe/src/dump.rs +++ b/task/jefe/src/dump.rs @@ -23,8 +23,9 @@ compile_error!( except on specially designated boards" ); -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, counters::Count)] enum Trace { + #[count(skip)] None, Initialized, GetDumpArea(u8), @@ -57,7 +58,7 @@ enum Trace { DumpDone(Result<(), humpty::DumpError<()>>), } -ringbuf!(Trace, 8, Trace::None); +counted_ringbuf!(Trace, 8, Trace::None); pub fn initialize_dump_areas() -> u32 { let areas = humpty::initialize_dump_areas( diff --git a/task/jefe/src/external.rs b/task/jefe/src/external.rs index a17b60a235..5bfb53fb05 100644 --- a/task/jefe/src/external.rs +++ b/task/jefe/src/external.rs @@ -54,7 +54,7 @@ use ringbuf::*; use userlib::*; /// The actual requests that we honor from an external source entity -#[derive(FromPrimitive, Copy, Clone, Debug, Eq, PartialEq)] +#[derive(FromPrimitive, Copy, Clone, Debug, Eq, PartialEq, counters::Count)] enum Request { None = 0, Start = 1, @@ -63,7 +63,7 @@ enum Request { Fault = 4, } -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, counters::Count)] enum Error { IllegalTask, BadTask, @@ -73,15 +73,16 @@ enum Error { #[derive(Copy, Clone, Debug, Eq, PartialEq)] struct TaskIndex(u16); -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, counters::Count)] enum Trace { + #[count(skip)] None, - Request(Request, TaskIndex), - Disposition(TaskIndex, Disposition), - Error(Error), + Request(#[count(children)] Request, TaskIndex), + Disposition(TaskIndex, #[count(children)] Disposition), + Error(#[count(children)] Error), } -ringbuf!(Trace, 4, Trace::None); +counted_ringbuf!(Trace, 4, Trace::None); #[no_mangle] static JEFE_EXTERNAL_READY: AtomicU32 = AtomicU32::new(0); diff --git a/task/jefe/src/main.rs b/task/jefe/src/main.rs index 9e66d9a3d7..81c6b45f6e 100644 --- a/task/jefe/src/main.rs +++ b/task/jefe/src/main.rs @@ -39,7 +39,7 @@ use idol_runtime::RequestError; use task_jefe_api::{DumpAgentError, ResetReason}; use userlib::*; -#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Default, counters::Count)] pub enum Disposition { #[default] Restart,