From 82de00e8b308fdfb1e4b8550f9f09ea7d0f66da1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 20:23:56 +0000 Subject: [PATCH 1/2] Initial plan From 9a7a381305a2a5d1a8230c58e7b9f4674440efb5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 20:28:16 +0000 Subject: [PATCH 2/2] Add ENOTSUP fallback for DMVFS mutexes before RTOS start Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com> --- src/dmvfs.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/dmvfs.c b/src/dmvfs.c index dc464ac..ce9674c 100644 --- a/src/dmvfs.c +++ b/src/dmvfs.c @@ -2,6 +2,7 @@ #include "dmvfs.h" #include #include +#include typedef struct { Dmod_Context_t* fs_context; @@ -56,7 +57,18 @@ static inline bool lock_mutex(void) } if(g_mutex != NULL) { - return (Dmod_Mutex_Lock(g_mutex) == 0); + int ret = Dmod_Mutex_Lock(g_mutex); + if (ret == 0) + { + return true; + } + else if (ret == -ENOTSUP) + { + /* RTOS has not started yet - fall back to critical sections */ + Dmod_EnterCritical(); + return true; + } + return false; } else { @@ -72,7 +84,12 @@ static inline void unlock_mutex(void) { if(g_mutex != NULL) { - Dmod_Mutex_Unlock(g_mutex); + int ret = Dmod_Mutex_Unlock(g_mutex); + if (ret == -ENOTSUP) + { + /* RTOS has not started yet - we used critical sections for locking */ + Dmod_ExitCritical(); + } } else {