From 6f950b9ff573c732b3f22788335051d0294a3e5a Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Wed, 21 Jan 2026 16:34:55 +0100 Subject: [PATCH 1/2] host-flashsrv: add meterfs_debugCtx_t setter JIRA: NIL-920 (cherry picked from commit 7f5db0ef8957cb57bbf96a53e9aace3e54e8995c) --- storage/host-flash/host-flashsrv.c | 11 ++++++++++- storage/host-flash/host-flashsrv.h | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/storage/host-flash/host-flashsrv.c b/storage/host-flash/host-flashsrv.c index 0dd10e5b2..3899881aa 100644 --- a/storage/host-flash/host-flashsrv.c +++ b/storage/host-flash/host-flashsrv.c @@ -19,7 +19,8 @@ static struct { pthread_mutex_t lock; meterfs_ctx_t ctx; -} hostflashsrv_common; +} hostflashsrv_common = { 0 }; + int hostflashsrv_readFile(id_t *id, off_t off, char *buff, size_t bufflen) { @@ -123,3 +124,11 @@ int hostflashsrv_init(size_t *flashsz, size_t *sectorsz, const char *fileName) return 0; } + + +#if METERFS_DEBUG_UTILS +void hostflashsrv_setDebugCtx(meterfs_debugCtx_t *ctx) +{ + hostflashsrv_common.ctx.debugCtx = *ctx; +} +#endif diff --git a/storage/host-flash/host-flashsrv.h b/storage/host-flash/host-flashsrv.h index 0c9bd9179..8ecb2d146 100644 --- a/storage/host-flash/host-flashsrv.h +++ b/storage/host-flash/host-flashsrv.h @@ -36,4 +36,10 @@ int hostflashsrv_devctl(meterfs_i_devctl_t *i, meterfs_o_devctl_t *o); int hostflashsrv_init(size_t *flashsz, size_t *sectorsz, const char *fileName); + +#if METERFS_DEBUG_UTILS +/* WARN: callable before hostflashsrv_init() */ +void hostflashsrv_setDebugCtx(meterfs_debugCtx_t *ctx); +#endif + #endif From 4216af954308093626897b7ea7f91a99eea5bc9c Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Tue, 3 Feb 2026 15:49:38 +0100 Subject: [PATCH 2/2] storage/gr716-flash: add option to set SPIMCTRL_BASE via board_config.h In upcoming meterfs changes, meterfs.h will include board_config.h. SPIMCTRL0_BASE and SPIMCTRL1_BASE may be defined by board_config.h (as is the case on sparcv8leon-gr716-mini), causing redefinition in spimctrl.h if board_config.h is included. JIRA: NIL-920 (cherry picked from commit 8bcaeeb634195a9c403fce6dadd63933931c83d0) --- storage/gr716-flash/spimctrl.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/gr716-flash/spimctrl.h b/storage/gr716-flash/spimctrl.h index 154387279..672f663e6 100644 --- a/storage/gr716-flash/spimctrl.h +++ b/storage/gr716-flash/spimctrl.h @@ -18,14 +18,20 @@ #include #include +#include #define SPIMCTRL_NUM 2 #define FLASH0_AHB_ADDR 0x02000000 #define FLASH1_AHB_ADDR 0x04000000 +#ifndef SPIMCTRL0_BASE #define SPIMCTRL0_BASE ((void *)0xFFF00100) +#endif + +#ifndef SPIMCTRL1_BASE #define SPIMCTRL1_BASE ((void *)0xFFF00200) +#endif /* clang-format off */