From 6453e08db68a06aca1d90bbd3d1b2b2858bd78c3 Mon Sep 17 00:00:00 2001 From: IsaacDynamo Date: Thu, 28 Dec 2023 22:10:30 +0100 Subject: [PATCH 1/2] Make freertos_rs_get_system_state() optional with #if guard. uxTaskGetSystemState() is only available when configUSE_TRACE_FACILITY is enabled --- freertos-rust/src/freertos/shim.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/freertos-rust/src/freertos/shim.c b/freertos-rust/src/freertos/shim.c index d435b13..71bdf74 100644 --- a/freertos-rust/src/freertos/shim.c +++ b/freertos-rust/src/freertos/shim.c @@ -109,9 +109,11 @@ TickType_t freertos_rs_xTaskGetTickCount() { return xTaskGetTickCount(); } +#if (configUSE_TRACE_FACILITY == 1) UBaseType_t freertos_rs_get_system_state(TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime) { return uxTaskGetSystemState(pxTaskStatusArray, uxArraySize, pulTotalRunTime); } +#endif #ifdef configCPU_CLOCK_HZ unsigned long freertos_rs_get_configCPU_CLOCK_HZ() { From a021054277f82d960e5431cee5ab83196230df63 Mon Sep 17 00:00:00 2001 From: IsaacDynamo Date: Thu, 28 Dec 2023 22:11:03 +0100 Subject: [PATCH 2/2] Suppress unused parameter warning when INCLUDE_uxTaskGetStackHighWaterMark is disabled --- freertos-rust/src/freertos/shim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/freertos-rust/src/freertos/shim.c b/freertos-rust/src/freertos/shim.c index 71bdf74..b5e544f 100644 --- a/freertos-rust/src/freertos/shim.c +++ b/freertos-rust/src/freertos/shim.c @@ -234,6 +234,7 @@ UBaseType_t freertos_rs_get_stack_high_water_mark(TaskHandle_t task) { #if (INCLUDE_uxTaskGetStackHighWaterMark == 1) return uxTaskGetStackHighWaterMark(task); #else + (void)task; return 0; #endif }